Skip to content

Commit

Permalink
Draft Corrections Fixes after QA (#1876)
Browse files Browse the repository at this point in the history
* Fixes for Draft Corrections after QA
* Fix Public Amend Draft loading
  • Loading branch information
dimak1 authored May 16, 2024
1 parent 73dc2c5 commit 7b01c12
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
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.1.23",
"version": "3.1.24",
"private": true,
"appName": "Assets UI",
"sbcName": "SBC Common Components",
Expand Down
1 change: 1 addition & 0 deletions ppr-ui/src/components/common/ButtonFooter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ export default defineComponent({
prevDraft: prevDraftId
}
await setRegTableNewItem(newItem)
localState.submitting = false
return true
}
}
Expand Down
22 changes: 13 additions & 9 deletions ppr-ui/src/composables/mhrRegistration/useMhrCorrections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,21 @@ import { useNavigation, useNewMhrRegistration } from '@/composables'
import {
AdminRegistrationIF,
HomeSectionIF,
MhRegistrationSummaryIF,
NewMhrRegistrationApiIF,
RegistrationTypeIF,
UpdatedBadgeIF
} from '@/interfaces'
import { cloneDeep, omit } from 'lodash'
import { MhrCorrectionClient, MhrCorrectionStaff } from '@/resources/registrationTypes'
import { MhrCorrectionClient, MhrCorrectionStaff, MhrPublicAmendment } from '@/resources/registrationTypes'

export const useMhrCorrections = () => {
const {
setMhrBaseline,
setRegistrationType,
setMhrDraftNumber,
setMhrStatusType
setMhrStatusType,
setMhrInformation
} = useStore()
const {
getMhrStatusType,
Expand Down Expand Up @@ -122,7 +124,7 @@ export const useMhrCorrections = () => {
},
currentState: {
year: getMhrRegistration.value.description.baseInformation.year,
circa: getMhrRegistration.value.description.baseInformation.circa
circa: getMhrRegistration.value.description.baseInformation.circa || false
}
})),
make: computed((): UpdatedBadgeIF => ({
Expand Down Expand Up @@ -179,8 +181,9 @@ export const useMhrCorrections = () => {
})),
civicAddress: computed((): UpdatedBadgeIF => ({
action: isPublicAmendment.value ? ActionTypes.EDITED : ActionTypes.CORRECTED,
baseline: getMhrBaseline.value?.location.address,
currentState: getMhrRegistrationLocation.value.address
// postal code is not displayed in UI and causing the corrections badge to show up
baseline: omit(getMhrBaseline.value?.location.address, 'postalCode'),
currentState: omit(getMhrRegistrationLocation.value.address, 'postalCode')
})),
landDetails: computed((): UpdatedBadgeIF => ({
action: isPublicAmendment.value ? ActionTypes.EDITED : ActionTypes.CORRECTED,
Expand Down Expand Up @@ -243,16 +246,17 @@ export const useMhrCorrections = () => {
await goToRoute(RouteNames.SUBMITTING_PARTY)
}

const initDraftMhrCorrection = async (draftMhrCorrection): Promise<void> => {
const initDraftMhrCorrection = async (mhrInfo: MhRegistrationSummaryIF): Promise<void> => {

const draftNumber = draftMhrCorrection.draftNumber
const draftNumber = mhrInfo.draftNumber
await setMhrInformation(mhrInfo)

// Fetch draft MHR Data
const { registration } = await getMhrDraft(draftNumber)
// Fetch original MHR Data (before the draft correction updates)
const { data } = await fetchMhRegistration(draftMhrCorrection.mhrNumber)
const { data } = await fetchMhRegistration(mhrInfo.mhrNumber)

const correctionType: RegistrationTypeIF = [MhrCorrectionStaff, MhrCorrectionClient]
const correctionType: RegistrationTypeIF = [MhrCorrectionStaff, MhrCorrectionClient, MhrPublicAmendment]
.find((corr: RegistrationTypeIF) => corr.registrationTypeAPI === registration.documentType)

setRegistrationType(correctionType)
Expand Down

0 comments on commit 7b01c12

Please sign in to comment.