From 97186569d3ffcb651b77817b405e43679d33aa89 Mon Sep 17 00:00:00 2001 From: mariiaKraievska Date: Wed, 25 Jun 2025 15:19:53 +0300 Subject: [PATCH] WEB-232: Reset overAppliedCalculationType and overAppliedNumber fields when 'Allow approval / disbursal above loan applied amount' is unchecked --- .../loan-product-terms-step.component.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/app/products/loan-products/loan-product-stepper/loan-product-terms-step/loan-product-terms-step.component.ts b/src/app/products/loan-products/loan-product-stepper/loan-product-terms-step/loan-product-terms-step.component.ts index 5e2461a41..e9192df72 100644 --- a/src/app/products/loan-products/loan-product-stepper/loan-product-terms-step/loan-product-terms-step.component.ts +++ b/src/app/products/loan-products/loan-product-stepper/loan-product-terms-step/loan-product-terms-step.component.ts @@ -202,6 +202,8 @@ export class LoanProductTermsStepComponent implements OnInit, OnChanges { maxNumberOfRepayments: [''], isLinkedToFloatingInterestRates: [false], allowApprovedDisbursedAmountsOverApplied: [false], + overAppliedCalculationType: [{ value: null, disabled: true }], + overAppliedNumber: [{ value: null, disabled: true }], minInterestRatePerPeriod: [''], interestRatePerPeriod: [ '', @@ -236,12 +238,14 @@ export class LoanProductTermsStepComponent implements OnInit, OnChanges { .get('allowApprovedDisbursedAmountsOverApplied') .valueChanges.subscribe((allowApprovedDisbursedAmountsOverApplied) => { if (allowApprovedDisbursedAmountsOverApplied) { - this.loanProductTermsForm.addControl('overAppliedCalculationType', new UntypedFormControl('')); - this.loanProductTermsForm.addControl('overAppliedNumber', new UntypedFormControl('')); + this.loanProductTermsForm.get('overAppliedCalculationType').enable(); + this.loanProductTermsForm.get('overAppliedNumber').enable(); this.loanProductTermsForm.addControl('disallowExpectedDisbursements', new UntypedFormControl('true')); } else { - this.loanProductTermsForm.removeControl('overAppliedCalculationType'); - this.loanProductTermsForm.removeControl('overAppliedNumber'); + this.loanProductTermsForm.get('overAppliedCalculationType').disable(); + this.loanProductTermsForm.get('overAppliedCalculationType').patchValue(null); + this.loanProductTermsForm.get('overAppliedNumber').disable(); + this.loanProductTermsForm.get('overAppliedNumber').patchValue(null); this.loanProductTermsForm.removeControl('disallowExpectedDisbursements'); } });