Skip to content

Commit

Permalink
Death Transfers: Change Details (bcgov#2073)
Browse files Browse the repository at this point in the history
* Change Details on Death Transfers

* Remove dev code

* Frozen SoG Updates
  • Loading branch information
cameron-eyds authored Nov 25, 2024
1 parent d6de16d commit 0e14c88
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 64 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.3.5",
"version": "3.3.6",
"private": true,
"appName": "Assets UI",
"sbcName": "SBC Common Components",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,8 @@

<!-- Group Add / Edit -->
<template
v-if="!isTransferDueToDeath && !isFrozenMhrDueToAffidavit &&
!(isMhrCorrection && editHomeOwner) && !(disableNameFields && isCurrentOwner(owner))"
v-if="!isTransferDueToDeath && !(isMhrCorrection && editHomeOwner) &&
!(disableNameFields && isCurrentOwner(owner))"
>
<hr class="mt-3 mb-10">
<HomeOwnerGroups
Expand Down Expand Up @@ -533,13 +533,11 @@ export default defineComponent({
const {
isCurrentOwner,
isTransferDueToDeath,
isTransferDueToSaleOrGift,
isTransferToAdminNoWill,
hasCurrentOwnerChanges,
disableNameFields,
isTransferToExecOrAdmin,
TransToExec,
TransAffidavit
TransToExec
} = useTransferOwners()
const {
Expand Down Expand Up @@ -731,14 +729,6 @@ export default defineComponent({
localState.ownerGroupId = localState.owner.groupId
}
// In Sale or Gift Transfer after Affidavit (aka Frozen) flow, add new owners to same group as Executor
if (props.isMhrTransfer &&
isTransferDueToSaleOrGift.value &&
isFrozenMhrDueToAffidavit.value) {
// Find the GroupId with an Executor
localState.ownerGroupId = TransAffidavit.getGroupIdWithExecutor()
}
if (props.isMhrTransfer &&
isTransferToAdminNoWill.value &&
localState.owner.partyType === HomeOwnerPartyTypes.ADMINISTRATOR) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@
<v-btn
variant="plain"
color="primary"
class="menu-drop-down-btn px-0 mr-n2"
class="menu-drop-down-btn px-0 mr-n4"
:disabled="isAddingMode || isGlobalEditingMode"
v-bind="props"
>
Expand Down Expand Up @@ -398,19 +398,17 @@
<v-btn
v-if="!isRemovedHomeOwner(item) &&
!isChangedOwner(item) &&
!isDisabledForSoGChanges(item) &&
!(!isPartyTypeNotEAT(item) && isTransferToSurvivingJointTenant)"
!(!isPartyTypeNotEAT(item) && isTransferToSurvivingJointTenant) &&
!isDisabledForSJTChanges(item) &&
!isDisabledForWillChanges(item)"
variant="plain"
color="primary"
class="mr-n4"
:ripple="false"
:disabled="
isAddingMode ||
isEditingMode ||
isGlobalEditingMode ||
isDisabledForSJTChanges(item) ||
isDisabledForWillChanges(item)
"
isGlobalEditingMode"
data-test-id="table-delete-btn"
@click="markForRemoval(item)"
>
Expand All @@ -431,9 +429,7 @@
color="primary"
class="mx-0 px-0"
:ripple="false"
:disabled="
isAddingMode || isEditingMode || isGlobalEditingMode || isDisabledForSJTChanges(item)
"
:disabled="isAddingMode || isEditingMode || isGlobalEditingMode"
data-test-id="table-undo-btn"
@click="undo(item)"
>
Expand All @@ -448,15 +444,31 @@
/>
</v-btn>

<!-- Change Details when other actions are disabled -->
<v-btn
v-else-if="isDisabledForSJTChanges(item) || isDisabledForWillChanges(item)"
variant="plain"
color="primary"
class="mx-0 px-0"
:ripple="false"
data-test-id="owner-change-details-btn"
@click="openForEditing(homeOwners.indexOf(item))"
>
<v-icon size="small">
mdi-pencil
</v-icon>
<span>Change Details</span>
</v-btn>

<!-- Menu actions drop down menu -->
<template
v-if="enableTransferOwnerMenuActions(item) &&
!isRemovedHomeOwner(item) &&
!(!isPartyTypeNotEAT(item) && isTransferToSurvivingJointTenant)"
!(!isPartyTypeNotEAT(item) && isTransferToSurvivingJointTenant) &&
!isDisabledForSJTChanges(item) &&
!isDisabledForWillChanges(item)"
>
<v-menu
location="bottom right"
>
<v-menu location="bottom right">
<template #activator="{ props }">
<v-btn
variant="plain"
Expand Down Expand Up @@ -507,6 +519,22 @@
</v-menu>
</template>
</template>
<template v-else-if="!!getMhrTransferType?.transferType">
<!-- Change Details when other actions are disabled -->
<v-btn
variant="plain"
color="primary"
class="mx-0 px-0"
:ripple="false"
data-test-id="owner-change-details-btn"
@click="openForEditing(homeOwners.indexOf(item))"
>
<v-icon size="small">
mdi-pencil
</v-icon>
<span>Change Details</span>
</v-btn>
</template>
</td>
</div>

Expand Down Expand Up @@ -792,6 +820,7 @@ export default defineComponent({
const addressSchema = PartyAddressSchema
const { setUnsavedChanges } = useStore()
const {
getMhrTransferType,
getMhrRegistrationValidationModel,
getMhrInfoValidation,
hasUnsavedChanges,
Expand Down Expand Up @@ -1248,6 +1277,7 @@ export default defineComponent({
showCorrectUndoOptions,
isMhrCorrection,
correctAmendLabel,
getMhrTransferType,
...toRefs(localState)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@
<v-btn
variant="plain"
color="primary"
class="pa-0"
class="mr-1"
:disabled="isGlobalEditingMode"
v-bind="props"
>
Expand Down
9 changes: 6 additions & 3 deletions ppr-ui/src/composables/mhrInformation/useMhrInformation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,8 @@ export const useMhrInformation = () => {
const parseDueToDeathOwnerGroups = (isDraft: boolean = false): MhrRegistrationHomeOwnerGroupIF[] => {
const ownerGroups = []
getMhrTransferHomeOwnerGroups.value.forEach(ownerGroup => {
if (ownerGroup.owners.some(owner => owner.action === ActionTypes.REMOVED)) {
if (ownerGroup.owners.some(owner =>
owner.action === ActionTypes.REMOVED || owner.action === ActionTypes.CHANGED)) {
ownerGroups.push({
...ownerGroup,
owners: ownerGroup.owners
Expand All @@ -489,11 +490,13 @@ export const useMhrInformation = () => {
const parseDeletedDueToDeathOwnerGroups = (): MhrRegistrationHomeOwnerGroupIF[] => {
const ownerGroups = []
getMhrTransferHomeOwnerGroups.value.forEach(ownerGroup => {
if (ownerGroup.owners.some(owner => owner.action === ActionTypes.REMOVED)) {
if (ownerGroup.owners.some(owner =>
owner.action === ActionTypes.REMOVED || owner.action === ActionTypes.CHANGED)) {
ownerGroups.push({
...ownerGroup,
groupId: getCurrentOwnerGroupIdByOwnerId(ownerGroup.owners[0].ownerId),
owners: ownerGroup.owners.filter(owner => owner.action === ActionTypes.REMOVED).map(owner => {
owners: ownerGroup.owners.filter(owner =>
owner.action === ActionTypes.REMOVED || owner.action === ActionTypes.CHANGED).map(owner => {
return owner.individualName ? { ...owner, individualName: normalizeObject(owner.individualName) } : owner
}),
// Determine group tenancy type
Expand Down
17 changes: 6 additions & 11 deletions ppr-ui/src/composables/mhrInformation/useTransferOwners.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
ApiTransferTypes,
HomeOwnerPartyTypes,
HomeTenancyTypes,
MhApiFrozenDocumentTypes,
MhApiStatusTypes,
SupportingDocumentsOptions
} from '@/enums'
Expand Down Expand Up @@ -310,9 +309,7 @@ export const useTransferOwners = (enableAllActions: boolean = false) => {
case ApiTransferTypes.SZL:
case ApiTransferTypes.TAXS:
case ApiTransferTypes.VEST:
// Enable for all but FROZEN status due to Affe
return !(getMhrInformation.value.statusType === MhApiStatusTypes.FROZEN &&
getMhrInformation.value?.frozenDocumentType === MhApiFrozenDocumentTypes.TRANS_AFFIDAVIT)
return true // Always enable for above transfer types
case ApiTransferTypes.TO_EXECUTOR_PROBATE_WILL:
case ApiTransferTypes.TO_EXECUTOR_UNDER_25K_WILL:
case ApiTransferTypes.SURVIVING_JOINT_TENANT:
Expand Down Expand Up @@ -398,8 +395,6 @@ export const useTransferOwners = (enableAllActions: boolean = false) => {
case ApiTransferTypes.TRANS_RECEIVERSHIP:
case ApiTransferTypes.TRANS_SEVER_GRANT:
case ApiTransferTypes.TRANS_WRIT_SEIZURE:
return !(getMhrInformation.value.statusType === MhApiStatusTypes.FROZEN &&
getMhrInformation.value?.frozenDocumentType === MhApiFrozenDocumentTypes.TRANS_AFFIDAVIT)
default:
return true
}
Expand Down Expand Up @@ -438,15 +433,15 @@ export const useTransferOwners = (enableAllActions: boolean = false) => {
**/
const isDisabledForSJTChanges = (owner: MhrRegistrationHomeOwnerIF): boolean => {
if (getMhrTransferType.value?.transferType === ApiTransferTypes.SURVIVING_JOINT_TENANT) {
const hasDeceasedOrChangedOwners = getMhrTransferHomeOwnerGroups.value.some(group =>
group.owners.some(owner => owner.action === ActionTypes.REMOVED || owner.action === ActionTypes.CHANGED))
const hasDeceasedOwners = getMhrTransferHomeOwnerGroups.value.some(group =>
group.owners.some(owner => owner.action === ActionTypes.REMOVED))

const isDeceasedOrChangedOwnerGroup = getMhrTransferHomeOwnerGroups.value.find(group =>
const isDeceasedOwnerGroup = getMhrTransferHomeOwnerGroups.value.find(group =>
group.groupId === owner.groupId).owners.some(owner =>
owner.action === ActionTypes.REMOVED || owner.action === ActionTypes.CHANGED
owner.action === ActionTypes.REMOVED
)

return hasDeceasedOrChangedOwners && !isDeceasedOrChangedOwnerGroup
return hasDeceasedOwners && !isDeceasedOwnerGroup
}
return false
}
Expand Down
21 changes: 4 additions & 17 deletions ppr-ui/src/composables/mhrRegistration/useHomeOwners.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@ import {
ActionTypes,
ApiTransferTypes,
HomeOwnerPartyTypes,
HomeTenancyTypes,
MhApiFrozenDocumentTypes,
MhApiStatusTypes
HomeTenancyTypes
} from '@/enums'
import { MhrCompVal, MhrSectVal } from '@/composables/mhrRegistration/enums'
import { useMhrValidations, useTransferOwners } from '@/composables'
import { useMhrValidations } from '@/composables'
import { find, findIndex, remove, set, uniq } from 'lodash'
import { storeToRefs } from 'pinia'
import { deepChangesComparison } from '@/utils'
Expand All @@ -42,7 +40,6 @@ export function useHomeOwners (isMhrTransfer: boolean = false, isMhrCorrection:
const {
// Getters
getMhrBaseline,
getMhrInformation,
getMhrRegistrationHomeOwners,
getMhrRegistrationHomeOwnerGroups,
getMhrRegistrationValidationModel,
Expand Down Expand Up @@ -302,19 +299,9 @@ export function useHomeOwners (isMhrTransfer: boolean = false, isMhrCorrection:
}
const fallBackId = (isMhrTransfer || isMhrCorrection) ? transferDefaultId : DEFAULT_GROUP_ID

// Is true when current flow is Sale or Gift transfer and the mhr is currently frozen
const isFrozenSoGTransfer = getMhrTransferType.value?.transferType === ApiTransferTypes.SALE_OR_GIFT &&
getMhrInformation.value?.statusType === MhApiStatusTypes.FROZEN &&
getMhrInformation.value?.frozenDocumentType === MhApiFrozenDocumentTypes.TRANS_AFFIDAVIT

// Try to find a group to add the owner
// If frozen Sale or Gift Transfer: Add Owner to the last ownership group with recently added Executor
const groupToUpdate = isFrozenSoGTransfer
? homeOwnerGroups.find(group => group.groupId ===
useTransferOwners().getMostRecentExecutorOrAdmin(homeOwnerGroups)?.groupId)
: homeOwnerGroups.find(
(group: MhrRegistrationHomeOwnerGroupIF) => group.groupId === (groupId || fallBackId)
) || ({} as MhrRegistrationHomeOwnerGroupIF)
const groupToUpdate = homeOwnerGroups.find((group: MhrRegistrationHomeOwnerGroupIF) =>
group.groupId === (groupId || fallBackId)) || ({} as MhrRegistrationHomeOwnerGroupIF)

// Allow update to "REMOVED" group if WILL flow
if (groupToUpdate.owners &&
Expand Down
4 changes: 2 additions & 2 deletions ppr-ui/src/resources/dialogOptions/confirmationDialogs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ export const mhrTableRemoveDialog: DialogOptionsIF = {
export const mhrDeceasedOwnerChanges: DialogOptionsIF = {
acceptText: 'Undo Changes and Delete Owner',
cancelText: 'Cancel',
title: 'Deceased owner\'s information cannot be changed',
text: `The phone number and mailing address of a deceased owner cannot be changed prior to deletion.
title: 'Deleted owner\'s information cannot be changed',
text: `The phone number and mailing address of an owner cannot be changed prior to deletion.
Deleting this owner will undo any changes you have made to their phone number or mailing address. `
}

Expand Down

0 comments on commit 0e14c88

Please sign in to comment.