feat: add create standing instructions (#1142)

Fixes: #268
This commit is contained in:
Muskan Khedia
2020-07-19 18:27:17 +05:30
committed by GitHub
parent c134026030
commit af6cdbaa9f
15 changed files with 588 additions and 9 deletions
@@ -0,0 +1,46 @@
/** Angular Imports */
import { Injectable } from '@angular/core';
import { Resolve, ActivatedRouteSnapshot } from '@angular/router';
/** rxjs Imports */
import { Observable } from 'rxjs';
/** Custom Services */
import { AccountTransfersService } from '../account-transfers.service';
/**
* View Standing Instructions resolver.
*/
@Injectable()
export class StandingInstructionsTemplateResolver implements Resolve<Object> {
accountTypeId: string;
/**
* @param {accountTransfersService} AccountTransfersService Account Transfers service.
*/
constructor(private accountTransfersService: AccountTransfersService) { }
/**
* Returns the Standing Instructions Data.
* @param {ActivatedRouteSnapshot} route Route Snapshot
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const officeId = route.queryParamMap.get('officeId');
const accountType = route.queryParamMap.get('accountType');
const clientId = route.parent.paramMap.get('clientId');
switch (accountType) {
case 'fromloans':
this.accountTypeId = '1';
break;
case 'fromsavings':
this.accountTypeId = '2';
break;
default:
this.accountTypeId = '0';
}
return this.accountTransfersService.getStandingInstructionsTemplate(clientId, officeId, this.accountTypeId);
}
}