33 lines
903 B
TypeScript
33 lines
903 B
TypeScript
/** 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 Charge data resolver.
|
|
*/
|
|
@Injectable()
|
|
export class ClientChargeViewResolver implements Resolve<Object> {
|
|
|
|
/**
|
|
* @param {ClientsService} ClientsService Clients service.
|
|
*/
|
|
constructor(private clientsService: ClientsService) { }
|
|
|
|
/**
|
|
* Returns the Client Charge data.
|
|
* @returns {Observable<any>}
|
|
*/
|
|
resolve(route: ActivatedRouteSnapshot): Observable<any> {
|
|
const clientId = route.parent.parent.parent.paramMap.get('clientId');
|
|
const chargeId = route.paramMap.get('chargeId');
|
|
return this.clientsService.getSelectedChargeData(clientId, chargeId);
|
|
}
|
|
|
|
}
|