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

MHR Re-Registrations Framework #1905

Merged
merged 7 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.

4 changes: 2 additions & 2 deletions ppr-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ppr-ui",
"version": "3.2.2",
"version": "3.2.3",
"private": true,
"appName": "Assets UI",
"sbcName": "SBC Common Components",
Expand All @@ -14,7 +14,7 @@
"test:coverage": "vitest run --coverage"
},
"dependencies": {
"@bcrs-shared-components/input-field-date-picker" : "^1.0.0",
"@bcrs-shared-components/input-field-date-picker": "^1.0.0",
"@lemoncode/fonk": "^1.5.1",
"@lemoncode/fonk-range-number-validator": "^1.1.0",
"@sentry/vue": "^7.50.0",
Expand Down
19 changes: 18 additions & 1 deletion ppr-ui/src/components/common/RegistrationsWrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,13 @@ import {
} from '@/resources/dialogOptions'
import { StatusCodes } from 'http-status-codes'
import { cloneDeep } from 'lodash'
import { useExemptions, useMhrCorrections, useNavigation, useNewMhrRegistration } from '@/composables'
import {
useExemptions,
useMhrCorrections,
useNavigation,
useNewMhrRegistration,
useMhrReRegistration
} from '@/composables'

export default defineComponent({
name: 'RegistrationsWrapper',
Expand Down Expand Up @@ -342,6 +348,8 @@ export default defineComponent({

const { goToExemptions } = useExemptions()

const { initMhrReRegistration } = useMhrReRegistration()

const localState = reactive({
loading: false,
myRegAdd: '',
Expand Down Expand Up @@ -721,6 +729,9 @@ export default defineComponent({
case UnitNoteDocTypes.NON_RESIDENTIAL_EXEMPTION:
openMhrExemption(mhrInfo, action)
break
case UnitNoteDocTypes.RESCIND_EXEMPTION:
openMhrReRegistration(mhrInfo)
break
default:
localState.myRegAction = null
localState.myRegActionDocId = ''
Expand Down Expand Up @@ -778,6 +789,12 @@ export default defineComponent({
await goToExemptions(type)
}

const openMhrReRegistration = async (mhrSummary: MhRegistrationSummaryIF): Promise<void> => {
localState.loading = true
await initMhrReRegistration(mhrSummary)
await goToRoute(RouteNames.SUBMITTING_PARTY)
}

const removeMhrDraft = async (mhrNumber: string): Promise<void> => {
localState.myRegDataLoading = true
await deleteMhrDraft(mhrNumber)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,13 @@
:currentState="amendedBadgeLocationType.currentState"
isCaseSensitive
/>
<UpdatedBadge
v-else-if="isMhrReRegistration"
class="mb-1"
:action="correctionState.action"
:baseline="correctionState.location.baseline"
:currentState="correctionState.location.currentState"
/>
</v-col>
<v-col
cols="9"
Expand Down Expand Up @@ -179,6 +186,13 @@
:currentState="amendedBadgeLocationType.currentState"
isCaseSensitive
/>
<UpdatedBadge
v-else-if="isMhrReRegistration"
class="mb-1"
:action="correctionState.action"
:baseline="correctionState.location.baseline"
:currentState="correctionState.location.currentState"
/>
</v-col>
<v-col
cols="9"
Expand Down Expand Up @@ -221,6 +235,13 @@
:currentState="amendedBadgeLocationType.currentState"
isCaseSensitive
/>
<UpdatedBadge
v-else-if="isMhrReRegistration"
class="mb-1"
:action="correctionState.action"
:baseline="correctionState.location.baseline"
:currentState="correctionState.location.currentState"
/>
</v-col>
<v-col
v-if="hasManualEntries"
Expand Down Expand Up @@ -448,7 +469,7 @@
>
<h3>Civic Address</h3>
<UpdatedBadge
v-if="isMhrCorrection"
v-if="showUpdatedBadge"
class="mb-1"
:action="correctionState.action"
:baseline="correctionState.civicAddress.baseline"
Expand Down Expand Up @@ -539,7 +560,7 @@
>
<v-col>
<UpdatedBadge
v-if="isMhrCorrection"
v-if="showUpdatedBadge"
class="mb-1"
:action="correctionState.action"
:baseline="correctionState.landDetails.baseline"
Expand Down Expand Up @@ -579,7 +600,8 @@ import {
useMhrCorrections,
useMhrInfoValidation,
useMhrValidations,
useTransportPermits
useTransportPermits,
useUpdatedBadges
} from '@/composables'
import { storeToRefs } from 'pinia'
import { useCountriesProvinces } from '@/composables/address/factories'
Expand Down Expand Up @@ -645,7 +667,8 @@ export default defineComponent({
getMhrOriginalTransportPermit,
getMhrOriginalTransportPermitHomeLocation,
getMhrTransportPermitPreviousLocation,
getMhrTransportPermitHomeLocation
getMhrTransportPermitHomeLocation,
isMhrReRegistration
} = storeToRefs(useStore())

const {
Expand All @@ -664,6 +687,7 @@ export default defineComponent({
isCancelChangeLocationActive
} = useTransportPermits()
const { correctionState, isMhrCorrection } = useMhrCorrections()
const { showUpdatedBadge } = useUpdatedBadges()

const homeLocationInfo: MhrRegistrationHomeLocationIF =
(props.isPrevTransportPermitLocation || props.isCancelTransportPermitReview)
Expand Down Expand Up @@ -800,6 +824,8 @@ export default defineComponent({
isCancelChangeLocationActive,
correctionState,
isMhrCorrection,
isMhrReRegistration,
showUpdatedBadge,
...toRefs(localState)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<v-col cols="3">
<h3>Manufacturer's Name</h3>
<UpdatedBadge
v-if="isMhrCorrection"
v-if="showUpdatedBadge"
class="mb-1"
:action="correctionState.action"
:baseline="correctionState.manufacturer.baseline"
Expand All @@ -57,7 +57,7 @@
<v-col cols="3">
<h3>Year of Manufacture</h3>
<UpdatedBadge
v-if="isMhrCorrection"
v-if="showUpdatedBadge"
class="mb-1"
:action="correctionState.action"
:baseline="correctionState.manufacturerYear.baseline"
Expand All @@ -83,7 +83,7 @@
<v-col cols="3">
<h3>Make</h3>
<UpdatedBadge
v-if="isMhrCorrection"
v-if="showUpdatedBadge"
class="mb-1"
:action="correctionState.action"
:baseline="correctionState.make.baseline"
Expand All @@ -101,7 +101,7 @@
<v-col cols="3">
<h3>Model</h3>
<UpdatedBadge
v-if="isMhrCorrection"
v-if="showUpdatedBadge"
class="mb-1"
:action="correctionState.action"
:baseline="correctionState.model.baseline"
Expand All @@ -128,7 +128,7 @@
>
<h3>Home Certification</h3>
<UpdatedBadge
v-if="isMhrCorrection"
v-if="showUpdatedBadge"
:action="correctionState.action"
:baseline="correctionState.homeCertification.baseline"
:currentState="correctionState.homeCertification.currentState"
Expand Down Expand Up @@ -170,7 +170,7 @@
>
<h3>CSA Standard</h3>
<UpdatedBadge
v-if="isMhrCorrection"
v-if="showUpdatedBadge"
:action="correctionState.action"
:baseline="correctionState.homeCertification.baseline"
:currentState="correctionState.homeCertification.currentState"
Expand Down Expand Up @@ -213,7 +213,7 @@
>
<h3>Date of Engineer's Report</h3>
<UpdatedBadge
v-if="isMhrCorrection"
v-if="showUpdatedBadge"
:action="correctionState.action"
:baseline="correctionState.homeCertification.baseline"
:currentState="correctionState.homeCertification.currentState"
Expand Down Expand Up @@ -271,7 +271,7 @@
<v-col cols="3">
<h3>Rebuilt Status</h3>
<UpdatedBadge
v-if="isMhrCorrection"
v-if="showUpdatedBadge"
:action="correctionState.action"
:baseline="correctionState.rebuilt.baseline"
:currentState="correctionState.rebuilt.currentState"
Expand All @@ -292,7 +292,7 @@
<v-col cols="3">
<h3>Other Information</h3>
<UpdatedBadge
v-if="isMhrCorrection"
v-if="showUpdatedBadge"
:action="correctionState.action"
:baseline="correctionState.otherRemarks.baseline"
:currentState="correctionState.otherRemarks.currentState"
Expand All @@ -314,7 +314,7 @@ import { useStore } from '@/store/store'
import { HomeCertificationOptions, RouteNames } from '@/enums'
import { yyyyMmDdToPacificDate, formatAsHtml, hasTruthyValue } from '@/utils'
import { HomeSections } from '@/components/mhrRegistration'
import { useMhrCorrections, useMhrValidations } from '@/composables'
import { useMhrCorrections, useMhrValidations, useUpdatedBadges } from '@/composables'
import { storeToRefs } from 'pinia'
import { UpdatedBadge } from '@/components/common'

Expand Down Expand Up @@ -346,7 +346,8 @@ export default defineComponent({
MhrSectVal,
getStepValidation
} = useMhrValidations(toRefs(getMhrRegistrationValidationModel.value))
const { correctionState, isMhrCorrection } = useMhrCorrections()
const { correctionState } = useMhrCorrections()
const { showUpdatedBadge } = useUpdatedBadges()

const localState = reactive({
isCSA: computed((): boolean => {
Expand Down Expand Up @@ -374,7 +375,7 @@ export default defineComponent({
formatAsHtml,
RouteNames,
correctionState,
isMhrCorrection,
showUpdatedBadge,
getMhrRegistrationOtherInfo,
getMhrRegistrationHomeDescription,
isMhrManufacturerRegistration,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
:class="{ 'error-text': validate }"
>Certification</label>
<UpdatedBadge
v-if="isMhrCorrection"
v-if="showUpdatedBadge"
:action="correctionState.action"
:baseline="correctionState.homeCertification.baseline"
:currentState="correctionState.homeCertification.currentState"
Expand Down Expand Up @@ -190,7 +190,7 @@
import { computed, defineComponent, reactive, ref, toRefs, watch } from 'vue'
import { InputFieldDatePicker, UpdatedBadge } from '@/components/common'
import { HomeCertificationOptions } from '@/enums'
import { useInputRules, useMhrCorrections, useMhrValidations } from '@/composables'
import { useInputRules, useMhrCorrections, useMhrValidations, useUpdatedBadges } from '@/composables'
import { useStore } from '@/store/store'
import { createDateFromPacificTime, localTodayDate } from '@/utils/date-helper'
import { storeToRefs } from 'pinia'
Expand Down Expand Up @@ -226,7 +226,9 @@ export default defineComponent({
MhrSectVal,
setValidation
} = useMhrValidations(toRefs(getMhrRegistrationValidationModel.value))
const { correctionState, isMhrCorrection } = useMhrCorrections()
const { correctionState } = useMhrCorrections()
const { showUpdatedBadge } = useUpdatedBadges()

const csaForm = ref(null) as FormIF
const engineerForm = ref(null) as FormIF
const datePicker = ref(null) as FormIF
Expand Down Expand Up @@ -345,7 +347,7 @@ export default defineComponent({
isRoleStaffReg,
required,
correctionState,
isMhrCorrection,
showUpdatedBadge,
...toRefs(localState)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
Year of Manufacture
</label>
<UpdatedBadge
v-if="isMhrCorrection"
v-if="showUpdatedBadge"
:action="correctionState.action"
:baseline="correctionState.manufacturerYear.baseline"
:currentState="correctionState.manufacturerYear.currentState"
Expand Down Expand Up @@ -72,7 +72,7 @@ import {
watch
} from 'vue'
import { useStore } from '@/store/store'
import { useInputRules, useMhrCorrections, useMhrValidations } from '@/composables/'
import { useInputRules, useMhrCorrections, useMhrValidations, useUpdatedBadges } from '@/composables/'
import { storeToRefs } from 'pinia'
import { UpdatedBadge } from '@/components/common'

Expand Down Expand Up @@ -111,7 +111,8 @@ export default defineComponent({
hasError
} = useMhrValidations(toRefs(getMhrRegistrationValidationModel.value))

const { correctionState, isMhrCorrection } = useMhrCorrections()
const { correctionState } = useMhrCorrections()
const { showUpdatedBadge } = useUpdatedBadges()

const manufactureYearRules = computed((): Array<()=>string|boolean> =>
customRules(
Expand Down Expand Up @@ -143,7 +144,7 @@ export default defineComponent({
hasError,
yearRef,
manufactureYearRules,
isMhrCorrection,
showUpdatedBadge,
correctionState,
getMhrBaseline,
getMhrRegistration,
Expand Down
Loading
Loading