Use quantityAllocated
This commit is contained in:
parent
c4fdfd2498
commit
14d89d2ab9
5 changed files with 35 additions and 21 deletions
|
@ -232,7 +232,7 @@ const OrderFulfillPage: React.FC<OrderFulfillPageProps> = ({
|
||||||
lineIndex
|
lineIndex
|
||||||
].value.reduce(
|
].value.reduce(
|
||||||
(quantityToFulfill, lineInput) =>
|
(quantityToFulfill, lineInput) =>
|
||||||
quantityToFulfill + lineInput.quantity,
|
quantityToFulfill + (lineInput.quantity || 0),
|
||||||
0
|
0
|
||||||
);
|
);
|
||||||
const overfulfill = remainingQuantity < quantityToFulfill;
|
const overfulfill = remainingQuantity < quantityToFulfill;
|
||||||
|
@ -281,6 +281,10 @@ const OrderFulfillPage: React.FC<OrderFulfillPageProps> = ({
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const availableQuantity =
|
||||||
|
warehouseStock.quantity -
|
||||||
|
warehouseStock.quantityAllocated;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TableCell className={classes.colQuantity}>
|
<TableCell className={classes.colQuantity}>
|
||||||
<div className={classes.colQuantityContent}>
|
<div className={classes.colQuantityContent}>
|
||||||
|
@ -312,12 +316,11 @@ const OrderFulfillPage: React.FC<OrderFulfillPageProps> = ({
|
||||||
}
|
}
|
||||||
error={
|
error={
|
||||||
overfulfill ||
|
overfulfill ||
|
||||||
formsetStock.quantity >
|
formsetStock.quantity > availableQuantity
|
||||||
warehouseStock.quantity
|
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<div className={classes.remainingQuantity}>
|
<div className={classes.remainingQuantity}>
|
||||||
/ {warehouseStock.quantity}
|
/ {availableQuantity}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
|
|
|
@ -37,25 +37,29 @@ export const orderToFulfill: OrderFulfillData_order = {
|
||||||
__typename: "Stock",
|
__typename: "Stock",
|
||||||
id: "U3RvY2s6NTIy",
|
id: "U3RvY2s6NTIy",
|
||||||
warehouse: warehouseList[0],
|
warehouse: warehouseList[0],
|
||||||
quantity: 1217
|
quantity: 1217,
|
||||||
|
quantityAllocated: 10
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
__typename: "Stock",
|
__typename: "Stock",
|
||||||
id: "U3RvY2s6NTIx",
|
id: "U3RvY2s6NTIx",
|
||||||
warehouse: warehouseList[1],
|
warehouse: warehouseList[1],
|
||||||
quantity: 1217
|
quantity: 1217,
|
||||||
|
quantityAllocated: 20
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
__typename: "Stock",
|
__typename: "Stock",
|
||||||
id: "U3RvY2s6NTIz",
|
id: "U3RvY2s6NTIz",
|
||||||
warehouse: warehouseList[2],
|
warehouse: warehouseList[2],
|
||||||
quantity: 1217
|
quantity: 1217,
|
||||||
|
quantityAllocated: 4
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
__typename: "Stock",
|
__typename: "Stock",
|
||||||
id: "U3RvY2s6NTI0",
|
id: "U3RvY2s6NTI0",
|
||||||
warehouse: warehouseList[3],
|
warehouse: warehouseList[3],
|
||||||
quantity: 1220
|
quantity: 1220,
|
||||||
|
quantityAllocated: 7
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -93,19 +97,22 @@ export const orderToFulfill: OrderFulfillData_order = {
|
||||||
__typename: "Stock",
|
__typename: "Stock",
|
||||||
id: "U3RvY2s6NTI=",
|
id: "U3RvY2s6NTI=",
|
||||||
warehouse: warehouseList[1],
|
warehouse: warehouseList[1],
|
||||||
quantity: 760
|
quantity: 760,
|
||||||
|
quantityAllocated: 2
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
__typename: "Stock",
|
__typename: "Stock",
|
||||||
id: "U3RvY2s6NTE=",
|
id: "U3RvY2s6NTE=",
|
||||||
warehouse: warehouseList[2],
|
warehouse: warehouseList[2],
|
||||||
quantity: 760
|
quantity: 760,
|
||||||
|
quantityAllocated: 33
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
__typename: "Stock",
|
__typename: "Stock",
|
||||||
id: "U3RvY2s6NTM=",
|
id: "U3RvY2s6NTM=",
|
||||||
warehouse: warehouseList[3],
|
warehouse: warehouseList[3],
|
||||||
quantity: 760
|
quantity: 760,
|
||||||
|
quantityAllocated: 4
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -143,13 +150,15 @@ export const orderToFulfill: OrderFulfillData_order = {
|
||||||
__typename: "Stock",
|
__typename: "Stock",
|
||||||
id: "U3RvY2s6NTc=",
|
id: "U3RvY2s6NTc=",
|
||||||
warehouse: warehouseList[0],
|
warehouse: warehouseList[0],
|
||||||
quantity: 587
|
quantity: 587,
|
||||||
|
quantityAllocated: 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
__typename: "Stock",
|
__typename: "Stock",
|
||||||
id: "U3RvY2s6NTY=",
|
id: "U3RvY2s6NTY=",
|
||||||
warehouse: warehouseList[2],
|
warehouse: warehouseList[2],
|
||||||
quantity: 587
|
quantity: 587,
|
||||||
|
quantityAllocated: 1
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
@ -365,6 +365,7 @@ const orderFulfillData = gql`
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
quantity
|
quantity
|
||||||
|
quantityAllocated
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
thumbnail(size: 64) {
|
thumbnail(size: 64) {
|
||||||
|
|
|
@ -27,6 +27,7 @@ export interface OrderFulfillData_order_lines_variant_stocks {
|
||||||
id: string;
|
id: string;
|
||||||
warehouse: OrderFulfillData_order_lines_variant_stocks_warehouse;
|
warehouse: OrderFulfillData_order_lines_variant_stocks_warehouse;
|
||||||
quantity: number;
|
quantity: number;
|
||||||
|
quantityAllocated: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface OrderFulfillData_order_lines_variant {
|
export interface OrderFulfillData_order_lines_variant {
|
||||||
|
|
|
@ -64486,7 +64486,7 @@ exports[`Storyshots Views / Orders / Fulfill order default 1`] = `
|
||||||
<div
|
<div
|
||||||
class="OrderFulfillPage-remainingQuantity-id"
|
class="OrderFulfillPage-remainingQuantity-id"
|
||||||
>
|
>
|
||||||
/ 1217
|
/ 1207
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
@ -64530,7 +64530,7 @@ exports[`Storyshots Views / Orders / Fulfill order default 1`] = `
|
||||||
<div
|
<div
|
||||||
class="OrderFulfillPage-remainingQuantity-id"
|
class="OrderFulfillPage-remainingQuantity-id"
|
||||||
>
|
>
|
||||||
/ 1217
|
/ 1197
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
@ -64574,7 +64574,7 @@ exports[`Storyshots Views / Orders / Fulfill order default 1`] = `
|
||||||
<div
|
<div
|
||||||
class="OrderFulfillPage-remainingQuantity-id"
|
class="OrderFulfillPage-remainingQuantity-id"
|
||||||
>
|
>
|
||||||
/ 1217
|
/ 1213
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
@ -64618,7 +64618,7 @@ exports[`Storyshots Views / Orders / Fulfill order default 1`] = `
|
||||||
<div
|
<div
|
||||||
class="OrderFulfillPage-remainingQuantity-id"
|
class="OrderFulfillPage-remainingQuantity-id"
|
||||||
>
|
>
|
||||||
/ 1220
|
/ 1213
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
@ -64712,7 +64712,7 @@ exports[`Storyshots Views / Orders / Fulfill order default 1`] = `
|
||||||
<div
|
<div
|
||||||
class="OrderFulfillPage-remainingQuantity-id"
|
class="OrderFulfillPage-remainingQuantity-id"
|
||||||
>
|
>
|
||||||
/ 760
|
/ 758
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
@ -64756,7 +64756,7 @@ exports[`Storyshots Views / Orders / Fulfill order default 1`] = `
|
||||||
<div
|
<div
|
||||||
class="OrderFulfillPage-remainingQuantity-id"
|
class="OrderFulfillPage-remainingQuantity-id"
|
||||||
>
|
>
|
||||||
/ 760
|
/ 727
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
@ -64800,7 +64800,7 @@ exports[`Storyshots Views / Orders / Fulfill order default 1`] = `
|
||||||
<div
|
<div
|
||||||
class="OrderFulfillPage-remainingQuantity-id"
|
class="OrderFulfillPage-remainingQuantity-id"
|
||||||
>
|
>
|
||||||
/ 760
|
/ 756
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
@ -64889,7 +64889,7 @@ exports[`Storyshots Views / Orders / Fulfill order default 1`] = `
|
||||||
<div
|
<div
|
||||||
class="OrderFulfillPage-remainingQuantity-id"
|
class="OrderFulfillPage-remainingQuantity-id"
|
||||||
>
|
>
|
||||||
/ 587
|
/ 586
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
|
Loading…
Reference in a new issue