diff --git a/locale/defaultMessages.json b/locale/defaultMessages.json index 72fa802df..eed47724e 100644 --- a/locale/defaultMessages.json +++ b/locale/defaultMessages.json @@ -3810,6 +3810,10 @@ "context": "unassign attribute from product type, button", "string": "Unassign" }, + "SBb6Ej": { + "context": "select a warehouse to fulfill product from", + "string": "Select warehouse..." + }, "SHm7ee": { "string": "Search by product name, attribute, product type etc..." }, diff --git a/src/orders/components/OrderFulfillLine/OrderFulfillLine.tsx b/src/orders/components/OrderFulfillLine/OrderFulfillLine.tsx index e68517fcc..e5c7a7184 100644 --- a/src/orders/components/OrderFulfillLine/OrderFulfillLine.tsx +++ b/src/orders/components/OrderFulfillLine/OrderFulfillLine.tsx @@ -58,7 +58,7 @@ export const OrderFulfillLine: React.FC = props => { const isStockExceeded = lineFormQuantity > availableQuantity; - if (!line || !lineFormWarehouse) { + if (!line) { return ( @@ -156,7 +156,11 @@ export const OrderFulfillLine: React.FC = props => { )} - {isPreorder || isDeletedVariant ? undefined : availableQuantity} + {lineFormWarehouse + ? isPreorder || isDeletedVariant + ? undefined + : availableQuantity + : "-"} = props => { data-test-id="select-warehouse-button" >
-
- {lineFormWarehouse?.name ?? } -
+ + {lineFormWarehouse?.name ?? + intl.formatMessage(messages.selectWarehouse)} +
diff --git a/src/orders/components/OrderFulfillLine/messages.ts b/src/orders/components/OrderFulfillLine/messages.ts index 97663a02d..716a951b4 100644 --- a/src/orders/components/OrderFulfillLine/messages.ts +++ b/src/orders/components/OrderFulfillLine/messages.ts @@ -17,4 +17,9 @@ export const messages = defineMessages({ id: "W5hb5H", description: "warehouse input", }, + selectWarehouse: { + defaultMessage: "Select warehouse...", + id: "SBb6Ej", + description: "select a warehouse to fulfill product from", + }, }); diff --git a/src/orders/components/OrderFulfillLine/styles.ts b/src/orders/components/OrderFulfillLine/styles.ts index 29f4df9de..a2a0f7189 100644 --- a/src/orders/components/OrderFulfillLine/styles.ts +++ b/src/orders/components/OrderFulfillLine/styles.ts @@ -62,6 +62,7 @@ export const useStyles = makeStyles( warehouseButtonContentText: { overflow: "hidden", textOverflow: "ellipsis", + whiteSpace: "nowrap", }, }), { name: "OrderFulfillLine" }, diff --git a/src/orders/components/OrderFulfillPage/OrderFulfillPage.tsx b/src/orders/components/OrderFulfillPage/OrderFulfillPage.tsx index 1a39f24b8..7c84c11a5 100644 --- a/src/orders/components/OrderFulfillPage/OrderFulfillPage.tsx +++ b/src/orders/components/OrderFulfillPage/OrderFulfillPage.tsx @@ -163,6 +163,10 @@ const OrderFulfillPage: React.FC = props => { !shopSettings?.fulfillmentAllowUnpaid && !order?.isPaid; + const areWarehousesSet = formsetData.every(line => + line.value.every(v => v.warehouse), + ); + const shouldEnableSave = () => { if (!order || loading) { return false; @@ -186,7 +190,7 @@ const OrderFulfillPage: React.FC = props => { return formQuantityFulfilled > quantityToFulfill; }); - return !overfulfill && isAtLeastOneFulfilled; + return !overfulfill && isAtLeastOneFulfilled && areWarehousesSet; }; return ( @@ -261,7 +265,7 @@ const OrderFulfillPage: React.FC = props => { lineId: line.id, warehouseId: formsetData[lineIndex]?.value?.[0]?.warehouse - .id, + ?.id, }) } /> diff --git a/src/storybook/__snapshots__/Stories.test.ts.snap b/src/storybook/__snapshots__/Stories.test.ts.snap index 7cc7b17c6..c01a8ada2 100644 --- a/src/storybook/__snapshots__/Stories.test.ts.snap +++ b/src/storybook/__snapshots__/Stories.test.ts.snap @@ -114340,79 +114340,121 @@ exports[`Storyshots Views / Orders / Fulfill order default 1`] = `
- +
- - ‌ - + S +
- - ‌ - + 62783187 - - ‌ - +
+ +
+ / 2 +
+ +
+ - - ‌ - + - - - ‌ - + +
+
+ Select warehouse... +
+ +
+
+
- +
- - ‌ - + 2.5l +
- - ‌ - + 998323583 - - ‌ - +
+ +
+ / 4 +
+ +
+ - - ‌ - + - - - ‌ - + +
+
+ Select warehouse... +
+ +
+
+
- +
- - ‌ - + 5l +
- - ‌ - + 998323584 - - ‌ - +
+ +
+ / 1 +
+ +
+ - - ‌ - + - - - ‌ - + +
+
+ Select warehouse... +
+ +
+
+ @@ -114687,79 +114813,121 @@ exports[`Storyshots Views / Orders / Fulfill order error 1`] = `
- +
- - ‌ - + S +
- - ‌ - + 62783187 - - ‌ - +
+ +
+ / 2 +
+ +
+ - - ‌ - + - - - ‌ - + +
+
+ Select warehouse... +
+ +
+
+
- +
- - ‌ - + 2.5l +
- - ‌ - + 998323583 - - ‌ - +
+ +
+ / 4 +
+ +
+ - - ‌ - + - - - ‌ - + +
+
+ Select warehouse... +
+ +
+
+
- +
- - ‌ - + 5l +
- - ‌ - + 998323584 - - ‌ - +
+ +
+ / 1 +
+ +
+ - - ‌ - + - - - ‌ - + +
+
+ Select warehouse... +
+ +
+
+ @@ -115098,79 +115350,121 @@ exports[`Storyshots Views / Orders / Fulfill order one warehouse 1`] = `
- +
- - ‌ - + S +
- - ‌ - + 62783187 - - ‌ - +
+ +
+ / 2 +
+ +
+ - - ‌ - + - - - ‌ - + +
+
+ Select warehouse... +
+ +
+
+
- +
- - ‌ - + 2.5l +
- - ‌ - + 998323583 - - ‌ - +
+ +
+ / 4 +
+ +
+ - - ‌ - + - - - ‌ - + +
+
+ Select warehouse... +
+ +
+
+
- +
- - ‌ - + 5l +
- - ‌ - + 998323584 - - ‌ - +
+ +
+ / 1 +
+ +
+ - - ‌ - + - - - ‌ - + +
+
+ Select warehouse... +
+ +
+
+