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 matInput
matTooltip="{{ 'tooltips.Sets the overdraft required for interest calculation' | translate }}" matTooltip="{{ 'tooltips.Sets the overdraft required for interest calculation' | translate }}"
formControlName="minOverdraftForInterestCalculation" formControlName="minOverdraftForInterestCalculation"
min="0"
step="0.01"
/> />
</mat-form-field> </mat-form-field>
<mat-form-field class="flex-31"> <mat-form-field class="flex-31">
@@ -189,6 +191,8 @@
matInput matInput
matTooltip="{{ 'tooltips.Default interest rate on overdraft' | translate }}" matTooltip="{{ 'tooltips.Default interest rate on overdraft' | translate }}"
formControlName="nominalAnnualInterestRateOverdraft" formControlName="nominalAnnualInterestRateOverdraft"
min="0"
step="0.01"
/> />
</mat-form-field> </mat-form-field>
<mat-form-field class="flex-31"> <mat-form-field class="flex-31">
@@ -198,6 +202,8 @@
matInput matInput
matTooltip="{{ 'tooltips.Sets the maximum allowed overdraft amount' | translate }}" matTooltip="{{ 'tooltips.Sets the maximum allowed overdraft amount' | translate }}"
formControlName="overdraftLimit" formControlName="overdraftLimit"
min="0"
step="0.01"
/> />
</mat-form-field> </mat-form-field>
</div> </div>
@@ -225,6 +231,8 @@
matInput matInput
matTooltip="{{ 'tooltips.Inactive period to mark an account as Inactive' | translate }}" matTooltip="{{ 'tooltips.Inactive period to mark an account as Inactive' | translate }}"
formControlName="daysToInactive" formControlName="daysToInactive"
min="0"
step="1"
required required
/> />
<mat-error> <mat-error>
@@ -240,6 +248,8 @@
matInput matInput
matTooltip="{{ 'tooltips.Inactive period to mark an account as Dormant' | translate }}" matTooltip="{{ 'tooltips.Inactive period to mark an account as Dormant' | translate }}"
formControlName="daysToDormancy" formControlName="daysToDormancy"
min="0"
step="1"
required required
/> />
<mat-error> <mat-error>
@@ -254,6 +264,8 @@
matInput matInput
matTooltip="{{ 'tooltips.Inactive period to mark an account as Escheat' | translate }}" matTooltip="{{ 'tooltips.Inactive period to mark an account as Escheat' | translate }}"
formControlName="daysToEscheat" formControlName="daysToEscheat"
min="0"
step="1"
required required
/> />
<mat-error> <mat-error>
@@ -132,9 +132,15 @@ export class SavingProductSettingsStepComponent implements OnInit {
this.savingProductSettingsForm.get('allowOverdraft').valueChanges.subscribe((allowOverdraft: any) => { this.savingProductSettingsForm.get('allowOverdraft').valueChanges.subscribe((allowOverdraft: any) => {
if (allowOverdraft) { if (allowOverdraft) {
this.savingProductSettingsForm.addControl('minOverdraftForInterestCalculation', new UntypedFormControl('')); this.savingProductSettingsForm.addControl(
this.savingProductSettingsForm.addControl('nominalAnnualInterestRateOverdraft', new UntypedFormControl('')); 'minOverdraftForInterestCalculation',
this.savingProductSettingsForm.addControl('overdraftLimit', new UntypedFormControl('')); new UntypedFormControl('', [Validators.min(0)])
);
this.savingProductSettingsForm.addControl(
'nominalAnnualInterestRateOverdraft',
new UntypedFormControl('', [Validators.min(0)])
);
this.savingProductSettingsForm.addControl('overdraftLimit', new UntypedFormControl('', [Validators.min(0)]));
} else { } else {
this.savingProductSettingsForm.removeControl('minOverdraftForInterestCalculation'); this.savingProductSettingsForm.removeControl('minOverdraftForInterestCalculation');
this.savingProductSettingsForm.removeControl('nominalAnnualInterestRateOverdraft'); this.savingProductSettingsForm.removeControl('nominalAnnualInterestRateOverdraft');
@@ -154,9 +160,27 @@ export class SavingProductSettingsStepComponent implements OnInit {
.get('isDormancyTrackingActive') .get('isDormancyTrackingActive')
.valueChanges.subscribe((isDormancyTrackingActive: any) => { .valueChanges.subscribe((isDormancyTrackingActive: any) => {
if (isDormancyTrackingActive) { if (isDormancyTrackingActive) {
this.savingProductSettingsForm.addControl('daysToInactive', new UntypedFormControl('', Validators.required)); this.savingProductSettingsForm.addControl(
this.savingProductSettingsForm.addControl('daysToDormancy', new UntypedFormControl('', Validators.required)); 'daysToInactive',
this.savingProductSettingsForm.addControl('daysToEscheat', new UntypedFormControl('', Validators.required)); 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 { } else {
this.savingProductSettingsForm.removeControl('daysToInactive'); this.savingProductSettingsForm.removeControl('daysToInactive');
this.savingProductSettingsForm.removeControl('daysToDormancy'); this.savingProductSettingsForm.removeControl('daysToDormancy');