Use quantityAllocated

This commit is contained in:
dominik-zeglen 2020-04-21 13:13:39 +02:00
parent c4fdfd2498
commit 14d89d2ab9
5 changed files with 35 additions and 21 deletions

View file

@ -232,7 +232,7 @@ const OrderFulfillPage: React.FC<OrderFulfillPageProps> = ({
lineIndex
].value.reduce(
(quantityToFulfill, lineInput) =>
quantityToFulfill + lineInput.quantity,
quantityToFulfill + (lineInput.quantity || 0),
0
);
const overfulfill = remainingQuantity < quantityToFulfill;
@ -281,6 +281,10 @@ const OrderFulfillPage: React.FC<OrderFulfillPageProps> = ({
);
}
const availableQuantity =
warehouseStock.quantity -
warehouseStock.quantityAllocated;
return (
<TableCell className={classes.colQuantity}>
<div className={classes.colQuantityContent}>
@ -312,12 +316,11 @@ const OrderFulfillPage: React.FC<OrderFulfillPageProps> = ({
}
error={
overfulfill ||
formsetStock.quantity >
warehouseStock.quantity
formsetStock.quantity > availableQuantity
}
/>
<div className={classes.remainingQuantity}>
/ {warehouseStock.quantity}
/ {availableQuantity}
</div>
</div>
</TableCell>

View file

@ -37,25 +37,29 @@ export const orderToFulfill: OrderFulfillData_order = {
__typename: "Stock",
id: "U3RvY2s6NTIy",
warehouse: warehouseList[0],
quantity: 1217
quantity: 1217,
quantityAllocated: 10
},
{
__typename: "Stock",
id: "U3RvY2s6NTIx",
warehouse: warehouseList[1],
quantity: 1217
quantity: 1217,
quantityAllocated: 20
},
{
__typename: "Stock",
id: "U3RvY2s6NTIz",
warehouse: warehouseList[2],
quantity: 1217
quantity: 1217,
quantityAllocated: 4
},
{
__typename: "Stock",
id: "U3RvY2s6NTI0",
warehouse: warehouseList[3],
quantity: 1220
quantity: 1220,
quantityAllocated: 7
}
]
},
@ -93,19 +97,22 @@ export const orderToFulfill: OrderFulfillData_order = {
__typename: "Stock",
id: "U3RvY2s6NTI=",
warehouse: warehouseList[1],
quantity: 760
quantity: 760,
quantityAllocated: 2
},
{
__typename: "Stock",
id: "U3RvY2s6NTE=",
warehouse: warehouseList[2],
quantity: 760
quantity: 760,
quantityAllocated: 33
},
{
__typename: "Stock",
id: "U3RvY2s6NTM=",
warehouse: warehouseList[3],
quantity: 760
quantity: 760,
quantityAllocated: 4
}
]
},
@ -143,13 +150,15 @@ export const orderToFulfill: OrderFulfillData_order = {
__typename: "Stock",
id: "U3RvY2s6NTc=",
warehouse: warehouseList[0],
quantity: 587
quantity: 587,
quantityAllocated: 0
},
{
__typename: "Stock",
id: "U3RvY2s6NTY=",
warehouse: warehouseList[2],
quantity: 587
quantity: 587,
quantityAllocated: 1
}
]
},

View file

@ -365,6 +365,7 @@ const orderFulfillData = gql`
id
}
quantity
quantityAllocated
}
}
thumbnail(size: 64) {

View file

@ -27,6 +27,7 @@ export interface OrderFulfillData_order_lines_variant_stocks {
id: string;
warehouse: OrderFulfillData_order_lines_variant_stocks_warehouse;
quantity: number;
quantityAllocated: number;
}
export interface OrderFulfillData_order_lines_variant {

View file

@ -64486,7 +64486,7 @@ exports[`Storyshots Views / Orders / Fulfill order default 1`] = `
<div
class="OrderFulfillPage-remainingQuantity-id"
>
/ 1217
/ 1207
</div>
</div>
</td>
@ -64530,7 +64530,7 @@ exports[`Storyshots Views / Orders / Fulfill order default 1`] = `
<div
class="OrderFulfillPage-remainingQuantity-id"
>
/ 1217
/ 1197
</div>
</div>
</td>
@ -64574,7 +64574,7 @@ exports[`Storyshots Views / Orders / Fulfill order default 1`] = `
<div
class="OrderFulfillPage-remainingQuantity-id"
>
/ 1217
/ 1213
</div>
</div>
</td>
@ -64618,7 +64618,7 @@ exports[`Storyshots Views / Orders / Fulfill order default 1`] = `
<div
class="OrderFulfillPage-remainingQuantity-id"
>
/ 1220
/ 1213
</div>
</div>
</td>
@ -64712,7 +64712,7 @@ exports[`Storyshots Views / Orders / Fulfill order default 1`] = `
<div
class="OrderFulfillPage-remainingQuantity-id"
>
/ 760
/ 758
</div>
</div>
</td>
@ -64756,7 +64756,7 @@ exports[`Storyshots Views / Orders / Fulfill order default 1`] = `
<div
class="OrderFulfillPage-remainingQuantity-id"
>
/ 760
/ 727
</div>
</div>
</td>
@ -64800,7 +64800,7 @@ exports[`Storyshots Views / Orders / Fulfill order default 1`] = `
<div
class="OrderFulfillPage-remainingQuantity-id"
>
/ 760
/ 756
</div>
</div>
</td>
@ -64889,7 +64889,7 @@ exports[`Storyshots Views / Orders / Fulfill order default 1`] = `
<div
class="OrderFulfillPage-remainingQuantity-id"
>
/ 587
/ 586
</div>
</div>
</td>