Skip to content

Commit

Permalink
Fix error state for the Group (#1364)
Browse files Browse the repository at this point in the history
  • Loading branch information
dimak1 authored May 31, 2023
1 parent 3ddfdc8 commit 7ce04d9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,7 @@ export default defineComponent({
isTransferToAdminNoWill,
groupHasRemovedAllCurrentOwners,
moveCurrentOwnersToPreviousOwners,
hasMinOneExecOrAdminInGroup,
TransSaleOrGift,
TransToExec,
TransToAdmin,
Expand Down Expand Up @@ -552,7 +553,7 @@ export default defineComponent({
!localState.showTableError && !props.isReadonlyTable
const isInvalidTransferOwnerGroup = (groupId: number, hasExecOrAdminInGroup: boolean) => {
if (props.validateTransfer && !hasUnsavedChanges.value) return false
if (props.validateTransfer && (!hasUnsavedChanges.value || hasMinOneExecOrAdminInGroup(groupId))) return false
const hasRemovedOwners = TransToExec.hasSomeOwnersRemoved(groupId)
// groups that are not edited are valid
Expand Down Expand Up @@ -693,22 +694,12 @@ export default defineComponent({
? TransToAdmin.hasAddedAdministratorsInGroup(groupId)
: TransToExec.hasAddedExecutorsInGroup(groupId)
let hasAtLeastOneExecOrAdmin = false
// for WILL and LETA transfers, id one Exec or Admin is removed,
// do not shot group message that all owners must be removed
if (isTransferToExecutorProbateWill.value) {
hasAtLeastOneExecOrAdmin = TransToExec.hasAtLeastOneExecInGroup(groupId)
} else if (isTransferToAdminNoWill.value) {
hasAtLeastOneExecOrAdmin = TransToAdmin.hasAtLeastOneAdminInGroup(groupId)
}
return (
(TransToExec.hasSomeOwnersRemoved(groupId) || hasAddedRoleInGroup) &&
!(hasAddedRoleInGroup &&
TransToExec.hasAllCurrentOwnersRemoved(groupId) &&
!TransToExec.isAllGroupOwnersWithDeathCerts(groupId)) &&
!hasAtLeastOneExecOrAdmin
!hasMinOneExecOrAdminInGroup(groupId)
)
}
Expand Down
12 changes: 12 additions & 0 deletions ppr-ui/src/composables/mhrInformation/useTransferOwners.ts
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,17 @@ export const useTransferOwners = (enableAllActions: boolean = false) => {
}
}

// For WIll and LETA Transfers, at least one Exec or Admin is required to proceed
// Used for hiding group message (that all owners must be removed)
const hasMinOneExecOrAdminInGroup = (groupId) => {
if (isTransferToExecutorProbateWill.value) {
return TransToExec.hasAtLeastOneExecInGroup(groupId)
} else if (isTransferToAdminNoWill.value) {
return TransToAdmin.hasAtLeastOneAdminInGroup(groupId)
}
return false
}

/** Return true if the specified owner is part of the current/base ownership structure **/
const isCurrentOwner = (owner: MhrRegistrationHomeOwnerIF): boolean => {
return getMhrTransferCurrentHomeOwnerGroups.value.some(group =>
Expand Down Expand Up @@ -712,6 +723,7 @@ export const useTransferOwners = (enableAllActions: boolean = false) => {
hasCurrentOwnerChanges,
hasCurrentGroupChanges,
moveCurrentOwnersToPreviousOwners,
hasMinOneExecOrAdminInGroup,
...toRefs(localState)
}
}

0 comments on commit 7ce04d9

Please sign in to comment.