From 36246ef8983187a012922df670eedbaca2344739 Mon Sep 17 00:00:00 2001 From: Cameron Bowler Date: Wed, 16 Oct 2024 12:16:33 -0700 Subject: [PATCH 1/5] Tax Certifcate Options and Help Content --- ppr-ui/package-lock.json | 4 +- ppr-ui/package.json | 2 +- .../mhrTransfers/TaxCertificate.vue | 37 ++++++++-- .../HelpContent/QsTaxCertificateHelp.vue | 38 ++++++++++ .../HelpContent/StaffTaxCertificateHelp.vue | 74 +++++++++++++++++++ .../mhrTransportPermit/LocationChange.vue | 29 +++++++- .../MhrRegistrationHomeLocationIF.ts | 1 + 7 files changed, 174 insertions(+), 11 deletions(-) create mode 100644 ppr-ui/src/components/mhrTransportPermit/HelpContent/QsTaxCertificateHelp.vue create mode 100644 ppr-ui/src/components/mhrTransportPermit/HelpContent/StaffTaxCertificateHelp.vue diff --git a/ppr-ui/package-lock.json b/ppr-ui/package-lock.json index d90c14595..af172c240 100644 --- a/ppr-ui/package-lock.json +++ b/ppr-ui/package-lock.json @@ -1,12 +1,12 @@ { "name": "ppr-ui", - "version": "3.2.64", + "version": "3.2.65", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "ppr-ui", - "version": "3.2.64", + "version": "3.2.65", "dependencies": { "@bcrs-shared-components/input-field-date-picker": "^1.0.0", "@lemoncode/fonk": "^1.5.1", diff --git a/ppr-ui/package.json b/ppr-ui/package.json index 3022fb8e5..fb25ae5cd 100644 --- a/ppr-ui/package.json +++ b/ppr-ui/package.json @@ -1,6 +1,6 @@ { "name": "ppr-ui", - "version": "3.2.64", + "version": "3.2.65", "private": true, "appName": "Assets UI", "sbcName": "SBC Common Components", diff --git a/ppr-ui/src/components/mhrTransfers/TaxCertificate.vue b/ppr-ui/src/components/mhrTransfers/TaxCertificate.vue index 36f4cbe95..de21569a6 100644 --- a/ppr-ui/src/components/mhrTransfers/TaxCertificate.vue +++ b/ppr-ui/src/components/mhrTransfers/TaxCertificate.vue @@ -10,13 +10,22 @@ ref="expiryDatePickerRef" title="Tax Certificate Expiry Date" :initialValue="props.expiryDate" - :inputRules="required('This field is required')" + :inputRules="state.dateRules" :minDate="state.minDate" :maxDate="state.maxDate" + :disablePicker="state.certificateWaived" @emitDate="setDate($event)" @emitCancel="state.selectedFutureDate = ''" @emitClear="state.selectedFutureDate = ''" /> + + + @@ -25,10 +34,11 @@ import { useInputRules } from "@/composables" import { calendarDates } from "@/utils" -import { reactive, computed, watch, ref } from "vue" +import { reactive, computed, watch, ref, nextTick, onMounted } from 'vue' import { FormCard, InputFieldDatePicker } from "../common" import { useStore } from "@/store/store" import { FormIF } from "@/interfaces" +import { storeToRefs } from 'pinia' const props = defineProps<{ expiryDate?: string, @@ -37,21 +47,36 @@ const props = defineProps<{ const expiryDatePickerRef = ref(null) as FormIF -const emit = defineEmits(['isValid', 'setStoreProperty']) +const emit = defineEmits(['isValid', 'setStoreProperty', 'waiveCertificate']) -const { isRoleStaffReg } = useStore() +const { isRoleStaffReg, isRoleStaffSbc, getMhrTransportPermitHomeLocation } = storeToRefs(useStore()) const { required } = useInputRules() const state = reactive({ + certificateWaived: false, selectedFutureDate: '', - minDate: calendarDates.tomorrow, - maxDate: computed(() => isRoleStaffReg ? null : calendarDates.startOfNextYear) + dateRules: computed(() => !state.certificateWaived ? required('This field is required') : []), + minDate: computed(() => isRoleStaffReg.value ? null : calendarDates.tomorrow), + maxDate: computed(() => isRoleStaffReg.value ? null : calendarDates.startOfNextYear) +}) + +onMounted(() => { + state.certificateWaived = getMhrTransportPermitHomeLocation.value?.waiveCertificate }) watch(() => props.validate, async () => { expiryDatePickerRef.value?.validate() }) +watch(() => state.certificateWaived, async (val: boolean) => { + expiryDatePickerRef.value.clearDate() + await nextTick() + + expiryDatePickerRef.value?.validate() + emit('isValid', val) + emit('waiveCertificate', val) +}) + watch(() => state.selectedFutureDate, val => { emit('setStoreProperty', val) emit('isValid', !!val) diff --git a/ppr-ui/src/components/mhrTransportPermit/HelpContent/QsTaxCertificateHelp.vue b/ppr-ui/src/components/mhrTransportPermit/HelpContent/QsTaxCertificateHelp.vue new file mode 100644 index 000000000..200e3ca14 --- /dev/null +++ b/ppr-ui/src/components/mhrTransportPermit/HelpContent/QsTaxCertificateHelp.vue @@ -0,0 +1,38 @@ + + diff --git a/ppr-ui/src/components/mhrTransportPermit/LocationChange.vue b/ppr-ui/src/components/mhrTransportPermit/LocationChange.vue index 51e24622f..523fd5fe3 100644 --- a/ppr-ui/src/components/mhrTransportPermit/LocationChange.vue +++ b/ppr-ui/src/components/mhrTransportPermit/LocationChange.vue @@ -185,12 +185,33 @@ class="mt-10" >

4. Confirm Tax Certificate

-

+

+ A valid tax certificate is required in all cases. To confirm your tax certificate, enter the expiry date + below. If there is no expiry date in the tax certificate, then enter the last day of the relevant tax year + , e.g. 31 Dec 20xx. Exceptions are outlined in the tax certificate help section. +

+

A valid tax certificate is required; it must be issued from the tax authority with jurisdiction of the home, and must show that all local taxes have been paid for the current tax year. To confirm your tax certificate, enter the expiry date below.

+ + + + @@ -211,7 +233,7 @@ import { FormIF } from '@/interfaces' import { locationChangeTypes } from '@/resources/mhr-transport-permits/transport-permits' import { useStore } from '@/store/store' import { reactive, computed, watch, ref, nextTick, onMounted } from 'vue' -import { FormCard } from '@/components/common' +import { FormCard, SimpleHelpToggle } from '@/components/common' import { HomeCivicAddress, HomeLandOwnership, HomeLocationType } from '@/components/mhrRegistration' import { CivicAddressSchema } from '@/schemas/civic-address' import { TaxCertificate } from '@/components/mhrTransfers' @@ -221,6 +243,8 @@ import { storeToRefs } from "pinia" import { changeTransportPermitLocationTypeDialog } from '@/resources/dialogOptions' import { BaseDialog } from '@/components/dialogs' import { cloneDeep } from 'lodash' +import QsTaxCertificateHelp from '@/components/mhrTransportPermit/HelpContent/QsTaxCertificateHelp.vue' +import StaffTaxCertificateHelp from '@/components/mhrTransportPermit/HelpContent/StaffTaxCertificateHelp.vue' const props = defineProps<{ validate: boolean @@ -234,6 +258,7 @@ const { setMhrTransportPermit, setMhrTransportPermitNewLocation, const { hasUnsavedChanges, isRoleStaffSbc, + isRoleStaffReg, isRoleQualifiedSupplier, getMhrTransportPermit, getMhrTransportPermitHomeLocation, diff --git a/ppr-ui/src/interfaces/mhr-registration-interfaces/MhrRegistrationHomeLocationIF.ts b/ppr-ui/src/interfaces/mhr-registration-interfaces/MhrRegistrationHomeLocationIF.ts index 7e98d9344..9a7894dfb 100644 --- a/ppr-ui/src/interfaces/mhr-registration-interfaces/MhrRegistrationHomeLocationIF.ts +++ b/ppr-ui/src/interfaces/mhr-registration-interfaces/MhrRegistrationHomeLocationIF.ts @@ -38,4 +38,5 @@ export interface MhrRegistrationHomeLocationWithoutAddressIF { reserveNumber?: string exceptionPlan?: string permitWithinSamePark?: boolean // for transport permit amendment + waiveCertificate?: boolean // waive transport permit tax certificate } From 73075b3583c428063cb1f34d6aeee18959afe3c9 Mon Sep 17 00:00:00 2001 From: Cameron Bowler Date: Wed, 16 Oct 2024 12:18:52 -0700 Subject: [PATCH 2/5] padding fix --- ppr-ui/src/components/mhrTransfers/TaxCertificate.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ppr-ui/src/components/mhrTransfers/TaxCertificate.vue b/ppr-ui/src/components/mhrTransfers/TaxCertificate.vue index de21569a6..35cf8d148 100644 --- a/ppr-ui/src/components/mhrTransfers/TaxCertificate.vue +++ b/ppr-ui/src/components/mhrTransfers/TaxCertificate.vue @@ -23,7 +23,7 @@ From 79d3d0ab92c8c20a1f77aa210bb1aa69f6f03ad2 Mon Sep 17 00:00:00 2001 From: Cameron Bowler Date: Wed, 16 Oct 2024 12:37:17 -0700 Subject: [PATCH 3/5] Refactor Validation for QS --- ppr-ui/src/components/mhrTransfers/TaxCertificate.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ppr-ui/src/components/mhrTransfers/TaxCertificate.vue b/ppr-ui/src/components/mhrTransfers/TaxCertificate.vue index 35cf8d148..d735661e0 100644 --- a/ppr-ui/src/components/mhrTransfers/TaxCertificate.vue +++ b/ppr-ui/src/components/mhrTransfers/TaxCertificate.vue @@ -61,7 +61,10 @@ const state = reactive({ }) onMounted(() => { - state.certificateWaived = getMhrTransportPermitHomeLocation.value?.waiveCertificate + // Set the initial value of the certificate waived checkbox if the user is a staff member + if (isRoleStaffReg.value || isRoleStaffSbc.value) { + state.certificateWaived = getMhrTransportPermitHomeLocation.value?.waiveCertificate + } }) watch(() => props.validate, async () => { From b2e83d7e1e3214f151e6399f1b676fc7d5be3ccb Mon Sep 17 00:00:00 2001 From: Cameron Bowler Date: Wed, 16 Oct 2024 16:36:01 -0700 Subject: [PATCH 4/5] State Improvements for Tax Cert and Extend/CreateNew Permits --- .../src/components/mhrTransfers/TaxCertificate.vue | 11 ++++++----- ppr-ui/src/resources/dialogOptions/cancelDialogs.ts | 2 +- ppr-ui/src/views/mhrInformation/MhrInformation.vue | 13 +++++++++---- .../src/views/mhrInformation/MhrTransportPermit.vue | 2 ++ 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/ppr-ui/src/components/mhrTransfers/TaxCertificate.vue b/ppr-ui/src/components/mhrTransfers/TaxCertificate.vue index d735661e0..ed53e6365 100644 --- a/ppr-ui/src/components/mhrTransfers/TaxCertificate.vue +++ b/ppr-ui/src/components/mhrTransfers/TaxCertificate.vue @@ -23,7 +23,7 @@ @@ -72,10 +72,11 @@ watch(() => props.validate, async () => { }) watch(() => state.certificateWaived, async (val: boolean) => { - expiryDatePickerRef.value.clearDate() - await nextTick() - - expiryDatePickerRef.value?.validate() + if (val){ + expiryDatePickerRef.value.clearDate() + await nextTick() + expiryDatePickerRef.value?.validate() + } emit('isValid', val) emit('waiveCertificate', val) }) diff --git a/ppr-ui/src/resources/dialogOptions/cancelDialogs.ts b/ppr-ui/src/resources/dialogOptions/cancelDialogs.ts index a0a1c424c..505170017 100644 --- a/ppr-ui/src/resources/dialogOptions/cancelDialogs.ts +++ b/ppr-ui/src/resources/dialogOptions/cancelDialogs.ts @@ -86,6 +86,6 @@ export const confirmNewTransportPermit: DialogOptionsIF = { title: 'Verify Transport Permit Status', label: '', text: 'By applying for a new transport permit you are confirming that the active Transport permit {number} issued' + - ' on {date of issue} has been completed and will render as no longer active.' + ' on {date of issue} has been completed and will no longer be active.' } diff --git a/ppr-ui/src/views/mhrInformation/MhrInformation.vue b/ppr-ui/src/views/mhrInformation/MhrInformation.vue index c167041a9..390742339 100644 --- a/ppr-ui/src/views/mhrInformation/MhrInformation.vue +++ b/ppr-ui/src/views/mhrInformation/MhrInformation.vue @@ -1506,16 +1506,21 @@ export default defineComponent({ localState.showTransferType = !localState.showTransferType } + const resetPermitState = () => { + resetValidationState() + resetMhrInformation() + resetTransportPermit(true) + localState.validate = false + } + const handleCancelTransportPermitChanges = (showConfirmationDialog = true) => { if (hasUnsavedChanges.value && showConfirmationDialog) { // show dialog localState.showCancelTransportPermitDialog = true } else { + console.log('Cancel Called') // reset validation and close dialog - resetValidationState() - resetMhrInformation() - resetTransportPermit(true) - localState.validate = false + resetPermitState() } } diff --git a/ppr-ui/src/views/mhrInformation/MhrTransportPermit.vue b/ppr-ui/src/views/mhrInformation/MhrTransportPermit.vue index 73044b5f7..b3287cb91 100644 --- a/ppr-ui/src/views/mhrInformation/MhrTransportPermit.vue +++ b/ppr-ui/src/views/mhrInformation/MhrTransportPermit.vue @@ -579,6 +579,7 @@ const toggleCancelTransportPermit = (val: boolean) => { const toggleExtendTransportPermit = (val: boolean) => { setExtendLocationChange(val) setMhrTransportPermitLocationChangeType(val ? LocationChangeTypes.EXTEND_PERMIT : null) + if (!val) emit('cancelTransportPermitChanges', val) } const handleConfirmNewPermit = (val: boolean) => { @@ -586,6 +587,7 @@ const handleConfirmNewPermit = (val: boolean) => { setLocationChange(val) setLocationChangeType(val ? LocationChangeTypes.TRANSPORT_PERMIT : null) state.showConfirmNewPermitDialog = false + if (!val) emit('cancelTransportPermitChanges', val) } From 2b206c69be487afcc89ecd635121a49664266b8b Mon Sep 17 00:00:00 2001 From: Cameron Bowler Date: Wed, 16 Oct 2024 16:37:09 -0700 Subject: [PATCH 5/5] clean up: --- ppr-ui/src/views/mhrInformation/MhrInformation.vue | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/ppr-ui/src/views/mhrInformation/MhrInformation.vue b/ppr-ui/src/views/mhrInformation/MhrInformation.vue index 390742339..c167041a9 100644 --- a/ppr-ui/src/views/mhrInformation/MhrInformation.vue +++ b/ppr-ui/src/views/mhrInformation/MhrInformation.vue @@ -1506,21 +1506,16 @@ export default defineComponent({ localState.showTransferType = !localState.showTransferType } - const resetPermitState = () => { - resetValidationState() - resetMhrInformation() - resetTransportPermit(true) - localState.validate = false - } - const handleCancelTransportPermitChanges = (showConfirmationDialog = true) => { if (hasUnsavedChanges.value && showConfirmationDialog) { // show dialog localState.showCancelTransportPermitDialog = true } else { - console.log('Cancel Called') // reset validation and close dialog - resetPermitState() + resetValidationState() + resetMhrInformation() + resetTransportPermit(true) + localState.validate = false } }