Loan Tranche Section Added

This commit is contained in:
Ramveer
2022-06-08 08:56:08 +02:00
committed by Arnold Gálovics
parent 4783f602b0
commit c279b96db7
4 changed files with 103 additions and 2 deletions
@@ -36,7 +36,7 @@
<ng-template matStepLabel>TERMS</ng-template>
<mifosx-loans-account-terms-step [loansAccountProductTemplate]="loansAccountProductTemplate"
[loansAccountTemplate] = "loansAccountTemplate">
[loansAccountTemplate] = "loansAccountTemplate" [multiDisburseLoan] = "multiDisburseLoan">
</mifosx-loans-account-terms-step>
</mat-step>
@@ -33,6 +33,8 @@ export class CreateLoansAccountComponent implements OnInit {
loansAccountProductTemplate: any;
/** Collateral Options */
collateralOptions: any;
/** Multi Disburse Loan */
multiDisburseLoan: any;
/**
* Sets loans account create form.
@@ -65,6 +67,12 @@ export class CreateLoansAccountComponent implements OnInit {
this.loansService.getLoansCollateralTemplateResource(this.loansAccountProductTemplate.loanProductId).subscribe((response: any) => {
this.collateralOptions = response.loanCollateralOptions;
});
const clientId = this.loansAccountTemplate.clientId;
const productId= this.loansAccountProductTemplate.loanProductId
this.loansService.getLoansAccountTemplateResource(clientId, productId).subscribe((response: any) => {
this.multiDisburseLoan = response.multiDisburseLoan;
});
}
/** Get Loans Account Details Form Data */
@@ -113,6 +121,10 @@ export class CreateLoansAccountComponent implements OnInit {
type: collateralEle.type,
value: collateralEle.value,
description: collateralEle.description
})),
disbursementData:this.loansAccount.disbursementData.map((item: any) => ({
expectedDisbursementDate: this.dateUtils.formatDate(item.expectedDisbursementDate, dateFormat),
principal: item.principal
})),
interestChargedFromDate: this.dateUtils.formatDate(this.loansAccount.interestChargedFromDate, dateFormat),
repaymentsStartingFromDate: this.dateUtils.formatDate(this.loansAccount.repaymentsStartingFromDate, dateFormat),
@@ -146,6 +158,9 @@ export class CreateLoansAccountComponent implements OnInit {
if (!(loansAccountData.isFloatingInterestRate === false)) {
delete loansAccountData.isFloatingInterestRate;
}
if (!(this.multiDisburseLoan)) {
delete loansAccountData.disbursementData;
}
this.loansService.createLoansAccount(loansAccountData).subscribe((response: any) => {
this.router.navigate(['../', response.resourceId], { relativeTo: this.route });