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> <mat-label>{{ 'labels.inputs.Decimal Places' | translate }}</mat-label>
<input <input
type="number" type="number"
min="0"
matTooltip="{{ 'tooltips.Number of decimal places to be used to track and report' | translate }}" matTooltip="{{ 'tooltips.Number of decimal places to be used to track and report' | translate }}"
matInput matInput
formControlName="digitsAfterDecimal" formControlName="digitsAfterDecimal"
required required
/> />
<mat-error> <mat-error *ngIf="loanProductCurrencyForm.get('digitsAfterDecimal')?.hasError('required')">
{{ 'labels.inputs.Decimal Places' | translate }} {{ 'labels.commons.is' | translate }} {{ 'labels.inputs.Decimal Places' | translate }} {{ 'labels.commons.is' | translate }}
<strong>{{ 'labels.commons.required' | translate }}</strong> <strong>{{ 'labels.commons.required' | translate }}</strong>
</mat-error> </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>
<mat-form-field class="flex-48"> <mat-form-field class="flex-48">
<mat-label>{{ 'labels.inputs.Currency in multiples of' | translate }}</mat-label> <mat-label>{{ 'labels.inputs.Currency in multiples of' | translate }}</mat-label>
<input <input
type="number" type="number"
min="1"
matInput matInput
matTooltip="{{ 'tooltips.Enter multiples of currency value' | translate }}" matTooltip="{{ 'tooltips.Enter multiples of currency value' | translate }}"
formControlName="inMultiplesOf" 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>
<mat-form-field class="flex-48"> <mat-form-field class="flex-48">
<mat-label>{{ 'labels.inputs.Installment in multiples of' | translate }}</mat-label> <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> </mat-form-field>
</div> </div>
@@ -45,8 +45,8 @@ export class LoanProductCurrencyStepComponent implements OnInit {
digitsAfterDecimal: this.loanProductsTemplate.currency.decimalPlaces digitsAfterDecimal: this.loanProductsTemplate.currency.decimalPlaces
? this.loanProductsTemplate.currency.decimalPlaces ? this.loanProductsTemplate.currency.decimalPlaces
: 2, : 2,
inMultiplesOf: this.loanProductsTemplate.currency.inMultiplesOf, inMultiplesOf: this.loanProductsTemplate.currency.inMultiplesOf ?? 1,
installmentAmountInMultiplesOf: this.loanProductsTemplate.installmentAmountInMultiplesOf installmentAmountInMultiplesOf: this.loanProductsTemplate.installmentAmountInMultiplesOf ?? 1
}); });
} }
@@ -58,10 +58,25 @@ export class LoanProductCurrencyStepComponent implements OnInit {
], ],
digitsAfterDecimal: [ digitsAfterDecimal: [
2, 2,
Validators.required [
Validators.required,
Validators.min(0)
]
], ],
inMultiplesOf: '', inMultiplesOf: [
installmentAmountInMultiplesOf: '' 1,
[
Validators.required,
Validators.min(1)
]
],
installmentAmountInMultiplesOf: [
'',
[
Validators.required,
Validators.min(1)
]
]
}); });
} }