diff --git a/src/app/organization/fund-mapping/fund-mapping.component.html b/src/app/organization/fund-mapping/fund-mapping.component.html index f8ad9abb8..7673bc488 100644 --- a/src/app/organization/fund-mapping/fund-mapping.component.html +++ b/src/app/organization/fund-mapping/fund-mapping.component.html @@ -132,6 +132,7 @@ type="number" matInput required + min="0" formControlName="minOutStandingAmountPercentage" placeholder="{{ 'labels.inputs.Minimum Value' | translate }}" /> @@ -150,6 +151,7 @@ type="number" matInput required + min="0" formControlName="outStandingAmountPercentage" placeholder="{{ 'labels.inputs.Comparison Value' | translate }}" /> @@ -168,6 +170,7 @@ type="number" matInput required + min="0" formControlName="maxOutStandingAmountPercentage" placeholder="{{ 'labels.inputs.Maximum Value' | translate }}" /> @@ -213,6 +216,7 @@ type="number" matInput required + min="0" formControlName="minOutstandingAmount" placeholder="{{ 'labels.inputs.Minimum Value' | translate }}" /> @@ -231,6 +235,7 @@ type="number" matInput required + min="0" formControlName="outstandingAmount" placeholder="{{ 'labels.inputs.Comparison Value' | translate }}" /> @@ -249,6 +254,7 @@ type="number" matInput required + min="0" formControlName="maxOutstandingAmount" placeholder="{{ 'labels.inputs.Maximum Value' | translate }}" /> diff --git a/src/app/organization/fund-mapping/fund-mapping.component.ts b/src/app/organization/fund-mapping/fund-mapping.component.ts index 775d1ea6e..cfa86da2e 100644 --- a/src/app/organization/fund-mapping/fund-mapping.component.ts +++ b/src/app/organization/fund-mapping/fund-mapping.component.ts @@ -186,17 +186,26 @@ export class FundMappingComponent implements OnInit { if (_value === 'between') { this.fundMappingForm.addControl( 'minOutStandingAmountPercentage', - new UntypedFormControl('', Validators.required) + new UntypedFormControl('', [ + Validators.required, + Validators.min(0) + ]) ); this.fundMappingForm.addControl( 'maxOutStandingAmountPercentage', - new UntypedFormControl('', Validators.required) + new UntypedFormControl('', [ + Validators.required, + Validators.min(0) + ]) ); this.fundMappingForm.removeControl('outStandingAmountPercentage'); } else { this.fundMappingForm.addControl( 'outStandingAmountPercentage', - new UntypedFormControl('', Validators.required) + new UntypedFormControl('', [ + Validators.required, + Validators.min(0) + ]) ); this.fundMappingForm.removeControl('minOutStandingAmountPercentage'); this.fundMappingForm.removeControl('maxOutStandingAmountPercentage'); @@ -216,11 +225,29 @@ export class FundMappingComponent implements OnInit { this.fundMappingForm.addControl('outstandingAmountCondition', new UntypedFormControl('', Validators.required)); this.fundMappingForm.get('outstandingAmountCondition').valueChanges.subscribe((_value: string) => { if (_value === 'between') { - this.fundMappingForm.addControl('minOutstandingAmount', new UntypedFormControl('', Validators.required)); - this.fundMappingForm.addControl('maxOutstandingAmount', new UntypedFormControl('', Validators.required)); + this.fundMappingForm.addControl( + 'minOutstandingAmount', + new UntypedFormControl('', [ + Validators.required, + Validators.min(0) + ]) + ); + this.fundMappingForm.addControl( + 'maxOutstandingAmount', + new UntypedFormControl('', [ + Validators.required, + Validators.min(0) + ]) + ); this.fundMappingForm.removeControl('outstandingAmount'); } else { - this.fundMappingForm.addControl('outstandingAmount', new UntypedFormControl('', Validators.required)); + this.fundMappingForm.addControl( + 'outstandingAmount', + new UntypedFormControl('', [ + Validators.required, + Validators.min(0) + ]) + ); this.fundMappingForm.removeControl('minOutstandingAmount'); this.fundMappingForm.removeControl('maxOutstandingAmount'); }