diff --git a/app/client/src/routes/helpdesk.tsx b/app/client/src/routes/helpdesk.tsx index 91732803..23f8080a 100644 --- a/app/client/src/routes/helpdesk.tsx +++ b/app/client/src/routes/helpdesk.tsx @@ -48,22 +48,20 @@ import { useRebateYearActions, } from "@/contexts/rebateYear"; -type Response = - | { - formSchema: null; - formio: null; - bap: BapSubmissionData; - } - | { - formSchema: { url: string; json: object }; - formio: +type Response = { + rebateId: string | null; + formSchema: { url: string; json: object } | null; + formio: + | ( | FormioFRF2022Submission | FormioPRF2022Submission | FormioCRF2022Submission | FormioFRF2023Submission - | FormioPRF2023Submission; - bap: BapSubmissionData; - }; + | FormioPRF2023Submission + ) + | null; + bap: BapSubmissionData | null; +}; type SubmissionAction = { _id: string; // MongoDB ObjectId string @@ -120,22 +118,22 @@ function ResultTableRow(props: { DraftSubmission, unknown >; - lastSearchedText: string; formType: FormType; + rebateId: string | null; formio: | FormioFRF2022Submission | FormioPRF2022Submission | FormioCRF2022Submission | FormioFRF2023Submission | FormioPRF2023Submission; - bap: BapSubmissionData; + bap: BapSubmissionData | null; }) { const { setFormDisplayed, setActionsData, submissionMutation, - lastSearchedText, formType, + rebateId, formio, bap, } = props; @@ -180,11 +178,11 @@ function ResultTableRow(props: { const date = formatDate(formio.modified); const time = formatTime(formio.modified); - const bapId = lastSearchedText.length === 6 ? bap.rebateId : bap.mongoId; + const bapInternalStatus = bap?.status || ""; + const bapReimbursementNeeded = bap?.reimbursementNeeded || false; - const bapInternalStatus = bap.status || ""; + const bapStatus = bapStatusMap[rebateYear][formType].get(bapInternalStatus); const formioStatus = formioStatusMap.get(formio.state); - const bapReimbursementNeeded = bap.reimbursementNeeded || false; const needsEdits = submissionNeedsEdits({ formio, bap }); @@ -199,9 +197,7 @@ function ResultTableRow(props: { ? "Edits Requested" : crfNeedsReimbursement ? "Reimbursement Needed" - : bapStatusMap[rebateYear][formType].get(bapInternalStatus) || - formioStatus || - ""; + : bapStatus || formioStatus || ""; const nameField = formioNameField[rebateYear][formType]; const emailField = formioEmailField[rebateYear][formType]; @@ -229,11 +225,11 @@ function ResultTableRow(props: { -