Skip to content

Commit

Permalink
Updated Exemption Initialization (#1597)
Browse files Browse the repository at this point in the history
  • Loading branch information
cameron-eyds authored Oct 24, 2023
1 parent bcbae33 commit 749d65a
Showing 1 changed file with 21 additions and 11 deletions.
32 changes: 21 additions & 11 deletions ppr-ui/src/composables/exemption/useExemptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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:
}
}

Expand Down

0 comments on commit 749d65a

Please sign in to comment.