Skip to content

Commit

Permalink
Cancel Transport Permit framework (#1868)
Browse files Browse the repository at this point in the history
* Cancel Transport Permit framework, component updates, store updates
* Add Cancel Transport Permit feature flag
* Update Fee Summary for Cancel Transport Permit
* Add IDs to PPR Reg dropdown to help with cypress tests
* Add unit tests for Cancel Transport Permit
  • Loading branch information
dimak1 authored May 13, 2024
1 parent 29bd65b commit d014fe0
Show file tree
Hide file tree
Showing 19 changed files with 403 additions and 132 deletions.
4 changes: 4 additions & 0 deletions ppr-ui/src/assets/styles/base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ a {
font-size: 1.0625rem;
}

.fs-18 {
font-size: 18px;
}

.fs-21 {
font-size: 1.3125rem;
}
Expand Down
13 changes: 13 additions & 0 deletions ppr-ui/src/assets/svgs/icon_cancel_permit.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,32 @@
>
<label class="font-weight-bold pl-2">Location of Home</label>
</header>
<div
v-if="isCancelChangeLocationActive"
class="px-8 mt-5 mb-n5"
>
<div class="d-flex align-center">
<img
width="25"
:src="isPrevTransportPermitLocation
? require('@/assets/svgs/homelocationicon_reviewscreen.svg')
: require('@/assets/svgs/icon_cancel_permit.svg')"
>
<label class="font-weight-bold pl-2">
{{ isPrevTransportPermitLocation ? 'Restored Location' : 'Cancelled Location' }}
</label>
</div>
<v-divider
class="border-opacity-15 mt-4"
/>
</div>

<div
:class="{
'border-error-left': showStepError && !isTransferReview && !isTransportPermitReview && !isMhrCorrection
}"
:class="[
{'border-error-left': showStepError && !isTransferReview && !isTransportPermitReview && !isMhrCorrection},
{'cancelled-location-info': isCancelChangeLocationActive && !isPrevTransportPermitLocation},
{'restored-location-info': isCancelChangeLocationActive && isPrevTransportPermitLocation}
]"
>
<section
v-if="showStepError && !isTransferReview && !isTransportPermitReview && !isMhrCorrection"
Expand All @@ -34,16 +55,31 @@
><span>Return to this step to complete it.</span></router-link>
</span>
</section>

<section
v-if="(!!homeLocationInfo.locationType || hasAddress || isOwnLand !== null)"
id="review-home-location-section"
class="pt-5 pb-9"
>
<v-row
v-if="isCancelChangeLocationActive && isPrevTransportPermitLocation"
noGutters
class="px-8 my-5"
>
<v-col>
<p>
This is the location of the home prior to the transport permit being issued and will be the
registered location of the home.
</p>
</v-col>
</v-row>

<!-- Transport permit details rendered when there is an active permit -->
<!-- add top margin to compensate negative bottom margin of the section tag -->
<TransportPermitDetails
v-if="hasActiveTransportPermit && !isChangeLocationActive && !isCorrectionReview"
v-if="hasActiveTransportPermit &&
!isChangeLocationActive &&
!isCorrectionReview &&
!isPrevTransportPermitLocation"
class="mt-5"
/>

Expand Down Expand Up @@ -235,7 +271,7 @@
<!-- PID -->
<template v-if="includesPid">
<!-- PID Entered-->
<template v-if="!getIsManualLocation">
<template v-if="!isManualLocation">
<v-row
noGutters
class="px-8 pt-1"
Expand Down Expand Up @@ -557,6 +593,10 @@ export default defineComponent({
isPadEditable: {
type: Boolean,
default: false
},
isPrevTransportPermitLocation: {
type: Boolean,
default: false
}
},
setup (props) {
Expand All @@ -574,6 +614,7 @@ export default defineComponent({
getMhrTransportPermit,
getMhrOriginalTransportPermit,
getMhrOriginalTransportPermitHomeLocation,
getMhrTransportPermitPreviousLocation,
getMhrTransportPermitHomeLocation
} = storeToRefs(useStore())
Expand All @@ -589,12 +630,14 @@ export default defineComponent({
isChangeLocationActive,
isAmendLocationActive,
isNotManufacturersLot,
isMovingWithinSamePark
isMovingWithinSamePark,
isCancelChangeLocationActive
} = useTransportPermits()
const { correctionState, isMhrCorrection } = useMhrCorrections()
const homeLocationInfo: MhrRegistrationHomeLocationIF =
props.isTransportPermitReview ? getMhrTransportPermit.value.newLocation : getMhrRegistrationLocation.value
props.isPrevTransportPermitLocation ? getMhrTransportPermitPreviousLocation.value :
props.isTransportPermitReview ? getMhrTransportPermit.value.newLocation : getMhrRegistrationLocation.value
const localState = reactive({
// transport permit
Expand Down Expand Up @@ -622,6 +665,9 @@ export default defineComponent({
return [HomeLocationTypes.OTHER_STRATA, HomeLocationTypes.OTHER_TYPE]
.includes(homeLocationInfo.otherType)
}),
isManualLocation: computed((): boolean => {
return props.isPrevTransportPermitLocation ? !homeLocationInfo.pidNumber : getIsManualLocation.value
}),
hasAddress: computed((): boolean => {
return !!(homeLocationInfo.address?.street ||
homeLocationInfo.address?.streetAdditional ||
Expand Down Expand Up @@ -708,7 +754,6 @@ export default defineComponent({
RouteNames,
MhrSectVal,
getStepValidation,
getIsManualLocation,
isMhrManufacturerRegistration,
shortPacificDate,
getMhrRegistrationLocation,
Expand All @@ -717,6 +762,7 @@ export default defineComponent({
isNotManufacturersLot,
isAmendLocationActive,
isChangeLocationActive,
isCancelChangeLocationActive,
correctionState,
isMhrCorrection,
...toRefs(localState)
Expand All @@ -742,4 +788,8 @@ export default defineComponent({
.error-text {
font-size: 16px;
}
.cancelled-location-info {
opacity: 0.5;
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
</template>
<template v-else-if="displayGroup[item.raw.group]">
<v-list-item
:id="`reg-type-item-${item.raw.registrationTypeAPI}`"
v-bind="props"
class="py-3 registration-list registration-list-item"
@click="selectRegistration(item.raw)"
Expand Down
3 changes: 3 additions & 0 deletions ppr-ui/src/composables/fees/FeeSummary.vue
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ export default defineComponent({
[FeeSummaryTypes.MHSEARCH, FeeSummaryTypes.NEW_MHR, FeeSummaryTypes.MHR_TRANSFER,
FeeSummaryTypes.MHR_UNIT_NOTE, FeeSummaryTypes.RESIDENTIAL_EXEMPTION,
FeeSummaryTypes.NON_RESIDENTIAL_EXEMPTION, FeeSummaryTypes.MHR_TRANSPORT_PERMIT,
FeeSummaryTypes.MHR_TRANSPORT_PERMIT_CANCEL,
FeeSummaryTypes.MHR_AMEND_TRANSPORT_PERMIT, FeeSummaryTypes.MHR_STAFF_CORRECTION,
FeeSummaryTypes.MHR_CLIENT_CORRECTION, FeeSummaryTypes.MHR_PUBLIC_AMENDMENT
]
Expand Down Expand Up @@ -448,6 +449,8 @@ export default defineComponent({
return 'Location Change'
case FeeSummaryTypes.MHR_AMEND_TRANSPORT_PERMIT:
return 'Amend Transport Permit'
case FeeSummaryTypes.MHR_TRANSPORT_PERMIT_CANCEL:
return 'Cancel Transport Permit'
case FeeSummaryTypes.MHR_UNIT_NOTE:
return UnitNotesInfo[localState.feeSubType].header
case FeeSummaryTypes.RESIDENTIAL_EXEMPTION:
Expand Down
1 change: 1 addition & 0 deletions ppr-ui/src/composables/fees/enums/feeSummaryTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export enum FeeSummaryTypes {
MHR_PUBLIC_AMENDMENT = 'mhr_public_amendment',
MHR_TRANSFER = 'mhr_transfer',
MHR_TRANSPORT_PERMIT = 'mhr_transport_permit',
MHR_TRANSPORT_PERMIT_CANCEL = 'mhr_transport_permit_cancel',
MHR_AMEND_TRANSPORT_PERMIT = 'mhr_amend_transport_permit',
MHR_UNIT_NOTE = 'mhr_unit_note',
RESIDENTIAL_EXEMPTION = 'residential_exemption',
Expand Down
3 changes: 3 additions & 0 deletions ppr-ui/src/composables/fees/factories/useFeeSummary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ export function getFeeSummary (
if (feeType === FeeSummaryTypes.MHR_AMEND_TRANSPORT_PERMIT) {
return { ...defaultFeeSummaries.feeDefaultNoFee }
}
if (feeType === FeeSummaryTypes.MHR_TRANSPORT_PERMIT_CANCEL) {
return { ...defaultFeeSummaries.feeDefaultNoFee }
}
if(feeType === FeeSummaryTypes.MHR_STAFF_CORRECTION) {
return { ...defaultFeeSummaries[FeeSummaryDefaults.NO_FEE] }
}
Expand Down
24 changes: 23 additions & 1 deletion ppr-ui/src/composables/mhrInformation/useMhrInformation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ export const useMhrInformation = () => {
setMhrTransferAttentionReference,
setMhrTransferConsideration,
setMhrAccountSubmittingParty,
setMhrInformationPermitData
setMhrInformationPermitData,
setMhrTransportPermitPreviousLocation,
setTransportPermitChangeAllowed
} = useStore()
const {
// Getters
Expand Down Expand Up @@ -164,6 +166,12 @@ export const useMhrInformation = () => {
// Set Transports Permit Data when it's present
if(!!data?.permitStatus) await parseMhrPermitData(data)

// previous location of the Transport Permit (used to cancel the permit)
data?.previousLocation && parsePreviousLocation(data.previousLocation)

// parse the flag for Transport Permit changes (eg QS can only cancel its own permits)
data?.changePermit && setTransportPermitChangeAllowed(data.changePermit)

// Parse transfer details conditionally.
// Some situations call for it being pre-populated from base registration.
includeDetails && parseTransferDetails(data)
Expand Down Expand Up @@ -351,6 +359,20 @@ export const useMhrInformation = () => {
setMhrTransferOwnLand(data?.ownLand || null)
}

// Parse previous location of home - user for transport permit cancellation
const parsePreviousLocation = (previousLocation: MhrRegistrationHomeLocationIF): void => {

const otherTypes = [HomeLocationTypes.OTHER_RESERVE, HomeLocationTypes.OTHER_STRATA, HomeLocationTypes.OTHER_TYPE]

// otherType location is used in UI only
if (otherTypes.includes(previousLocation.locationType)) {
previousLocation.otherType = previousLocation.locationType
previousLocation.locationType = HomeLocationTypes.OTHER_LAND
}

setMhrTransportPermitPreviousLocation(previousLocation);
}

/** Filing Submission Helpers **/

const parseOwnerGroups = (isDraft: boolean = false): MhrRegistrationHomeOwnerGroupIF[] => {
Expand Down
19 changes: 18 additions & 1 deletion ppr-ui/src/composables/mhrInformation/useTransportPermits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { cloneDeep, get, isEqual } from 'lodash'
// Global constants
const isChangeLocationActive: Ref<boolean> = ref(false)
const isAmendLocationActive: Ref<boolean> = ref(false)
const isCancelChangeLocationActive: Ref<boolean> = ref(false)

export const useTransportPermits = () => {
const {
Expand Down Expand Up @@ -51,12 +52,18 @@ export const useTransportPermits = () => {
getFeatureFlag('mhr-transport-permit-enabled')
})

/** Returns true when staff and the feature flag is enabled **/
/** Returns true when staff and the feature flag is enabled to amend transport **/
const isAmendChangeLocationEnabled: ComputedRef<boolean> = computed((): boolean => {
return (isRoleStaffReg.value || isRoleQualifiedSupplier.value || isRoleStaffSbc.value) &&
getFeatureFlag('mhr-amend-transport-permit-enabled')
})

/** Returns true when staff and the feature flag is enabled to cancel transport permit**/
const isCancelChangeLocationEnabled: ComputedRef<boolean> = computed((): boolean => {
return (isRoleStaffReg.value || isRoleQualifiedSupplier.value || isRoleStaffSbc.value) &&
getFeatureFlag('mhr-cancel-transport-permit-enabled')
})

/** Checks if Home's current location is not on Manufacturer's Lot **/
const isNotManufacturersLot: ComputedRef<boolean> = computed((): boolean =>
getMhrRegistrationLocation.value.locationType !== HomeLocationTypes.LOT
Expand Down Expand Up @@ -92,6 +99,11 @@ export const useTransportPermits = () => {
isAmendLocationActive.value = val
}

/** Toggle Amend location change flow **/
const setCancelLocationChange = (val: boolean) => {
isCancelChangeLocationActive.value = val
}

const setLocationChangeType = (locationChangeType: LocationChangeTypes) => {
setMhrTransportPermitLocationChangeType(locationChangeType)
}
Expand Down Expand Up @@ -250,6 +262,7 @@ export const useTransportPermits = () => {

const initTransportPermit = (): MhrTransportPermitIF => {
isAmendLocationActive.value = false
isCancelChangeLocationActive.value = false
return {
documentId: '',
submittingParty: {
Expand Down Expand Up @@ -307,6 +320,7 @@ export const useTransportPermits = () => {
reserveNumber: '',
exceptionPlan: ''
} as MhrRegistrationHomeLocationIF,
previousLocation: null,
ownLand: null,
registrationStatus: ''
}
Expand All @@ -318,8 +332,10 @@ export const useTransportPermits = () => {
resetTransportPermit,
isChangeLocationActive,
isAmendLocationActive,
isCancelChangeLocationActive,
isChangeLocationEnabled,
isAmendChangeLocationEnabled,
isCancelChangeLocationEnabled,
isNotManufacturersLot,
isActiveHomeOutsideBc,
isMovingWithinSamePark,
Expand All @@ -331,6 +347,7 @@ export const useTransportPermits = () => {
setLocationChange,
setLocationChangeType,
setAmendLocationChange,
setCancelLocationChange,
getUiLocationType,
getUiFeeSummaryLocationType,
populateLocationInfoForSamePark,
Expand Down
1 change: 1 addition & 0 deletions ppr-ui/src/enums/transportPermits.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export enum LocationChangeTypes {
TRANSPORT_PERMIT = 'TRANSPORT_PERMIT',
TRANSPORT_PERMIT_SAME_PARK = 'TRANSPORT_PERMIT_SAME_PARK',
TRANSPORT_PERMIT_CANCEL = 'CANCEL_PERMIT',
REGISTERED_LOCATION = 'REGISTERED_LOCATION'
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export interface MhrTransportPermitIF {
submittingParty: SubmittingPartyIF,
locationChangeType: LocationChangeTypes,
newLocation: MhrRegistrationHomeLocationIF,
previousLocation: MhrRegistrationHomeLocationIF, // used when cancelling the permits
ownLand: boolean,
landStatusConfirmation?: boolean,
amendment?: boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ export interface MhRegistrationSummaryIF {
lienRegistrationType?: string
frozenDocumentType?: string
exemptDateTime?: string
changePermit?: boolean // used to determine if QS can cancel MHR Transport Permit
permitDateTime?: string
permitExpiryDateTime?: string
permitRegistrationNumber?: string
Expand Down
Loading

0 comments on commit d014fe0

Please sign in to comment.