WEB-772 Prevent negative values in savings product settings fields (#3206)

This commit is contained in:
Soni Jay
2026-02-22 15:28:55 -06:00
committed by GitHub
parent f13c425fbc
commit 20d19c2eee
2 changed files with 42 additions and 6 deletions
@@ -180,6 +180,8 @@
matInput
matTooltip="{{ 'tooltips.Sets the overdraft required for interest calculation' | translate }}"
formControlName="minOverdraftForInterestCalculation"
min="0"
step="0.01"
/>
</mat-form-field>
<mat-form-field class="flex-31">
@@ -189,6 +191,8 @@
matInput
matTooltip="{{ 'tooltips.Default interest rate on overdraft' | translate }}"
formControlName="nominalAnnualInterestRateOverdraft"
min="0"
step="0.01"
/>
</mat-form-field>
<mat-form-field class="flex-31">
@@ -198,6 +202,8 @@
matInput
matTooltip="{{ 'tooltips.Sets the maximum allowed overdraft amount' | translate }}"
formControlName="overdraftLimit"
min="0"
step="0.01"
/>
</mat-form-field>
</div>
@@ -225,6 +231,8 @@
matInput
matTooltip="{{ 'tooltips.Inactive period to mark an account as Inactive' | translate }}"
formControlName="daysToInactive"
min="0"
step="1"
required
/>
<mat-error>
@@ -240,6 +248,8 @@
matInput
matTooltip="{{ 'tooltips.Inactive period to mark an account as Dormant' | translate }}"
formControlName="daysToDormancy"
min="0"
step="1"
required
/>
<mat-error>
@@ -254,6 +264,8 @@
matInput
matTooltip="{{ 'tooltips.Inactive period to mark an account as Escheat' | translate }}"
formControlName="daysToEscheat"
min="0"
step="1"
required
/>
<mat-error>
@@ -132,9 +132,15 @@ export class SavingProductSettingsStepComponent implements OnInit {
this.savingProductSettingsForm.get('allowOverdraft').valueChanges.subscribe((allowOverdraft: any) => {
if (allowOverdraft) {
this.savingProductSettingsForm.addControl('minOverdraftForInterestCalculation', new UntypedFormControl(''));
this.savingProductSettingsForm.addControl('nominalAnnualInterestRateOverdraft', new UntypedFormControl(''));
this.savingProductSettingsForm.addControl('overdraftLimit', new UntypedFormControl(''));
this.savingProductSettingsForm.addControl(
'minOverdraftForInterestCalculation',
new UntypedFormControl('', [Validators.min(0)])
);
this.savingProductSettingsForm.addControl(
'nominalAnnualInterestRateOverdraft',
new UntypedFormControl('', [Validators.min(0)])
);
this.savingProductSettingsForm.addControl('overdraftLimit', new UntypedFormControl('', [Validators.min(0)]));
} else {
this.savingProductSettingsForm.removeControl('minOverdraftForInterestCalculation');
this.savingProductSettingsForm.removeControl('nominalAnnualInterestRateOverdraft');
@@ -154,9 +160,27 @@ export class SavingProductSettingsStepComponent implements OnInit {
.get('isDormancyTrackingActive')
.valueChanges.subscribe((isDormancyTrackingActive: any) => {
if (isDormancyTrackingActive) {
this.savingProductSettingsForm.addControl('daysToInactive', new UntypedFormControl('', Validators.required));
this.savingProductSettingsForm.addControl('daysToDormancy', new UntypedFormControl('', Validators.required));
this.savingProductSettingsForm.addControl('daysToEscheat', new UntypedFormControl('', Validators.required));
this.savingProductSettingsForm.addControl(
'daysToInactive',
new UntypedFormControl('', [
Validators.required,
Validators.min(0)
])
);
this.savingProductSettingsForm.addControl(
'daysToDormancy',
new UntypedFormControl('', [
Validators.required,
Validators.min(0)
])
);
this.savingProductSettingsForm.addControl(
'daysToEscheat',
new UntypedFormControl('', [
Validators.required,
Validators.min(0)
])
);
} else {
this.savingProductSettingsForm.removeControl('daysToInactive');
this.savingProductSettingsForm.removeControl('daysToDormancy');