diff --git a/ppr-ui/package-lock.json b/ppr-ui/package-lock.json index dcc81c181..b5cb5d59a 100644 --- a/ppr-ui/package-lock.json +++ b/ppr-ui/package-lock.json @@ -1,12 +1,12 @@ { "name": "ppr-ui", - "version": "3.2.7", + "version": "3.2.8", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "ppr-ui", - "version": "3.2.7", + "version": "3.2.8", "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 c643c73cd..c2d7a58e2 100644 --- a/ppr-ui/package.json +++ b/ppr-ui/package.json @@ -1,6 +1,6 @@ { "name": "ppr-ui", - "version": "3.2.7", + "version": "3.2.8", "private": true, "appName": "Assets UI", "sbcName": "SBC Common Components", diff --git a/ppr-ui/src/components/common/ButtonFooter.vue b/ppr-ui/src/components/common/ButtonFooter.vue index 2f5791331..5a6ed4a48 100644 --- a/ppr-ui/src/components/common/ButtonFooter.vue +++ b/ppr-ui/src/components/common/ButtonFooter.vue @@ -175,6 +175,7 @@ export default defineComponent({ isRoleStaffBcol, isRoleStaffReg, isRoleStaffSbc, + isMhrReRegistration, getMhrInformation } = storeToRefs(useStore()) const { mhrDraftHandler } = useNewMhrRegistration() @@ -254,7 +255,7 @@ export default defineComponent({ const newItem: RegTableNewItemI = { addedReg: draft.financingStatement?.documentId || draft.draftNumber, // adding mhrNumber will scroll to draft mhr correction - addedRegParent: isMhrCorrection.value ? getMhrInformation.value.mhrNumber : '', + addedRegParent: (isMhrCorrection.value || isMhrReRegistration.value) ? getMhrInformation.value.mhrNumber : '', addedRegSummary: null, prevDraft: prevDraftId } diff --git a/ppr-ui/src/components/common/RegistrationsWrapper.vue b/ppr-ui/src/components/common/RegistrationsWrapper.vue index c2f19af2b..9056c6b84 100644 --- a/ppr-ui/src/components/common/RegistrationsWrapper.vue +++ b/ppr-ui/src/components/common/RegistrationsWrapper.vue @@ -357,7 +357,7 @@ export default defineComponent({ const { goToExemptions } = useExemptions() - const { initMhrReRegistration } = useMhrReRegistration() + const { initMhrReRegistration, initDraftMhrReRegistration } = useMhrReRegistration() const localState = reactive({ loading: false, @@ -739,7 +739,7 @@ export default defineComponent({ openMhr(mhrInfo) break case TableActions.OPEN_DRAFT_CORRECTION: - if (mhrInfo.outOfDate) { + if (mhrInfo.outOfDate) { // Handle stale drafts before opening the MHR when flagged as outOfDate localState.staleDraftId = mhrInfo?.draftNumber localState.mhrWithDraftId = mhrInfo?.mhrNumber @@ -748,6 +748,16 @@ export default defineComponent({ } openDraftMhrCorrection(mhrInfo) break + case TableActions.OPEN_DRAFT_RE_REGISTRATION: + if (mhrInfo.outOfDate) { + // Handle stale drafts before opening the MHR when flagged as outOfDate + localState.staleDraftId = mhrInfo?.draftNumber + localState.mhrWithDraftId = mhrInfo?.mhrNumber + localState.staleDraftDialogDisplay = true + return + } + openDraftMhrReRegistration(mhrInfo) + break case UnitNoteDocTypes.RESIDENTIAL_EXEMPTION_ORDER: case UnitNoteDocTypes.NON_RESIDENTIAL_EXEMPTION: openMhrExemption(mhrInfo, action) @@ -807,6 +817,12 @@ export default defineComponent({ goToRoute(RouteNames.SUBMITTING_PARTY) } + const openDraftMhrReRegistration = async (draftMhrCorrection) => { + await initDraftMhrReRegistration(draftMhrCorrection) + // Navigate to MHR Re-Registration home route + goToRoute(RouteNames.SUBMITTING_PARTY) + } + const openMhrExemption = async (mhrSummary: MhRegistrationSummaryIF, type: UnitNoteDocTypes): Promise => { await setMhrInformation(mhrSummary) await goToExemptions(type) diff --git a/ppr-ui/src/components/tables/common/TableRow.vue b/ppr-ui/src/components/tables/common/TableRow.vue index 7f3016705..1f28dd861 100644 --- a/ppr-ui/src/components/tables/common/TableRow.vue +++ b/ppr-ui/src/components/tables/common/TableRow.vue @@ -880,7 +880,8 @@ export default defineComponent({ switch (item.registrationType) { case APIMhrTypes.REGISTRY_STAFF_ADMIN: - action = TableActions.OPEN_DRAFT_CORRECTION + action = item.registrationDescription === APIMhrDescriptionTypes.RE_REGISTER_NEW_UNIT + ? TableActions.OPEN_DRAFT_RE_REGISTRATION : TableActions.OPEN_DRAFT_CORRECTION break case APIMhrTypes.MANUFACTURED_HOME_REGISTRATION: action = item.draftNumber ? TableActions.EDIT_NEW_MHR : TableActions.OPEN_MHR diff --git a/ppr-ui/src/composables/mhrRegistration/useMhrReRegistration.ts b/ppr-ui/src/composables/mhrRegistration/useMhrReRegistration.ts index 64753f42a..01f68a7bc 100644 --- a/ppr-ui/src/composables/mhrRegistration/useMhrReRegistration.ts +++ b/ppr-ui/src/composables/mhrRegistration/useMhrReRegistration.ts @@ -2,21 +2,34 @@ import { HomeCertificationOptions } from '@/enums' import { MhRegistrationSummaryIF } from '@/interfaces' import { MhrReRegistrationType } from '@/resources' import { useStore } from '@/store/store' -import { fetchMhRegistration } from '@/utils' +import { fetchMhRegistration, getMhrDraft } from '@/utils' import { useNewMhrRegistration } from './useNewMhrRegistration' import { cloneDeep } from 'lodash' import { useMhrInformation } from '../mhrInformation' export const useMhrReRegistration = () => { - const { - setMhrBaseline, - setRegistrationType - } = useStore() + const { setMhrBaseline, setRegistrationType, setMhrDraftNumber } = useStore() const { setMhrNumber, setMhrStatusType } = useStore() const { parseMhrPermitData } = useMhrInformation() - const initMhrReRegistration = async (mhrSummary: MhRegistrationSummaryIF): Promise => { + const initMhrReRegistration = async (mhrSummary: MhRegistrationSummaryIF): Promise => + initReRegistrationOrDraft(mhrSummary) + + const initDraftMhrReRegistration = async (mhrSummary: MhRegistrationSummaryIF): Promise => + initReRegistrationOrDraft(mhrSummary, true) + + /** + * Private function to init the MHR Re-Registration or Draft Re-Registration. + * + * @param {MhRegistrationSummaryIF} mhrSummary - The MHR summary information. + * @param {boolean} isDraft - A flag indicating whether the registration is a draft or not. Defaults to false. + * + */ + const initReRegistrationOrDraft = async ( + mhrSummary: MhRegistrationSummaryIF, + isDraft: boolean = false + ): Promise => { setMhrNumber(mhrSummary.mhrNumber) setRegistrationType(MhrReRegistrationType) setMhrStatusType(mhrSummary.statusType) @@ -29,14 +42,20 @@ export const useMhrReRegistration = () => { (data?.description?.engineerName && HomeCertificationOptions.ENGINEER_INSPECTION) || null - // remove props that should not be pre-populated into Re-Registration - data.documentId = '' - data.ownerGroups = [] + if (!isDraft) { + // remove props that should not be pre-populated into Re-Registration + data.documentId = '' + data.ownerGroups = [] + // parse Transport Permit data to correctly show Location of Home step + parseMhrPermitData(data) + } else { + const draftNumber = mhrSummary.draftNumber + const { registration } = await getMhrDraft(draftNumber) + setMhrDraftNumber(draftNumber) + setMhrStatusType(data?.status) + await useNewMhrRegistration().initDraftOrCurrentMhr(registration) + } - // parse Transport Permit data to correctly show Location of Home step - parseMhrPermitData(data) - - // Preserve MHR snapshot await setMhrBaseline( cloneDeep({ ...data, @@ -47,10 +66,14 @@ export const useMhrReRegistration = () => { } }) ) - await useNewMhrRegistration().initDraftOrCurrentMhr(data, false) + + if (!isDraft) { + await useNewMhrRegistration().initDraftOrCurrentMhr(data, false) + } } return { - initMhrReRegistration + initMhrReRegistration, + initDraftMhrReRegistration } } diff --git a/ppr-ui/src/composables/mhrRegistration/useNewMhrRegistration.ts b/ppr-ui/src/composables/mhrRegistration/useNewMhrRegistration.ts index 694058830..7bfae64f8 100644 --- a/ppr-ui/src/composables/mhrRegistration/useNewMhrRegistration.ts +++ b/ppr-ui/src/composables/mhrRegistration/useNewMhrRegistration.ts @@ -50,6 +50,7 @@ export const useNewMhrRegistration = (isMhrCorrections: boolean = false) => { // Getters isRoleStaffReg, isMhrManufacturerRegistration, + isMhrReRegistration, getFolioOrReferenceNumber, getMhrRegistrationHomeDescription, getMhrRegistrationSubmittingParty, @@ -358,7 +359,7 @@ export const useNewMhrRegistration = (isMhrCorrections: boolean = false) => { } // add additional props to payload for Mhr Corrections - if (isMhrCorrection.value) { + if (isMhrCorrection.value || isMhrReRegistration.value) { data.documentType = getRegistrationType.value?.registrationTypeAPI data.mhrNumber = getMhrInformation.value.mhrNumber } @@ -375,7 +376,7 @@ export const useNewMhrRegistration = (isMhrCorrections: boolean = false) => { const mhrDraftHandler = async (): Promise => { - const draftType = isMhrCorrection.value + const draftType = (isMhrCorrection.value || isMhrReRegistration.value) ? APIMhrTypes.REGISTRY_STAFF_ADMIN : APIMhrTypes.MANUFACTURED_HOME_REGISTRATION diff --git a/ppr-ui/src/enums/registrationTypes.ts b/ppr-ui/src/enums/registrationTypes.ts index d1339be37..e2c9915dd 100644 --- a/ppr-ui/src/enums/registrationTypes.ts +++ b/ppr-ui/src/enums/registrationTypes.ts @@ -90,7 +90,7 @@ export enum UIRegistrationTypes { SPECULATION_VACANCY_TAX = 'Crown Charge - Speculation and Vacancy Tax Act', TOBACCO_TAX = 'Crown Charge - Tobacco Tax Act', OTHER = 'Crown Charge - Other', - // miscellaneous registration other + // miscellaneous registration other LIEN_UNPAID_WAGES = 'Lien for Unpaid Wages', HERITAGE_CONSERVATION_NOTICE = 'Heritage Conservation Notice', MANUFACTURED_HOME_NOTICE = 'Manufactured Home Notice', @@ -127,7 +127,7 @@ export enum StatementTypes { CHANGE_STATEMENT = 'CHANGE', DISHCARGE_STATEMENT = 'DISCHARGE', FINANCING_STATEMENT = 'FINANCING', - RENEWAL_STATEMENT = 'RENEWAL', + RENEWAL_STATEMENT = 'RENEWAL' } export enum APIAmendmentTypes { @@ -183,6 +183,7 @@ export enum UIRegistrationClassTypes { export enum APIMhrDescriptionTypes { REGISTER_NEW_UNIT = 'MANUFACTURED HOME REGISTRATION', + RE_REGISTER_NEW_UNIT = 'MANUFACTURED HOME RE-REGISTRATION', CONVERTED = 'RECORD CONVERSION', SALE_OR_GIFT = 'TRANSFER DUE TO SALE OR GIFT', @@ -251,7 +252,7 @@ export enum APIMhrTypes { RESIDENTIAL_EXEMPTION = 'EXEMPTION_RES', MANUFACTURED_HOME_REGISTRATION = 'MHREG', TRANSPORT_PERMIT = 'PERMIT', - REGISTRY_STAFF_ADMIN = 'REG_STAFF_ADMIN', + REGISTRY_STAFF_ADMIN = 'REG_STAFF_ADMIN' } /** diff --git a/ppr-ui/src/enums/tableActions.ts b/ppr-ui/src/enums/tableActions.ts index 685036c2d..fd66724a8 100644 --- a/ppr-ui/src/enums/tableActions.ts +++ b/ppr-ui/src/enums/tableActions.ts @@ -9,5 +9,6 @@ export enum TableActions { REMOVE_TRANSFER_DRAFT = 'removeTransferDraft', OPEN_MHR = 'openMhr', EDIT_NEW_MHR = 'editMhr', - OPEN_DRAFT_CORRECTION = 'openDraftCorrection' + OPEN_DRAFT_CORRECTION = 'openDraftCorrection', + OPEN_DRAFT_RE_REGISTRATION = 'openDraftReRegistration' } diff --git a/ppr-ui/src/views/newMhrRegistration/MhrRegistration.vue b/ppr-ui/src/views/newMhrRegistration/MhrRegistration.vue index af96f89b5..6aae20e20 100644 --- a/ppr-ui/src/views/newMhrRegistration/MhrRegistration.vue +++ b/ppr-ui/src/views/newMhrRegistration/MhrRegistration.vue @@ -56,7 +56,7 @@ class="pt-3 pb-6" > -

{{ getRegistrationType.registrationTypeUI }}

+

{{ getRegistrationType.registrationTypeUI }} {{ isDraft && ' - Draft' }}

The homeowner and home location information in the Initial Registration form must align with the supporting documentation. @@ -175,7 +175,8 @@ export default defineComponent({ setRegTableNewItem, setMhrTransferType, setDraft, - setMhrInformationDraftId + setMhrInformationDraftId, + setMhrCorrectStatusType } = useStore() const { // Getters @@ -321,6 +322,11 @@ export default defineComponent({ delete data.submittingParty.hasUsedPartyLookup } + // Because Corrections flow is reused for Re-Registrations, the Mhr status needs to be set in corrections + if (isMhrReRegistration.value) { + setMhrCorrectStatusType(getMhrInformation.value.statusType) + } + const mhrSubmission = isMhrCorrection.value || isMhrReRegistration.value ? await submitAdminRegistration( getMhrInformation.value.mhrNumber,