@bjsdistribution/dms-client-return 0.1.97-prod → 0.1.98-prod
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/icons/ChevronDownIcon.js +26 -0
- package/dist/assets/icons/ChevronDownIcon.js.map +1 -0
- package/dist/common/modals/order-action-modal/OrderActionModal.js.map +1 -1
- package/dist/common/modals/order-action-modal/footer/OrderActionFooter.js.map +1 -1
- package/dist/components/order-view/notes/order-dropdown/NewReturnDropdown.js +7 -7
- package/dist/components/order-view/notes/order-dropdown/NewReturnDropdown.js.map +1 -1
- package/dist/components/order-view/order-actions/actions/split-order/SplitOrderTable.js +222 -55
- package/dist/components/order-view/order-actions/actions/split-order/SplitOrderTable.js.map +1 -1
- package/dist/components/order-view/order-actions/actions/split-order/index.js +50 -37
- package/dist/components/order-view/order-actions/actions/split-order/index.js.map +1 -1
- package/dist/components/order-view/products-info/collapsed-content/index.js +1 -1
- package/dist/components/order-view/products-info/collapsed-content/index.js.map +1 -1
- package/dist/components/order-view/products-info/index.js +36 -36
- package/dist/components/order-view/products-info/index.js.map +1 -1
- package/dist/components/order-view/return-client-products/product-table/ReturnProductTable.js +333 -162
- package/dist/components/order-view/return-client-products/product-table/ReturnProductTable.js.map +1 -1
- package/dist/components/order-view/return-client-products/product-table/palletGrouping.js +47 -0
- package/dist/components/order-view/return-client-products/product-table/palletGrouping.js.map +1 -0
- package/dist/components/order-view/store.js +164 -159
- package/dist/components/order-view/store.js.map +1 -1
- package/dist/types/common/modals/order-action-modal/OrderActionModal.d.ts +2 -1
- package/dist/types/common/modals/order-action-modal/footer/OrderActionFooter.d.ts +1 -1
- package/dist/types/components/order-view/return-client-products/product-table/palletGrouping.d.ts +23 -0
- package/dist/types/components/order-view/store.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as L } from "react/jsx-runtime";
|
|
2
|
+
function n(o) {
|
|
3
|
+
return /* @__PURE__ */ L(
|
|
4
|
+
"svg",
|
|
5
|
+
{
|
|
6
|
+
width: "10",
|
|
7
|
+
height: "6",
|
|
8
|
+
viewBox: "0 0 10 6",
|
|
9
|
+
fill: "none",
|
|
10
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
11
|
+
...o,
|
|
12
|
+
children: /* @__PURE__ */ L(
|
|
13
|
+
"path",
|
|
14
|
+
{
|
|
15
|
+
opacity: "0.4",
|
|
16
|
+
d: "M8.99999 0C9.56799 0 9.86466 0.657333 9.52199 1.082L9.47132 1.138L5.47132 5.138C5.35653 5.25279 5.20379 5.32174 5.04178 5.33193C4.87976 5.34211 4.71959 5.29283 4.59132 5.19333L4.52866 5.138L0.528656 1.138L0.473323 1.07533L0.437323 1.024L0.401323 0.96L0.389989 0.936L0.371989 0.891333L0.350656 0.819333L0.343989 0.784L0.337323 0.744L0.334656 0.706V0.627333L0.337989 0.588667L0.343989 0.548667L0.350656 0.514L0.371989 0.442L0.389989 0.397333L0.436656 0.309333L0.479989 0.249333L0.528656 0.195333L0.591323 0.14L0.642656 0.104L0.706656 0.0680002L0.730656 0.0566667L0.775323 0.0386664L0.847322 0.0173333L0.882656 0.0106665L0.922656 0.00399971L0.960656 0.00133324L8.99999 0Z",
|
|
17
|
+
fill: "#3A3630"
|
|
18
|
+
}
|
|
19
|
+
)
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
n as default
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=ChevronDownIcon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChevronDownIcon.js","sources":["../../../src/assets/icons/ChevronDownIcon.tsx"],"sourcesContent":["import React from 'react';\n\nfunction ChevronDownIcon(props: any) {\n return (\n <svg\n width=\"10\"\n height=\"6\"\n viewBox=\"0 0 10 6\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n {...props}\n >\n <path\n opacity=\"0.4\"\n d=\"M8.99999 0C9.56799 0 9.86466 0.657333 9.52199 1.082L9.47132 1.138L5.47132 5.138C5.35653 5.25279 5.20379 5.32174 5.04178 5.33193C4.87976 5.34211 4.71959 5.29283 4.59132 5.19333L4.52866 5.138L0.528656 1.138L0.473323 1.07533L0.437323 1.024L0.401323 0.96L0.389989 0.936L0.371989 0.891333L0.350656 0.819333L0.343989 0.784L0.337323 0.744L0.334656 0.706V0.627333L0.337989 0.588667L0.343989 0.548667L0.350656 0.514L0.371989 0.442L0.389989 0.397333L0.436656 0.309333L0.479989 0.249333L0.528656 0.195333L0.591323 0.14L0.642656 0.104L0.706656 0.0680002L0.730656 0.0566667L0.775323 0.0386664L0.847322 0.0173333L0.882656 0.0106665L0.922656 0.00399971L0.960656 0.00133324L8.99999 0Z\"\n fill=\"#3A3630\"\n />\n </svg>\n );\n}\n\nexport default ChevronDownIcon;\n"],"names":["ChevronDownIcon","props","jsx"],"mappings":";AAEA,SAASA,EAAgBC,GAAY;AACnC,SACE,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,OAAM;AAAA,MACN,QAAO;AAAA,MACP,SAAQ;AAAA,MACR,MAAK;AAAA,MACL,OAAM;AAAA,MACL,GAAGD;AAAA,MAEJ,UAAA,gBAAAC;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,SAAQ;AAAA,UACR,GAAE;AAAA,UACF,MAAK;AAAA,QAAA;AAAA,MAAA;AAAA,IACP;AAAA,EAAA;AAGN;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OrderActionModal.js","sources":["../../../../src/common/modals/order-action-modal/OrderActionModal.tsx"],"sourcesContent":["import React from 'react';\nimport styled from 'styled-components';\nimport BackgroundModal from './BackgroundModal';\nimport OrderActionHeader from './header/OrderActionHeader';\nimport OrderActionFooter from './footer/OrderActionFooter';\n\ninterface ActionModalProps {\n headerTitle: string;\n showAdditionalInfo?: boolean;\n infoText?: string;\n headerActions?: React.ReactNode;\n submitBtnTitle?:
|
|
1
|
+
{"version":3,"file":"OrderActionModal.js","sources":["../../../../src/common/modals/order-action-modal/OrderActionModal.tsx"],"sourcesContent":["import React from 'react';\nimport styled from 'styled-components';\nimport BackgroundModal from './BackgroundModal';\nimport OrderActionHeader from './header/OrderActionHeader';\nimport OrderActionFooter from './footer/OrderActionFooter';\n\ninterface ActionModalProps {\n headerTitle: string;\n showAdditionalInfo?: boolean;\n infoText?: string;\n headerActions?: React.ReactNode;\n /** ReactNode so a modal can show a spinner alongside the label while submitting. */\n submitBtnTitle?: React.ReactNode;\n footerActions?: React.ReactNode;\n children: React.ReactNode;\n onCloseHeader: () => void;\n onSubmit: () => void;\n isSubmitDisabled?: boolean;\n minWidth?: string; // New optional prop for min-width\n maxWidth?: string; // New optional prop for min-width\n}\n\nfunction OrderActionModal({\n minWidth = '30vw',\n maxWidth = '75vw',\n ...props\n}: ActionModalProps) {\n return (\n <BackgroundModal>\n <MainContainer minWidth={minWidth} maxWidth={maxWidth}>\n <OrderActionHeader\n title={props.headerTitle}\n onClose={props.onCloseHeader}\n showInformation={props.showAdditionalInfo}\n infoText={props.infoText}\n actions={props.headerActions}\n />\n {props.children}\n <OrderActionFooter\n submitButtonTitle={props.submitBtnTitle}\n onSubmit={props.onSubmit}\n actions={props.footerActions}\n isSubmitDisabled={props.isSubmitDisabled}\n />\n </MainContainer>\n </BackgroundModal>\n );\n}\n\n// Styled component with dynamic min-width\nconst MainContainer = styled.div<{ minWidth: string; maxWidth: string }>`\n min-height: 30vh;\n max-height: 80vh;\n border-radius: 12px;\n background: #fff;\n box-shadow: 0px 20px 24px -4px #10182814;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: space-between;\n overflow-x: hidden;\n max-width: ${({ maxWidth }) => maxWidth}; // Dynamic max-width\n min-width: ${({ minWidth }) => minWidth}; // Dynamic min-width\n`;\n\nexport default OrderActionModal;\n"],"names":["OrderActionModal","minWidth","maxWidth","props","jsx","BackgroundModal","jsxs","MainContainer","OrderActionHeader","OrderActionFooter","styled"],"mappings":";;;;;AAsBA,SAASA,EAAiB;AAAA,EACxB,UAAAC,IAAW;AAAA,EACX,UAAAC,IAAW;AAAA,EACX,GAAGC;AACL,GAAqB;AACnB,SACE,gBAAAC,EAACC,GAAA,EACC,UAAA,gBAAAC,EAACC,GAAA,EAAc,UAAAN,GAAoB,UAAAC,GACjC,UAAA;AAAA,IAAA,gBAAAE;AAAA,MAACI;AAAA,MAAA;AAAA,QACC,OAAOL,EAAM;AAAA,QACb,SAASA,EAAM;AAAA,QACf,iBAAiBA,EAAM;AAAA,QACvB,UAAUA,EAAM;AAAA,QAChB,SAASA,EAAM;AAAA,MAAA;AAAA,IAAA;AAAA,IAEhBA,EAAM;AAAA,IACP,gBAAAC;AAAA,MAACK;AAAA,MAAA;AAAA,QACC,mBAAmBN,EAAM;AAAA,QACzB,UAAUA,EAAM;AAAA,QAChB,SAASA,EAAM;AAAA,QACf,kBAAkBA,EAAM;AAAA,MAAA;AAAA,IAAA;AAAA,EAC1B,EAAA,CACF,EAAA,CACF;AAEJ;AAGA,MAAMI,IAAgBG,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,eAWd,CAAC,EAAE,UAAAR,EAAA,MAAeA,CAAQ;AAAA,eAC1B,CAAC,EAAE,UAAAD,EAAA,MAAeA,CAAQ;AAAA;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OrderActionFooter.js","sources":["../../../../../src/common/modals/order-action-modal/footer/OrderActionFooter.tsx"],"sourcesContent":["import { Button } from '@bjsdistribution/dms-component-library';\nimport React from 'react';\nimport styled from 'styled-components';\n\ninterface FooterProps {\n submitButtonTitle?:
|
|
1
|
+
{"version":3,"file":"OrderActionFooter.js","sources":["../../../../../src/common/modals/order-action-modal/footer/OrderActionFooter.tsx"],"sourcesContent":["import { Button } from '@bjsdistribution/dms-component-library';\nimport React from 'react';\nimport styled from 'styled-components';\n\ninterface FooterProps {\n submitButtonTitle?: React.ReactNode;\n cancelButtonTitle?: string;\n actions?: React.ReactNode;\n onSubmit: () => void;\n onCancel?: () => void;\n isSubmitDisabled?: boolean;\n}\n\nfunction OrderActionFooter(props: FooterProps) {\n const { isSubmitDisabled } = props;\n return (\n <Container>\n <SubmitButton\n shape=\"rounded\"\n colors=\"primary\"\n onClick={props.onSubmit}\n disabled={isSubmitDisabled}\n >\n {props.submitButtonTitle || 'submit'}\n </SubmitButton>\n {props.actions}\n </Container>\n );\n}\n\nconst SubmitButton = styled(Button)``;\n\nconst Container = styled.div`\n display: flex;\n /* justify-content: space-between; */\n gap: 15px;\n align-items: center;\n width: 100%;\n background: #f8fafc;\n border-radius: 0px 0px 6px 6px;\n padding: 10px 15px 10px 15px;\n border-top: 1px solid #edebe8;\n margin-left: 25px;\n`;\n\nexport default OrderActionFooter;\n"],"names":["OrderActionFooter","props","isSubmitDisabled","Container","jsx","SubmitButton","styled","Button"],"mappings":";;;AAaA,SAASA,EAAkBC,GAAoB;AAC7C,QAAM,EAAE,kBAAAC,MAAqBD;AAC7B,2BACGE,GAAA,EACC,UAAA;AAAA,IAAA,gBAAAC;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,OAAM;AAAA,QACN,QAAO;AAAA,QACP,SAASJ,EAAM;AAAA,QACf,UAAUC;AAAA,QAET,YAAM,qBAAqB;AAAA,MAAA;AAAA,IAAA;AAAA,IAE7BD,EAAM;AAAA,EAAA,GACT;AAEJ;AAEA,MAAMI,IAAeC,EAAOC,CAAM,KAE5BJ,IAAYG,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
|
|
@@ -2,7 +2,7 @@ import { jsxs as I, jsx as f } from "react/jsx-runtime";
|
|
|
2
2
|
import { useState as A, useEffect as d } from "react";
|
|
3
3
|
import l from "styled-components";
|
|
4
4
|
import { useApiHook as C } from "@bjsdistribution/dms-component-library";
|
|
5
|
-
import { useOrderDetails as N,
|
|
5
|
+
import { useOrderDetails as N, useReturnProductDetails as R, useOrderId as b } from "../../store.js";
|
|
6
6
|
import { Select as j } from "antd";
|
|
7
7
|
import { useNewReturnOrderData as z, useSelectedProducts as E } from "../../../store.js";
|
|
8
8
|
import { atom as h, useAtom as m } from "jotai";
|
|
@@ -23,7 +23,7 @@ const T = h(null), $ = h(null), U = () => {
|
|
|
23
23
|
op: "=",
|
|
24
24
|
value: t[0]
|
|
25
25
|
});
|
|
26
|
-
const { data: s, setShouldPerformAction:
|
|
26
|
+
const { data: s, setShouldPerformAction: u } = C({
|
|
27
27
|
endpoint: "/v1/return/orders/",
|
|
28
28
|
method: "GET",
|
|
29
29
|
filters: n && n?.length > 0 ? n : void 0,
|
|
@@ -32,8 +32,8 @@ const T = h(null), $ = h(null), U = () => {
|
|
|
32
32
|
performAction: !1
|
|
33
33
|
});
|
|
34
34
|
d(() => {
|
|
35
|
-
r && t?.length > 0 && t[0] &&
|
|
36
|
-
}, [r, t,
|
|
35
|
+
r && t?.length > 0 && t[0] && u(!0);
|
|
36
|
+
}, [r, t, u]), d(() => {
|
|
37
37
|
s && s?.data && r !== null && v(s?.data);
|
|
38
38
|
}, [s, r]), d(() => {
|
|
39
39
|
o && a?.length > 0 && i({
|
|
@@ -43,7 +43,7 @@ const T = h(null), $ = h(null), U = () => {
|
|
|
43
43
|
}, [o, a, i]);
|
|
44
44
|
const O = (e) => {
|
|
45
45
|
y(e);
|
|
46
|
-
},
|
|
46
|
+
}, p = S?.map((e) => ({
|
|
47
47
|
label: `${e?.recipient_name} - ${e?.postcode}`,
|
|
48
48
|
value: e?.id
|
|
49
49
|
}));
|
|
@@ -52,7 +52,7 @@ const T = h(null), $ = h(null), U = () => {
|
|
|
52
52
|
/* @__PURE__ */ f(
|
|
53
53
|
k,
|
|
54
54
|
{
|
|
55
|
-
options:
|
|
55
|
+
options: p,
|
|
56
56
|
value: o,
|
|
57
57
|
placeholder: "Select",
|
|
58
58
|
onChange: O,
|
|
@@ -60,7 +60,7 @@ const T = h(null), $ = h(null), U = () => {
|
|
|
60
60
|
showSearch: !0,
|
|
61
61
|
dropdownStyle: { width: "250px" },
|
|
62
62
|
popupClassName: g,
|
|
63
|
-
status:
|
|
63
|
+
status: p.length === 0 || o ? "" : "error",
|
|
64
64
|
notFoundContent: "No orders found with a similar postcode"
|
|
65
65
|
}
|
|
66
66
|
)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NewReturnDropdown.js","sources":["../../../../../src/components/order-view/notes/order-dropdown/NewReturnDropdown.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport styled from 'styled-components';\nimport { useApiHook } from '@bjsdistribution/dms-component-library';\nimport { ApiResponse } from '../../types';\nimport {
|
|
1
|
+
{"version":3,"file":"NewReturnDropdown.js","sources":["../../../../../src/components/order-view/notes/order-dropdown/NewReturnDropdown.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport styled from 'styled-components';\nimport { useApiHook } from '@bjsdistribution/dms-component-library';\nimport { ApiResponse } from '../../types';\nimport {\n useOrderDetails,\n useOrderId,\n useReturnProductDetails,\n} from '../../store';\nimport { Select } from 'antd';\nimport { useNewReturnOrderData, useSelectedProducts } from '../../../store';\nimport { atom, useAtom } from 'jotai';\n\nexport const payloadAtom = atom<any>(null);\nexport const selectedOrderId = atom<any>(null);\n\nconst NewReturnDropdown = () => {\n const defaultSelectStyle = { width: '100%' };\n const defaultPopupClassName = 'dropDownStyle';\n const [returnOrderData, setReturnOrderData] = useNewReturnOrderData();\n const [selectedId, setSelectedOrderId] = useAtom(selectedOrderId);\n const [selectedProducts] = useSelectedProducts();\n const [orderData] = useOrderDetails();\n const [, setPayload] = useAtom(payloadAtom);\n const [productData] = useReturnProductDetails();\n const [idProduct, setId] = useState<any>();\n const [orderId] = useOrderId();\n\n const id = orderData?.customer_id;\n useEffect(() => {\n const allProductIds =\n productData?.map((product: any) => product?.return_location) || [];\n setId(allProductIds);\n }, [productData]);\n\n const filters = [\n { field: 'customer_id', op: '=', value: id },\n { field: 'is_deleted', op: '=', value: 0 },\n { field: 'status', op: '!=', value: 'SD' },\n { field: 'id', op: '!=', value: orderId },\n ];\n\n if (idProduct?.length > 0 && idProduct[0]) {\n filters.push({\n field: 'return_order_products.return_location',\n op: '=',\n value: idProduct[0],\n });\n }\n\n const { data: fetchedReturnOrderData, setShouldPerformAction } = useApiHook<\n ApiResponse\n >({\n endpoint: '/v1/return/orders/',\n method: 'GET',\n filters: filters && filters?.length > 0 ? filters : undefined,\n //@ts-ignore\n pagination: { is_pagination: false },\n performAction: false,\n });\n\n useEffect(() => {\n if (id && idProduct?.length > 0 && idProduct[0]) {\n setShouldPerformAction(true);\n }\n }, [id, idProduct, setShouldPerformAction]);\n\n useEffect(() => {\n if (fetchedReturnOrderData && fetchedReturnOrderData?.data && id !== null) {\n setReturnOrderData(fetchedReturnOrderData?.data);\n }\n }, [fetchedReturnOrderData, id]);\n\n useEffect(() => {\n if (selectedId && selectedProducts?.length > 0) {\n const newPayload = {\n new_return_order: selectedId,\n products: selectedProducts,\n };\n setPayload(newPayload);\n }\n }, [selectedId, selectedProducts, setPayload]);\n\n const handleDropdownChange = (value: string) => {\n setSelectedOrderId(value);\n };\n const dropdownOptions = returnOrderData?.map((order: any) => ({\n label: `${order?.recipient_name} - ${order?.postcode}`,\n value: order?.id,\n }));\n return (\n <Container>\n <Text>New Return Order:</Text>\n <StyledAntSelect\n options={dropdownOptions}\n value={selectedId}\n placeholder=\"Select\"\n // @ts-ignore\n onChange={handleDropdownChange}\n style={defaultSelectStyle}\n showSearch\n dropdownStyle={{ width: '250px' }}\n popupClassName={defaultPopupClassName}\n status={dropdownOptions.length === 0 ? '' : selectedId ? '' : 'error'}\n notFoundContent=\"No orders found with a similar postcode\"\n />\n </Container>\n );\n};\n\nconst StyledAntSelect = styled(Select)`\n .ant-select-selector {\n /* width: 22vw; */\n border-radius: 22px;\n }\n .ant-select-clear {\n top: 40% !important;\n font-size: 18px !important;\n }\n`;\n\nconst Container = styled.div`\n display: flex;\n align-items: center;\n gap: 10px;\n align-self: stretch;\n white-space: nowrap;\n`;\n\nconst Text = styled.div`\n color: #000;\n font-family: 'Lato';\n font-size: 13px;\n font-weight: 400;\n line-height: 16px;\n`;\n\nexport default NewReturnDropdown;\n"],"names":["payloadAtom","atom","selectedOrderId","NewReturnDropdown","defaultSelectStyle","defaultPopupClassName","returnOrderData","setReturnOrderData","useNewReturnOrderData","selectedId","setSelectedOrderId","useAtom","selectedProducts","useSelectedProducts","orderData","useOrderDetails","setPayload","productData","useReturnProductDetails","idProduct","setId","useState","orderId","useOrderId","id","useEffect","allProductIds","product","filters","fetchedReturnOrderData","setShouldPerformAction","useApiHook","handleDropdownChange","value","dropdownOptions","order","Container","jsx","Text","StyledAntSelect","styled","Select"],"mappings":";;;;;;;;AAaO,MAAMA,IAAcC,EAAU,IAAI,GAC5BC,IAAkBD,EAAU,IAAI,GAEvCE,IAAoB,MAAM;AAC9B,QAAMC,IAAqB,EAAE,OAAO,OAAA,GAC9BC,IAAwB,iBACxB,CAACC,GAAiBC,CAAkB,IAAIC,EAAA,GACxC,CAACC,GAAYC,CAAkB,IAAIC,EAAQT,CAAe,GAC1D,CAACU,CAAgB,IAAIC,EAAA,GACrB,CAACC,CAAS,IAAIC,EAAA,GACd,GAAGC,CAAU,IAAIL,EAAQX,CAAW,GACpC,CAACiB,CAAW,IAAIC,EAAA,GAChB,CAACC,GAAWC,CAAK,IAAIC,EAAA,GACrB,CAACC,CAAO,IAAIC,EAAA,GAEZC,IAAKV,GAAW;AACtB,EAAAW,EAAU,MAAM;AACd,UAAMC,IACJT,GAAa,IAAI,CAACU,MAAiBA,GAAS,eAAe,KAAK,CAAA;AAClE,IAAAP,EAAMM,CAAa;AAAA,EACrB,GAAG,CAACT,CAAW,CAAC;AAEhB,QAAMW,IAAU;AAAA,IACd,EAAE,OAAO,eAAe,IAAI,KAAK,OAAOJ,EAAA;AAAA,IACxC,EAAE,OAAO,cAAc,IAAI,KAAK,OAAO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IAAA,gBAAAC,EAACC,KAAK,UAAA,oBAAA,CAAiB;AAAA,IACvB,gBAAAD;AAAA,MAACE;AAAA,MAAA;AAAA,QACC,SAASL;AAAA,QACT,OAAOzB;AAAA,QACP,aAAY;AAAA,QAEZ,UAAUuB;AAAA,QACV,OAAO5B;AAAA,QACP,YAAU;AAAA,QACV,eAAe,EAAE,OAAO,QAAA;AAAA,QACxB,gBAAgBC;AAAA,QAChB,QAAQ6B,EAAgB,WAAW,KAASzB,IAAL,KAAuB;AAAA,QAC9D,iBAAgB;AAAA,MAAA;AAAA,IAAA;AAAA,EAClB,GACF;AAEJ,GAEM8B,IAAkBC,EAAOC,CAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAW/BL,IAAYI,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAQnBF,IAAOE,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
|
|
@@ -1,71 +1,238 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import {
|
|
4
|
-
import { Skeleton as
|
|
5
|
-
import { Checkbox as
|
|
6
|
-
import { useLoading as
|
|
7
|
-
import { useSelectedSplit as
|
|
8
|
-
import { StyledTableWrapper as
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { jsx as t, Fragment as x, jsxs as i } from "react/jsx-runtime";
|
|
2
|
+
import L, { useState as u, useMemo as p, useEffect as _ } from "react";
|
|
3
|
+
import { useReturnProductDetails as j } from "../../../store.js";
|
|
4
|
+
import { Skeleton as z, Empty as B } from "antd";
|
|
5
|
+
import { Checkbox as m } from "@bjsdistribution/dms-component-library";
|
|
6
|
+
import { useLoading as F } from "../../../../order-daily-overview/store/store.js";
|
|
7
|
+
import { useSelectedSplit as H, useSplitOrderPayload as M } from "../../store.js";
|
|
8
|
+
import { StyledTableWrapper as O, StyledTable as U, EmptyDataContainer as q } from "../confirm-order/tables/ReminderStyles.js";
|
|
9
|
+
import a from "styled-components";
|
|
10
|
+
import W from "../../../../../assets/icons/ChevronDownIcon.js";
|
|
11
|
+
import { groupProductsByPallet as J, hasAnyPallet as K, toggleGroupSelectionIds as Q } from "../../../return-client-products/product-table/palletGrouping.js";
|
|
12
|
+
const y = 7;
|
|
13
|
+
function pe() {
|
|
14
|
+
const [n] = j(), [S] = F(), [r, c] = H(), [P, h] = u(!1), [k, f] = M(), g = p(
|
|
15
|
+
() => (r ?? []).map((e) => e?.id),
|
|
16
|
+
[r]
|
|
17
|
+
), N = p(
|
|
18
|
+
() => J(n),
|
|
19
|
+
[n]
|
|
20
|
+
), v = p(() => K(n), [
|
|
21
|
+
n
|
|
22
|
+
]), [w, C] = u({}), D = (e) => e.isNoPallet || !!w[e.key], I = (e) => C((l) => ({ ...l, [e]: !l[e] })), G = (e) => {
|
|
23
|
+
c(e.map((l) => ({ id: l }))), h(e.length === n?.length);
|
|
24
|
+
}, T = (e) => {
|
|
25
|
+
const l = e.target.checked;
|
|
26
|
+
h(l), c(
|
|
27
|
+
l ? n?.map((o) => ({ id: o.id })) : []
|
|
14
28
|
);
|
|
15
|
-
},
|
|
29
|
+
}, E = (e) => {
|
|
16
30
|
c((l) => {
|
|
17
|
-
const
|
|
18
|
-
|
|
31
|
+
const s = l?.some(
|
|
32
|
+
(d) => d.id === e
|
|
33
|
+
) ? l?.filter((d) => d.id !== e) : [...l, { id: e }];
|
|
34
|
+
return h(s?.length === n?.length), s;
|
|
19
35
|
});
|
|
36
|
+
}, R = (e, l) => {
|
|
37
|
+
const o = e.items.map((s) => s?.id);
|
|
38
|
+
G(Q(g, o, l));
|
|
20
39
|
};
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
...
|
|
40
|
+
_(() => {
|
|
41
|
+
f({
|
|
42
|
+
...k,
|
|
24
43
|
return_order: 1,
|
|
25
44
|
// FOR SPLIT ORDER WE ARE ASKED TO SET THIS AS 1
|
|
26
|
-
products:
|
|
45
|
+
products: r?.map((e) => e.id),
|
|
27
46
|
force: !0
|
|
28
47
|
});
|
|
29
|
-
}, [
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
48
|
+
}, [r, f]);
|
|
49
|
+
const b = (e) => /* @__PURE__ */ i("tr", { children: [
|
|
50
|
+
/* @__PURE__ */ t("td", { style: { position: "relative" }, children: /* @__PURE__ */ t(
|
|
51
|
+
m,
|
|
52
|
+
{
|
|
53
|
+
checked: r?.some(
|
|
54
|
+
(l) => l.id === e.id
|
|
55
|
+
),
|
|
56
|
+
onChange: () => E(e.id)
|
|
57
|
+
}
|
|
58
|
+
) }),
|
|
59
|
+
/* @__PURE__ */ t("td", { children: e?.order_product_type?.type }),
|
|
60
|
+
/* @__PURE__ */ t("td", { children: e?.code }),
|
|
61
|
+
/* @__PURE__ */ t("td", { children: e?.description }),
|
|
62
|
+
/* @__PURE__ */ t("td", { children: e?.description }),
|
|
63
|
+
/* @__PURE__ */ t("td", { children: e?.description }),
|
|
64
|
+
/* @__PURE__ */ t("td", { children: e?.sku })
|
|
65
|
+
] }, e.id), $ = (e) => {
|
|
66
|
+
const l = D(e), o = e.items.filter(
|
|
67
|
+
(A) => g.includes(A?.id)
|
|
68
|
+
).length, s = e.items.length > 0 && o === e.items.length, d = `${e.items.length} ${e.items.length === 1 ? "item" : "items"}`;
|
|
69
|
+
return /* @__PURE__ */ i(L.Fragment, { children: [
|
|
70
|
+
/* @__PURE__ */ t(V, { children: /* @__PURE__ */ t("td", { colSpan: y, children: /* @__PURE__ */ t("div", { className: e.isNoPallet ? "no-pallet-divider" : void 0, children: /* @__PURE__ */ i(X, { children: [
|
|
71
|
+
/* @__PURE__ */ t(
|
|
72
|
+
m,
|
|
73
|
+
{
|
|
74
|
+
checked: s,
|
|
75
|
+
onChange: () => R(e, s),
|
|
76
|
+
"aria-label": e.isNoPallet ? "Select all items with no pallet ID" : `Select whole pallet ${e.label}`
|
|
77
|
+
}
|
|
78
|
+
),
|
|
79
|
+
/* @__PURE__ */ i(
|
|
80
|
+
Y,
|
|
81
|
+
{
|
|
82
|
+
type: "button",
|
|
83
|
+
disabled: e.isNoPallet,
|
|
84
|
+
onClick: e.isNoPallet ? void 0 : () => I(e.key),
|
|
85
|
+
"aria-expanded": e.isNoPallet ? void 0 : l,
|
|
86
|
+
children: [
|
|
87
|
+
!e.isNoPallet && /* @__PURE__ */ t(Z, { $isExpanded: l, children: /* @__PURE__ */ t(W, {}) }),
|
|
88
|
+
/* @__PURE__ */ t("span", { className: "title", children: e.isNoPallet ? /* @__PURE__ */ t("span", { children: "No Pallet ID" }) : /* @__PURE__ */ i(x, { children: [
|
|
89
|
+
/* @__PURE__ */ t("span", { children: "Pallet ID:" }),
|
|
90
|
+
/* @__PURE__ */ t("strong", { children: e.label })
|
|
91
|
+
] }) }),
|
|
92
|
+
/* @__PURE__ */ i("span", { className: "count", children: [
|
|
93
|
+
"(",
|
|
94
|
+
d,
|
|
95
|
+
")"
|
|
96
|
+
] }),
|
|
97
|
+
o > 0 && /* @__PURE__ */ i("span", { className: "selected", children: [
|
|
98
|
+
o,
|
|
99
|
+
" selected"
|
|
100
|
+
] }),
|
|
101
|
+
!e.isNoPallet && /* @__PURE__ */ t(ee, { "aria-hidden": "true", children: l ? "−" : "+" })
|
|
102
|
+
]
|
|
103
|
+
}
|
|
104
|
+
)
|
|
105
|
+
] }) }) }) }),
|
|
106
|
+
l && e.items.map(b)
|
|
107
|
+
] }, e.key);
|
|
108
|
+
};
|
|
109
|
+
return /* @__PURE__ */ t(x, { children: /* @__PURE__ */ t(O, { id: "tableScrolling", children: /* @__PURE__ */ i(U, { children: [
|
|
110
|
+
/* @__PURE__ */ t("thead", { children: /* @__PURE__ */ i("tr", { children: [
|
|
111
|
+
/* @__PURE__ */ t("th", { style: { position: "relative" }, children: /* @__PURE__ */ t(
|
|
112
|
+
m,
|
|
33
113
|
{
|
|
34
|
-
checked:
|
|
35
|
-
onChange:
|
|
36
|
-
disabled:
|
|
114
|
+
checked: P,
|
|
115
|
+
onChange: T,
|
|
116
|
+
disabled: n?.length === 0 || n?.length === null
|
|
37
117
|
}
|
|
38
118
|
) }),
|
|
39
|
-
/* @__PURE__ */
|
|
40
|
-
/* @__PURE__ */
|
|
41
|
-
/* @__PURE__ */
|
|
42
|
-
/* @__PURE__ */
|
|
43
|
-
/* @__PURE__ */
|
|
44
|
-
/* @__PURE__ */
|
|
119
|
+
/* @__PURE__ */ t("th", { children: "Type" }),
|
|
120
|
+
/* @__PURE__ */ t("th", { children: "Code" }),
|
|
121
|
+
/* @__PURE__ */ t("th", { children: "Scan" }),
|
|
122
|
+
/* @__PURE__ */ t("th", { children: "Description" }),
|
|
123
|
+
/* @__PURE__ */ t("th", { children: "Delivery Instructions" }),
|
|
124
|
+
/* @__PURE__ */ t("th", { children: "Barcode" })
|
|
45
125
|
] }) }),
|
|
46
|
-
/* @__PURE__ */
|
|
47
|
-
/* @__PURE__ */
|
|
48
|
-
/* @__PURE__ */
|
|
49
|
-
] }) :
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
checked: n?.some(
|
|
54
|
-
(l) => l.id === t.id
|
|
55
|
-
),
|
|
56
|
-
onChange: () => y(t.id)
|
|
57
|
-
}
|
|
58
|
-
) }),
|
|
59
|
-
/* @__PURE__ */ e("td", { children: t?.order_product_type?.type }),
|
|
60
|
-
/* @__PURE__ */ e("td", { children: t?.code }),
|
|
61
|
-
/* @__PURE__ */ e("td", { children: t?.description }),
|
|
62
|
-
/* @__PURE__ */ e("td", { children: t?.description }),
|
|
63
|
-
/* @__PURE__ */ e("td", { children: t?.description }),
|
|
64
|
-
/* @__PURE__ */ e("td", { children: t?.sku })
|
|
65
|
-
] }, t.id)) })
|
|
66
|
-
] }) });
|
|
126
|
+
/* @__PURE__ */ t("tbody", { children: S ? /* @__PURE__ */ i("tr", { children: [
|
|
127
|
+
/* @__PURE__ */ t("td", { colSpan: 6, children: /* @__PURE__ */ t(z, { active: !0 }) }),
|
|
128
|
+
/* @__PURE__ */ t("td", { colSpan: 6 })
|
|
129
|
+
] }) : n?.length === 0 ? /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ t("td", { className: "emptyTd", colSpan: y, children: /* @__PURE__ */ t(q, { children: /* @__PURE__ */ t(B, { description: "No Data Found" }) }) }) }) : v ? N.map($) : n?.length > 0 && n?.map(
|
|
130
|
+
(e) => b(e)
|
|
131
|
+
) })
|
|
132
|
+
] }) }) });
|
|
67
133
|
}
|
|
134
|
+
const V = a.tr`
|
|
135
|
+
&& > td {
|
|
136
|
+
padding: 4px 0;
|
|
137
|
+
background: transparent;
|
|
138
|
+
border: none;
|
|
139
|
+
border-radius: 0;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/*
|
|
143
|
+
Divider separating the No Pallet ID group from the palletised groups. Applied
|
|
144
|
+
to an inner wrapper rather than the td, because the rule above resets cell
|
|
145
|
+
borders at && specificity and would win over a border on the td itself.
|
|
146
|
+
*/
|
|
147
|
+
&& .no-pallet-divider {
|
|
148
|
+
border-top: 1px solid #c9c6c1;
|
|
149
|
+
padding-top: 10px;
|
|
150
|
+
margin-top: 4px;
|
|
151
|
+
}
|
|
152
|
+
`, X = a.div`
|
|
153
|
+
/*
|
|
154
|
+
Required. The library Checkbox renders its real <input> as position:absolute
|
|
155
|
+
with no offsets, so it needs a positioned ancestor here — otherwise its
|
|
156
|
+
containing block resolves outside this scrolling modal, the invisible input
|
|
157
|
+
stops scrolling with the visible box, and clicks land on another pallet's
|
|
158
|
+
checkbox. Same reason the product cells set position:relative inline.
|
|
159
|
+
*/
|
|
160
|
+
position: relative;
|
|
161
|
+
display: flex;
|
|
162
|
+
align-items: center;
|
|
163
|
+
gap: 8px;
|
|
164
|
+
width: 100%;
|
|
165
|
+
padding: 8px 12px;
|
|
166
|
+
border: 1px solid #e2e0db;
|
|
167
|
+
border-radius: 6px;
|
|
168
|
+
background: #f1f5f9;
|
|
169
|
+
font-family: 'Roboto', sans-serif;
|
|
170
|
+
font-size: 13px;
|
|
171
|
+
font-weight: 500;
|
|
172
|
+
color: #3a3630;
|
|
173
|
+
|
|
174
|
+
`, Y = a.button`
|
|
175
|
+
display: flex;
|
|
176
|
+
align-items: center;
|
|
177
|
+
gap: 8px;
|
|
178
|
+
flex: 1;
|
|
179
|
+
padding: 0;
|
|
180
|
+
border: none;
|
|
181
|
+
background: transparent;
|
|
182
|
+
cursor: pointer;
|
|
183
|
+
text-align: left;
|
|
184
|
+
font: inherit;
|
|
185
|
+
color: inherit;
|
|
186
|
+
|
|
187
|
+
&:disabled {
|
|
188
|
+
cursor: default;
|
|
189
|
+
opacity: 1;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.title {
|
|
193
|
+
display: flex;
|
|
194
|
+
align-items: center;
|
|
195
|
+
gap: 6px;
|
|
196
|
+
text-transform: uppercase;
|
|
197
|
+
letter-spacing: 0.3px;
|
|
198
|
+
|
|
199
|
+
strong {
|
|
200
|
+
font-weight: 700;
|
|
201
|
+
text-transform: none;
|
|
202
|
+
letter-spacing: 0;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.count {
|
|
207
|
+
color: #6a7378;
|
|
208
|
+
font-weight: 400;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.selected {
|
|
212
|
+
color: #0099ff;
|
|
213
|
+
font-weight: 600;
|
|
214
|
+
font-size: 12px;
|
|
215
|
+
}
|
|
216
|
+
`, Z = a.span`
|
|
217
|
+
display: inline-flex;
|
|
218
|
+
align-items: center;
|
|
219
|
+
transition: transform 0.15s ease-in-out;
|
|
220
|
+
transform: rotate(${(n) => n.$isExpanded ? "0deg" : "-90deg"});
|
|
221
|
+
`, ee = a.span`
|
|
222
|
+
margin-left: auto;
|
|
223
|
+
display: inline-flex;
|
|
224
|
+
align-items: center;
|
|
225
|
+
justify-content: center;
|
|
226
|
+
width: 20px;
|
|
227
|
+
height: 20px;
|
|
228
|
+
border: 1px solid #cbd5e1;
|
|
229
|
+
border-radius: 4px;
|
|
230
|
+
background: #fff;
|
|
231
|
+
font-size: 14px;
|
|
232
|
+
line-height: 1;
|
|
233
|
+
color: #475569;
|
|
234
|
+
`;
|
|
68
235
|
export {
|
|
69
|
-
|
|
236
|
+
pe as default
|
|
70
237
|
};
|
|
71
238
|
//# sourceMappingURL=SplitOrderTable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SplitOrderTable.js","sources":["../../../../../../src/components/order-view/order-actions/actions/split-order/SplitOrderTable.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport { useProductDetails } from '../../../store';\n\nimport { Empty, Skeleton } from 'antd';\nimport { Checkbox } from '@bjsdistribution/dms-component-library';\nimport { useLoading } from '../../../../order-daily-overview/store/store';\nimport { useSelectedSplit, useSplitOrderPayload } from '../../store';\nimport {\n EmptyDataContainer,\n StyledTable,\n StyledTableWrapper,\n} from '../confirm-order/tables/ReminderStyles';\n\nfunction SplitOrderTable() {\n const [orderProductDetails] = useProductDetails();\n const [loading] = useLoading();\n const [selectedSplits, setSelectedSplit] = useSelectedSplit();\n const [selectAll, setSelectAll] = useState(false);\n const [payload, setPayload] = useSplitOrderPayload();\n\n // Handle Select All\n const handleSelectAll = (e: any) => {\n const isChecked = e.target.checked;\n setSelectAll(isChecked);\n\n if (isChecked) {\n setSelectedSplit(\n orderProductDetails?.map((order: any) => ({ id: order.id }))\n );\n } else {\n setSelectedSplit([]);\n }\n };\n\n const handleSelectedSplitList = (id: any) => {\n setSelectedSplit(prevSelectedOrder => {\n const isSelected = prevSelectedOrder?.some(order => order.id === id);\n\n const updatedSelection = isSelected\n ? prevSelectedOrder?.filter(order => order.id !== id)\n : [...prevSelectedOrder, { id }];\n\n setSelectAll(updatedSelection?.length === orderProductDetails?.length);\n\n return updatedSelection;\n });\n };\n\n useEffect(() => {\n setPayload({\n ...payload,\n return_order: 1, // FOR SPLIT ORDER WE ARE ASKED TO SET THIS AS 1\n products: selectedSplits?.map(order => order.id),\n force: true,\n });\n }, [selectedSplits, setPayload]);\n\n return (\n <StyledTableWrapper id=\"tableScrolling\">\n <StyledTable>\n <thead>\n <tr>\n <th style={{ position: 'relative' }}>\n <Checkbox\n checked={selectAll}\n onChange={handleSelectAll}\n disabled={\n orderProductDetails?.length === 0 ||\n orderProductDetails?.length === null\n }\n />\n </th>\n <th>Type</th>\n <th>Code</th>\n <th>Scan</th>\n <th>Description</th>\n <th>Delivery Instructions</th>\n <th>Barcode</th>\n </tr>\n </thead>\n <tbody>\n {loading ? (\n <tr>\n <td colSpan={6}>\n <Skeleton active />\n </td>\n <td colSpan={6}></td>\n </tr>\n ) : orderProductDetails?.length === 0 ? (\n <tr>\n <td className=\"emptyTd\" colSpan={7}>\n <EmptyDataContainer>\n <Empty description=\"No Data Found\" />\n </EmptyDataContainer>\n </td>\n </tr>\n ) : (\n orderProductDetails?.length > 0 &&\n orderProductDetails?.map((order: any) => (\n <tr key={order.id}>\n <td style={{ position: 'relative' }}>\n <Checkbox\n checked={selectedSplits?.some(\n selectedOrder => selectedOrder.id === order.id\n )}\n onChange={() => handleSelectedSplitList(order.id)}\n />\n </td>\n <td>{order?.order_product_type?.type}</td>\n <td>{order?.code}</td>\n <td>{order?.description}</td>\n <td>{order?.description}</td>\n <td>{order?.description}</td>\n <td>{order?.sku}</td>\n </tr>\n ))\n )}\n </tbody>\n </StyledTable>\n </StyledTableWrapper>\n );\n}\n\nexport default SplitOrderTable;\n"],"names":["SplitOrderTable","orderProductDetails","useProductDetails","loading","useLoading","selectedSplits","setSelectedSplit","useSelectedSplit","selectAll","setSelectAll","useState","payload","setPayload","useSplitOrderPayload","handleSelectAll","e","isChecked","order","handleSelectedSplitList","id","prevSelectedOrder","updatedSelection","useEffect","jsx","StyledTableWrapper","StyledTable","Checkbox","jsxs","Skeleton","EmptyDataContainer","Empty","selectedOrder"],"mappings":";;;;;;;;AAaA,SAASA,IAAkB;AACzB,QAAM,CAACC,CAAmB,IAAIC,EAAA,GACxB,CAACC,CA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AI,UAAAN,GAAO,KAAA,CAAK;AAAA,MACjB,gBAAAM,EAAC,MAAA,EAAI,UAAAN,GAAO,YAAA,CAAY;AAAA,MACxB,gBAAAM,EAAC,MAAA,EAAI,UAAAN,GAAO,YAAA,CAAY;AAAA,MACxB,gBAAAM,EAAC,MAAA,EAAI,UAAAN,GAAO,YAAA,CAAY;AAAA,MACxB,gBAAAM,EAAC,MAAA,EAAI,UAAAN,GAAO,IAAA,CAAI;AAAA,IAAA,KAdTA,EAAM,EAef,CACD,EAAA,CAEL;AAAA,EAAA,EAAA,CACF,EAAA,CACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"SplitOrderTable.js","sources":["../../../../../../src/components/order-view/order-actions/actions/split-order/SplitOrderTable.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useState } from 'react';\nimport { useReturnProductDetails } from '../../../store';\n\nimport { Empty, Skeleton } from 'antd';\nimport { Checkbox } from '@bjsdistribution/dms-component-library';\nimport { useLoading } from '../../../../order-daily-overview/store/store';\nimport { useSelectedSplit, useSplitOrderPayload } from '../../store';\nimport {\n EmptyDataContainer,\n StyledTable,\n StyledTableWrapper,\n} from '../confirm-order/tables/ReminderStyles';\nimport styled from 'styled-components';\nimport ChevronDownIcon from '../../../../../assets/icons/ChevronDownIcon';\nimport {\n groupProductsByPallet,\n hasAnyPallet,\n PalletGroup,\n toggleGroupSelectionIds,\n} from '../../../return-client-products/product-table/palletGrouping';\n\nconst COLUMN_COUNT = 7;\n\nfunction SplitOrderTable() {\n /**\n * Reads the return-products atom rather than the shared `productDetails` one:\n * this modal splits a return order, and only that payload carries pallet data.\n */\n const [orderProductDetails] = useReturnProductDetails();\n const [loading] = useLoading();\n const [selectedSplits, setSelectedSplit] = useSelectedSplit();\n const [selectAll, setSelectAll] = useState(false);\n const [payload, setPayload] = useSplitOrderPayload();\n\n const selectedIds = useMemo(\n () => (selectedSplits ?? []).map((order: any) => order?.id),\n [selectedSplits]\n );\n\n const palletGroups = useMemo(\n () => groupProductsByPallet(orderProductDetails),\n [orderProductDetails]\n );\n\n /** Return orders picked before pallet scanning keep the original flat list. */\n const isGrouped = useMemo(() => hasAnyPallet(orderProductDetails), [\n orderProductDetails,\n ]);\n\n /** Pallet groups start collapsed; the No Pallet ID group is always open. */\n const [expandedPallets, setExpandedPallets] = useState<\n Record<string, boolean>\n >({});\n\n const isGroupExpanded = (group: PalletGroup) =>\n group.isNoPallet || !!expandedPallets[group.key];\n\n const togglePallet = (key: string) =>\n setExpandedPallets(prev => ({ ...prev, [key]: !prev[key] }));\n\n const applySelection = (ids: any[]) => {\n setSelectedSplit(ids.map((id: any) => ({ id })));\n setSelectAll(ids.length === orderProductDetails?.length);\n };\n\n // Handle Select All\n const handleSelectAll = (e: any) => {\n const isChecked = e.target.checked;\n setSelectAll(isChecked);\n\n if (isChecked) {\n setSelectedSplit(\n orderProductDetails?.map((order: any) => ({ id: order.id }))\n );\n } else {\n setSelectedSplit([]);\n }\n };\n\n const handleSelectedSplitList = (id: any) => {\n setSelectedSplit((prevSelectedOrder: any) => {\n const isSelected = prevSelectedOrder?.some(\n (order: any) => order.id === id\n );\n\n const updatedSelection = isSelected\n ? prevSelectedOrder?.filter((order: any) => order.id !== id)\n : [...prevSelectedOrder, { id }];\n\n setSelectAll(updatedSelection?.length === orderProductDetails?.length);\n\n return updatedSelection;\n });\n };\n\n /** Selecting a whole pallet is a shortcut for ticking each of its rows. */\n const toggleGroupSelection = (group: PalletGroup, allSelected: boolean) => {\n const groupIds = group.items.map((item: any) => item?.id);\n applySelection(toggleGroupSelectionIds(selectedIds, groupIds, allSelected));\n };\n\n useEffect(() => {\n setPayload({\n ...payload,\n return_order: 1, // FOR SPLIT ORDER WE ARE ASKED TO SET THIS AS 1\n products: selectedSplits?.map((order: any) => order.id),\n force: true,\n });\n }, [selectedSplits, setPayload]);\n\n const renderProductRow = (product: any) => (\n <tr key={product.id}>\n <td style={{ position: 'relative' }}>\n <Checkbox\n checked={selectedSplits?.some(\n (selectedOrder: any) => selectedOrder.id === product.id\n )}\n onChange={() => handleSelectedSplitList(product.id)}\n />\n </td>\n <td>{product?.order_product_type?.type}</td>\n <td>{product?.code}</td>\n <td>{product?.description}</td>\n <td>{product?.description}</td>\n <td>{product?.description}</td>\n <td>{product?.sku}</td>\n </tr>\n );\n\n const renderPalletGroup = (group: PalletGroup) => {\n const expanded = isGroupExpanded(group);\n const selectedInGroup = group.items.filter((item: any) =>\n selectedIds.includes(item?.id)\n ).length;\n const allSelectedInGroup =\n group.items.length > 0 && selectedInGroup === group.items.length;\n const itemLabel = `${group.items.length} ${\n group.items.length === 1 ? 'item' : 'items'\n }`;\n\n return (\n <React.Fragment key={group.key}>\n <PalletHeaderRow>\n <td colSpan={COLUMN_COUNT}>\n <div className={group.isNoPallet ? 'no-pallet-divider' : undefined}>\n <PalletHeaderBar>\n <Checkbox\n checked={allSelectedInGroup}\n onChange={() => toggleGroupSelection(group, allSelectedInGroup)}\n aria-label={\n group.isNoPallet\n ? 'Select all items with no pallet ID'\n : `Select whole pallet ${group.label}`\n }\n />\n\n <PalletHeaderToggle\n type=\"button\"\n disabled={group.isNoPallet}\n onClick={\n group.isNoPallet ? undefined : () => togglePallet(group.key)\n }\n aria-expanded={group.isNoPallet ? undefined : expanded}\n >\n {!group.isNoPallet && (\n <Chevron $isExpanded={expanded}>\n <ChevronDownIcon />\n </Chevron>\n )}\n\n <span className=\"title\">\n {group.isNoPallet ? (\n <span>No Pallet ID</span>\n ) : (\n <>\n <span>Pallet ID:</span>\n <strong>{group.label}</strong>\n </>\n )}\n </span>\n\n <span className=\"count\">({itemLabel})</span>\n\n {selectedInGroup > 0 && (\n <span className=\"selected\">{selectedInGroup} selected</span>\n )}\n\n {!group.isNoPallet && (\n <ToggleGlyph aria-hidden=\"true\">\n {expanded ? '−' : '+'}\n </ToggleGlyph>\n )}\n </PalletHeaderToggle>\n </PalletHeaderBar>\n </div>\n </td>\n </PalletHeaderRow>\n\n {expanded && group.items.map(renderProductRow)}\n </React.Fragment>\n );\n };\n\n return (\n <>\n <StyledTableWrapper id=\"tableScrolling\">\n <StyledTable>\n <thead>\n <tr>\n <th style={{ position: 'relative' }}>\n <Checkbox\n checked={selectAll}\n onChange={handleSelectAll}\n disabled={\n orderProductDetails?.length === 0 ||\n orderProductDetails?.length === null\n }\n />\n </th>\n <th>Type</th>\n <th>Code</th>\n <th>Scan</th>\n <th>Description</th>\n <th>Delivery Instructions</th>\n <th>Barcode</th>\n </tr>\n </thead>\n <tbody>\n {loading ? (\n <tr>\n <td colSpan={6}>\n <Skeleton active />\n </td>\n <td colSpan={6}></td>\n </tr>\n ) : orderProductDetails?.length === 0 ? (\n <tr>\n <td className=\"emptyTd\" colSpan={COLUMN_COUNT}>\n <EmptyDataContainer>\n <Empty description=\"No Data Found\" />\n </EmptyDataContainer>\n </td>\n </tr>\n ) : isGrouped ? (\n palletGroups.map(renderPalletGroup)\n ) : (\n orderProductDetails?.length > 0 &&\n orderProductDetails?.map((product: any) =>\n renderProductRow(product)\n )\n )}\n </tbody>\n </StyledTable>\n </StyledTableWrapper>\n </>\n );\n}\n\nconst PalletHeaderRow = styled.tr`\n && > td {\n padding: 4px 0;\n background: transparent;\n border: none;\n border-radius: 0;\n }\n\n /*\n Divider separating the No Pallet ID group from the palletised groups. Applied\n to an inner wrapper rather than the td, because the rule above resets cell\n borders at && specificity and would win over a border on the td itself.\n */\n && .no-pallet-divider {\n border-top: 1px solid #c9c6c1;\n padding-top: 10px;\n margin-top: 4px;\n }\n`;\n\nconst PalletHeaderBar = styled.div`\n /*\n Required. The library Checkbox renders its real <input> as position:absolute\n with no offsets, so it needs a positioned ancestor here — otherwise its\n containing block resolves outside this scrolling modal, the invisible input\n stops scrolling with the visible box, and clicks land on another pallet's\n checkbox. Same reason the product cells set position:relative inline.\n */\n position: relative;\n display: flex;\n align-items: center;\n gap: 8px;\n width: 100%;\n padding: 8px 12px;\n border: 1px solid #e2e0db;\n border-radius: 6px;\n background: #f1f5f9;\n font-family: 'Roboto', sans-serif;\n font-size: 13px;\n font-weight: 500;\n color: #3a3630;\n\n`;\n\nconst PalletHeaderToggle = styled.button`\n display: flex;\n align-items: center;\n gap: 8px;\n flex: 1;\n padding: 0;\n border: none;\n background: transparent;\n cursor: pointer;\n text-align: left;\n font: inherit;\n color: inherit;\n\n &:disabled {\n cursor: default;\n opacity: 1;\n }\n\n .title {\n display: flex;\n align-items: center;\n gap: 6px;\n text-transform: uppercase;\n letter-spacing: 0.3px;\n\n strong {\n font-weight: 700;\n text-transform: none;\n letter-spacing: 0;\n }\n }\n\n .count {\n color: #6a7378;\n font-weight: 400;\n }\n\n .selected {\n color: #0099ff;\n font-weight: 600;\n font-size: 12px;\n }\n`;\n\nconst Chevron = styled.span<{ $isExpanded: boolean }>`\n display: inline-flex;\n align-items: center;\n transition: transform 0.15s ease-in-out;\n transform: rotate(${props => (props.$isExpanded ? '0deg' : '-90deg')});\n`;\n\nconst ToggleGlyph = styled.span`\n margin-left: auto;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 20px;\n height: 20px;\n border: 1px solid #cbd5e1;\n border-radius: 4px;\n background: #fff;\n font-size: 14px;\n line-height: 1;\n color: #475569;\n`;\n\nexport default SplitOrderTable;\n"],"names":["COLUMN_COUNT","SplitOrderTable","orderProductDetails","useReturnProductDetails","loading","useLoading","selectedSplits","setSelectedSplit","useSelectedSplit","selectAll","setSelectAll","useState","payload","setPayload","useSplitOrderPayload","selectedIds","useMemo","order","palletGroups","groupProductsByPallet","isGrouped","hasAnyPallet","expandedPallets","setExpandedPallets","isGroupExpanded","group","togglePallet","key","prev","applySelection","ids","id","handleSelectAll","isChecked","handleSelectedSplitList","prevSelectedOrder","updatedSelection","toggleGroupSelection","allSelected","groupIds","item","toggleGroupSelectionIds","useEffect","renderProductRow","product","jsxs","jsx","Checkbox","selectedOrder","renderPalletGroup","expanded","selectedInGroup","allSelectedInGroup","itemLabel","React","PalletHeaderRow","PalletHeaderBar","PalletHeaderToggle","Chevron","ChevronDownIcon","Fragment","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A;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAwBzBV,IAAqBU,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GA4C5BT,IAAUS,EAAO;AAAA;AAAA;AAAA;AAAA,sBAID,CAAAC,MAAUA,EAAM,cAAc,SAAS,QAAS;AAAA,GAGhEP,KAAcM,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
|
|
@@ -1,54 +1,67 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useEffect as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { useCurrentAction as
|
|
7
|
-
import { useApiHook as
|
|
8
|
-
import { useSplitOrderPayload as
|
|
9
|
-
import { notification as
|
|
10
|
-
import { useNavigate as
|
|
11
|
-
function
|
|
12
|
-
const [, o] =
|
|
1
|
+
import { jsx as e, Fragment as x, jsxs as O } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect as v } from "react";
|
|
3
|
+
import A from "../../../../../common/modals/order-action-modal/OrderActionModal.js";
|
|
4
|
+
import c from "styled-components";
|
|
5
|
+
import w from "./SplitOrderTable.js";
|
|
6
|
+
import { useCurrentAction as y, useOrderDetails as C, useOrderId as D } from "../../../store.js";
|
|
7
|
+
import { useApiHook as P } from "@bjsdistribution/dms-component-library";
|
|
8
|
+
import { useSplitOrderPayload as T, useSelectedSplit as I } from "../../store.js";
|
|
9
|
+
import { notification as $, Spin as k } from "antd";
|
|
10
|
+
import { useNavigate as j } from "react-router-dom";
|
|
11
|
+
function K() {
|
|
12
|
+
const [, o] = y(), [p] = C(), i = p?.order_recipient, u = `${i?.recipient_name}, ${i?.postcode}`, [r, m] = D(), [f] = T(), [n, s] = I(), S = () => {
|
|
13
13
|
o(void 0);
|
|
14
|
-
},
|
|
15
|
-
data:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
}, h = j(), {
|
|
15
|
+
data: t,
|
|
16
|
+
loading: d,
|
|
17
|
+
setShouldPerformAction: b
|
|
18
|
+
} = P({
|
|
19
|
+
endpoint: `/v1/return/split/${r}`,
|
|
19
20
|
method: "POST",
|
|
20
|
-
body:
|
|
21
|
+
body: f,
|
|
21
22
|
performAction: !1
|
|
22
|
-
}),
|
|
23
|
-
|
|
24
|
-
},
|
|
25
|
-
return
|
|
26
|
-
if (
|
|
27
|
-
const
|
|
28
|
-
console.log(
|
|
23
|
+
}), g = () => {
|
|
24
|
+
r && b(!0);
|
|
25
|
+
}, l = t?.data?.new_order;
|
|
26
|
+
return v(() => {
|
|
27
|
+
if (t?.code === 200) {
|
|
28
|
+
const a = location.pathname.split("/").slice(0, -1).join("/");
|
|
29
|
+
console.log(a, "currentPath"), h(`${a}/${l}`), m(l), s([]), $.success({
|
|
29
30
|
message: "Success",
|
|
30
31
|
description: (
|
|
31
32
|
//@ts-ignore
|
|
32
|
-
|
|
33
|
+
t?.message || "Sucess"
|
|
33
34
|
)
|
|
34
35
|
}), o(void 0), s([]);
|
|
35
36
|
}
|
|
36
|
-
}, [
|
|
37
|
-
|
|
37
|
+
}, [t]), /* @__PURE__ */ e(
|
|
38
|
+
A,
|
|
38
39
|
{
|
|
39
40
|
headerTitle: "Split Order",
|
|
40
41
|
showAdditionalInfo: !0,
|
|
41
|
-
infoText:
|
|
42
|
-
onCloseHeader:
|
|
43
|
-
onSubmit:
|
|
44
|
-
submitBtnTitle:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
42
|
+
infoText: u,
|
|
43
|
+
onCloseHeader: S,
|
|
44
|
+
onSubmit: g,
|
|
45
|
+
submitBtnTitle: d ? /* @__PURE__ */ O(_, { children: [
|
|
46
|
+
/* @__PURE__ */ e(k, { size: "small" }),
|
|
47
|
+
"Splitting..."
|
|
48
|
+
] }) : "Split Order",
|
|
49
|
+
footerActions: /* @__PURE__ */ e(x, {}),
|
|
50
|
+
isSubmitDisabled: d ? !0 : n?.length > 0 ? !n : !0,
|
|
51
|
+
children: /* @__PURE__ */ e(H, { children: /* @__PURE__ */ e(w, {}) })
|
|
48
52
|
}
|
|
49
53
|
);
|
|
50
54
|
}
|
|
51
|
-
const
|
|
55
|
+
const _ = c.span`
|
|
56
|
+
display: inline-flex;
|
|
57
|
+
align-items: center;
|
|
58
|
+
gap: 8px;
|
|
59
|
+
|
|
60
|
+
/* The button label is light, so the default dark spinner would be invisible. */
|
|
61
|
+
.ant-spin-dot-item {
|
|
62
|
+
background-color: currentColor;
|
|
63
|
+
}
|
|
64
|
+
`, H = c.div`
|
|
52
65
|
/* display: flex; */
|
|
53
66
|
padding: 15px 12px;
|
|
54
67
|
flex: 1 0 0;
|
|
@@ -64,6 +77,6 @@ const $ = O.div`
|
|
|
64
77
|
scrollbar-width: thin;
|
|
65
78
|
`;
|
|
66
79
|
export {
|
|
67
|
-
|
|
80
|
+
K as default
|
|
68
81
|
};
|
|
69
82
|
//# sourceMappingURL=index.js.map
|