Skip to content

Commit

Permalink
Fixes for MHR Re-Registration Flow (#1921)
Browse files Browse the repository at this point in the history
  • Loading branch information
dimak1 authored Jun 7, 2024
1 parent 8c5cf9b commit 5c228cb
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 20 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.2.13",
"version": "3.2.14",
"private": true,
"appName": "Assets UI",
"sbcName": "SBC Common Components",
Expand Down
11 changes: 6 additions & 5 deletions ppr-ui/src/components/mhrRegistration/YourHome/HomeSections.vue
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ export default defineComponent({
const {
// Getters
getMhrHomeSections,
getMhrRegistrationValidationModel
getMhrRegistrationValidationModel,
isMhrReRegistration
} = storeToRefs(useStore())
const {
Expand All @@ -125,7 +126,7 @@ export default defineComponent({
return getMhrHomeSections.value.length >= 1
}),
numberOfSections: computed((): number => {
return isMhrCorrection.value
return isMhrCorrection.value || isMhrReRegistration.value
? getMhrHomeSections.value.filter(section => section.action !== ActionTypes.REMOVED).length
: getMhrHomeSections.value.length
}),
Expand All @@ -140,7 +141,7 @@ export default defineComponent({
const addHomeSection = (homeSection: HomeSectionIF): void => {
const homeSections = [...getMhrHomeSections.value]
if (isMhrCorrection.value) {
if (isMhrCorrection.value || isMhrReRegistration.value) {
homeSection.action = ActionTypes.ADDED
}
// Add new home section to array
Expand All @@ -153,7 +154,7 @@ export default defineComponent({
// Create edited homeSection without id
const { ...editedSection } = homeSection
if (isMhrCorrection.value) {
if (isMhrCorrection.value || isMhrReRegistration.value) {
correctHomeSection(editedSection)
}
// Apply edited section to temp array
Expand All @@ -166,7 +167,7 @@ export default defineComponent({
const homeSections = [...getMhrHomeSections.value]
const homeSectionIndex = homeSections.indexOf(homeSection)
if (isMhrCorrection.value) {
if (isMhrCorrection.value || isMhrReRegistration.value) {
if (homeSection.action === ActionTypes.ADDED) {
// for newly Added section - remove section completely
homeSections.splice(homeSectionIndex, 1)
Expand Down
19 changes: 12 additions & 7 deletions ppr-ui/src/components/tables/mhr/HomeSectionsTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<v-table
id="mh-home-sections-table"
class="home-sections-table"
:class="{ 'mhr-correction': isMhrCorrection }"
:class="{ 'mhr-correction': isMhrCorrection || isMhrReRegistration }"
fixedHeader
>
<template #default>
Expand All @@ -29,7 +29,8 @@
<tr
v-for="(item, index) in homeSections"
:key="`${item}: ${index}`"
:class="{ 'deleted-section': isMhrCorrection && item.action === ActionTypes.REMOVED }"
:class="{ 'deleted-section': (isMhrCorrection || isMhrReRegistration)
&& item.action === ActionTypes.REMOVED }"
>
<!-- Edit Form -->
<template v-if="isActiveIndex(homeSections.indexOf(item))">
Expand All @@ -52,7 +53,7 @@
<template v-else>
<td :class="{ 'pl-0': isReviewMode }">
<span
v-if="isMhrCorrection"
v-if="(isMhrCorrection || isMhrReRegistration)"
class="dynamic-section-number"
/>
<span v-else>
Expand All @@ -77,7 +78,7 @@
class="text-right pr-2"
>
<v-btn
v-if="isMhrCorrection && showCorrectUndoOptions(item)"
v-if="(isMhrCorrection || isMhrReRegistration) && showCorrectUndoOptions(item)"
variant="plain"
color="primary"
:ripple="false"
Expand Down Expand Up @@ -106,7 +107,9 @@
<v-icon size="small">
mdi-pencil
</v-icon>
<span v-if="isMhrCorrection && item.action !== ActionTypes.ADDED">{{ correctAmendLabel }}</span>
<span v-if="isMhrCorrection && item.action !== ActionTypes.ADDED">
{{ correctAmendLabel }}
</span>
<span v-else>Edit</span>
<v-divider
class="ma-0 pl-3"
Expand Down Expand Up @@ -148,7 +151,7 @@
</v-list-item-subtitle>
</v-list-item>
<v-list-item
v-if="isMhrCorrection && item.action !== ActionTypes.REMOVED"
v-if="(isMhrCorrection || isMhrReRegistration) && item.action !== ActionTypes.REMOVED"
class="my-n2"
>
<v-list-item-subtitle
Expand Down Expand Up @@ -215,7 +218,8 @@ export default defineComponent({
emits: ['edit', 'remove', 'undo', 'isEditing'],
setup (props, context) {
const {
getMhrBaseline
getMhrBaseline,
isMhrReRegistration
} = storeToRefs(useStore())
const { isMhrCorrection, correctAmendLabel } = useMhrCorrections()
Expand Down Expand Up @@ -258,6 +262,7 @@ export default defineComponent({
remove,
isActiveIndex,
isMhrCorrection,
isMhrReRegistration,
correctAmendLabel,
getMhrBaseline,
showCorrectUndoOptions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ export const useMhrReRegistration = () => {
// remove props that should not be pre-populated into Re-Registration
data.documentId = ''
data.ownerGroups = []
data.attentionReference = ''
data.submittingParty = {}
// parse Transport Permit data to correctly show Location of Home step
parseMhrPermitData(data)
} else {
Expand All @@ -68,7 +70,7 @@ export const useMhrReRegistration = () => {
)

if (!isDraft) {
await useNewMhrRegistration().initDraftOrCurrentMhr(data, false)
await useNewMhrRegistration().initDraftOrCurrentMhr(data)
}
}

Expand Down
11 changes: 7 additions & 4 deletions ppr-ui/src/composables/mhrRegistration/useNewMhrRegistration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const useNewMhrRegistration = (isMhrCorrections: boolean = false) => {
setEmptyMhr,
setFolioOrReferenceNumber,
setMhrLocation,
setMhrLocationAllFields,
setMhrDraftNumber,
setMhrTableHistory,
setMhrHomeDescription,
Expand Down Expand Up @@ -239,17 +240,19 @@ export const useNewMhrRegistration = (isMhrCorrections: boolean = false) => {
// Show groups for Tenants in Common
setShowGroups(getHomeTenancyType() === HomeTenancyTypes.COMMON)
// Set Home Location
for (const [key, val] of Object.entries(mhrData.location)) {
setMhrLocation({ key, value: val })
const homeLocation = {} as MhrRegistrationHomeLocationIF

for (const [key, val] of Object.entries(mhrData.location)) {
homeLocation[key] = val
// Map radio button options for Other Land Types
if (
[HomeLocationTypes.OTHER_RESERVE, HomeLocationTypes.OTHER_STRATA, HomeLocationTypes.OTHER_TYPE].includes(val)
) {
setMhrLocation({ key: 'otherType', value: val })
setMhrLocation({ key: 'locationType', value: HomeLocationTypes.OTHER_LAND })
homeLocation.otherType = val
homeLocation.locationType = HomeLocationTypes.OTHER_LAND
}
}
setMhrLocationAllFields(homeLocation)
}

const resetLocationInfoFields = (location: MhrLocationInfoIF): MhrLocationInfoIF => {
Expand Down
2 changes: 2 additions & 0 deletions ppr-ui/src/views/Dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ export default defineComponent({
// Actions
setSearchHistory,
setSearchResults,
setMhrDraftNumber,
setSearchedType,
setSearchedValue,
setSearchDebtorName,
Expand Down Expand Up @@ -266,6 +267,7 @@ export default defineComponent({
setSearchedType(null)
setSearchedValue('')
setSearchResults(null)
setMhrDraftNumber('')
onAppReady(props.appReady)
})
Expand Down

0 comments on commit 5c228cb

Please sign in to comment.