Fix fulfillment page if not tracking stock (#2290)
* Fix fulfillment page if not tracking stock * Update snapshots and messages
This commit is contained in:
parent
884ea78cf5
commit
4ee5eb7795
6 changed files with 785 additions and 385 deletions
|
@ -3810,6 +3810,10 @@
|
||||||
"context": "unassign attribute from product type, button",
|
"context": "unassign attribute from product type, button",
|
||||||
"string": "Unassign"
|
"string": "Unassign"
|
||||||
},
|
},
|
||||||
|
"SBb6Ej": {
|
||||||
|
"context": "select a warehouse to fulfill product from",
|
||||||
|
"string": "Select warehouse..."
|
||||||
|
},
|
||||||
"SHm7ee": {
|
"SHm7ee": {
|
||||||
"string": "Search by product name, attribute, product type etc..."
|
"string": "Search by product name, attribute, product type etc..."
|
||||||
},
|
},
|
||||||
|
|
|
@ -58,7 +58,7 @@ export const OrderFulfillLine: React.FC<OrderFulfillLineProps> = props => {
|
||||||
|
|
||||||
const isStockExceeded = lineFormQuantity > availableQuantity;
|
const isStockExceeded = lineFormQuantity > availableQuantity;
|
||||||
|
|
||||||
if (!line || !lineFormWarehouse) {
|
if (!line) {
|
||||||
return (
|
return (
|
||||||
<TableRow key={lineIndex}>
|
<TableRow key={lineIndex}>
|
||||||
<TableCellAvatar className={classes.colName}>
|
<TableCellAvatar className={classes.colName}>
|
||||||
|
@ -156,7 +156,11 @@ export const OrderFulfillLine: React.FC<OrderFulfillLineProps> = props => {
|
||||||
</TableCell>
|
</TableCell>
|
||||||
)}
|
)}
|
||||||
<TableCell className={classes.colStock} key="total">
|
<TableCell className={classes.colStock} key="total">
|
||||||
{isPreorder || isDeletedVariant ? undefined : availableQuantity}
|
{lineFormWarehouse
|
||||||
|
? isPreorder || isDeletedVariant
|
||||||
|
? undefined
|
||||||
|
: availableQuantity
|
||||||
|
: "-"}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell className={classes.colWarehouse}>
|
<TableCell className={classes.colWarehouse}>
|
||||||
<IconButton
|
<IconButton
|
||||||
|
@ -165,9 +169,13 @@ export const OrderFulfillLine: React.FC<OrderFulfillLineProps> = props => {
|
||||||
data-test-id="select-warehouse-button"
|
data-test-id="select-warehouse-button"
|
||||||
>
|
>
|
||||||
<div className={classes.warehouseButtonContent}>
|
<div className={classes.warehouseButtonContent}>
|
||||||
<div className={classes.warehouseButtonContentText}>
|
<Typography
|
||||||
{lineFormWarehouse?.name ?? <Skeleton />}
|
color={lineFormWarehouse ? "textPrimary" : "textSecondary"}
|
||||||
</div>
|
className={classes.warehouseButtonContentText}
|
||||||
|
>
|
||||||
|
{lineFormWarehouse?.name ??
|
||||||
|
intl.formatMessage(messages.selectWarehouse)}
|
||||||
|
</Typography>
|
||||||
<ChevronIcon />
|
<ChevronIcon />
|
||||||
</div>
|
</div>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
|
|
|
@ -17,4 +17,9 @@ export const messages = defineMessages({
|
||||||
id: "W5hb5H",
|
id: "W5hb5H",
|
||||||
description: "warehouse input",
|
description: "warehouse input",
|
||||||
},
|
},
|
||||||
|
selectWarehouse: {
|
||||||
|
defaultMessage: "Select warehouse...",
|
||||||
|
id: "SBb6Ej",
|
||||||
|
description: "select a warehouse to fulfill product from",
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -62,6 +62,7 @@ export const useStyles = makeStyles(
|
||||||
warehouseButtonContentText: {
|
warehouseButtonContentText: {
|
||||||
overflow: "hidden",
|
overflow: "hidden",
|
||||||
textOverflow: "ellipsis",
|
textOverflow: "ellipsis",
|
||||||
|
whiteSpace: "nowrap",
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
{ name: "OrderFulfillLine" },
|
{ name: "OrderFulfillLine" },
|
||||||
|
|
|
@ -163,6 +163,10 @@ const OrderFulfillPage: React.FC<OrderFulfillPageProps> = props => {
|
||||||
!shopSettings?.fulfillmentAllowUnpaid &&
|
!shopSettings?.fulfillmentAllowUnpaid &&
|
||||||
!order?.isPaid;
|
!order?.isPaid;
|
||||||
|
|
||||||
|
const areWarehousesSet = formsetData.every(line =>
|
||||||
|
line.value.every(v => v.warehouse),
|
||||||
|
);
|
||||||
|
|
||||||
const shouldEnableSave = () => {
|
const shouldEnableSave = () => {
|
||||||
if (!order || loading) {
|
if (!order || loading) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -186,7 +190,7 @@ const OrderFulfillPage: React.FC<OrderFulfillPageProps> = props => {
|
||||||
return formQuantityFulfilled > quantityToFulfill;
|
return formQuantityFulfilled > quantityToFulfill;
|
||||||
});
|
});
|
||||||
|
|
||||||
return !overfulfill && isAtLeastOneFulfilled;
|
return !overfulfill && isAtLeastOneFulfilled && areWarehousesSet;
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -261,7 +265,7 @@ const OrderFulfillPage: React.FC<OrderFulfillPageProps> = props => {
|
||||||
lineId: line.id,
|
lineId: line.id,
|
||||||
warehouseId:
|
warehouseId:
|
||||||
formsetData[lineIndex]?.value?.[0]?.warehouse
|
formsetData[lineIndex]?.value?.[0]?.warehouse
|
||||||
.id,
|
?.id,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue