Loan account creation and modification with Loan schedule type validation
This commit is contained in:
committed by
Adam Saghy
parent
f6261be8d5
commit
80b821838c
+17
-12
@@ -121,6 +121,23 @@
|
||||
<p>{{"labels.inputs.Is Equal Amortization" | translate}}</p>
|
||||
</mat-checkbox>
|
||||
|
||||
<div fxFlex="48%" *ngIf="loanScheduleType">
|
||||
<span fxFlex="40%"><p>{{"labels.inputs.Loan Schedule Type" | translate}}</p></span>
|
||||
<span fxFlex="60%"><p>{{ loanScheduleType.value }}</p></span>
|
||||
</div>
|
||||
|
||||
<mat-form-field fxFlex="48%">
|
||||
<mat-label>{{"labels.inputs.Repayment Strategy" | translate}}</mat-label>
|
||||
<mat-select formControlName="transactionProcessingStrategyCode" matTooltip="{{ 'tooltips.The repayment strategy' | translate}}" [disabled]="repaymentStrategyDisabled">
|
||||
<mat-option *ngFor="let transactionProcessingStrategy of transactionProcessingStrategyOptions" [value]="transactionProcessingStrategy.code">
|
||||
{{ transactionProcessingStrategy.name }}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
<mat-error *ngIf="loansAccountTermsForm.controls.transactionProcessingStrategyCode.hasError('required')">
|
||||
{{"labels.inputs.Repayment Strategy" | translate}} {{"labels.commons.is" | translate}} <strong>{{"labels.commons.required" | translate}}</strong>
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
</ng-container>
|
||||
|
||||
<ng-container *ngIf="loansAccountTermsData?.isLoanProductLinkedToFloatingRate">
|
||||
@@ -182,18 +199,6 @@
|
||||
<input matInput formControlName="graceOnInterestCharged" matTooltip="{{ 'tooltips.If the Interest Free Period' | translate}}">
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field fxFlex="48%">
|
||||
<mat-label>{{"labels.inputs.Repayment strategy" | translate}}</mat-label>
|
||||
<mat-select formControlName="transactionProcessingStrategyCode" matTooltip="{{ 'tooltips.The repayment strategy' | translate}}">
|
||||
<mat-option *ngFor="let transactionProcessingStrategy of transactionProcessingStrategyOptions" [value]="transactionProcessingStrategy.code">
|
||||
{{ transactionProcessingStrategy.name }}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
<mat-error *ngIf="loansAccountTermsForm.controls.transactionProcessingStrategyCode.hasError('required')">
|
||||
{{"labels.inputs.Repayment Strategy" | translate}} {{"labels.commons.is" | translate}} <strong>{{"labels.commons.required" | translate}}</strong>
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<h4 fxFlex="98%" class="mat-h4">{{"labels.heading.Moratorium" | translate}} <i class="fas fa-question" matTooltip="{{ 'tooltips.The moratorium information' | translate}}"></i></h4>
|
||||
|
||||
<mat-form-field fxFlex="23%">
|
||||
|
||||
+24
-3
@@ -4,12 +4,14 @@ import { UntypedFormGroup, UntypedFormBuilder, Validators, FormArray } from '@an
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { LoansAccountAddCollateralDialogComponent } from 'app/loans/custom-dialog/loans-account-add-collateral-dialog/loans-account-add-collateral-dialog.component';
|
||||
import { LoanProducts } from 'app/products/loan-products/loan-products';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.component';
|
||||
import { FormDialogComponent } from 'app/shared/form-dialog/form-dialog.component';
|
||||
import { DatepickerBase } from 'app/shared/form-dialog/formfield/model/datepicker-base';
|
||||
import { FormfieldBase } from 'app/shared/form-dialog/formfield/model/formfield-base';
|
||||
import { InputBase } from 'app/shared/form-dialog/formfield/model/input-base';
|
||||
import { CodeName, OptionData } from 'app/shared/models/option-data.model';
|
||||
|
||||
/**
|
||||
* Create Loans Account Terms Step
|
||||
@@ -61,9 +63,9 @@ export class LoansAccountTermsStepComponent implements OnInit, OnChanges {
|
||||
/** Multi Disbursement Data */
|
||||
disbursementDataSource: {}[] = [];
|
||||
currencyDisplaySymbol = '$';
|
||||
/** Loan Transaction strategies */
|
||||
/** Loan repayment strategies */
|
||||
transactionProcessingStrategyOptions: any = [];
|
||||
|
||||
repaymentStrategyDisabled = false;
|
||||
/** Check if value of collateral added is more than principal amount */
|
||||
isCollateralSufficient = false;
|
||||
/** Total value of all collateral added to a loan */
|
||||
@@ -83,6 +85,8 @@ export class LoansAccountTermsStepComponent implements OnInit, OnChanges {
|
||||
|
||||
loanId: any = null;
|
||||
|
||||
loanScheduleType: OptionData | null = null;
|
||||
|
||||
/**
|
||||
* Create Loans Account Terms Form
|
||||
* @param formBuilder FormBuilder
|
||||
@@ -440,7 +444,24 @@ export class LoansAccountTermsStepComponent implements OnInit, OnChanges {
|
||||
this.amortizationTypeData = this.loansAccountProductTemplate.amortizationTypeOptions;
|
||||
this.interestCalculationPeriodTypeData = this.loansAccountProductTemplate.interestCalculationPeriodTypeOptions;
|
||||
this.clientActiveLoanData = this.loansAccountProductTemplate.clientActiveLoanOptions;
|
||||
this.transactionProcessingStrategyOptions = this.loansAccountProductTemplate.transactionProcessingStrategyOptions;
|
||||
this.loanScheduleType = this.loansAccountProductTemplate.loanScheduleType;
|
||||
this.transactionProcessingStrategyOptions = [];
|
||||
if (this.loanScheduleType.code === LoanProducts.LOAN_SCHEDULE_TYPE_CUMULATIVE) {
|
||||
// Filter Advanced Payment Allocation Strategy
|
||||
this.transactionProcessingStrategyOptions = this.loansAccountProductTemplate.transactionProcessingStrategyOptions.filter(
|
||||
(cn: CodeName) => !LoanProducts.isAdvancedPaymentAllocationStrategy(cn.code)
|
||||
);
|
||||
this.repaymentStrategyDisabled = false;
|
||||
} else {
|
||||
// Only Advanced Payment Allocation Strategy
|
||||
this.loansAccountProductTemplate.transactionProcessingStrategyOptions.some(
|
||||
(cn: CodeName) => {
|
||||
if (LoanProducts.isAdvancedPaymentAllocationStrategy(cn.code)) {
|
||||
this.transactionProcessingStrategyOptions.push(cn);
|
||||
}
|
||||
});
|
||||
this.repaymentStrategyDisabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user