Loan account with Fixed Length attribute
This commit is contained in:
committed by
Jose Alberto Hernandez
parent
d5a2e99af0
commit
5400feb989
+10
-4
@@ -86,7 +86,7 @@
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field fxFlex="20%" *ngIf="loansAccountTermsForm.controls.repaymentFrequencyType.value == 2">
|
||||
<mat-form-field fxFlex="14%" *ngIf="loansAccountTermsForm.controls.repaymentFrequencyType.value == 2">
|
||||
<mat-label>{{"labels.inputs.Select On" | translate}}</mat-label>
|
||||
<mat-select formControlName="repaymentFrequencyNthDayType">
|
||||
<mat-option *ngFor="let repaymentFrequencyNthDayType of repaymentFrequencyNthDayTypeData"
|
||||
@@ -96,7 +96,7 @@
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field fxFlex="20%" *ngIf="loansAccountTermsForm.controls.repaymentFrequencyType.value == 2">
|
||||
<mat-form-field fxFlex="14%" *ngIf="loansAccountTermsForm.controls.repaymentFrequencyType.value == 2">
|
||||
<mat-label>{{"labels.inputs.Select Day" | translate}}</mat-label>
|
||||
<mat-select formControlName="repaymentFrequencyDayOfWeekType">
|
||||
<mat-option *ngFor="let repaymentFrequencyDayOfWeekType of repaymentFrequencyDaysOfWeekTypeData"
|
||||
@@ -124,7 +124,7 @@
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field fxFlex="23%">
|
||||
<mat-form-field fxFlex="14%">
|
||||
<mat-label>{{"labels.inputs.Amortization" | translate}}</mat-label>
|
||||
<mat-select required matTooltip="{{ 'tooltips.The Amortization value' | translate}}" formControlName="amortizationType">
|
||||
<mat-option *ngFor="let amortizationType of amortizationTypeData" [value]="amortizationType.id">
|
||||
@@ -135,8 +135,13 @@
|
||||
{{"labels.inputs.Amortization Type" | translate}} {{"labels.commons.is" | translate}} <strong>{{"labels.commons.required" | translate}}</strong>
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field fxFlex="14%" *ngIf="isEqualPrincipalPayments()">
|
||||
<mat-label>{{"labels.inputs.Principal Percentage Per Installment" | translate}}</mat-label>
|
||||
<input type="number" matInput formControlName="fixedPrincipalPercentagePerInstallment">
|
||||
</mat-form-field>
|
||||
|
||||
<mat-checkbox fxFlex="23%" formControlName="isEqualAmortization"
|
||||
<mat-checkbox fxFlex="14%" formControlName="isEqualAmortization"
|
||||
[checked]="loansAccountTermsData?.isEqualAmortization">
|
||||
<p>{{"labels.inputs.Is Equal Amortization" | translate}}</p>
|
||||
</mat-checkbox>
|
||||
@@ -175,6 +180,7 @@
|
||||
</div>
|
||||
|
||||
</ng-container>
|
||||
<h4 fxFlex="98%" class="mat-h4">{{"labels.inputs.Loan Schedule" | translate}}</h4>
|
||||
|
||||
<div fxFlex="48%" *ngIf="loanScheduleType">
|
||||
<span fxFlex="40%"><p>{{"labels.inputs.Loan Schedule Type" | translate}}</p></span>
|
||||
|
||||
+16
-5
@@ -269,10 +269,19 @@ export class LoansAccountTermsStepComponent implements OnInit, OnChanges {
|
||||
this.calculateLoanTerm(numberOfRepayments, repaymentEvery);
|
||||
});
|
||||
|
||||
this.loansAccountTermsForm.get('loanTermFrequencyType').valueChanges
|
||||
this.loansAccountTermsForm.get('loanTermFrequencyType').valueChanges
|
||||
.subscribe(loanTermFrequencyType => {
|
||||
this.loansAccountTermsForm.patchValue({'repaymentFrequencyType': loanTermFrequencyType});
|
||||
});
|
||||
|
||||
this.loansAccountTermsForm.get('amortizationType').valueChanges
|
||||
.subscribe(amortizationType => {
|
||||
if (amortizationType === 0) { // Equal Principal Payments
|
||||
this.loansAccountTermsForm.addControl('fixedPrincipalPercentagePerInstallment', new UntypedFormControl(''));
|
||||
} else { // Equal Installments
|
||||
this.loansAccountTermsForm.removeControl('fixedPrincipalPercentagePerInstallment');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
setAdvancedPaymentStrategyControls(): void {
|
||||
@@ -282,7 +291,7 @@ export class LoansAccountTermsStepComponent implements OnInit, OnChanges {
|
||||
this.loansAccountTermsForm.removeControl('fixedLength');
|
||||
if (this.loansAccountTermsData.product.fixedLength) {
|
||||
this.loansAccountTermsForm.addControl('interestRatePerPeriod', new UntypedFormControl({value: 0, disabled: true}, Validators.required));
|
||||
this.loansAccountTermsForm.addControl('fixedLength', new UntypedFormControl({value: this.loansAccountTermsData.product.fixedLength, disabled: true}));
|
||||
this.loansAccountTermsForm.addControl('fixedLength', new UntypedFormControl(this.loansAccountTermsData.product.fixedLength));
|
||||
} else {
|
||||
this.loansAccountTermsForm.addControl('interestRatePerPeriod', new UntypedFormControl(this.loansAccountTermsData.interestRatePerPeriod, Validators.required));
|
||||
}
|
||||
@@ -296,6 +305,10 @@ export class LoansAccountTermsStepComponent implements OnInit, OnChanges {
|
||||
return false;
|
||||
}
|
||||
|
||||
isEqualPrincipalPayments(): boolean {
|
||||
return (this.loansAccountTermsForm.value.amortizationType === 0);
|
||||
}
|
||||
|
||||
/** Create Loans Account Terms Form */
|
||||
createloansAccountTermsForm() {
|
||||
this.loansAccountTermsForm = this.formBuilder.group({
|
||||
@@ -493,9 +506,7 @@ export class LoansAccountTermsStepComponent implements OnInit, OnChanges {
|
||||
* Returns loans account terms form value.
|
||||
*/
|
||||
get loansAccountTerms() {
|
||||
const terms = this.loansAccountTermsForm.getRawValue();
|
||||
delete terms['fixedLength'];
|
||||
return terms;
|
||||
return this.loansAccountTermsForm.getRawValue();
|
||||
}
|
||||
|
||||
get loanCollateral() {
|
||||
|
||||
Reference in New Issue
Block a user