Validate total amount
This commit is contained in:
@@ -18,8 +18,18 @@ export default class AddReimbursementComponent extends Component {
|
|||||||
@tracked expenses = A([]);
|
@tracked expenses = A([]);
|
||||||
@tracked expenseFormVisible = true;
|
@tracked expenseFormVisible = true;
|
||||||
|
|
||||||
|
get isValidTotal () {
|
||||||
|
const amount = parseFloat(this.total);
|
||||||
|
if (Number.isNaN(amount)) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return amount > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
get submitButtonEnabled () {
|
get submitButtonEnabled () {
|
||||||
return this.expenses.length > 0;
|
return this.isValidTotal &&
|
||||||
|
(this.expenses.length > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
get submitButtonDisabled () {
|
get submitButtonDisabled () {
|
||||||
|
|||||||
Reference in New Issue
Block a user