Fix order draft negative quantity
This commit is contained in:
parent
1fda14d2aa
commit
484780dcc3
1 changed files with 27 additions and 19 deletions
|
@ -164,9 +164,16 @@ const OrderDraftDetailsProducts: React.FC<OrderDraftDetailsProductsProps> = prop
|
||||||
initial={{ quantity: line.quantity }}
|
initial={{ quantity: line.quantity }}
|
||||||
onSubmit={data => onOrderLineChange(line.id, data)}
|
onSubmit={data => onOrderLineChange(line.id, data)}
|
||||||
>
|
>
|
||||||
{({ change, data, hasChanged, submit }) => (
|
{({ change, data, hasChanged, submit }) => {
|
||||||
|
const handleQuantityChange = event => {
|
||||||
|
if (/^\d*(\.\d+)?$/.test(event.target.value)) {
|
||||||
|
change(event);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
<DebounceForm
|
<DebounceForm
|
||||||
change={change}
|
change={handleQuantityChange}
|
||||||
submit={hasChanged ? submit : undefined}
|
submit={hasChanged ? submit : undefined}
|
||||||
time={200}
|
time={200}
|
||||||
>
|
>
|
||||||
|
@ -182,7 +189,8 @@ const OrderDraftDetailsProducts: React.FC<OrderDraftDetailsProductsProps> = prop
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</DebounceForm>
|
</DebounceForm>
|
||||||
)}
|
);
|
||||||
|
}}
|
||||||
</Form>
|
</Form>
|
||||||
) : (
|
) : (
|
||||||
<Skeleton />
|
<Skeleton />
|
||||||
|
|
Loading…
Reference in a new issue