WEB-566 Validation Missing: Negative Values Accepted in Currency in multiples of ,Installment in multiples of and Decimal Places Fields (#2981)

This commit is contained in:
Soni Jay
2026-01-11 09:37:49 -06:00
committed by GitHub
parent 8d8d79c0c2
commit dc1f75bbb8
2 changed files with 45 additions and 7 deletions
@@ -31,30 +31,53 @@
<mat-label>{{ 'labels.inputs.Decimal Places' | translate }}</mat-label>
<input
type="number"
min="0"
matTooltip="{{ 'tooltips.Number of decimal places to be used to track and report' | translate }}"
matInput
formControlName="digitsAfterDecimal"
required
/>
<mat-error>
<mat-error *ngIf="loanProductCurrencyForm.get('digitsAfterDecimal')?.hasError('required')">
{{ 'labels.inputs.Decimal Places' | translate }} {{ 'labels.commons.is' | translate }}
<strong>{{ 'labels.commons.required' | translate }}</strong>
</mat-error>
<mat-error *ngIf="loanProductCurrencyForm.get('digitsAfterDecimal')?.hasError('min')">
{{ 'labels.inputs.Decimal Places' | translate }} {{ 'labels.commons.Minimum Value must be' | translate }}
<strong>0</strong>
</mat-error>
</mat-form-field>
<mat-form-field class="flex-48">
<mat-label>{{ 'labels.inputs.Currency in multiples of' | translate }}</mat-label>
<input
type="number"
min="1"
matInput
matTooltip="{{ 'tooltips.Enter multiples of currency value' | translate }}"
formControlName="inMultiplesOf"
required
/>
<mat-error *ngIf="loanProductCurrencyForm.get('inMultiplesOf')?.hasError('required')">
{{ 'labels.inputs.Currency in multiples of' | translate }} {{ 'labels.commons.is' | translate }}
<strong>{{ 'labels.commons.required' | translate }}</strong>
</mat-error>
<mat-error *ngIf="loanProductCurrencyForm.get('inMultiplesOf')?.hasError('min')">
{{ 'labels.inputs.Currency in multiples of' | translate }}
{{ 'labels.commons.Minimum Value must be' | translate }} <strong>1</strong>
</mat-error>
</mat-form-field>
<mat-form-field class="flex-48">
<mat-label>{{ 'labels.inputs.Installment in multiples of' | translate }}</mat-label>
<input type="number" matInput formControlName="installmentAmountInMultiplesOf" />
<input type="number" min="1" matInput formControlName="installmentAmountInMultiplesOf" required />
<mat-error *ngIf="loanProductCurrencyForm.get('installmentAmountInMultiplesOf')?.hasError('required')">
{{ 'labels.inputs.Installment in multiples of' | translate }} {{ 'labels.commons.is' | translate }}
<strong>{{ 'labels.commons.required' | translate }}</strong>
</mat-error>
<mat-error *ngIf="loanProductCurrencyForm.get('installmentAmountInMultiplesOf')?.hasError('min')">
{{ 'labels.inputs.Installment in multiples of' | translate }}
{{ 'labels.commons.Minimum Value must be' | translate }} <strong>1</strong>
</mat-error>
</mat-form-field>
</div>
@@ -45,8 +45,8 @@ export class LoanProductCurrencyStepComponent implements OnInit {
digitsAfterDecimal: this.loanProductsTemplate.currency.decimalPlaces
? this.loanProductsTemplate.currency.decimalPlaces
: 2,
inMultiplesOf: this.loanProductsTemplate.currency.inMultiplesOf,
installmentAmountInMultiplesOf: this.loanProductsTemplate.installmentAmountInMultiplesOf
inMultiplesOf: this.loanProductsTemplate.currency.inMultiplesOf ?? 1,
installmentAmountInMultiplesOf: this.loanProductsTemplate.installmentAmountInMultiplesOf ?? 1
});
}
@@ -58,10 +58,25 @@ export class LoanProductCurrencyStepComponent implements OnInit {
],
digitsAfterDecimal: [
2,
Validators.required
[
Validators.required,
Validators.min(0)
]
],
inMultiplesOf: '',
installmentAmountInMultiplesOf: ''
inMultiplesOf: [
1,
[
Validators.required,
Validators.min(1)
]
],
installmentAmountInMultiplesOf: [
'',
[
Validators.required,
Validators.min(1)
]
]
});
}