feat: client actions (assign/unassign staff) (#1067)

Fixes: #1066
This commit is contained in:
Karan Takalkar
2020-07-13 11:18:10 +05:30
committed by GitHub
parent ac529dbae8
commit af32d481bf
29 changed files with 378 additions and 13 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 { ClientsService } from '../clients.service';
/**
* Client Actions data resolver.
*/
@Injectable()
export class ClientActionsResolver implements Resolve<Object> {
/**
* @param {ClientsService} clientsService Clients service.
*/
constructor(private clientsService: ClientsService) { }
/**
* Returns the clients actions data.
* @param {ActivatedRouteSnapshot} route Route Snapshot
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const actionName = route.paramMap.get('name');
const clientId = route.paramMap.get('clientId') || route.parent.parent.paramMap.get('clientId');
switch (actionName) {
case 'Assign Staff':
return this.clientsService.getClientDataAndTemplate(clientId);
default:
return undefined;
}
}
}