WEB-448 Credit Amount Field Allows Invalid Values (Zero and Negative) in Journal Entry Creation
This commit is contained in:
@@ -51,7 +51,14 @@
|
|||||||
|
|
||||||
<mat-form-field class="flex-43">
|
<mat-form-field class="flex-43">
|
||||||
<mat-label>{{ 'labels.inputs.Debit Amount' | translate }}</mat-label>
|
<mat-label>{{ 'labels.inputs.Debit Amount' | translate }}</mat-label>
|
||||||
<input type="number" matInput required formControlName="amount" />
|
<input
|
||||||
|
type="number"
|
||||||
|
matInput
|
||||||
|
required
|
||||||
|
formControlName="amount"
|
||||||
|
min="1"
|
||||||
|
(input)="onAmountInput($event)"
|
||||||
|
/>
|
||||||
<mat-error *ngIf="debits.at(i).controls.amount.hasError('required')">
|
<mat-error *ngIf="debits.at(i).controls.amount.hasError('required')">
|
||||||
{{ 'labels.inputs.Debit Amount' | translate }} {{ 'labels.commons.is' | translate }}
|
{{ 'labels.inputs.Debit Amount' | translate }} {{ 'labels.commons.is' | translate }}
|
||||||
<strong>{{ 'labels.commons.required' | translate }}</strong>
|
<strong>{{ 'labels.commons.required' | translate }}</strong>
|
||||||
@@ -92,7 +99,14 @@
|
|||||||
|
|
||||||
<mat-form-field class="flex-43">
|
<mat-form-field class="flex-43">
|
||||||
<mat-label>{{ 'labels.inputs.Credit Amount' | translate }}</mat-label>
|
<mat-label>{{ 'labels.inputs.Credit Amount' | translate }}</mat-label>
|
||||||
<input type="number" matInput required formControlName="amount" />
|
<input
|
||||||
|
type="number"
|
||||||
|
matInput
|
||||||
|
required
|
||||||
|
formControlName="amount"
|
||||||
|
min="1"
|
||||||
|
(input)="onAmountInput($event)"
|
||||||
|
/>
|
||||||
<mat-error *ngIf="credits.at(i).controls.amount.hasError('required')">
|
<mat-error *ngIf="credits.at(i).controls.amount.hasError('required')">
|
||||||
{{ 'labels.inputs.Credit Amount' | translate }} {{ 'labels.commons.is' | translate }}
|
{{ 'labels.inputs.Credit Amount' | translate }} {{ 'labels.commons.is' | translate }}
|
||||||
<strong>{{ 'labels.commons.required' | translate }}</strong>
|
<strong>{{ 'labels.commons.required' | translate }}</strong>
|
||||||
|
|||||||
@@ -34,6 +34,11 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
|||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class CreateJournalEntryComponent implements OnInit, AfterViewInit {
|
export class CreateJournalEntryComponent implements OnInit, AfterViewInit {
|
||||||
|
onCreditAmountInput(event: any) {
|
||||||
|
if (event.target.value < 1) {
|
||||||
|
event.target.value = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
/** Minimum transaction date allowed. */
|
/** Minimum transaction date allowed. */
|
||||||
minDate = new Date(2000, 0, 1);
|
minDate = new Date(2000, 0, 1);
|
||||||
/** Maximum transaction date allowed. */
|
/** Maximum transaction date allowed. */
|
||||||
@@ -140,7 +145,9 @@ export class CreateJournalEntryComponent implements OnInit, AfterViewInit {
|
|||||||
],
|
],
|
||||||
amount: [
|
amount: [
|
||||||
'',
|
'',
|
||||||
Validators.required
|
[
|
||||||
|
Validators.required,
|
||||||
|
Validators.min(1)]
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user