From 41c5051c4256446f0c9d49e048ce79de626a4f69 Mon Sep 17 00:00:00 2001 From: Dima K Date: Mon, 20 Nov 2023 13:15:41 -0400 Subject: [PATCH] Updates to Residential Exemption with Lien (#1621) * Add Lien Msg for Res Exemptions * Refactor and add LienAlert component for Transfers and Exemptions --- ppr-ui/src/assets/styles/theme.scss | 4 + ppr-ui/src/components/common/LienAlert.vue | 140 ++++++++++++++++++ ppr-ui/src/components/common/index.ts | 1 + .../src/components/tables/common/TableRow.vue | 40 ++++- .../mhrInformation/useMhrInfoValidation.ts | 7 +- .../mhrInformation/useMhrInformation.ts | 39 ++++- ppr-ui/src/resources/index.ts | 1 + ppr-ui/src/resources/lienMessages.ts | 6 + ppr-ui/src/store/store.ts | 4 + .../src/views/exemption/ExemptionDetails.vue | 11 +- .../src/views/exemption/ExemptionReview.vue | 13 +- .../views/mhrInformation/MhrInformation.vue | 71 +++------ ppr-ui/tests/unit/ExemptionDetails.spec.ts | 3 +- ppr-ui/tests/unit/ExemptionReview.spec.ts | 5 + ppr-ui/tests/unit/MhrInformation.spec.ts | 6 +- 15 files changed, 286 insertions(+), 65 deletions(-) create mode 100644 ppr-ui/src/components/common/LienAlert.vue create mode 100644 ppr-ui/src/resources/lienMessages.ts diff --git a/ppr-ui/src/assets/styles/theme.scss b/ppr-ui/src/assets/styles/theme.scss index d60bcb6e4..dc8092815 100644 --- a/ppr-ui/src/assets/styles/theme.scss +++ b/ppr-ui/src/assets/styles/theme.scss @@ -49,6 +49,10 @@ $BCgovAGold2: #fff8ef; $BCgovAGold3: #ffe0bc; $BCgovAGold4: #ffd4a2; +// Warning Colors +$warning: #FCBA19; +$backgroundWarning: #FFF7E3; + // Error Colors $BCgovInputError: #ff5252; $error: #D3272C; diff --git a/ppr-ui/src/components/common/LienAlert.vue b/ppr-ui/src/components/common/LienAlert.vue new file mode 100644 index 000000000..03ed40d2b --- /dev/null +++ b/ppr-ui/src/components/common/LienAlert.vue @@ -0,0 +1,140 @@ + + + + + diff --git a/ppr-ui/src/components/common/index.ts b/ppr-ui/src/components/common/index.ts index 309ebb72a..85e8567f5 100644 --- a/ppr-ui/src/components/common/index.ts +++ b/ppr-ui/src/components/common/index.ts @@ -35,3 +35,4 @@ export { default as PartyReview } from './PartyReview.vue' export { default as FormCard } from './FormCard.vue' export { default as OrgNameLookup } from './OrgNameLookup.vue' export { default as ReviewCard } from './ReviewCard.vue' +export { default as LienAlert } from './LienAlert.vue' diff --git a/ppr-ui/src/components/tables/common/TableRow.vue b/ppr-ui/src/components/tables/common/TableRow.vue index 3db5abd78..63817f3cf 100644 --- a/ppr-ui/src/components/tables/common/TableRow.vue +++ b/ppr-ui/src/components/tables/common/TableRow.vue @@ -400,12 +400,35 @@ - exemption-icon - Residential Exemption + + + {{ hasLienForQS + ? 'There is a lien on this home preventing an exemption to be filed.' + : `There is a lock on this home preventing an exemption to be filed. + If you require further information please contact BC Registries staff.` + }} + + + exemption-icon + Residential Exemption + { return (isRoleQualifiedSupplier.value || isRoleStaffReg.value || isRoleStaff.value) && !isRoleStaffSbc.value && !isRoleStaffBcol.value - }) + }), + hasLienForQS: computed(() => + isRoleQualifiedSupplier.value && + localState.item.lienRegistrationType && + localState.item.lienRegistrationType !== APIRegistrationTypes.SECURITY_AGREEMENT + ), + hasLockedForQS: computed(() => + hasLockedState(localState.item) && isRoleQualifiedSupplier.value + ) }) const deleteDraft = (item: DraftResultIF): void => { @@ -904,6 +935,7 @@ export default defineComponent({ isRenewalDisabled, isRepairersLienAmendDisabled, isRoleStaffReg, + isRoleQualifiedSupplier, isExemptionEnabled, hasChildResExemption, hasRenewal, diff --git a/ppr-ui/src/composables/mhrInformation/useMhrInfoValidation.ts b/ppr-ui/src/composables/mhrInformation/useMhrInfoValidation.ts index 782031e9d..8a6d053a2 100644 --- a/ppr-ui/src/composables/mhrInformation/useMhrInfoValidation.ts +++ b/ppr-ui/src/composables/mhrInformation/useMhrInfoValidation.ts @@ -4,7 +4,7 @@ import { MhrRegistrationHomeOwnerIF } from '@/interfaces' import { computed } from 'vue-demi' -import { useHomeOwners, useTransferOwners } from '@/composables' +import { useHomeOwners, useMhrInformation, useTransferOwners } from '@/composables' import { ActionTypes } from '@/enums' import { storeToRefs } from 'pinia' @@ -21,6 +21,9 @@ export const useMhrInfoValidation = (validationState: mhrInfoValidationStateIF) const { isTransferDueToDeath } = useTransferOwners() + const { + getLienInfo + } = useMhrInformation() /** Set specified flag */ const setValidation = (propertyKey: string, isValid: boolean): void => { @@ -52,7 +55,7 @@ export const useMhrInfoValidation = (validationState: mhrInfoValidationStateIF) validationState.isValidTransferType && validationState.isValidTransferOwners && (isTransferDueToDeath.value || validationState.isTransferDetailsValid) && - !hasLien.value + (!hasLien.value || getLienInfo().isSubmissionAllowed) ) }) diff --git a/ppr-ui/src/composables/mhrInformation/useMhrInformation.ts b/ppr-ui/src/composables/mhrInformation/useMhrInformation.ts index a5dc015ea..3a7d5a532 100644 --- a/ppr-ui/src/composables/mhrInformation/useMhrInformation.ts +++ b/ppr-ui/src/composables/mhrInformation/useMhrInformation.ts @@ -9,6 +9,7 @@ import { } from '@/interfaces' import { useStore } from '@/store/store' import { + APIRegistrationTypes, ActionTypes, ApiHomeTenancyTypes, ApiTransferTypes, @@ -21,10 +22,10 @@ import { } from '@/enums' import { fetchMhRegistration, normalizeObject, parseAccountToSubmittingParty } from '@/utils' import { cloneDeep } from 'lodash' -import { useHomeOwners, useTransferOwners } from '@/composables' +import { useExemptions, useHomeOwners, useTransferOwners } from '@/composables' import { computed, reactive, toRefs } from 'vue-demi' import { storeToRefs } from 'pinia' -import { QSLockedStateUnitNoteTypes } from '@/resources' +import { LienMessages, QSLockedStateUnitNoteTypes } from '@/resources' export const useMhrInformation = () => { const { @@ -60,7 +61,8 @@ export const useMhrInformation = () => { getMhrTransferHomeOwnerGroups, getMhrTransferCurrentHomeOwnerGroups, getMhrTransferDocumentId, - getMhrTransferType + getMhrTransferType, + getLienRegistrationType } = storeToRefs(useStore()) const { @@ -71,6 +73,8 @@ export const useMhrInformation = () => { getCurrentOwnerGroupIdByOwnerId } = useTransferOwners() + const { getActiveExemption } = useExemptions() + /** Local State for custom computed properties. **/ const localState = reactive({ isFrozenMhr: computed((): boolean => { @@ -190,6 +194,34 @@ export const useMhrInformation = () => { )] } + // Get information about the lien to help with styling and functionality + const getLienInfo = (): { class: string, msg: string, isSubmissionAllowed: boolean } => { + const hasActiveExemption = !!getActiveExemption() + const isLienRegistrationTypeSA = getLienRegistrationType.value === APIRegistrationTypes.SECURITY_AGREEMENT + + if (isRoleStaffReg.value || (isRoleQualifiedSupplier.value && isLienRegistrationTypeSA)) { + return { + class: 'warning', + msg: LienMessages.defaultWarning, + isSubmissionAllowed: true + } + } else if (isRoleQualifiedSupplier.value) { + return { + class: 'error', + msg: LienMessages.QSError, + isSubmissionAllowed: false + } + } else if (isRoleQualifiedSupplier.value && + hasActiveExemption && + isLienRegistrationTypeSA) { + return { + class: 'warning', + msg: LienMessages.exemptionsWarning, + isSubmissionAllowed: true + } + } + } + /** Draft Filings **/ /** * Parse a draft MHR Information into State. @@ -371,6 +403,7 @@ export const useMhrInformation = () => { parseMhrInformation, initDraftMhrInformation, parseSubmittingPartyInfo, + getLienInfo, ...toRefs(localState) } } diff --git a/ppr-ui/src/resources/index.ts b/ppr-ui/src/resources/index.ts index 2afd590a8..2ff592161 100644 --- a/ppr-ui/src/resources/index.ts +++ b/ppr-ui/src/resources/index.ts @@ -22,3 +22,4 @@ export * from './contactInformationContent' export * from './userAccessOrgLookup' export * from './userAccessRequirements' export * from './exemptions' +export * from './lienMessages' diff --git a/ppr-ui/src/resources/lienMessages.ts b/ppr-ui/src/resources/lienMessages.ts new file mode 100644 index 000000000..5d904b906 --- /dev/null +++ b/ppr-ui/src/resources/lienMessages.ts @@ -0,0 +1,6 @@ +/* eslint-disable max-len */ +export const LienMessages = { + defaultWarning: 'There is a lien pertaining to this home. You can view liens against the manufactured home in the Personal Property Registry by conducting a combined Manufactured Home Registry and PPR search.', + QSError: 'There is at least one lien pertaining to this manufactured home that may be preventing some changes to this home. Any liens preventing changes must be either discharged or have prescribed conditions met before making changes. If prescribed conditions have been met, changes cannot be completed online and must be registered by BC Registries staff. You can view liens against the manufactured home in the PPR by conducting a combined Manufactured Home Registry and PPR search.', + exemptionsWarning: 'There is a PPSA (Personal Property Security Act) security interest pertaining to this manufactured home. You must have consent of each Secured Party in the agreement to continue. You can view liens against the manufactured home in the Personal Property Registry by conducting a combined Manufactured Home Registry and PPR search.' +} diff --git a/ppr-ui/src/store/store.ts b/ppr-ui/src/store/store.ts index a2cf6aa1e..aa284ed69 100644 --- a/ppr-ui/src/store/store.ts +++ b/ppr-ui/src/store/store.ts @@ -644,6 +644,9 @@ export const useStore = defineStore('assetsStore', () => { // Current state is to verify the property exists. Future state may be more granular dependent on type. return !!state.value.mhrInformation.lienRegistrationType }) + const getLienRegistrationType = computed(() => { + return state.value.mhrInformation.lienRegistrationType + }) const getMhrUnitNotes: ComputedRef> = computed>(() => { return state.value.mhrUnitNotes @@ -1365,6 +1368,7 @@ export const useStore = defineStore('assetsStore', () => { // Lien-related getter hasLien, + getLienRegistrationType, // Mhr Info Validation State getMhrInfoValidation, diff --git a/ppr-ui/src/views/exemption/ExemptionDetails.vue b/ppr-ui/src/views/exemption/ExemptionDetails.vue index 0bb1d5c97..d60087263 100644 --- a/ppr-ui/src/views/exemption/ExemptionDetails.vue +++ b/ppr-ui/src/views/exemption/ExemptionDetails.vue @@ -1,5 +1,8 @@