Fix order draft negative quantity
This commit is contained in:
parent
1fda14d2aa
commit
484780dcc3
1 changed files with 27 additions and 19 deletions
|
@ -164,25 +164,33 @@ 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 }) => {
|
||||||
<DebounceForm
|
const handleQuantityChange = event => {
|
||||||
change={change}
|
if (/^\d*(\.\d+)?$/.test(event.target.value)) {
|
||||||
submit={hasChanged ? submit : undefined}
|
change(event);
|
||||||
time={200}
|
}
|
||||||
>
|
};
|
||||||
{debounce => (
|
|
||||||
<TextField
|
return (
|
||||||
className={classes.quantityField}
|
<DebounceForm
|
||||||
fullWidth
|
change={handleQuantityChange}
|
||||||
name="quantity"
|
submit={hasChanged ? submit : undefined}
|
||||||
type="number"
|
time={200}
|
||||||
value={data.quantity}
|
>
|
||||||
onChange={debounce}
|
{debounce => (
|
||||||
onBlur={submit}
|
<TextField
|
||||||
/>
|
className={classes.quantityField}
|
||||||
)}
|
fullWidth
|
||||||
</DebounceForm>
|
name="quantity"
|
||||||
)}
|
type="number"
|
||||||
|
value={data.quantity}
|
||||||
|
onChange={debounce}
|
||||||
|
onBlur={submit}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</DebounceForm>
|
||||||
|
);
|
||||||
|
}}
|
||||||
</Form>
|
</Form>
|
||||||
) : (
|
) : (
|
||||||
<Skeleton />
|
<Skeleton />
|
||||||
|
|
Loading…
Reference in a new issue