Skip to content

Commit

Permalink
Fix Validations for Transfer To Admin (bcgov#1794)
Browse files Browse the repository at this point in the history
* Fix LETA Transfer validation
  • Loading branch information
dimak1 authored Mar 22, 2024
1 parent bbe73bf commit c10a4c5
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 5 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.0.67",
"version": "3.0.68",
"private": true,
"appName": "Assets UI",
"sbcName": "SBC Common Components",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,7 @@ export default defineComponent({
isCurrentOwner,
isTransferDueToDeath,
isTransferDueToSaleOrGift,
isTransferToAdminNoWill,
hasCurrentOwnerChanges,
disableNameFields,
isTransferToExecOrAdmin,
Expand Down Expand Up @@ -733,6 +734,15 @@ export default defineComponent({
localState.ownerGroupId = TransAffidavit.getGroupIdWithExecutor()
}
if (props.isMhrTransfer &&
isTransferToAdminNoWill.value &&
localState.owner.partyType === HomeOwnerPartyTypes.ADMINISTRATOR) {
// find group with deleted owner
localState.ownerGroupId =
find(getMhrTransferHomeOwnerGroups.value, { owners: [{ action: ActionTypes.REMOVED }] }).groupId
}
addOwnerToTheGroup(
localState.owner as MhrRegistrationHomeOwnerIF,
localState.ownerGroupId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -797,6 +797,7 @@ export default defineComponent({
moveCurrentOwnersToPreviousOwners,
hasMinOneExecOrAdminInGroup,
hasAllOwnersRemoved,
hasOnlyOneGroupOfOwners,
TransSaleOrGift,
TransToExec,
TransToAdmin,
Expand All @@ -823,7 +824,7 @@ export default defineComponent({
return props.validateTransfer &&
((props.isMhrTransfer && !hasUnsavedChanges.value) ||
!localState.isValidAllocation ||
(!showGroups.value && hasAllOwnersRemoved()))
(!showGroups.value && hasAllOwnersRemoved() && !hasOnlyOneGroupOfOwners()))
}
return ((props.validateTransfer || (!props.isMhrTransfer && localState.reviewedOwners)) &&
Expand Down Expand Up @@ -1109,7 +1110,8 @@ export default defineComponent({
(isTransferToSurvivingJointTenant.value ? TransJointTenants.isValidTransfer.value : true) &&
((isTransferToExecutorProbateWill.value || isTransferToExecutorUnder25Will.value)
? TransToExec.isValidTransfer.value
: true)
: true) &&
(isTransferToAdminNoWill.value ? TransToAdmin.isValidTransfer.value : true)
)
}, { immediate: true, deep: true })
Expand Down
6 changes: 6 additions & 0 deletions ppr-ui/src/components/mhrTransfers/SupportingDocuments.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
id="supporting-doc-option-one"
:label="docOptions.optionOne.text"
:value="docOptions.optionOne.value"
class="non-clickable-label"
data-test-id="supporting-doc-option-one"
/>
<v-radio
Expand All @@ -30,6 +31,7 @@
:value="docOptions.optionTwo.value"
:disabled="isSecondOptionDisabled"
:color="isSecondOptionError ? 'error' : 'primary'"
class="non-clickable-label"
data-test-id="supporting-doc-option-two"
/>
</v-radio-group>
Expand Down Expand Up @@ -151,6 +153,10 @@ export default defineComponent({
display: flex;
flex-direction: column;
:deep(.non-clickable-label .v-label) {
pointer-events: none;
}
.v-radio {
flex: 1;
background-color: rgba(0, 0, 0, 0.06);
Expand Down
13 changes: 13 additions & 0 deletions ppr-ui/src/composables/mhrInformation/useTransferOwners.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,11 @@ export const useTransferOwners = (enableAllActions: boolean = false) => {
owner.action === ActionTypes.REMOVED)
}

// Return true if there is only one group of owners
const hasOnlyOneGroupOfOwners = (): boolean => {
return getMhrTransferHomeOwnerGroups.value.length === 1
}

// Transfer Due to Sale or Gift flow and all the related conditions/logic
const TransSaleOrGift: any = {
isValidTransfer: computed((): boolean => {
Expand Down Expand Up @@ -605,6 +610,13 @@ export const useTransferOwners = (enableAllActions: boolean = false) => {
}

const TransToAdmin = {
isValidTransfer: computed((): boolean => {
const groupWithDeletedOwners: MhrRegistrationHomeOwnerGroupIF = getMhrTransferHomeOwnerGroups.value?.find(group =>
group.owners.some(owner => owner.action === ActionTypes.REMOVED))

if (!groupWithDeletedOwners) return false
return TransToAdmin.hasAtLeastOneAdminInGroup(groupWithDeletedOwners.groupId)
}),
hasAddedAdministratorsInGroup: (groupId): boolean =>
hasAddedPartyTypeToGroup(groupId, HomeOwnerPartyTypes.ADMINISTRATOR),
hasAtLeastOneAdminInGroup: (groupId): boolean => {
Expand Down Expand Up @@ -762,6 +774,7 @@ export const useTransferOwners = (enableAllActions: boolean = false) => {
isDisabledForSJTChanges,
isDisabledForWillChanges,
hasAllOwnersRemoved,
hasOnlyOneGroupOfOwners,
TransSaleOrGift,
TransToExec, // Transfer Due to Death - Grant of Probate (with Will)
TransJointTenants,
Expand Down

0 comments on commit c10a4c5

Please sign in to comment.