Fix amount input
This commit is contained in:
parent
0d30a8135c
commit
7c1cd96691
@ -52,6 +52,11 @@ export function NewMovementWidget(
|
||||
return;
|
||||
}
|
||||
|
||||
if (!amount && !p.isInbox) {
|
||||
alert(`Please specify ${entity} amount!`);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
if (!p.isInbox) {
|
||||
await MovementApi.Create({
|
||||
|
@ -25,7 +25,7 @@ export function AmountInput(p: {
|
||||
value = "-";
|
||||
} else if (state === InputState.StartDecimal) {
|
||||
value = String(p.value) + ".";
|
||||
} else if (!Number.isNaN(p.value)) {
|
||||
} else if (!Number.isNaN(p.value) && p.value !== 0) {
|
||||
value = String(p.value);
|
||||
}
|
||||
|
||||
@ -47,7 +47,7 @@ export function AmountInput(p: {
|
||||
const parsed = Number(a);
|
||||
|
||||
// Empty field
|
||||
if (a?.length === 0) p.onValueChange(NaN);
|
||||
if (a?.length === 0 || a === undefined) p.onValueChange(NaN);
|
||||
// Input number
|
||||
else if ((a?.length ?? 0) > 0 && !Number.isNaN(parsed))
|
||||
p.onValueChange(parsed);
|
||||
|
Loading…
x
Reference in New Issue
Block a user