@@ -86,7 +86,7 @@
|
||||
<span *ngIf="!(groupViewData.centerId || groupViewData.collectionMeetingCalendar) && groupViewData.status.value==='Active'">
|
||||
<button mat-menu-item *mifosxHasPermission="'CREATE_MEETING'">Attatch Meeting</button></span>
|
||||
<button mat-menu-item *mifosxHasPermission="'CLOSE_GROUP'" (click)="doAction('Close')">Close</button>
|
||||
<button mat-menu-item *mifosxHasPermission="'DELETE_GROUP'">Delete</button>
|
||||
<button mat-menu-item *mifosxHasPermission="'DELETE_GROUP'" (click)="doAction('Delete')">Delete</button>
|
||||
</mat-menu>
|
||||
|
||||
</mat-card-actions>
|
||||
|
||||
@@ -5,6 +5,7 @@ import { MatDialog } from '@angular/material';
|
||||
|
||||
/** Custom Dialogs */
|
||||
import { UnassignStaffDialogComponent } from './custom-dialogs/unassign-staff-dialog/unassign-staff-dialog.component';
|
||||
import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.component';
|
||||
|
||||
/** Custom Services */
|
||||
import { GroupsService } from '../groups.service';
|
||||
@@ -52,6 +53,9 @@ export class GroupsViewComponent {
|
||||
case 'Unassign Staff':
|
||||
this.unassignStaff();
|
||||
break;
|
||||
case 'Delete':
|
||||
this.deleteGroup();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,4 +84,20 @@ export class GroupsViewComponent {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the group
|
||||
*/
|
||||
private deleteGroup() {
|
||||
const deleteGroupDialogRef = this.dialog.open(DeleteDialogComponent, {
|
||||
data: { deleteContext: `group with id: ${this.groupViewData.id}` }
|
||||
});
|
||||
deleteGroupDialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response.delete) {
|
||||
this.groupsService.deleteGroup(this.groupViewData.id).subscribe(() => {
|
||||
this.router.navigate(['/groups'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -52,6 +52,14 @@ export class GroupsService {
|
||||
return this.http.get('/groups', { params: httpParams } );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} groupId shares account Id
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
deleteGroup(groupId: string): Observable<any> {
|
||||
return this.http.delete(`/groups/${groupId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param groupId Group Id of group to get data for.
|
||||
* @returns {Observable<any>} Group data.
|
||||
|
||||
Reference in New Issue
Block a user