Skip to content

Commit

Permalink
Convert to Lower Case and the check eligibility criteria (#67)
Browse files Browse the repository at this point in the history
* fix: Redirect after form submission and when the popup modal's order ID dialog close button is clicked.

* fix:convert to LowerCase and the check eligibility criteria

---------

Co-authored-by: sagar <sagarkoshti1990@gmila.com>
  • Loading branch information
sagarkoshti1990 and sagar authored Dec 3, 2024
1 parent 72f36c6 commit 28b40b2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
7 changes: 4 additions & 3 deletions src/components/common/Dialogue.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ const CommonDialogue: React.FC<CommonDialogueProps> = ({
setIsAccordionOpen(expandedIndex.length > 0);
};
const { t } = useTranslation();

return (
<Modal isOpen={Boolean(isOpen)} onClose={onClose}>
<ModalOverlay />
Expand All @@ -56,7 +57,7 @@ const CommonDialogue: React.FC<CommonDialogueProps> = ({
</>
) : (
<>
<Box className="heading">Application Submmited</Box>
<Box className="heading">Application Submited</Box>
<Box color="gray.600" fontWeight="300" fontSize="18px">
Confirmation
</Box>
Expand Down Expand Up @@ -109,14 +110,14 @@ const CommonDialogue: React.FC<CommonDialogueProps> = ({
<Text fontSize="md" color="gray.700">
{t("SUBMIT_DIALOGUE_CONTENT_TEXT")}
<Text as="span" color="blue.600" fontWeight="medium">
{(isOpen as any)?.name || ""}
{(isOpen as { name?: string })?.name || ""}
</Text>{" "}
{t("SUBMIT_DIALOGUE_SUBMITTED_TEXT")}!
</Text>
<Text fontSize="sm" color="gray.500" mt={3}>
{t("SUBMIT_DIALOGUE_APPLICATION_ID_TEXT")}:
<Text as="span" fontWeight="medium">
{(isOpen as any)?.orderId || ""}
{(isOpen as { orderId?: string })?.orderId || ""}
</Text>
</Text>
</>
Expand Down
11 changes: 8 additions & 3 deletions src/utils/jsHelper/helper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -351,14 +351,19 @@ export function checkEligibilityCriteria({
}): boolean {
if (value == null) return false;
// Convert value to string if it's a number
const val = typeof value === "string" ? value : value?.toString();
const val =
typeof value === "string"
? value.toLowerCase()
: (value?.toString() || "").toLowerCase();
if (!val) return false;

// Convert conditionValues to an array of strings
const conditionVals: string[] =
typeof conditionValues === "string"
? [conditionValues]
: (conditionValues as (string | number)[]).map((cv) => cv?.toString());
? [conditionValues.toLowerCase()]
: (conditionValues as (string | number)[]).map((cv) =>
cv?.toString().toLowerCase()
);

// Evaluate the condition
switch (condition.trim()) {
Expand Down

0 comments on commit 28b40b2

Please sign in to comment.