From f981599dccb0afc4cde7c3910666d327ab27d472 Mon Sep 17 00:00:00 2001 From: Dima K Date: Fri, 28 Jun 2024 18:13:42 +0200 Subject: [PATCH] Fix Void Transport Permit Text and Badge (#1956) * Fix Void Transport Permit with active Exemption --- ppr-ui/src/composables/exemption/useExemptions.ts | 5 ++++- ppr-ui/tests/unit/ExemptionDetails.spec.ts | 4 ++-- ppr-ui/tests/unit/ExemptionReview.spec.ts | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ppr-ui/src/composables/exemption/useExemptions.ts b/ppr-ui/src/composables/exemption/useExemptions.ts index 7c825b46e..000699eab 100644 --- a/ppr-ui/src/composables/exemption/useExemptions.ts +++ b/ppr-ui/src/composables/exemption/useExemptions.ts @@ -20,8 +20,10 @@ import { UnitNoteDocTypes, UnitNoteStatusTypes } from '@/enums' +import { useRouter } from 'vue-router' export const useExemptions = () => { + const router = useRouter() const { goToRoute } = useNavigation() const { setMhrExemption, setMhrExemptionNote, setMhrExemptionValidation, setMhrExemptionValue } = useStore() const { @@ -60,7 +62,8 @@ export const useExemptions = () => { const isExemptionWithActiveTransportPermit: ComputedRef = computed((): boolean => { return ( getMhrInformation.value.permitStatus === MhApiStatusTypes.ACTIVE && - (isResExemption.value || isNonResExemption.value) + (isResExemption.value || isNonResExemption.value) && + [RouteNames.EXEMPTION_DETAILS, RouteNames.EXEMPTION_REVIEW].includes(router.currentRoute.value.name as RouteNames) ) }) diff --git a/ppr-ui/tests/unit/ExemptionDetails.spec.ts b/ppr-ui/tests/unit/ExemptionDetails.spec.ts index 2763afd36..fc2dbd17a 100644 --- a/ppr-ui/tests/unit/ExemptionDetails.spec.ts +++ b/ppr-ui/tests/unit/ExemptionDetails.spec.ts @@ -8,7 +8,7 @@ import { axe } from 'vitest-axe' import { TransportPermitDetails } from '@/components/mhrTransportPermit' import { useStore } from '@/store/store' import { mockedAddress } from './test-data' -import { UnitNoteDocTypes } from '@/enums' +import { RouteNames, UnitNoteDocTypes } from '@/enums' const store = useStore() @@ -16,7 +16,7 @@ describe('ExemptionDetails', () => { let wrapper beforeEach(async () => { - wrapper = await createComponent(ExemptionDetails as any, { showErrors: false }) + wrapper = await createComponent(ExemptionDetails as any, { showErrors: false }, RouteNames.EXEMPTION_DETAILS) await nextTick() }) diff --git a/ppr-ui/tests/unit/ExemptionReview.spec.ts b/ppr-ui/tests/unit/ExemptionReview.spec.ts index 56d534579..606df6ce9 100644 --- a/ppr-ui/tests/unit/ExemptionReview.spec.ts +++ b/ppr-ui/tests/unit/ExemptionReview.spec.ts @@ -22,7 +22,7 @@ import { ConfirmCompletion } from '@/components/mhrTransfers' import { StaffPayment } from '@/components/common' import { axe } from 'vitest-axe' import { useStore } from '@/store/store' -import { UnitNoteDocTypes } from '@/enums' +import { RouteNames, UnitNoteDocTypes } from '@/enums' import { mockedAddress } from './test-data' import { TransportPermitDetails } from '@/components/mhrTransportPermit' @@ -32,7 +32,7 @@ describe('ExemptionReview', () => { let wrapper beforeEach(async () => { - wrapper = await createComponent(ExemptionReview, { showErrors: false }, null) + wrapper = await createComponent(ExemptionReview, { showErrors: false }, RouteNames.EXEMPTION_REVIEW) setupMockStaffUser() await nextTick() })