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..ed53e6365 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,40 @@ 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(() => { + // 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 () => { expiryDatePickerRef.value?.validate() }) +watch(() => state.certificateWaived, async (val: boolean) => { + if (val){ + 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 } 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/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) }