feat: fixed deposits account actions (add-charge) (#993)

Fixes: #992
This commit is contained in:
Karan Takalkar
2020-07-04 20:07:38 +05:30
committed by GitHub
parent 380d09c22e
commit 1486b78441
11 changed files with 321 additions and 14 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 { SavingsService } from 'app/savings/savings.service';
/**
* Fixed Deposits Account Actions data resolver.
*/
@Injectable()
export class FixedDepositsAccountActionsResolver implements Resolve<Object> {
/**
* @param {SavingsService} SavingsService Savings service.
*/
constructor(private savingsService: SavingsService) { }
/**
* Returns the Fixed deposits account actions data.
* @param {ActivatedRouteSnapshot} route Route Snapshot
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const actionName = route.paramMap.get('name');
const fixedDepositAccountId = route.paramMap.get('fixedDepositAccountId') || route.parent.parent.paramMap.get('fixedDepositAccountId');
switch (actionName) {
case 'Add Charge':
return this.savingsService.getSavingsChargeTemplateResource(fixedDepositAccountId);
default:
return undefined;
}
}
}