feat: group actions (assign/unassign staff) (#1029)

Fixes #1028
This commit is contained in:
Karan Takalkar
2020-07-08 15:37:38 +05:30
committed by GitHub
parent 356cda70b8
commit b3abac32f5
17 changed files with 356 additions and 8 deletions
@@ -0,0 +1,38 @@
/** Angular Imports */
import { Injectable } from '@angular/core';
import { Resolve, ActivatedRouteSnapshot } from '@angular/router';
/** rxjs Imports */
import { Observable } from 'rxjs';
/** Custom Services */
import { GroupsService } from '../groups.service';
/**
* Group Actions data resolver.
*/
@Injectable()
export class GroupActionsResolver implements Resolve<Object> {
/**
* @param {GroupsService} groupsService Savings service.
*/
constructor(private groupsService: GroupsService) { }
/**
* Returns the Savings account actions data.
* @param {ActivatedRouteSnapshot} route Route Snapshot
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const actionName = route.paramMap.get('name');
const groupId = route.paramMap.get('groupId') || route.parent.parent.paramMap.get('groupId');
switch (actionName) {
case 'Assign Staff':
return this.groupsService.getGroupData(groupId, 'true');
default:
return undefined;
}
}
}