feat: add loan action button (#874)
- add prepay loan action - add repayment loan action Fixes: #243 Fixes: #242
This commit is contained in:
@@ -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 { LoansService } from '../loans.service';
|
||||
|
||||
/**
|
||||
* Loans notes data resolver.
|
||||
*/
|
||||
@Injectable()
|
||||
export class LoanActionButtonResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {LoansService} LoansService Loans service.
|
||||
*/
|
||||
constructor(private loansService: LoansService) { }
|
||||
|
||||
/**
|
||||
* Returns the Loans Notes Data.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
resolve(route: ActivatedRouteSnapshot): Observable<any> {
|
||||
const loanId = route.parent.paramMap.get('loanId');
|
||||
const loanActionButton = route.paramMap.get('action');
|
||||
if (loanActionButton === 'assign-loan-officer') {
|
||||
return this.loansService.getLoanTemplate(loanId);
|
||||
// } else if (loanActionButton === 'make-repayment') {
|
||||
// return this.loansService.getLoanActionTemplate(loanId, 'repayment');
|
||||
} else {
|
||||
return this.loansService.getLoanActionTemplate(loanId, 'prepayLoan');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user