diff --git a/src/app/deposits/recurring-deposits/recurring-deposits-account-view/general-tab/general-tab.component.html b/src/app/deposits/recurring-deposits/recurring-deposits-account-view/general-tab/general-tab.component.html index f6c94179d..2bff87041 100644 --- a/src/app/deposits/recurring-deposits/recurring-deposits-account-view/general-tab/general-tab.component.html +++ b/src/app/deposits/recurring-deposits/recurring-deposits-account-view/general-tab/general-tab.component.html @@ -266,7 +266,7 @@
{{"labels.inputs.Is Equal Amortization" | translate}}
{{"labels.inputs.Loan Schedule Type" | translate}}
diff --git a/src/app/loans/loans-account-stepper/loans-account-terms-step/loans-account-terms-step.component.ts b/src/app/loans/loans-account-stepper/loans-account-terms-step/loans-account-terms-step.component.ts index 2a9829926..73207d16a 100644 --- a/src/app/loans/loans-account-stepper/loans-account-terms-step/loans-account-terms-step.component.ts +++ b/src/app/loans/loans-account-stepper/loans-account-terms-step/loans-account-terms-step.component.ts @@ -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() { diff --git a/src/app/loans/loans-view/account-details/account-details.component.html b/src/app/loans/loans-view/account-details/account-details.component.html index 22275b0dd..5d89d5417 100644 --- a/src/app/loans/loans-view/account-details/account-details.component.html +++ b/src/app/loans/loans-view/account-details/account-details.component.html @@ -1,27 +1,37 @@ -