WEB-216: Disable delete group action for non-pending groups (#3058)

Co-authored-by: Parth Sharma <parthsharma@Parths-MacBook-Air.local>
This commit is contained in:
parth-sharma-10 2026-01-28 23:58:31 +05:30 committed by GitHub
parent 30a143fced
commit 544990cfd0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 1 deletions

View File

@ -198,7 +198,13 @@
<button mat-menu-item *mifosxHasPermission="'CLOSE_GROUP'" (click)="doAction('Close')">
{{ 'labels.buttons.Close' | translate }}
</button>
<button mat-menu-item *mifosxHasPermission="'DELETE_GROUP'" (click)="doAction('Delete')">
<button
mat-menu-item
*mifosxHasPermission="'DELETE_GROUP'"
[disabled]="!canDeleteGroup()"
matTooltip="Only pending groups can be deleted"
(click)="doAction('Delete')"
>
{{ 'labels.buttons.Delete' | translate }}
</button>
</mat-menu>

View File

@ -143,6 +143,9 @@ export class GroupsViewComponent implements OnInit, OnDestroy {
this.unassignStaff();
break;
case 'Delete':
if (!this.canDeleteGroup()) {
return;
}
this.deleteGroup();
break;
}
@ -193,6 +196,13 @@ export class GroupsViewComponent implements OnInit, OnDestroy {
}
});
}
/**
* Checks if the group can be deleted.
* Only groups in Pending state are allowed to be deleted.
*/
canDeleteGroup(): boolean {
return this.groupViewData?.status?.value === 'Pending';
}
/**
* Deletes the group