Skip to content

Commit

Permalink
Doc-Id-Drs
Browse files Browse the repository at this point in the history
  • Loading branch information
cameron-eyds committed Oct 23, 2024
1 parent 26e2cd1 commit 8fd6b15
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 56 deletions.
6 changes: 3 additions & 3 deletions ppr-ui/src/components/common/DocumentId.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
id="location-change-doc-id"
cols="9"
>
{{ getMhrTransportPermit.documentId }}
{{ getMhrTransportPermit.documentId || 'Generate a Document ID Number upon filing' }}
</v-col>
</v-row>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
cols="9"
class="details"
>
{{ unitNote.documentId }}
{{ unitNote.documentId || 'Generate a Document ID Number upon filing' }}
</v-col>
</v-row>
<v-divider class="my-3 mx-0" />
Expand Down
2 changes: 1 addition & 1 deletion ppr-ui/src/composables/mhrInformation/useMhrInformation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 0 additions & 3 deletions ppr-ui/src/composables/mhrRegistration/useMhrValidations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ export const useNewMhrRegistration = (isMhrCorrections: boolean = false) => {
getStaffPayment,
getMhrDraftNumber,
getRegistrationType,
getMhrInformation
getMhrInformation,
getMhrGenerateDocId
} = storeToRefs(useStore())
const {
setShowGroups,
Expand Down Expand Up @@ -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 && {
Expand Down
8 changes: 5 additions & 3 deletions ppr-ui/src/views/exemption/ExemptionReview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,8 @@ export default defineComponent({
getStaffPayment,
isRoleStaffReg,
isRoleQualifiedSupplier,
hasLien
hasLien,
getMhrGenerateDocId
} = storeToRefs(useStore())
const {
exemptionLabel,
Expand All @@ -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 }
Expand Down
7 changes: 5 additions & 2 deletions ppr-ui/src/views/mhrInformation/MhrInformation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand Down
8 changes: 1 addition & 7 deletions ppr-ui/src/views/mhrInformation/MhrTransportPermit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
/>
</section>
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion ppr-ui/src/views/newMhrRegistration/HomeOwners.vue
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@
cols="9"
class="gray7"
>
{{ getMhrTransferDocumentId }}
{{ getMhrTransferDocumentId || 'Generate a Document ID Number upon filing' }}
</v-col>
</v-row>
<v-row
Expand Down
33 changes: 1 addition & 32 deletions ppr-ui/src/views/newMhrRegistration/SubmittingParty.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,12 @@ export default defineComponent({
getMhrRegistrationValidationModel,
getMhrRegistrationSubmittingParty
} = storeToRefs(useStore())
const { customRules, isNumber, maxLength, minLength, required } = useInputRules()
const { maxLength } = useInputRules()
const {
MhrCompVal,
MhrSectVal,
hasError,
setValidation,
getValidation,
getSectionValidation,
scrollToInvalid
} = useMhrValidations(toRefs(getMhrRegistrationValidationModel.value))
Expand All @@ -96,22 +95,6 @@ export default defineComponent({
documentId: getMhrRegistrationDocumentId.value || '',
isRefNumValid: false,
loadingDocId: false,
isUniqueDocId: false,
displayDocIdError: false,
documentIdRules: computed((): any[] => {
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)
}),
Expand All @@ -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 }
Expand Down

0 comments on commit 8fd6b15

Please sign in to comment.