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 12:28:31 -06:00
committed by GitHub
co-authored by Parth Sharma
parent 30a143fced
commit 544990cfd0
2 changed files with 17 additions and 1 deletions
@@ -198,7 +198,13 @@
<button mat-menu-item *mifosxHasPermission="'CLOSE_GROUP'" (click)="doAction('Close')"> <button mat-menu-item *mifosxHasPermission="'CLOSE_GROUP'" (click)="doAction('Close')">
{{ 'labels.buttons.Close' | translate }} {{ 'labels.buttons.Close' | translate }}
</button> </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 }} {{ 'labels.buttons.Delete' | translate }}
</button> </button>
</mat-menu> </mat-menu>
@@ -143,6 +143,9 @@ export class GroupsViewComponent implements OnInit, OnDestroy {
this.unassignStaff(); this.unassignStaff();
break; break;
case 'Delete': case 'Delete':
if (!this.canDeleteGroup()) {
return;
}
this.deleteGroup(); this.deleteGroup();
break; 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 * Deletes the group