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 }}
|
||||
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
|
||||
change={change}
|
||||
change={handleQuantityChange}
|
||||
submit={hasChanged ? submit : undefined}
|
||||
time={200}
|
||||
>
|
||||
|
@ -182,7 +189,8 @@ const OrderDraftDetailsProducts: React.FC<OrderDraftDetailsProductsProps> = prop
|
|||
/>
|
||||
)}
|
||||
</DebounceForm>
|
||||
)}
|
||||
);
|
||||
}}
|
||||
</Form>
|
||||
) : (
|
||||
<Skeleton />
|
||||
|
|
Loading…
Reference in a new issue