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