mirror of
https://github.com/openMF/web-app.git
synced 2026-02-06 15:56:54 +00:00
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:
parent
30a143fced
commit
544990cfd0
@ -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>
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user