Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle Cancelled MHR for Staff and QS #1907

Merged
merged 4 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ppr-ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ppr-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ppr-ui",
"version": "3.2.3",
"version": "3.2.4",
"private": true,
"appName": "Assets UI",
"sbcName": "SBC Common Components",
Expand Down
25 changes: 24 additions & 1 deletion ppr-ui/src/components/common/RegistrationsWrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
:setOptions="myRegAddDialog"
@proceed="myRegAddDialogProceed"
/>
<BaseDialog
id="myRegCannotBeAddedDialog"
:setDisplay="myRegCannotBeAddedDialogDisplay"
:setOptions="myRegCannotBeAddedDialog"
@proceed="myRegCannotBeAddedDialogDisplay = false"
/>
<BaseDialog
id="myRegDeleteDialog"
:setDisplay="myRegDeleteDialogDisplay"
Expand Down Expand Up @@ -242,6 +248,7 @@ import {
APIMhrTypes,
APIStatusTypes,
ErrorCategories,
MhApiStatusTypes,
RouteNames,
SettingOptions,
TableActions,
Expand All @@ -267,6 +274,7 @@ import {
amendConfirmationDialog,
dischargeConfirmationDialog,
manufacturerRegSuccessDialogOptions,
mhRegistrationCannotBeAddedDialog,
mhRegistrationFoundDialog,
mhrTableRemoveDialog,
registrationAddErrorDialog,
Expand Down Expand Up @@ -335,7 +343,8 @@ export default defineComponent({
// Getters
getRegTableBaseRegs, getRegTableDraftsBaseReg, isMhrRegistration, isMhrManufacturerRegistration,
getRegTableTotalRowCount, getStateModel, getRegTableDraftsChildReg, hasMorePages, getRegTableNewItem,
getRegTableSortOptions, getRegTableSortPage, getUserSettings, getMhRegTableBaseRegs, isRoleStaffReg
getRegTableSortOptions, getRegTableSortPage, getUserSettings, getMhRegTableBaseRegs, isRoleStaffReg,
isRoleQualifiedSupplier
} = storeToRefs(useStore())

const {
Expand All @@ -359,6 +368,7 @@ export default defineComponent({
myRegFilter: '',
myRegActionRoute: null as RouteNames,
myRegAddDialog: null as DialogOptionsIF,
myRegCannotBeAddedDialog: null as DialogOptionsIF,
myRegAddDialogError: null as StatusCodes,
dialogPermanentlyHidden: false,
manufacturerRegSuccessDialogDisplay: false,
Expand All @@ -368,6 +378,7 @@ export default defineComponent({
staleDraftDialogDisplay: false,
hideSuccessDialog: false,
myRegAddDialogDisplay: false,
myRegCannotBeAddedDialogDisplay: false,
myRegActionDialogDisplay: false,
myRegDeleteDialogDisplay: false,
myRegDeleteDialog: null as DialogOptionsIF,
Expand Down Expand Up @@ -499,6 +510,10 @@ export default defineComponent({
? await getMHRegistrationSummary(regNum, false)
: await getRegistrationSummary(regNum, false)
if (!reg.error) {
if (props.isMhr && isRoleQualifiedSupplier.value && reg.statusType === MhApiStatusTypes.CANCELLED) {
myMHRegCannotBeAddedSetDialog(regNum)
return
}
props.isMhr
? myMHRegAddFoundSetDialog(regNum, reg as MhRegistrationSummaryIF)
: myRegAddFoundSetDialog(regNum, reg as RegistrationSummaryIF)
Expand Down Expand Up @@ -576,6 +591,14 @@ export default defineComponent({
localState.myRegAddDialogDisplay = true
}

// Cancelled MHR Found Dialog
const myMHRegCannotBeAddedSetDialog = (searchedRegNum: string): void => {
localState.myRegCannotBeAddedDialog = Object.assign({ ...mhRegistrationCannotBeAddedDialog })
localState.myRegCannotBeAddedDialog.text =
localState.myRegCannotBeAddedDialog.text.replace('{reg_num}', searchedRegNum)
localState.myRegCannotBeAddedDialogDisplay = true
}

const myRegAddErrSetDialog = (error: ErrorIF): void => {
localState.myRegAddDialogError = error.statusCode
const regNum = localState.myRegAdd?.trim()?.toUpperCase()
Expand Down
6 changes: 2 additions & 4 deletions ppr-ui/src/components/tables/common/TableRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -492,10 +492,8 @@
</template>
<v-list class="actions__more-actions registration-actions">
<v-list-item
v-if="isRoleStaffReg && isExemptionEnabled && hasChildResExemption(item) &&
![HomeLocationTypes.HOME_PARK, HomeLocationTypes.LOT].includes(item.locationType)"
v-if="isRoleStaffReg && isExemptionEnabled && isExemptOrCancelled(item.statusType)"
data-test-id="rescind-exemption-btn"
:disabled="!isExemptOrCancelled(item.statusType)"
@click="openExemption(UnitNoteDocTypes.RESCIND_EXEMPTION, item)"
>
<v-list-item-subtitle>
Expand Down Expand Up @@ -872,7 +870,7 @@ export default defineComponent({
}

const isEnabledMhr = (item: MhRegistrationSummaryIF) => {
return [MhApiStatusTypes.ACTIVE, MhApiStatusTypes.FROZEN, MhApiStatusTypes.EXEMPT]
return [MhApiStatusTypes.ACTIVE, MhApiStatusTypes.FROZEN, MhApiStatusTypes.EXEMPT, MhApiStatusTypes.CANCELLED]
.includes(item.statusType as MhApiStatusTypes) &&
localState.enableOpenEdit && (item.registrationDescription === APIMhrDescriptionTypes.REGISTER_NEW_UNIT ||
item.registrationDescription === APIMhrDescriptionTypes.CONVERTED)
Expand Down
10 changes: 7 additions & 3 deletions ppr-ui/src/components/tombstone/TombstoneDynamic.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@
noGutters
>
<v-col>
<div class="float-right">
<div
class="float-right"
data-test-id="mhr-reg-status"
>
<span class="generic-label mr-2">Registration Status: </span> {{ statusType }}
<UpdatedBadge
v-if="showAmendedRegStatusBadge"
Expand Down Expand Up @@ -98,7 +101,7 @@

<!-- Mhr Amend/Correct Btns -->
<v-row
v-if="isMhrChangesEnabled && isRouteName(RouteNames.MHR_INFORMATION)"
v-if="isMhrChangesEnabled && isRouteName(RouteNames.MHR_INFORMATION) && !isCancelledMhr"
noGutters
class="mt-2 mb-n4"
>
Expand Down Expand Up @@ -219,7 +222,7 @@ export default defineComponent({
isMhrReRegistration
} = storeToRefs(useStore())
const { isRouteName } = useNavigation()
const { isFrozenMhr } = useMhrInformation()
const { isFrozenMhr, isCancelledMhr } = useMhrInformation()
const { initMhrCorrection, isMhrChangesEnabled, isMhrCorrection } = useMhrCorrections()

const { isAmendLocationActive, isCancelChangeLocationActive, hasMhrStatusChangedToActive } = useTransportPermits()
Expand Down Expand Up @@ -278,6 +281,7 @@ export default defineComponent({
return {
RouteNames,
isRouteName,
isCancelledMhr,
isMhrCorrection,
initMhrCorrection,
isMhrChangesEnabled,
Expand Down
13 changes: 7 additions & 6 deletions ppr-ui/src/components/unitNotes/UnitNotePanels.vue
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ import {
from '@/resources'
import { UnitNoteIF } from '@/interfaces/unit-note-interfaces'
import UnitNotePanel from './UnitNotePanel.vue'
import { useMhrUnitNotePanel, useNavigation } from '@/composables'
import { useMhrInformation, useMhrUnitNotePanel, useNavigation } from '@/composables'

export default defineComponent({
name: 'UnitNotePanels',
Expand Down Expand Up @@ -143,16 +143,17 @@ export default defineComponent({
setMhrUnitNoteType
} = useStore()

const {
createPanelUnitNotes
} = useMhrUnitNotePanel()
const { createPanelUnitNotes } = useMhrUnitNotePanel()
const { isCancelledMhr } = useMhrInformation()

const localState = reactive({
activePanels: [],
panelUnitNotes: createPanelUnitNotes(props.unitNotes),
addUnitNoteDropdown: computed((): UnitNoteDocTypes[] => {
const dropdown = isRoleStaffReg ? ResidentialExemptionStaffDropDown : ResidentialExemptionQSDropDown
return props.hasActiveExemption ? dropdown : UnitNotesDropdown
const dropdown = (isRoleStaffReg || isCancelledMhr.value)
? ResidentialExemptionStaffDropDown
: ResidentialExemptionQSDropDown
return (props.hasActiveExemption || isCancelledMhr.value) ? dropdown : UnitNotesDropdown
})
})

Expand Down
3 changes: 3 additions & 0 deletions ppr-ui/src/composables/mhrInformation/useMhrInformation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ export const useMhrInformation = () => {
isExemptMhr: computed((): boolean => {
return getMhrInformation.value.statusType === MhApiStatusTypes.EXEMPT
}),
isCancelledMhr: computed((): boolean => {
return getMhrInformation.value.statusType === MhApiStatusTypes.CANCELLED
}),
isFrozenMhrDueToAffidavit: computed((): boolean => {
return localState.isFrozenMhr &&
getMhrInformation.value?.frozenDocumentType === MhApiFrozenDocumentTypes.TRANS_AFFIDAVIT
Expand Down
10 changes: 10 additions & 0 deletions ppr-ui/src/resources/dialogOptions/registrationAddDialogs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ export const mhRegistrationFoundDialog: DialogOptionsIF = {
textExtra: [] // added in component
}

// Cancelled MHR dialog content for Qualified Supplier
export const mhRegistrationCannotBeAddedDialog: DialogOptionsIF = {
acceptText: 'OK',
cancelText: '',
title: 'Cancelled Registration',
text: 'The registration for this manufactured home <b>{reg_num}</b> was ' +
'cancelled and cannot be added to your table. <br><br>You can view the details of this ' +
'registration by conducting an MHR search for this registration number.'
}

export const registrationNotFoundDialog: DialogOptionsIF = {
acceptText: 'OK',
cancelText: '',
Expand Down
18 changes: 15 additions & 3 deletions ppr-ui/src/views/mhrInformation/MhrInformation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,21 +79,31 @@

<template v-if="!isReviewMode">
<p
v-if="!isExemptMhr"
v-if="!isExemptMhr && !isCancelledMhr"
class="mt-7"
>
This is the current information for this registration as of
<span class="font-weight-bold">{{ asOfDateTime }}</span>.
</p>
<p
v-if="!isExemptMhr && !showInProgressMsg"
v-if="!isExemptMhr && !showInProgressMsg && !isCancelledMhr"
class="mt-7"
data-test-id="correct-into-desc"
>
Ensure ALL of the information below is correct before making any changes to this registration.
Necessary fees will be applied as updates are made.
</p>

<!-- Cancelled MHR Info -->
<p
v-if="isCancelledMhr"
class="mt-7"
data-test-id="cancelled-info-desc"
>
This manufactured home is cancelled <span class="font-weight-bold">as of {{ asOfDateTime }}</span>
and changes can no longer be made to this home unless the manufactured home is re-registered.
</p>

<!-- Unit Note Info -->
<p
v-if="isExemptMhr"
Expand Down Expand Up @@ -419,7 +429,7 @@
<span class="font-weight-bold pl-2">Home Owners</span>
</v-col>
<v-col
v-if="enableHomeOwnerChanges && !isExemptMhr"
v-if="enableHomeOwnerChanges && !isExemptMhr && !isCancelledMhr"
cols="3"
class="text-right"
>
Expand Down Expand Up @@ -784,6 +794,7 @@ export default defineComponent({
isFrozenMhr,
isFrozenMhrDueToAffidavit,
isExemptMhr,
isCancelledMhr,
getLienInfo,
buildApiData,
initMhrTransfer,
Expand Down Expand Up @@ -1530,6 +1541,7 @@ export default defineComponent({
isFrozenMhr,
isFrozenMhrDueToAffidavit,
isExemptMhr,
isCancelledMhr,
emitError,
setValidation,
getInfoValidation,
Expand Down
4 changes: 2 additions & 2 deletions ppr-ui/src/views/mhrInformation/MhrTransportPermit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@

<!-- Default Transport Permit Actions -->
<v-btn
v-else-if="!isExemptMhr && !hasActiveTransportPermit"
v-else-if="!isExemptMhr && !hasActiveTransportPermit && !isCancelledMhr"
id="home-location-change-btn"
variant="plain"
class=""
Expand Down Expand Up @@ -341,7 +341,7 @@ const { hasActiveTransportPermit, isChangeLocationActive, isAmendLocationActive,
isActivePermitWithinSamePark, isAmendChangeLocationEnabled, isCancelChangeLocationEnabled,
setCancelLocationChange
} = useTransportPermits()
const { isExemptMhr } = useMhrInformation()
const { isExemptMhr, isCancelledMhr } = useMhrInformation()

const {
setValidation,
Expand Down
18 changes: 18 additions & 0 deletions ppr-ui/tests/unit/MhrInformation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1165,6 +1165,22 @@ describe('Mhr Information', async () => {
await store.setMhrStatusType(MhApiStatusTypes.ACTIVE)
})

it('should render correct MHR Info view for Cancelled home', async () => {
defaultFlagSet['mhr-transport-permit-enabled'] = true

await store.setAuthRoles([AuthRoles.PPR_STAFF])
await store.setMhrStatusType(MhApiStatusTypes.CANCELLED)

wrapper.vm.dataLoaded = true
await nextTick()

expect(wrapper.find(getTestId('correct-into-desc')).exists()).toBeFalsy()
expect(wrapper.find(getTestId('cancelled-info-desc')).exists()).toBeTruthy()
expect(wrapper.find('#home-owners-change-btn').exists()).toBeFalsy()
expect(wrapper.find(getTestId('transport-permit-btn')).exists()).toBeFalsy()
})


it('should enable amend and cancel transport permit', async () => {
defaultFlagSet['mhr-transport-permit-enabled'] = true

Expand Down Expand Up @@ -1196,4 +1212,6 @@ describe('Mhr Information', async () => {
await store.setAuthRoles([AuthRoles.MHR])
})



})
13 changes: 11 additions & 2 deletions ppr-ui/tests/unit/TombstoneDynamic.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createComponent, setupMockStaffUser, setupMockUser } from './utils'
import { createComponent, getTestId, setupMockStaffUser, setupMockUser } from './utils'
import {
mockedFinancingStatementComplete,
mockedMhrInformation,
Expand All @@ -8,7 +8,7 @@ import {
import { useStore } from '@/store/store'
import { FinancingStatementIF } from '@/interfaces'
import { TombstoneDynamic } from '@/components/tombstone'
import { RouteNames } from '@/enums'
import { MhApiStatusTypes, RouteNames } from '@/enums'
import { defaultFlagSet, pacificDate } from '@/utils'
import { nextTick } from 'vue'
import { expect } from 'vitest'
Expand Down Expand Up @@ -180,4 +180,13 @@ describe('TombstoneDynamic component - MHR', () => {
const correctionBtn = await wrapper.find('#registry-correction-btn')
expect(correctionBtn.exists()).toBe(true)
})

it('does not render correction and public amend buttons for Cancelled Mhr', async () => {
await store.setMhrStatusType(MhApiStatusTypes.CANCELLED)
await nextTick()

expect(wrapper.find('#registry-correction-btn').exists()).toBe(false)
expect(wrapper.find('#public-amend-btn').exists()).toBe(false)
expect(wrapper.find(getTestId('mhr-reg-status')).text()).toContain('Cancelled')
})
})
Loading