From 749d65a8d6cf2ba110a4ebc6d590a0448696fb26 Mon Sep 17 00:00:00 2001 From: CameronEYDS <53542131+cameron-eyds@users.noreply.github.com> Date: Tue, 24 Oct 2023 09:09:00 -0700 Subject: [PATCH] Updated Exemption Initialization (#1597) --- .../composables/exemption/useExemptions.ts | 32 ++++++++++++------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/ppr-ui/src/composables/exemption/useExemptions.ts b/ppr-ui/src/composables/exemption/useExemptions.ts index 87f111e48..a350a0dc2 100644 --- a/ppr-ui/src/composables/exemption/useExemptions.ts +++ b/ppr-ui/src/composables/exemption/useExemptions.ts @@ -90,18 +90,28 @@ export const useExemptions = () => { }) setMhrExemptionNote({ key: 'documentType', value: exemptionType }) - if (isRoleQualifiedSupplier.value) { - const account = await getAccountInfoFromAuth() - setMhrExemptionValue({ key: 'submittingParty', value: parseAccountToSubmittingParty(account) }) + // Initialize role specific values + switch (true) { + case isRoleQualifiedSupplier.value: + const account = await getAccountInfoFromAuth() + setMhrExemptionValue({ key: 'submittingParty', value: parseAccountToSubmittingParty(account) }) - // Reset Validations here for qs specific requirements - updateValidation('documentId', true) - updateValidation('submittingParty', true) - updateValidation('staffPayment', true) - } else { - const validationState = getMhrExemptionValidation.value - // eslint-disable-next-line no-return-assign - Object.keys(validationState).forEach(flag => validationState[flag] = false) + // Reset Validations here for qs specific requirements + updateValidation('documentId', true) + updateValidation('submittingParty', true) + updateValidation('staffPayment', true) + break + case isRoleStaffReg.value: + const validationState = getMhrExemptionValidation.value + // eslint-disable-next-line no-return-assign + Object.keys(validationState).forEach(flag => validationState[flag] = false) + + // Staff specific flags + updateValidation('remarks', true) + updateValidation('attention', true) + updateValidation('folio', true) + break + default: } }