diff --git a/ppr-ui/src/components/common/DocumentId.vue b/ppr-ui/src/components/common/DocumentId.vue index dd9895490..83853c469 100644 --- a/ppr-ui/src/components/common/DocumentId.vue +++ b/ppr-ui/src/components/common/DocumentId.vue @@ -137,7 +137,7 @@ export default defineComponent({ emits: ['isValid', 'setStoreProperty', 'setGenerateDocId'], setup (props, { emit }) { const { setMhrGenerateDocId } = useStore() - const { hasDrsEnabled } = storeToRefs(useStore()) + const { hasDrsEnabled, getMhrGenerateDocId } = storeToRefs(useStore()) const { customRules, isNumber, maxLength, minLength, required } = useInputRules() const documentIdForm = ref(null) as FormIF @@ -148,7 +148,7 @@ export default defineComponent({ loadingDocId: false, isUniqueDocId: false, displayDocIdError: false, - generateDocumentId: false, + generateDocumentId: getMhrGenerateDocId.value, showBorderError: computed(() => props.validate && !localState.isVerifiedDocId), isVerifiedDocId: computed(() => { return (localState.isDocumentIdFormValid && localState.isUniqueDocId) || localState.generateDocumentId @@ -205,11 +205,11 @@ export default defineComponent({ }) watch(() => localState.generateDocumentId, (val: boolean) => { - console.log(val) localState.documentIdModel = '' localState.loadingDocId = false setMhrGenerateDocId(val) emit('isValid', val) + if(!val) emit('setStoreProperty', '') }) return { diff --git a/ppr-ui/src/components/mhrTransportPermit/LocationChangeReview.vue b/ppr-ui/src/components/mhrTransportPermit/LocationChangeReview.vue index f3b071051..ee15081b7 100644 --- a/ppr-ui/src/components/mhrTransportPermit/LocationChangeReview.vue +++ b/ppr-ui/src/components/mhrTransportPermit/LocationChangeReview.vue @@ -17,7 +17,7 @@ id="location-change-doc-id" cols="9" > - {{ getMhrTransportPermit.documentId }} + {{ getMhrTransportPermit.documentId || 'Generate a Document ID Number upon filing' }} diff --git a/ppr-ui/src/components/unitNotes/UnitNoteReviewDetailsTable.vue b/ppr-ui/src/components/unitNotes/UnitNoteReviewDetailsTable.vue index 0b5f02a08..a6876d847 100644 --- a/ppr-ui/src/components/unitNotes/UnitNoteReviewDetailsTable.vue +++ b/ppr-ui/src/components/unitNotes/UnitNoteReviewDetailsTable.vue @@ -34,7 +34,7 @@ cols="9" class="details" > - {{ unitNote.documentId }} + {{ unitNote.documentId || 'Generate a Document ID Number upon filing' }} diff --git a/ppr-ui/src/composables/mhrInformation/useMhrInformation.ts b/ppr-ui/src/composables/mhrInformation/useMhrInformation.ts index 992c7c554..d19e27255 100644 --- a/ppr-ui/src/composables/mhrInformation/useMhrInformation.ts +++ b/ppr-ui/src/composables/mhrInformation/useMhrInformation.ts @@ -537,7 +537,7 @@ export const useMhrInformation = () => { consideration: getMhrTransferConsideration.value, transferDate: getMhrTransferDate.value, ownLand: getMhrTransferOwnLand.value, - ...(getMhrTransferDocumentId.value && { + ...(getMhrTransferDocumentId.value && !getMhrGenerateDocId.value && { documentId: getMhrTransferDocumentId.value }), registrationType: (isTransferNonGiftBillOfSale.value || isTransferWithoutBillOfSale.value) diff --git a/ppr-ui/src/composables/mhrRegistration/useMhrValidations.ts b/ppr-ui/src/composables/mhrRegistration/useMhrValidations.ts index 09edfcbc2..9fab346c7 100644 --- a/ppr-ui/src/composables/mhrRegistration/useMhrValidations.ts +++ b/ppr-ui/src/composables/mhrRegistration/useMhrValidations.ts @@ -3,9 +3,6 @@ import { MhrCompVal, MhrSectVal } from '@/composables/mhrRegistration/enums' export const useMhrValidations = (validationState: any) => { /** Set specified flag */ const setValidation = (section: MhrSectVal, component: MhrCompVal, isValid: boolean): void => { - console.log('section:', section) - console.log('component:', component) - console.log('isValid:', isValid) // Only sets specified flag if the section and component are part of the validation model if (validationState[section]?.value[component] !== undefined) { validationState[section].value[component] = isValid diff --git a/ppr-ui/src/composables/mhrRegistration/useNewMhrRegistration.ts b/ppr-ui/src/composables/mhrRegistration/useNewMhrRegistration.ts index ad405b613..0ca8d2e96 100644 --- a/ppr-ui/src/composables/mhrRegistration/useNewMhrRegistration.ts +++ b/ppr-ui/src/composables/mhrRegistration/useNewMhrRegistration.ts @@ -64,7 +64,8 @@ export const useNewMhrRegistration = (isMhrCorrections: boolean = false) => { getStaffPayment, getMhrDraftNumber, getRegistrationType, - getMhrInformation + getMhrInformation, + getMhrGenerateDocId } = storeToRefs(useStore()) const { setShowGroups, @@ -348,7 +349,7 @@ export const useNewMhrRegistration = (isMhrCorrections: boolean = false) => { ...(isRoleStaffReg.value && !!getStaffPayment.value && { clientReferenceId: getStaffPayment.value.folioNumber }), - ...(!isMhrManufacturerRegistration.value && { + ...(!isMhrManufacturerRegistration.value && !getMhrGenerateDocId.value && { documentId: getMhrRegistrationDocumentId.value }), ...(isMhrManufacturerRegistration.value && !!getFolioOrReferenceNumber.value && { diff --git a/ppr-ui/src/views/exemption/ExemptionReview.vue b/ppr-ui/src/views/exemption/ExemptionReview.vue index 004f9095c..a510b3d9f 100644 --- a/ppr-ui/src/views/exemption/ExemptionReview.vue +++ b/ppr-ui/src/views/exemption/ExemptionReview.vue @@ -259,7 +259,8 @@ export default defineComponent({ getStaffPayment, isRoleStaffReg, isRoleQualifiedSupplier, - hasLien + hasLien, + getMhrGenerateDocId } = storeToRefs(useStore()) const { exemptionLabel, @@ -278,8 +279,9 @@ export default defineComponent({ }), reviewContent: computed(() => { return [ - getMhrExemption.value?.documentId - ? { label: 'Document ID', property: getMhrExemption.value?.documentId } + (getMhrExemption.value?.documentId || getMhrGenerateDocId.value) + ? { label: 'Document ID', property: getMhrExemption.value?.documentId || + 'Generate a Document ID Number upon filing' } : null, getMhrExemptionNote.value?.nonResidentialReason ? { label: 'Declaration Details', property: localState.nonResidentialDisplayReason } diff --git a/ppr-ui/src/views/mhrInformation/MhrInformation.vue b/ppr-ui/src/views/mhrInformation/MhrInformation.vue index e331b6717..455d1d23e 100644 --- a/ppr-ui/src/views/mhrInformation/MhrInformation.vue +++ b/ppr-ui/src/views/mhrInformation/MhrInformation.vue @@ -1344,7 +1344,8 @@ export default defineComponent({ // If Transfer or Transport Permit is valid, enter review mode // For Affidavit Transfers, need to complete affidavit before proceeding - if (isValidTransfer.value || isValidTransportPermit.value || isValidExtendTransportPermit.value) { + if (isValidTransfer.value || isValidTransportPermit.value || + (isExtendChangeLocationActive.value && isValidExtendTransportPermit.value)) { localState.isReviewMode = true localState.validate = false scrollToTop() @@ -1428,9 +1429,11 @@ export default defineComponent({ const handleIncompleteRegistrationsResp = async (val: boolean) => { if (!val) { setUnsavedChanges(false) - resetTransportPermit(true) + await resetTransportPermit(true) resetValidationState() localState.validate = false + localState.isReviewMode = false + setMhrGenerateDocId(false) await scrollToFirstError(false, 'mhr-information-header') } localState.showIncompleteRegistrationDialog = false diff --git a/ppr-ui/src/views/mhrInformation/MhrTransportPermit.vue b/ppr-ui/src/views/mhrInformation/MhrTransportPermit.vue index 47b6aab4f..11d938bc1 100644 --- a/ppr-ui/src/views/mhrInformation/MhrTransportPermit.vue +++ b/ppr-ui/src/views/mhrInformation/MhrTransportPermit.vue @@ -435,7 +435,7 @@ :content="{ sideLabel: 'Document ID', hintText: 'Enter the 8-digit Document ID number' }" :documentId="state.transportPermitDocumentId" :validate="validate" - @setStoreProperty="handleDocumentIdUpdate($event)" + @setStoreProperty="setMhrTransportPermit({ key: 'documentId', value: $event })" @isValid="setValidation('isDocumentIdValid', $event)" /> @@ -562,12 +562,6 @@ const toggleAmendLocationChange = async () => { } } -const handleDocumentIdUpdate = (documentId: string) => { - if (documentId) { - setMhrTransportPermit({ key: 'documentId', value: documentId }) - } -} - const toggleCancelTransportPermit = (val: boolean) => { setLocationChangeType(val ? LocationChangeTypes.TRANSPORT_PERMIT_CANCEL : null) if (val) { diff --git a/ppr-ui/src/views/newMhrRegistration/HomeOwners.vue b/ppr-ui/src/views/newMhrRegistration/HomeOwners.vue index 14c732461..d03296510 100644 --- a/ppr-ui/src/views/newMhrRegistration/HomeOwners.vue +++ b/ppr-ui/src/views/newMhrRegistration/HomeOwners.vue @@ -305,7 +305,7 @@ cols="9" class="gray7" > - {{ getMhrTransferDocumentId }} + {{ getMhrTransferDocumentId || 'Generate a Document ID Number upon filing' }} { - return getValidation(MhrSectVal.REVIEW_CONFIRM_VALID, MhrCompVal.VALIDATE_STEPS) - ? customRules( - required('Enter a Document ID'), - maxLength(8, true), - minLength(8, true), - isNumber() - ) - : customRules( - required('Enter a Document ID'), - maxLength(8, true), - isNumber() - ) - }), validateSubmitter: computed((): boolean => { return getSectionValidation(MhrSectVal.SUBMITTING_PARTY_VALID, MhrCompVal.SUBMITTER_VALID) }), @@ -120,24 +103,10 @@ export default defineComponent({ }), validateRefNum: computed((): boolean => { return getSectionValidation(MhrSectVal.SUBMITTING_PARTY_VALID, MhrCompVal.REF_NUM_VALID) - }), - uniqueDocIdError: computed((): string[] => { - // Manual error handling for Unique DocId Lookup - return localState.displayDocIdError ? ['Must be unique number'] : [] }) }) watch(() => localState.documentId, async (val: string) => { - if (localState.documentId.length === 8) { - localState.loadingDocId = true - const validateDocId: MhrDocIdResponseIF = await validateDocumentID(localState.documentId) - localState.isUniqueDocId = !validateDocId.exists && validateDocId.valid - localState.displayDocIdError = !localState.isUniqueDocId - } else { - localState.isUniqueDocId = false - localState.displayDocIdError = false - } - localState.loadingDocId = false setMhrRegistrationDocumentId(val) }, { immediate: true }