feat: add centers action (assign and unassign staff) (#1091)

Fixes: #1090
This commit is contained in:
Muskan Khedia
2020-07-14 11:33:27 +05:30
committed by GitHub
parent 3e50f79016
commit 96f881e909
17 changed files with 311 additions and 9 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 { CentersService } from '../centers.service';
/**
* Group Actions data resolver.
*/
@Injectable()
export class CenterActionsResolver implements Resolve<Object> {
/**
* @param {CentersService} centersService Savings service.
*/
constructor(private centersService: CentersService) { }
/**
* Returns the Centers account actions data.
* @param {ActivatedRouteSnapshot} route Route Snapshot
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const actionName = route.paramMap.get('name');
const centerId = route.paramMap.get('centerId') || route.parent.parent.paramMap.get('centerId');
switch (actionName) {
case 'Assign Staff':
return this.centersService.getGroupStaffData(centerId);
default:
return undefined;
}
}
}