diff --git a/ppr-ui/package-lock.json b/ppr-ui/package-lock.json index 4e606dd70..c6e429399 100644 --- a/ppr-ui/package-lock.json +++ b/ppr-ui/package-lock.json @@ -1,12 +1,12 @@ { "name": "ppr-ui", - "version": "3.2.44", + "version": "3.2.45", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "ppr-ui", - "version": "3.2.44", + "version": "3.2.45", "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 ab8bd8a53..9dc41041b 100644 --- a/ppr-ui/package.json +++ b/ppr-ui/package.json @@ -1,6 +1,6 @@ { "name": "ppr-ui", - "version": "3.2.44", + "version": "3.2.45", "private": true, "appName": "Assets UI", "sbcName": "SBC Common Components", diff --git a/ppr-ui/src/components/tables/RegistrationTable.vue b/ppr-ui/src/components/tables/RegistrationTable.vue index 49419f2e0..0d7e5f5ad 100644 --- a/ppr-ui/src/components/tables/RegistrationTable.vue +++ b/ppr-ui/src/components/tables/RegistrationTable.vue @@ -191,8 +191,8 @@ singleLine persistentClear :clearIcon="'mdi-close'" - @click="showDatePicker = true" aria-hidden="true" + @click="showDatePicker = true" /> - - + Edit @@ -322,9 +325,9 @@ v-else-if="!isExpired(item) && !isDischarged(item)" class="edit-btn" color="primary" + aria-hidden="false" + aria-label="Amend Button" @click="handleAction(item, TableActions.AMEND)" - aria-hidden="false" - aria-label="Amend Button" > Amend @@ -332,9 +335,9 @@ v-else color="primary" class="remove-btn" + aria-label="Remove From Table Button" + aria-hidden="false" @click="handleAction(item, TableActions.REMOVE)" - aria-hidden="false" - aria-label="Remove From Table Button" > Remove From Table @@ -473,9 +476,9 @@ Open @@ -620,9 +623,9 @@ Edit @@ -698,7 +701,7 @@ import { HomeLocationTypes } from '@/enums' import { useRegistration } from '@/composables/useRegistration' -import { useExemptions, useTransferOwners } from '@/composables' +import { useExemptions, useMhrInformation, useTransferOwners } from '@/composables' import moment from 'moment' import { storeToRefs } from 'pinia' import { QSLockedStateUnitNoteTypes } from '@/resources' @@ -743,6 +746,7 @@ export default defineComponent({ securedParties } = useRegistration(null) const { isTransAffi } = useTransferOwners() + const { hasQsTransferOrExemptionBlockingLien } = useMhrInformation() const { isExemptionEnabled, isNonResExemptionEnabled, hasChildResExemption } = useExemptions() const localState = reactive({ @@ -781,7 +785,7 @@ export default defineComponent({ hasLienForQS: computed(() => { return isRoleQualifiedSupplier.value && localState.item.lienRegistrationType && - localState.item.lienRegistrationType !== APIRegistrationTypes.SECURITY_AGREEMENT + hasQsTransferOrExemptionBlockingLien.value }), hasLockedForQS: computed(() => { return hasLockedState(localState.item) && isRoleQualifiedSupplier.value diff --git a/ppr-ui/src/components/unitNotes/UnitNoteAdd.vue b/ppr-ui/src/components/unitNotes/UnitNoteAdd.vue index ada2e632d..b69896653 100644 --- a/ppr-ui/src/components/unitNotes/UnitNoteAdd.vue +++ b/ppr-ui/src/components/unitNotes/UnitNoteAdd.vue @@ -136,7 +136,8 @@ export default defineComponent({ : personGivingNoticeContent ), isNoticeOfTaxSale: computed((): boolean => props.docType === UnitNoteDocTypes.NOTICE_OF_TAX_SALE), - hasNoPersonGivingNotice: props.docType === UnitNoteDocTypes.DECAL_REPLACEMENT || (getMhrUnitNote.value as UnitNoteIF).hasNoPersonGivingNotice || false, + hasNoPersonGivingNotice: props.docType === UnitNoteDocTypes.DECAL_REPLACEMENT || + (getMhrUnitNote.value as UnitNoteIF).hasNoPersonGivingNotice || false, // Remarks unitNoteRemarks: (getMhrUnitNote.value as UnitNoteIF).remarks || '', @@ -176,7 +177,10 @@ export default defineComponent({ onMounted(() => { if(props.docType === UnitNoteDocTypes.DECAL_REPLACEMENT) { - setValidation(MhrSectVal.UNIT_NOTE_VALID, MhrCompVal.PERSON_GIVING_NOTICE_VALID, localState.hasNoPersonGivingNotice) + setValidation( + MhrSectVal.UNIT_NOTE_VALID, MhrCompVal.PERSON_GIVING_NOTICE_VALID, + localState.hasNoPersonGivingNotice + ) handleStoreUpdate('hasNoPersonGivingNotice', localState.hasNoPersonGivingNotice) } }) diff --git a/ppr-ui/src/composables/mhrInformation/useMhrInformation.ts b/ppr-ui/src/composables/mhrInformation/useMhrInformation.ts index dfdf081bd..922af9fc6 100644 --- a/ppr-ui/src/composables/mhrInformation/useMhrInformation.ts +++ b/ppr-ui/src/composables/mhrInformation/useMhrInformation.ts @@ -117,7 +117,38 @@ export const useMhrInformation = () => { localState.isFrozenMhr && QSLockedStateUnitNoteTypes.includes(getMhrInformation.value?.frozenDocumentType) ) - }) + }), + /** Returns true when there is a lien present that would block a Qualified Supplier from ALL Registration Types **/ + hasQsBlockingLien: computed((): boolean => { + return [ + APIRegistrationTypes.SECURITY_AGREEMENT_TAX, + APIRegistrationTypes.TRANSITION_SECURITY_AGREEMENT_TAX, + APIRegistrationTypes.TRANSITION_MH_TAX + ].includes(getLienRegistrationType.value) + }), + /** Returns true when there is a lien present that would block a Qualified Supplier from Transfers or Exemptions **/ + hasQsTransferOrExemptionBlockingLien: computed((): boolean => { + return localState.hasQsBlockingLien || + [ + APIRegistrationTypes.SECURITY_AGREEMENT_GOV, + APIRegistrationTypes.TRANSITION_SECURITY_AGREEMENT_GOV, + APIRegistrationTypes.TRANSITION_MH_GOV, + APIRegistrationTypes.MARRIAGE_MH, + APIRegistrationTypes.LAND_TAX_LIEN, + APIRegistrationTypes.MAINTENANCE_LIEN, + APIRegistrationTypes.MANUFACTURED_HOME_NOTICE, + APIRegistrationTypes.SALE_OF_GOODS + ].includes(getLienRegistrationType.value) + }), + /** Returns true when there is a lien present that would block a Qualified Supplier from Transport Permits **/ + hasQsPermitBlockingLien: computed((): boolean => { + return localState.hasQsBlockingLien || + [ + APIRegistrationTypes.LAND_TAX_LIEN, + APIRegistrationTypes.MAINTENANCE_LIEN, + APIRegistrationTypes.MANUFACTURED_HOME_NOTICE + ].includes(getLienRegistrationType.value) + }), }) /** New Filings / Initializing **/ diff --git a/ppr-ui/src/composables/mhrInformation/useTransportPermits.ts b/ppr-ui/src/composables/mhrInformation/useTransportPermits.ts index edeef6060..9995122b1 100644 --- a/ppr-ui/src/composables/mhrInformation/useTransportPermits.ts +++ b/ppr-ui/src/composables/mhrInformation/useTransportPermits.ts @@ -18,13 +18,13 @@ import { UnitNoteIF } from '@/interfaces' import { - APIRegistrationTypes, HomeLocationTypes, MhApiStatusTypes, UnitNoteDocTypes, UnitNoteStatusTypes } from '@/enums' import { cloneDeep, get, isEqual } from 'lodash' +import { useMhrInformation } from '@/composables' // Global constants const isChangeLocationActive: Ref = ref(false) @@ -36,7 +36,6 @@ export const useTransportPermits = () => { isRoleStaffSbc, isRoleStaffReg, isRoleQualifiedSupplier, - getLienRegistrationType, getMhrUnitNotes, getMhrTransportPermit, getMhrOriginalTransportPermit, @@ -54,6 +53,8 @@ export const useTransportPermits = () => { setMhrTransportPermitLocationChangeType } = useStore() + const { hasQsPermitBlockingLien } = useMhrInformation() + /** Returns true when the Mhr Information permitStatus is ACTIVE **/ const hasActiveTransportPermit: ComputedRef = computed((): boolean => { return getMhrInformation.value.permitStatus === MhApiStatusTypes.ACTIVE @@ -143,24 +144,20 @@ export const useTransportPermits = () => { .includes(newLocation) } - const isTransportPermitDisabled = computed((): boolean => + const isTransportPermitDisabled = computed((): boolean => { // QS or SBC role check - (isRoleQualifiedSupplier.value || isRoleStaffSbc.value) && - // PPR Liens check - ([APIRegistrationTypes.LAND_TAX_LIEN, - APIRegistrationTypes.MAINTENANCE_LIEN, - APIRegistrationTypes.MANUFACTURED_HOME_NOTICE] - .includes(getLienRegistrationType.value as APIRegistrationTypes) || - // Unit Notes check + return (isRoleQualifiedSupplier.value || isRoleStaffSbc.value) && + // PPR Liens check + ((isRoleQualifiedSupplier.value && hasQsPermitBlockingLien.value) || + // Unit Notes check getMhrUnitNotes.value .filter(note => note.status === UnitNoteStatusTypes.ACTIVE) .some(note => [ UnitNoteDocTypes.NOTICE_OF_TAX_SALE, UnitNoteDocTypes.CONFIDENTIAL_NOTE, UnitNoteDocTypes.RESTRAINING_ORDER - ].includes(note.documentType)) - ) - ) + ].includes(note.documentType))) + }) /** * Check if Amend or Cancel Transport Permit is allowed for Exempt MHR based on few conditions. diff --git a/ppr-ui/src/enums/registrationTypes.ts b/ppr-ui/src/enums/registrationTypes.ts index 7e1b7b299..da8b42195 100644 --- a/ppr-ui/src/enums/registrationTypes.ts +++ b/ppr-ui/src/enums/registrationTypes.ts @@ -57,7 +57,15 @@ export enum APIRegistrationTypes { MHR_CORRECTION_STAFF = 'REGC_STAFF', MHR_CORRECTION_CLIENT = 'REGC_CLIENT', MHR_PUBLIC_AMENDMENT = 'PUBA', - MHR_RE_REGISTRATION = 'EXRE' + MHR_RE_REGISTRATION = 'EXRE', + // Secured Party is the Crown + SECURITY_AGREEMENT_GOV = 'SA_GOV', + TRANSITION_SECURITY_AGREEMENT_GOV = 'TA_GOV', + TRANSITION_MH_GOV = 'TM_GOV', + // Provincial Ministry tax branch + SECURITY_AGREEMENT_TAX = 'SA_TAX', + TRANSITION_SECURITY_AGREEMENT_TAX = 'TA_TAX', + TRANSITION_MH_TAX = 'TM_TAX' } export enum UIRegistrationTypes { diff --git a/ppr-ui/src/utils/axios-base.ts b/ppr-ui/src/utils/axios-base.ts new file mode 100644 index 000000000..656c09247 --- /dev/null +++ b/ppr-ui/src/utils/axios-base.ts @@ -0,0 +1,25 @@ +import Axios from 'axios' +import * as Sentry from '@sentry/browser' + +const axios = Axios.create() + +axios.interceptors.request.use( + config => { + config.headers['x-apikey'] = sessionStorage.getItem('PPR_API_KEY') + return config + }, + error => { + // console.log('axios interceptor set request headers error: ' + error) + Promise.reject(error) + } +) + +axios.interceptors.response.use( + response => response, + error => { + Sentry.captureException(error) + return Promise.reject(error) + } +) + +export { axios } diff --git a/ppr-ui/src/utils/axios-von.ts b/ppr-ui/src/utils/axios-von.ts deleted file mode 100644 index f2888c56b..000000000 --- a/ppr-ui/src/utils/axios-von.ts +++ /dev/null @@ -1,14 +0,0 @@ -import Axios from 'axios' -import * as Sentry from '@sentry/browser' - -const axios = Axios.create() - -axios.interceptors.response.use( - response => response, - error => { - Sentry.captureException(error) - return Promise.reject(error) - } -) - -export { axios } diff --git a/ppr-ui/src/utils/ltsa-api-helper.ts b/ppr-ui/src/utils/ltsa-api-helper.ts index 4948916fb..00b293838 100644 --- a/ppr-ui/src/utils/ltsa-api-helper.ts +++ b/ppr-ui/src/utils/ltsa-api-helper.ts @@ -1,5 +1,5 @@ // Libraries -import { axios } from '@/utils/axios-ppr' +import { axios } from '@/utils/axios-base' import { StatusCodes } from 'http-status-codes' import { ErrorCategories } from '@/enums' import { LtsaDetailsIF, TitleSummariesIF } from '@/interfaces/ltsa-api-interfaces' diff --git a/ppr-ui/src/views/mhrInformation/MhrInformation.vue b/ppr-ui/src/views/mhrInformation/MhrInformation.vue index 97f086d98..b13b9cecd 100644 --- a/ppr-ui/src/views/mhrInformation/MhrInformation.vue +++ b/ppr-ui/src/views/mhrInformation/MhrInformation.vue @@ -615,7 +615,6 @@ import { import { StaffPaymentOptions, APIMHRMapSearchTypes, - APIRegistrationTypes, APISearchTypes, ApiTransferTypes, MhApiStatusTypes, @@ -779,7 +778,6 @@ export default defineComponent({ getCertifyInformation, hasUnsavedChanges, hasLien, - getLienRegistrationType, isRoleStaffSbc, isRoleStaffReg, isRoleManufacturer, @@ -807,7 +805,8 @@ export default defineComponent({ parseMhrInformation, initDraftMhrInformation, parseSubmittingPartyInfo, - isFrozenMhrDueToUnitNote + isFrozenMhrDueToUnitNote, + hasQsTransferOrExemptionBlockingLien } = useMhrInformation() const { setValidation, @@ -893,7 +892,7 @@ export default defineComponent({ isChangeOwnershipBtnDisabled: computed((): boolean => { if(isRoleStaffReg.value && hasLien.value && !isFrozenMhrDueToAffidavit.value){ return false - } + } const isFrozenMhr = isFrozenMhrDueToAffidavit.value || isFrozenMhrDueToUnitNote.value @@ -903,7 +902,7 @@ export default defineComponent({ const isRoleBasedTransferDisabled = !isRoleStaffReg.value && localState.disableRoleBaseTransfer return isFrozenMhr || isTransportPermitDisabled || - ((hasLien.value && !localState.isLienRegistrationTypeSA) || isRoleBasedTransferDisabled) + ((hasLien.value && hasQsTransferOrExemptionBlockingLien.value) || isRoleBasedTransferDisabled) }), // Transport Permit @@ -975,7 +974,7 @@ export default defineComponent({ }), transferErrorMsg: computed((): string => { if (localState.validate && hasLien.value && - (isRoleQualifiedSupplier.value && !localState.isLienRegistrationTypeSA)) { + (isRoleQualifiedSupplier.value && hasQsTransferOrExemptionBlockingLien.value)) { return '< Lien on this home is preventing transfer' } @@ -999,9 +998,6 @@ export default defineComponent({ isDraft: computed((): boolean => { return getMhrInformation.value.draftNumber }), - isLienRegistrationTypeSA: computed((): boolean => { - return getLienRegistrationType.value === APIRegistrationTypes.SECURITY_AGREEMENT - }), exemptDate: computed((): string => (isExemptMhr.value && getMhrInformation.value?.exemptDateTime) ? pacificDate(getMhrInformation.value?.exemptDateTime, true) @@ -1157,7 +1153,7 @@ export default defineComponent({ await nextTick() // Prevent proceeding when Lien present - if (hasLien.value && (isRoleQualifiedSupplier.value && !localState.isLienRegistrationTypeSA)) { + if (hasLien.value && (isRoleQualifiedSupplier.value && hasQsTransferOrExemptionBlockingLien.value)) { await scrollToFirstError(true) return } diff --git a/ppr-ui/src/views/mhrInformation/MhrTransportPermit.vue b/ppr-ui/src/views/mhrInformation/MhrTransportPermit.vue index 87363114c..82bdc560b 100644 --- a/ppr-ui/src/views/mhrInformation/MhrTransportPermit.vue +++ b/ppr-ui/src/views/mhrInformation/MhrTransportPermit.vue @@ -112,7 +112,7 @@ variant="plain" color="primary" :ripple="false" - :disabled="disable || disabledDueToLocation || state.disableDueToLien" + :disabled="disable || disabledDueToLocation" data-test-id="transport-permit-btn" @click="toggleLocationChange()" > @@ -315,7 +315,7 @@ import { DocumentId, SimpleHelpToggle } from "@/components/common" import { LocationChange } from "@/components/mhrTransportPermit" import { useMhrInformation, useMhrInfoValidation, useTransportPermits } from "@/composables/mhrInformation" -import { APIRegistrationTypes, LocationChangeTypes } from "@/enums" +import { LocationChangeTypes } from "@/enums" import { useStore } from "@/store/store" import { storeToRefs } from "pinia" import { computed, reactive } from "vue" @@ -338,9 +338,6 @@ const { isRoleStaffReg, getMhrInfoValidation, getMhrTransportPermit, - hasLien, - isRoleQualifiedSupplier, - getLienRegistrationType, getTransportPermitChangeAllowed } = storeToRefs(useStore()) const { hasActiveTransportPermit, isChangeLocationActive, isAmendLocationActive, isCancelChangeLocationActive, @@ -355,11 +352,7 @@ const { } = useMhrInfoValidation(getMhrInfoValidation.value) const state = reactive({ - transportPermitDocumentId: computed(() => getMhrTransportPermit.value.documentId), - disableDueToLien: computed((): boolean => { - return isRoleQualifiedSupplier.value && hasLien.value && - getLienRegistrationType.value !== APIRegistrationTypes.SECURITY_AGREEMENT - }) + transportPermitDocumentId: computed(() => getMhrTransportPermit.value.documentId) }) const toggleLocationChange = () => { diff --git a/ppr-ui/tests/unit/MhrInformationQsTransfers.spec.ts b/ppr-ui/tests/unit/MhrInformationQsTransfers.spec.ts index cf2890c53..903ad0f72 100644 --- a/ppr-ui/tests/unit/MhrInformationQsTransfers.spec.ts +++ b/ppr-ui/tests/unit/MhrInformationQsTransfers.spec.ts @@ -2,7 +2,14 @@ import { defaultFlagSet } from '@/utils' import { mockMhrTransferCurrentHomeOwner } from './test-data' import { createComponent, mapMhrTypeToProductCode, setupCurrentHomeOwners, setupMockUser } from './utils' import { HomeOwners, MhrInformation } from '@/views' -import { MhApiFrozenDocumentTypes, MhApiStatusTypes, MhrSubTypes, ProductCode, RouteNames } from '@/enums' +import { + APIRegistrationTypes, + MhApiFrozenDocumentTypes, + MhApiStatusTypes, + MhrSubTypes, + ProductCode, + RouteNames +} from '@/enums' import { nextTick } from 'vue' import { LienAlert } from '@/components/common' import { TransferType } from '@/components/mhrTransfers' @@ -83,7 +90,7 @@ for (const subProduct of subProducts) { }) it('renders Lien Alert', async () => { - store.setLienType('mockLienType') + store.setLienType(APIRegistrationTypes.TRANSITION_SECURITY_AGREEMENT_TAX) await nextTick() expect(wrapper.find('#home-owners-header').exists()).toBe(true) @@ -92,6 +99,16 @@ for (const subProduct of subProducts) { expect(wrapper.find('#home-owners-change-btn').attributes().disabled).toBeDefined() }) + it('does not render Lien Alert and disable Transfers for TRANSITION_SECURITY_AGREEMENT', async () => { + store.setLienType(APIRegistrationTypes.TRANSITION_SECURITY_AGREEMENT) + await nextTick() + + expect(wrapper.find('#home-owners-header').exists()).toBe(true) + expect(wrapper.find('#home-owners-change-btn').exists()).toBe(true) + // Verify Enabled Home Owners Change btn + expect(wrapper.find('#home-owners-change-btn').attributes().disabled).toBeUndefined() + }) + it('verify frozen state due to affe filing', async () => { store.setMhrStatusType(MhApiStatusTypes.FROZEN) store.setMhrFrozenDocumentType(MhApiFrozenDocumentTypes.TRANS_AFFIDAVIT)