@bjsdistribution/dms-client-return 0.1.71-prod → 0.1.72-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/common/utils.js +8 -4
- package/dist/common/utils.js.map +1 -1
- package/dist/components/order-daily-overview/return-after-table/table/OrderTable.js +59 -52
- package/dist/components/order-daily-overview/return-after-table/table/OrderTable.js.map +1 -1
- package/dist/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.js +144 -137
- package/dist/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.js.map +1 -1
- package/dist/types/common/utils.d.ts +1 -0
- package/package.json +1 -1
package/dist/common/utils.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import { getProjectEnv as
|
|
2
|
-
const e =
|
|
1
|
+
import { getProjectEnv as n } from "@bjsdistribution/dms-component-library";
|
|
2
|
+
const e = n(), r = e === "release_us" ? "Zipcode" : "Postcode", a = e === "release_us" ? "LBS" : "KG", o = {
|
|
3
|
+
staging: { 86: "BJS HD", 112: "BJS Extra" },
|
|
4
|
+
production: { 1: "BJS HD", 108: "BJS Extra" }
|
|
5
|
+
}, i = (t) => t == null ? "" : o[e === "staging" || e === "development" ? "staging" : "production"][Number(t)] || "";
|
|
3
6
|
export {
|
|
4
|
-
|
|
5
|
-
|
|
7
|
+
r as POSTCODE_LABEL,
|
|
8
|
+
a as WEIGHT_UNIT,
|
|
9
|
+
i as getAccountTypeLabel
|
|
6
10
|
};
|
|
7
11
|
//# sourceMappingURL=utils.js.map
|
package/dist/common/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../src/common/utils.ts"],"sourcesContent":["import { getProjectEnv } from '@bjsdistribution/dms-component-library';\n\nconst basedEnv = getProjectEnv();\n\nexport const POSTCODE_LABEL = basedEnv === 'release_us' ? 'Zipcode' : 'Postcode';\nexport const CURRENCY_SYMBOL = basedEnv === 'release_us' ? '$' : '£';\nexport const WEIGHT_UNIT = basedEnv === 'release_us' ? 'LBS' : 'KG';\n\nexport const getEnvironment = () => basedEnv;\n"],"names":["basedEnv","getProjectEnv","POSTCODE_LABEL","WEIGHT_UNIT"],"mappings":";AAEA,MAAMA,IAAWC,EAAA,GAEJC,IAAiBF,MAAa,eAAe,YAAY,YAEzDG,IAAcH,MAAa,eAAe,QAAQ;"}
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../src/common/utils.ts"],"sourcesContent":["import { getProjectEnv } from '@bjsdistribution/dms-component-library';\n\nconst basedEnv = getProjectEnv();\n\nexport const POSTCODE_LABEL = basedEnv === 'release_us' ? 'Zipcode' : 'Postcode';\nexport const CURRENCY_SYMBOL = basedEnv === 'release_us' ? '$' : '£';\nexport const WEIGHT_UNIT = basedEnv === 'release_us' ? 'LBS' : 'KG';\n\nexport const getEnvironment = () => basedEnv;\n\nconst ACCOUNT_TYPE_BY_OWNER_ID: Record<string, Record<number, string>> = {\n staging: { 86: 'BJS HD', 112: 'BJS Extra' },\n production: { 1: 'BJS HD', 108: 'BJS Extra' },\n};\n\nexport const getAccountTypeLabel = (ownerId: number | string | undefined) => {\n if (ownerId === undefined || ownerId === null) return '';\n const envKey = basedEnv === 'staging' || basedEnv === 'development'\n ? 'staging'\n : 'production';\n return ACCOUNT_TYPE_BY_OWNER_ID[envKey][Number(ownerId)] || '';\n};\n"],"names":["basedEnv","getProjectEnv","POSTCODE_LABEL","WEIGHT_UNIT","ACCOUNT_TYPE_BY_OWNER_ID","getAccountTypeLabel","ownerId"],"mappings":";AAEA,MAAMA,IAAWC,EAAA,GAEJC,IAAiBF,MAAa,eAAe,YAAY,YAEzDG,IAAcH,MAAa,eAAe,QAAQ,MAIzDI,IAAmE;AAAA,EACvE,SAAS,EAAE,IAAI,UAAU,KAAK,YAAA;AAAA,EAC9B,YAAY,EAAE,GAAG,UAAU,KAAK,YAAA;AAClC,GAEaC,IAAsB,CAACC,MACLA,KAAY,OAAa,KAI/CF,EAHQJ,MAAa,aAAaA,MAAa,gBAClD,YACA,YACkC,EAAE,OAAOM,CAAO,CAAC,KAAK;"}
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { jsx as e, Fragment as
|
|
2
|
-
import { Select as
|
|
3
|
-
import { useRef as
|
|
4
|
-
import { useOrderId as
|
|
5
|
-
import { EmptyDataContainer as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { StyledTableWrapper as
|
|
9
|
-
import { usePrintOptionTOggle as
|
|
10
|
-
import { NavLink as
|
|
11
|
-
import { formatDate as
|
|
12
|
-
import
|
|
13
|
-
import { useAssignData as
|
|
14
|
-
import
|
|
15
|
-
import { useApiHook as
|
|
1
|
+
import { jsx as e, Fragment as W, jsxs as n } from "react/jsx-runtime";
|
|
2
|
+
import { Select as $, notification as _, Skeleton as B, Empty as z } from "antd";
|
|
3
|
+
import { useRef as k, useState as S, useMemo as G, useEffect as v } from "react";
|
|
4
|
+
import { useOrderId as V, useReturnAfterOrderData as q } from "../../../order-view/store.js";
|
|
5
|
+
import { EmptyDataContainer as J } from "../../table/table-data/styles.js";
|
|
6
|
+
import K from "../../../../assets/icons/PrinterIcon.js";
|
|
7
|
+
import Q from "../../../../assets/icons/DownIcon.js";
|
|
8
|
+
import { StyledTableWrapper as X, StyledTable as Y, CustomDrop as Z } from "../../return-order-table/return-orders-filters/returnstyles.js";
|
|
9
|
+
import { usePrintOptionTOggle as ee, useLoading as re } from "../../store/store.js";
|
|
10
|
+
import { NavLink as te } from "react-router-dom";
|
|
11
|
+
import { formatDate as ne, displayValueOrNA as o } from "../../shared/utlis.js";
|
|
12
|
+
import oe from "../../shared/elements/PrintDropDown.js";
|
|
13
|
+
import { useAssignData as ce, useAssignPayload as ae, useCallApiAgain as se } from "../../../store.js";
|
|
14
|
+
import le from "styled-components";
|
|
15
|
+
import { useApiHook as ie } from "@bjsdistribution/dms-component-library";
|
|
16
16
|
import D from "../../../../common/CaretDownFilledIcon.js";
|
|
17
|
-
import
|
|
18
|
-
import { WEIGHT_UNIT as F } from "../../../../common/utils.js";
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
}, y =
|
|
17
|
+
import de from "../../../../common/SortIcon.js";
|
|
18
|
+
import { WEIGHT_UNIT as F, getAccountTypeLabel as I } from "../../../../common/utils.js";
|
|
19
|
+
const Oe = () => {
|
|
20
|
+
const N = k(null), h = k(null), [m, f] = ee(), [O] = ce(), [, T] = V(), [d] = q(), [b, P] = ae(), [, R] = S(!1), [, C] = se(), [E] = re(), [s, L] = S(null), l = (r) => {
|
|
21
|
+
L((t) => t?.key === r && t.direction === "asc" ? { key: r, direction: "desc" } : { key: r, direction: "asc" });
|
|
22
|
+
}, y = G(() => {
|
|
23
23
|
if (!d || !s) return d;
|
|
24
24
|
const { key: r, direction: t } = s;
|
|
25
|
-
return [...d].sort((
|
|
26
|
-
const c =
|
|
25
|
+
return [...d].sort((w, u) => {
|
|
26
|
+
const c = w[r], a = u[r];
|
|
27
27
|
return typeof c == "number" && typeof a == "number" ? t === "asc" ? c - a : a - c : typeof c == "string" && typeof a == "string" ? t === "asc" ? c.localeCompare(a) : a.localeCompare(c) : 0;
|
|
28
28
|
});
|
|
29
|
-
}, [d, s]), i = (r) => !s || s.key !== r ? /* @__PURE__ */ e(
|
|
29
|
+
}, [d, s]), i = (r) => !s || s.key !== r ? /* @__PURE__ */ e(de, {}) : s.direction === "asc" ? /* @__PURE__ */ e(D, {}) : /* @__PURE__ */ e(D, {}), j = (r) => {
|
|
30
30
|
f((t) => t === r ? null : r);
|
|
31
31
|
};
|
|
32
32
|
v(() => (document.addEventListener("mousedown", A), () => {
|
|
@@ -34,7 +34,7 @@ const Ne = () => {
|
|
|
34
34
|
}), []);
|
|
35
35
|
const A = (r) => {
|
|
36
36
|
h.current && !h.current.contains(r.target) && f(null);
|
|
37
|
-
},
|
|
37
|
+
}, x = (r) => {
|
|
38
38
|
switch (r) {
|
|
39
39
|
case "Cancelled":
|
|
40
40
|
return { color: "#E95252", background: "rgba(233, 82, 82, 0.15)" };
|
|
@@ -60,34 +60,34 @@ const Ne = () => {
|
|
|
60
60
|
}
|
|
61
61
|
}, {
|
|
62
62
|
data: p,
|
|
63
|
-
setShouldPerformAction:
|
|
63
|
+
setShouldPerformAction: U,
|
|
64
64
|
error: g
|
|
65
|
-
} =
|
|
65
|
+
} = ie({
|
|
66
66
|
endpoint: "return_orders/update/assign/",
|
|
67
67
|
method: "PUT",
|
|
68
68
|
body: [b],
|
|
69
69
|
performAction: !1
|
|
70
|
-
}),
|
|
70
|
+
}), H = O?.map((r) => ({
|
|
71
71
|
label: r?.type?.charAt(0)?.toUpperCase() + r?.type?.slice(1),
|
|
72
72
|
value: r?.bjs_delivery
|
|
73
|
-
})),
|
|
74
|
-
C(!1),
|
|
73
|
+
})), M = (r, t) => {
|
|
74
|
+
C(!1), R(t), P({
|
|
75
75
|
...b,
|
|
76
76
|
return_order_id: r,
|
|
77
77
|
bjs_delivery: t
|
|
78
|
-
}),
|
|
78
|
+
}), U(!0);
|
|
79
79
|
};
|
|
80
80
|
return v(() => {
|
|
81
|
-
p?.code === 200 ? (C(!0),
|
|
81
|
+
p?.code === 200 ? (C(!0), _.success({
|
|
82
82
|
message: "Success",
|
|
83
83
|
// @ts-ignore
|
|
84
84
|
description: `${p?.message}`
|
|
85
|
-
})) : g?.detail &&
|
|
85
|
+
})) : g?.detail && _.error({
|
|
86
86
|
message: "Failure",
|
|
87
87
|
// @ts-ignore
|
|
88
88
|
description: `${g?.detail[0]?.msg}`
|
|
89
89
|
});
|
|
90
|
-
}, [p, g]), /* @__PURE__ */ e(
|
|
90
|
+
}, [p, g]), /* @__PURE__ */ e(W, { children: /* @__PURE__ */ e(X, { className: "fortables", children: /* @__PURE__ */ n(Y, { children: [
|
|
91
91
|
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ n("tr", { children: [
|
|
92
92
|
/* @__PURE__ */ e("th", { onClick: () => l("created_at"), children: /* @__PURE__ */ n("div", { className: "sortIconClass", children: [
|
|
93
93
|
"Created ",
|
|
@@ -121,10 +121,10 @@ const Ne = () => {
|
|
|
121
121
|
/* @__PURE__ */ e("th", { children: "Status" }),
|
|
122
122
|
/* @__PURE__ */ e("th", { className: "emailInvoiceShare", children: "Labels" })
|
|
123
123
|
] }) }),
|
|
124
|
-
/* @__PURE__ */ e("tbody", { children:
|
|
125
|
-
/* @__PURE__ */ e("td", { colSpan: 16, children: /* @__PURE__ */ e(
|
|
124
|
+
/* @__PURE__ */ e("tbody", { children: E ? /* @__PURE__ */ n("tr", { children: [
|
|
125
|
+
/* @__PURE__ */ e("td", { colSpan: 16, children: /* @__PURE__ */ e(B, { active: !0 }) }),
|
|
126
126
|
/* @__PURE__ */ e("td", { colSpan: 16 })
|
|
127
|
-
] }) : y?.length === 0 ? /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: 16, children: /* @__PURE__ */ e(
|
|
127
|
+
] }) : y?.length === 0 ? /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: 16, children: /* @__PURE__ */ e(J, { children: /* @__PURE__ */ e(z, {}) }) }) }) : y?.map((r, t) => {
|
|
128
128
|
const u = {
|
|
129
129
|
cancelled: "Cancelled",
|
|
130
130
|
"on hold": "On Hold",
|
|
@@ -135,13 +135,20 @@ const Ne = () => {
|
|
|
135
135
|
outstanding: "Outstanding",
|
|
136
136
|
routed: "Routed",
|
|
137
137
|
failed: "Failed"
|
|
138
|
-
}[r?.status_value] || "Unknown", c =
|
|
138
|
+
}[r?.status_value] || "Unknown", c = x(u);
|
|
139
139
|
return /* @__PURE__ */ n("tr", { children: [
|
|
140
|
-
/* @__PURE__ */ e("td", { children:
|
|
140
|
+
/* @__PURE__ */ e("td", { children: ne(new Date(r?.created_at)) }),
|
|
141
141
|
/* @__PURE__ */ e("td", { children: o(r?.return_location_name) }),
|
|
142
142
|
/* @__PURE__ */ e("td", { children: r?.locations?.length ? r?.locations.join(", ") : "N/A" }),
|
|
143
|
-
/* @__PURE__ */
|
|
144
|
-
|
|
143
|
+
/* @__PURE__ */ n("td", { children: [
|
|
144
|
+
o(r?.customer_name),
|
|
145
|
+
I(r?.owner_id) && /* @__PURE__ */ n("span", { children: [
|
|
146
|
+
" (",
|
|
147
|
+
I(r?.owner_id),
|
|
148
|
+
")"
|
|
149
|
+
] })
|
|
150
|
+
] }),
|
|
151
|
+
/* @__PURE__ */ e("td", { onClick: () => T(r.id), children: /* @__PURE__ */ n("ul", { style: { listStyleType: "none", padding: 0 }, children: [
|
|
145
152
|
/* @__PURE__ */ e(
|
|
146
153
|
"li",
|
|
147
154
|
{
|
|
@@ -150,7 +157,7 @@ const Ne = () => {
|
|
|
150
157
|
fontWeight: 600,
|
|
151
158
|
paddingLeft: 0
|
|
152
159
|
},
|
|
153
|
-
children: /* @__PURE__ */ e(
|
|
160
|
+
children: /* @__PURE__ */ e(te, { to: `../${r.id}`, children: o(r?.recipient_name) })
|
|
154
161
|
}
|
|
155
162
|
),
|
|
156
163
|
/* @__PURE__ */ e("li", { style: { color: "#888075" }, children: o(r?.postcode) })
|
|
@@ -166,11 +173,11 @@ const Ne = () => {
|
|
|
166
173
|
] }),
|
|
167
174
|
/* @__PURE__ */ e("td", { children: o(r?.cube) }),
|
|
168
175
|
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ e(
|
|
169
|
-
|
|
176
|
+
ue,
|
|
170
177
|
{
|
|
171
|
-
options:
|
|
178
|
+
options: H,
|
|
172
179
|
placeholder: "Select",
|
|
173
|
-
onChange: (a) =>
|
|
180
|
+
onChange: (a) => M(r?.id, a),
|
|
174
181
|
style: { width: "150px" },
|
|
175
182
|
value: r?.bjs_delivery
|
|
176
183
|
}
|
|
@@ -194,19 +201,19 @@ const Ne = () => {
|
|
|
194
201
|
}
|
|
195
202
|
) }),
|
|
196
203
|
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("ul", { className: "actionbox", children: /* @__PURE__ */ e(
|
|
197
|
-
|
|
204
|
+
Z,
|
|
198
205
|
{
|
|
199
|
-
ref:
|
|
206
|
+
ref: N,
|
|
200
207
|
className: m === t ? "active" : "",
|
|
201
208
|
children: /* @__PURE__ */ n(
|
|
202
209
|
"li",
|
|
203
210
|
{
|
|
204
211
|
className: "shareIconContainer",
|
|
205
|
-
onClick: () =>
|
|
212
|
+
onClick: () => j(t),
|
|
206
213
|
children: [
|
|
207
|
-
/* @__PURE__ */ e(J, {}),
|
|
208
214
|
/* @__PURE__ */ e(K, {}),
|
|
209
|
-
|
|
215
|
+
/* @__PURE__ */ e(Q, {}),
|
|
216
|
+
m === t && /* @__PURE__ */ e("div", { ref: h, children: /* @__PURE__ */ e(oe, { legacyProductId: r }) })
|
|
210
217
|
]
|
|
211
218
|
}
|
|
212
219
|
)
|
|
@@ -215,7 +222,7 @@ const Ne = () => {
|
|
|
215
222
|
] }, r.id);
|
|
216
223
|
}) })
|
|
217
224
|
] }) }) });
|
|
218
|
-
},
|
|
225
|
+
}, ue = le($)`
|
|
219
226
|
.ant-select-selector {
|
|
220
227
|
/* width: 22vw; */
|
|
221
228
|
border-radius: 22px;
|
|
@@ -226,6 +233,6 @@ const Ne = () => {
|
|
|
226
233
|
}
|
|
227
234
|
`;
|
|
228
235
|
export {
|
|
229
|
-
|
|
236
|
+
Oe as default
|
|
230
237
|
};
|
|
231
238
|
//# sourceMappingURL=OrderTable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OrderTable.js","sources":["../../../../../src/components/order-daily-overview/return-after-table/table/OrderTable.tsx"],"sourcesContent":["import { Empty, notification, Select } from 'antd';\nimport React, { useEffect, useMemo, useRef, useState } from 'react';\nimport { Skeleton } from 'antd';\n// import { useSelectedOrders } from '../../../store';\nimport { useOrderId, useReturnAfterOrderData } from '../../../order-view/store';\nimport { EmptyDataContainer } from '../../table/table-data/styles';\nimport PrinterIcon from '../../../../assets/icons/PrinterIcon';\nimport DownIcon from '../../../../assets/icons/DownIcon';\nimport {\n StyledTable,\n StyledTableWrapper,\n CustomDrop,\n} from '../../return-order-table/return-orders-filters/returnstyles';\nimport { useLoading, usePrintOptionTOggle } from '../../store/store';\nimport { NavLink } from 'react-router-dom';\nimport { displayValueOrNA, formatDate } from '../../shared/utlis';\nimport PrintDropDown from '../../shared/elements/PrintDropDown';\nimport {\n useAssignData,\n useAssignPayload,\n useCallApiAgain,\n} from '../../../store';\nimport styled from 'styled-components';\nimport { useApiHook } from '@bjsdistribution/dms-component-library';\nimport { ApiResponse } from '../../common/interface';\nimport CaretDownFilledIcon from '../../../../common/CaretDownFilledIcon';\nimport SortIcon from '../../../../common/SortIcon';\nimport { WEIGHT_UNIT } from '../../../../common/utils';\n\nconst OrderTable = () => {\n // const [, setSelectedReturnOrder] = useSelectedOrders();\n // const [selectAll, setSelectAll] = useState(false);\n const dropdownRefParent = useRef<HTMLDivElement>(null);\n const dropdownRef = useRef<HTMLDivElement>(null);\n const [printToogle, setPrintToggle] = usePrintOptionTOggle();\n const [assignData] = useAssignData();\n const [, setOrderId] = useOrderId();\n const [returnAfterOrder] = useReturnAfterOrderData();\n const [assignPayload, setAssignPayload] = useAssignPayload();\n const [, setAssign] = useState<boolean>(false);\n const [, setCallAPi] = useCallApiAgain();\n const [loading] = useLoading();\n\n //sorting\n const [sortConfig, setSortConfig] = useState<{\n key: string;\n direction: 'asc' | 'desc';\n } | null>(null);\n\n const handleSort = (key: string) => {\n setSortConfig((prev: any) => {\n if (prev?.key === key && prev.direction === 'asc') {\n return { key, direction: 'desc' };\n }\n return { key, direction: 'asc' };\n });\n };\n\n const sortedData = useMemo(() => {\n if (!returnAfterOrder || !sortConfig) return returnAfterOrder;\n\n const { key, direction } = sortConfig;\n return [...returnAfterOrder].sort((a, b) => {\n const valueA = a[key];\n const valueB = b[key];\n\n if (typeof valueA === 'number' && typeof valueB === 'number') {\n return direction === 'asc' ? valueA - valueB : valueB - valueA;\n }\n if (typeof valueA === 'string' && typeof valueB === 'string') {\n return direction === 'asc'\n ? valueA.localeCompare(valueB)\n : valueB.localeCompare(valueA);\n }\n return 0;\n });\n }, [returnAfterOrder, sortConfig]);\n\n const renderSortIcon = (columnKey: string) => {\n if (!sortConfig || sortConfig.key !== columnKey) {\n return <SortIcon />;\n }\n return sortConfig.direction === 'asc' ? (\n <CaretDownFilledIcon />\n ) : (\n <CaretDownFilledIcon />\n );\n };\n\n const OpenDropDown = (index: number) => {\n setPrintToggle(prevIndex => (prevIndex === index ? null : index));\n };\n\n // Close dropdown outside click\n useEffect(() => {\n document.addEventListener('mousedown', handleClickOutside);\n return () => {\n document.removeEventListener('mousedown', handleClickOutside);\n };\n }, []);\n const handleClickOutside = (event: MouseEvent) => {\n if (\n dropdownRef.current &&\n !dropdownRef.current.contains(event.target as Node)\n ) {\n setPrintToggle(null);\n }\n };\n\n // const handleSelectAll = (e: any) => {\n // setSelectAll(e.target.checked);\n // if (e.target.checked) {\n // setSelectedReturnOrder(\n // returnAfterOrder.map((e: any) => ({\n // id: e.id,\n // status_id: 3,\n // }))\n // );\n // } else {\n // setSelectedReturnOrder([]);\n // }\n // };\n\n // const handleSelectInvoice = (id: any) => {\n // setSelectedReturnOrder((prevSelectedInvoices: any) => {\n // const isSelected = prevSelectedInvoices?.some(\n // (item: any) => item.id === id\n // );\n\n // if (isSelected) {\n // return prevSelectedInvoices.filter((items: any) => items.id !== id);\n // } else {\n // return [...prevSelectedInvoices, { id, status_id: 3 }];\n // }\n // });\n // };\n\n const getStatusClass = (status: string) => {\n switch (status) {\n case 'Cancelled':\n return { color: '#E95252', background: 'rgba(233, 82, 82, 0.15)' };\n case 'On Hold':\n return { color: '#F4A503', background: '#FFF1D6' };\n case 'Sub-Contracted':\n return { color: '#F4A503', background: '#FFF1D6' };\n case 'Awaiting route':\n return { color: '#845ADF', background: 'rgba(132, 90, 223, 0.15)' };\n case 'Awaiting':\n return { color: '#845ADF', background: 'rgba(132, 90, 223, 0.15)' };\n case 'Completed':\n return {\n color: '#1F9254',\n background: 'rgba(41, 204, 106, 0.15)',\n };\n case 'Outstanding':\n return { color: '#FF9900', background: 'rgba(255, 153, 0, 0.15)' };\n case 'Routed':\n return { color: '#6396E5', background: 'rgba(99, 150, 229, 0.15)' };\n default:\n return { color: '#000', background: '#fff' };\n }\n };\n\n // API for Assign\n const {\n data: actionResponse,\n setShouldPerformAction: setAssignAction,\n error: apiError,\n } = useApiHook<{\n data: ApiResponse[];\n }>({\n endpoint: `return_orders/update/assign/`,\n method: 'PUT',\n body: [assignPayload],\n performAction: false,\n });\n\n //client options\n const assignOptions = assignData?.map((option: any) => ({\n label: option?.type?.charAt(0)?.toUpperCase() + option?.type?.slice(1),\n value: option?.bjs_delivery,\n }));\n\n const handleAssignPayload = (Id: number, value: boolean) => {\n setCallAPi(false);\n setAssign(value);\n setAssignPayload({\n ...assignPayload,\n return_order_id: Id,\n bjs_delivery: value,\n });\n setAssignAction(true);\n };\n\n useEffect(() => {\n //@ts-ignore\n if (actionResponse?.code === 200) {\n setCallAPi(true);\n notification.success({\n message: 'Success',\n // @ts-ignore\n description: `${actionResponse?.message}`,\n });\n // @ts-ignore\n } else if (apiError?.detail) {\n notification.error({\n message: 'Failure',\n // @ts-ignore\n description: `${apiError?.detail[0]?.msg}`,\n });\n }\n }, [actionResponse, apiError]);\n\n return (\n <>\n <StyledTableWrapper className=\"fortables\">\n <StyledTable>\n <thead>\n <tr>\n {/* <th className=\"emailInvoiceCheckbox\">\n <Checkbox checked={false} />\n </th> */}\n <th onClick={() => handleSort('created_at')}>\n <div className=\"sortIconClass\">\n Created {renderSortIcon('created_at')}\n </div>\n </th>\n <th onClick={() => handleSort('return_location_name')}>\n <div className=\"sortIconClass\">\n Return Location {renderSortIcon('return_location_name')}\n </div>\n </th>\n <th>Pick Up Location</th>\n <th> Client</th>\n <th onClick={() => handleSort('recipient_name')}>\n <div className=\"sortIconClass\">\n Recipient {renderSortIcon('recipient_name')}\n </div>\n </th>\n <th>Consignment</th>\n <th>Return Order No</th>\n <th> Total Parts</th>\n <th> Total Orders</th>\n <th onClick={() => handleSort('weight')}>\n <div className=\"sortIconClass\">\n Total Weight ({WEIGHT_UNIT}) {renderSortIcon('weight')}\n </div>\n </th>\n <th onClick={() => handleSort('cube')}>\n <div className=\"sortIconClass\">\n Total CBM {renderSortIcon('cube')}\n </div>\n </th>\n <th>Assign</th>\n <th>Status</th>\n <th className=\"emailInvoiceShare\">Labels</th>\n </tr>\n </thead>\n <tbody>\n {loading ? (\n <tr>\n <td colSpan={16}>\n <Skeleton active />\n </td>\n <td colSpan={16}></td>\n </tr>\n ) : sortedData?.length === 0 ? (\n <tr>\n <td colSpan={16}>\n <EmptyDataContainer>\n <Empty />\n </EmptyDataContainer>\n </td>\n </tr>\n ) : (\n sortedData?.map((item: any, index: any) => {\n const statusMapping: any = {\n cancelled: 'Cancelled',\n 'on hold': 'On Hold',\n SC: 'Sub-Contracted',\n 'awaiting route': 'Awaiting',\n 'awaiting confirmation': 'Awaiting',\n complete: 'Completed',\n outstanding: 'Outstanding',\n routed: 'Routed',\n failed: 'Failed',\n };\n const status = statusMapping[item?.status_value] || 'Unknown';\n const statusClass = getStatusClass(status);\n\n return (\n <tr key={item.id}>\n {/* <td>\n <Checkbox\n checked={false}\n // onChange={() => handleSelectInvoice(item.id)}\n />\n </td> */}\n <td>{formatDate(new Date(item?.created_at))}</td>\n <td>{displayValueOrNA(item?.return_location_name)}</td>\n\n <td>\n {item?.locations?.length\n ? item?.locations.join(', ')\n : 'N/A'}\n </td>\n\n <td>{displayValueOrNA(item?.customer_name)}</td>\n\n <td onClick={() => setOrderId(item.id)}>\n <ul style={{ listStyleType: 'none', padding: 0 }}>\n <li\n style={{\n color: '#0099ff',\n fontWeight: 600,\n paddingLeft: 0,\n }}\n >\n <NavLink to={`../${item.id}`}>\n {displayValueOrNA(item?.recipient_name)}\n </NavLink>\n </li>\n <li style={{ color: '#888075' }}>\n {displayValueOrNA(item?.postcode)}\n </li>\n </ul>\n </td>\n\n <td>{displayValueOrNA(item?.consignment)}</td>\n <td>{displayValueOrNA(item?.order_number)}</td>\n\n <td>{displayValueOrNA(item?.total_products)}</td>\n <td>{displayValueOrNA(item?.total_orders)}</td>\n\n <td>\n {displayValueOrNA(item?.weight)}{' '}\n {item?.weight && item?.weight > 0 ? WEIGHT_UNIT : ''}\n </td>\n\n <td>{displayValueOrNA(item?.cube)}</td>\n\n <td key={item.id}>\n <StyledAntSelect\n options={assignOptions}\n placeholder=\"Select\"\n onChange={(value: any) =>\n handleAssignPayload(item?.id, value)\n }\n style={{ width: '150px' }}\n value={item?.bjs_delivery}\n />\n </td>\n\n <td>\n <ul\n className=\"statuscontainer\"\n style={{\n listStyleType: 'none',\n background: statusClass.background,\n }}\n >\n <li\n className=\"statustext\"\n style={{ color: statusClass.color }}\n >\n {status}\n </li>\n </ul>\n </td>\n <td>\n <ul className=\"actionbox\">\n <CustomDrop\n ref={dropdownRefParent}\n className={printToogle === index ? 'active' : ''}\n >\n <li\n className=\"shareIconContainer\"\n onClick={() => OpenDropDown(index)}\n >\n <PrinterIcon />\n <DownIcon />\n\n {printToogle === index && (\n <div ref={dropdownRef}>\n <PrintDropDown legacyProductId={item} />\n </div>\n )}\n </li>\n </CustomDrop>\n </ul>\n </td>\n </tr>\n );\n })\n )}\n </tbody>\n </StyledTable>\n </StyledTableWrapper>\n </>\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\nexport default OrderTable;\n"],"names":["OrderTable","dropdownRefParent","useRef","dropdownRef","printToogle","setPrintToggle","usePrintOptionTOggle","assignData","useAssignData","setOrderId","useOrderId","returnAfterOrder","useReturnAfterOrderData","assignPayload","setAssignPayload","useAssignPayload","setAssign","useState","setCallAPi","useCallApiAgain","loading","useLoading","sortConfig","setSortConfig","handleSort","key","prev","sortedData","useMemo","direction","a","b","valueA","valueB","renderSortIcon","columnKey","SortIcon","CaretDownFilledIcon","OpenDropDown","index","prevIndex","useEffect","handleClickOutside","event","getStatusClass","status","actionResponse","setAssignAction","apiError","useApiHook","assignOptions","option","handleAssignPayload","Id","value","notification","jsx","StyledTableWrapper","StyledTable","jsxs","WEIGHT_UNIT","Skeleton","EmptyDataContainer","Empty","item","statusClass","formatDate","displayValueOrNA","NavLink","StyledAntSelect","CustomDrop","PrinterIcon","DownIcon","PrintDropDown","styled","Select"],"mappings":";;;;;;;;;;;;;;;;;;AA6BA,MAAMA,KAAa,MAAM;AAGvB,QAAMC,IAAoBC,EAAuB,IAAI,GAC/CC,IAAcD,EAAuB,IAAI,GACzC,CAACE,GAAaC,CAAc,IAAIC,EAAA,GAChC,CAACC,CAAU,IAAIC,GAAA,GACf,CAAA,EAAGC,CAAU,IAAIC,EAAA,GACjB,CAACC,CAAgB,IAAIC,EAAA,GACrB,CAACC,GAAeC,CAAgB,IAAIC,GAAA,GACpC,GAAGC,CAAS,IAAIC,EAAkB,EAAK,GACvC,CAAA,EAAGC,CAAU,IAAIC,GAAA,GACjB,CAACC,CAAO,IAAIC,GAAA,GAGZ,CAACC,GAAYC,CAAa,IAAIN,EAG1B,IAAI,GAERO,IAAa,CAACC,MAAgB;AAClC,IAAAF,EAAc,CAACG,MACTA,GAAM,QAAQD,KAAOC,EAAK,cAAc,QACnC,EAAE,KAAAD,GAAK,WAAW,OAAA,IAEpB,EAAE,KAAAA,GAAK,WAAW,MAAA,CAC1B;AAAA,EACH,GAEME,IAAaC,EAAQ,MAAM;AAC/B,QAAI,CAACjB,KAAoB,CAACW,EAAY,QAAOX;AAE7C,UAAM,EAAE,KAAAc,GAAK,WAAAI,EAAA,IAAcP;AAC3B,WAAO,CAAC,GAAGX,CAAgB,EAAE,KAAK,CAACmB,GAAGC,MAAM;AAC1C,YAAMC,IAASF,EAAEL,CAAG,GACdQ,IAASF,EAAEN,CAAG;AAEpB,aAAI,OAAOO,KAAW,YAAY,OAAOC,KAAW,WAC3CJ,MAAc,QAAQG,IAASC,IAASA,IAASD,I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A;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
|
|
1
|
+
{"version":3,"file":"OrderTable.js","sources":["../../../../../src/components/order-daily-overview/return-after-table/table/OrderTable.tsx"],"sourcesContent":["import { Empty, notification, Select } from 'antd';\nimport React, { useEffect, useMemo, useRef, useState } from 'react';\nimport { Skeleton } from 'antd';\n// import { useSelectedOrders } from '../../../store';\nimport { useOrderId, useReturnAfterOrderData } from '../../../order-view/store';\nimport { EmptyDataContainer } from '../../table/table-data/styles';\nimport PrinterIcon from '../../../../assets/icons/PrinterIcon';\nimport DownIcon from '../../../../assets/icons/DownIcon';\nimport {\n StyledTable,\n StyledTableWrapper,\n CustomDrop,\n} from '../../return-order-table/return-orders-filters/returnstyles';\nimport { useLoading, usePrintOptionTOggle } from '../../store/store';\nimport { NavLink } from 'react-router-dom';\nimport { displayValueOrNA, formatDate } from '../../shared/utlis';\nimport PrintDropDown from '../../shared/elements/PrintDropDown';\nimport {\n useAssignData,\n useAssignPayload,\n useCallApiAgain,\n} from '../../../store';\nimport styled from 'styled-components';\nimport { useApiHook } from '@bjsdistribution/dms-component-library';\nimport { ApiResponse } from '../../common/interface';\nimport CaretDownFilledIcon from '../../../../common/CaretDownFilledIcon';\nimport SortIcon from '../../../../common/SortIcon';\nimport { WEIGHT_UNIT, getAccountTypeLabel } from '../../../../common/utils';\n\nconst OrderTable = () => {\n // const [, setSelectedReturnOrder] = useSelectedOrders();\n // const [selectAll, setSelectAll] = useState(false);\n const dropdownRefParent = useRef<HTMLDivElement>(null);\n const dropdownRef = useRef<HTMLDivElement>(null);\n const [printToogle, setPrintToggle] = usePrintOptionTOggle();\n const [assignData] = useAssignData();\n const [, setOrderId] = useOrderId();\n const [returnAfterOrder] = useReturnAfterOrderData();\n const [assignPayload, setAssignPayload] = useAssignPayload();\n const [, setAssign] = useState<boolean>(false);\n const [, setCallAPi] = useCallApiAgain();\n const [loading] = useLoading();\n\n //sorting\n const [sortConfig, setSortConfig] = useState<{\n key: string;\n direction: 'asc' | 'desc';\n } | null>(null);\n\n const handleSort = (key: string) => {\n setSortConfig((prev: any) => {\n if (prev?.key === key && prev.direction === 'asc') {\n return { key, direction: 'desc' };\n }\n return { key, direction: 'asc' };\n });\n };\n\n const sortedData = useMemo(() => {\n if (!returnAfterOrder || !sortConfig) return returnAfterOrder;\n\n const { key, direction } = sortConfig;\n return [...returnAfterOrder].sort((a, b) => {\n const valueA = a[key];\n const valueB = b[key];\n\n if (typeof valueA === 'number' && typeof valueB === 'number') {\n return direction === 'asc' ? valueA - valueB : valueB - valueA;\n }\n if (typeof valueA === 'string' && typeof valueB === 'string') {\n return direction === 'asc'\n ? valueA.localeCompare(valueB)\n : valueB.localeCompare(valueA);\n }\n return 0;\n });\n }, [returnAfterOrder, sortConfig]);\n\n const renderSortIcon = (columnKey: string) => {\n if (!sortConfig || sortConfig.key !== columnKey) {\n return <SortIcon />;\n }\n return sortConfig.direction === 'asc' ? (\n <CaretDownFilledIcon />\n ) : (\n <CaretDownFilledIcon />\n );\n };\n\n const OpenDropDown = (index: number) => {\n setPrintToggle(prevIndex => (prevIndex === index ? null : index));\n };\n\n // Close dropdown outside click\n useEffect(() => {\n document.addEventListener('mousedown', handleClickOutside);\n return () => {\n document.removeEventListener('mousedown', handleClickOutside);\n };\n }, []);\n const handleClickOutside = (event: MouseEvent) => {\n if (\n dropdownRef.current &&\n !dropdownRef.current.contains(event.target as Node)\n ) {\n setPrintToggle(null);\n }\n };\n\n // const handleSelectAll = (e: any) => {\n // setSelectAll(e.target.checked);\n // if (e.target.checked) {\n // setSelectedReturnOrder(\n // returnAfterOrder.map((e: any) => ({\n // id: e.id,\n // status_id: 3,\n // }))\n // );\n // } else {\n // setSelectedReturnOrder([]);\n // }\n // };\n\n // const handleSelectInvoice = (id: any) => {\n // setSelectedReturnOrder((prevSelectedInvoices: any) => {\n // const isSelected = prevSelectedInvoices?.some(\n // (item: any) => item.id === id\n // );\n\n // if (isSelected) {\n // return prevSelectedInvoices.filter((items: any) => items.id !== id);\n // } else {\n // return [...prevSelectedInvoices, { id, status_id: 3 }];\n // }\n // });\n // };\n\n const getStatusClass = (status: string) => {\n switch (status) {\n case 'Cancelled':\n return { color: '#E95252', background: 'rgba(233, 82, 82, 0.15)' };\n case 'On Hold':\n return { color: '#F4A503', background: '#FFF1D6' };\n case 'Sub-Contracted':\n return { color: '#F4A503', background: '#FFF1D6' };\n case 'Awaiting route':\n return { color: '#845ADF', background: 'rgba(132, 90, 223, 0.15)' };\n case 'Awaiting':\n return { color: '#845ADF', background: 'rgba(132, 90, 223, 0.15)' };\n case 'Completed':\n return {\n color: '#1F9254',\n background: 'rgba(41, 204, 106, 0.15)',\n };\n case 'Outstanding':\n return { color: '#FF9900', background: 'rgba(255, 153, 0, 0.15)' };\n case 'Routed':\n return { color: '#6396E5', background: 'rgba(99, 150, 229, 0.15)' };\n default:\n return { color: '#000', background: '#fff' };\n }\n };\n\n // API for Assign\n const {\n data: actionResponse,\n setShouldPerformAction: setAssignAction,\n error: apiError,\n } = useApiHook<{\n data: ApiResponse[];\n }>({\n endpoint: `return_orders/update/assign/`,\n method: 'PUT',\n body: [assignPayload],\n performAction: false,\n });\n\n //client options\n const assignOptions = assignData?.map((option: any) => ({\n label: option?.type?.charAt(0)?.toUpperCase() + option?.type?.slice(1),\n value: option?.bjs_delivery,\n }));\n\n const handleAssignPayload = (Id: number, value: boolean) => {\n setCallAPi(false);\n setAssign(value);\n setAssignPayload({\n ...assignPayload,\n return_order_id: Id,\n bjs_delivery: value,\n });\n setAssignAction(true);\n };\n\n useEffect(() => {\n //@ts-ignore\n if (actionResponse?.code === 200) {\n setCallAPi(true);\n notification.success({\n message: 'Success',\n // @ts-ignore\n description: `${actionResponse?.message}`,\n });\n // @ts-ignore\n } else if (apiError?.detail) {\n notification.error({\n message: 'Failure',\n // @ts-ignore\n description: `${apiError?.detail[0]?.msg}`,\n });\n }\n }, [actionResponse, apiError]);\n\n return (\n <>\n <StyledTableWrapper className=\"fortables\">\n <StyledTable>\n <thead>\n <tr>\n {/* <th className=\"emailInvoiceCheckbox\">\n <Checkbox checked={false} />\n </th> */}\n <th onClick={() => handleSort('created_at')}>\n <div className=\"sortIconClass\">\n Created {renderSortIcon('created_at')}\n </div>\n </th>\n <th onClick={() => handleSort('return_location_name')}>\n <div className=\"sortIconClass\">\n Return Location {renderSortIcon('return_location_name')}\n </div>\n </th>\n <th>Pick Up Location</th>\n <th> Client</th>\n <th onClick={() => handleSort('recipient_name')}>\n <div className=\"sortIconClass\">\n Recipient {renderSortIcon('recipient_name')}\n </div>\n </th>\n <th>Consignment</th>\n <th>Return Order No</th>\n <th> Total Parts</th>\n <th> Total Orders</th>\n <th onClick={() => handleSort('weight')}>\n <div className=\"sortIconClass\">\n Total Weight ({WEIGHT_UNIT}) {renderSortIcon('weight')}\n </div>\n </th>\n <th onClick={() => handleSort('cube')}>\n <div className=\"sortIconClass\">\n Total CBM {renderSortIcon('cube')}\n </div>\n </th>\n <th>Assign</th>\n <th>Status</th>\n <th className=\"emailInvoiceShare\">Labels</th>\n </tr>\n </thead>\n <tbody>\n {loading ? (\n <tr>\n <td colSpan={16}>\n <Skeleton active />\n </td>\n <td colSpan={16}></td>\n </tr>\n ) : sortedData?.length === 0 ? (\n <tr>\n <td colSpan={16}>\n <EmptyDataContainer>\n <Empty />\n </EmptyDataContainer>\n </td>\n </tr>\n ) : (\n sortedData?.map((item: any, index: any) => {\n const statusMapping: any = {\n cancelled: 'Cancelled',\n 'on hold': 'On Hold',\n SC: 'Sub-Contracted',\n 'awaiting route': 'Awaiting',\n 'awaiting confirmation': 'Awaiting',\n complete: 'Completed',\n outstanding: 'Outstanding',\n routed: 'Routed',\n failed: 'Failed',\n };\n const status = statusMapping[item?.status_value] || 'Unknown';\n const statusClass = getStatusClass(status);\n\n return (\n <tr key={item.id}>\n {/* <td>\n <Checkbox\n checked={false}\n // onChange={() => handleSelectInvoice(item.id)}\n />\n </td> */}\n <td>{formatDate(new Date(item?.created_at))}</td>\n <td>{displayValueOrNA(item?.return_location_name)}</td>\n\n <td>\n {item?.locations?.length\n ? item?.locations.join(', ')\n : 'N/A'}\n </td>\n\n <td>\n {displayValueOrNA(item?.customer_name)}\n {getAccountTypeLabel(item?.owner_id) && (\n <span> ({getAccountTypeLabel(item?.owner_id)})</span>\n )}\n </td>\n\n <td onClick={() => setOrderId(item.id)}>\n <ul style={{ listStyleType: 'none', padding: 0 }}>\n <li\n style={{\n color: '#0099ff',\n fontWeight: 600,\n paddingLeft: 0,\n }}\n >\n <NavLink to={`../${item.id}`}>\n {displayValueOrNA(item?.recipient_name)}\n </NavLink>\n </li>\n <li style={{ color: '#888075' }}>\n {displayValueOrNA(item?.postcode)}\n </li>\n </ul>\n </td>\n\n <td>{displayValueOrNA(item?.consignment)}</td>\n <td>{displayValueOrNA(item?.order_number)}</td>\n\n <td>{displayValueOrNA(item?.total_products)}</td>\n <td>{displayValueOrNA(item?.total_orders)}</td>\n\n <td>\n {displayValueOrNA(item?.weight)}{' '}\n {item?.weight && item?.weight > 0 ? WEIGHT_UNIT : ''}\n </td>\n\n <td>{displayValueOrNA(item?.cube)}</td>\n\n <td key={item.id}>\n <StyledAntSelect\n options={assignOptions}\n placeholder=\"Select\"\n onChange={(value: any) =>\n handleAssignPayload(item?.id, value)\n }\n style={{ width: '150px' }}\n value={item?.bjs_delivery}\n />\n </td>\n\n <td>\n <ul\n className=\"statuscontainer\"\n style={{\n listStyleType: 'none',\n background: statusClass.background,\n }}\n >\n <li\n className=\"statustext\"\n style={{ color: statusClass.color }}\n >\n {status}\n </li>\n </ul>\n </td>\n <td>\n <ul className=\"actionbox\">\n <CustomDrop\n ref={dropdownRefParent}\n className={printToogle === index ? 'active' : ''}\n >\n <li\n className=\"shareIconContainer\"\n onClick={() => OpenDropDown(index)}\n >\n <PrinterIcon />\n <DownIcon />\n\n {printToogle === index && (\n <div ref={dropdownRef}>\n <PrintDropDown legacyProductId={item} />\n </div>\n )}\n </li>\n </CustomDrop>\n </ul>\n </td>\n </tr>\n );\n })\n )}\n </tbody>\n </StyledTable>\n </StyledTableWrapper>\n </>\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\nexport default OrderTable;\n"],"names":["OrderTable","dropdownRefParent","useRef","dropdownRef","printToogle","setPrintToggle","usePrintOptionTOggle","assignData","useAssignData","setOrderId","useOrderId","returnAfterOrder","useReturnAfterOrderData","assignPayload","setAssignPayload","useAssignPayload","setAssign","useState","setCallAPi","useCallApiAgain","loading","useLoading","sortConfig","setSortConfig","handleSort","key","prev","sortedData","useMemo","direction","a","b","valueA","valueB","renderSortIcon","columnKey","SortIcon","CaretDownFilledIcon","OpenDropDown","index","prevIndex","useEffect","handleClickOutside","event","getStatusClass","status","actionResponse","setAssignAction","apiError","useApiHook","assignOptions","option","handleAssignPayload","Id","value","notification","jsx","StyledTableWrapper","StyledTable","jsxs","WEIGHT_UNIT","Skeleton","EmptyDataContainer","Empty","item","statusClass","formatDate","displayValueOrNA","getAccountTypeLabel","NavLink","StyledAntSelect","CustomDrop","PrinterIcon","DownIcon","PrintDropDown","styled","Select"],"mappings":";;;;;;;;;;;;;;;;;;AA6BA,MAAMA,KAAa,MAAM;AAGvB,QAAMC,IAAoBC,EAAuB,IAAI,GAC/CC,IAAcD,EAAuB,IAAI,GACzC,CAACE,GAAaC,CAAc,IAAIC,GAAA,GAChC,CAACC,CAAU,IAAIC,GAAA,GACf,CAAA,EAAGC,CAAU,IAAIC,EAAA,GACjB,CAACC,CAAgB,IAAIC,EAAA,GACrB,CAACC,GAAeC,CAAgB,IAAIC,GAAA,GACpC,GAAGC,CAAS,IAAIC,EAAkB,EAAK,GACvC,CAAA,EAAGC,CAAU,IAAIC,GAAA,GACjB,CAACC,CAAO,IAAIC,GAAA,GAGZ,CAACC,GAAYC,CAAa,IAAIN,EAG1B,IAAI,GAERO,IAAa,CAACC,M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AA,gBAAAA;AAAA,UAACe;AAAA,UAAA;AAAA,YACC,KAAKtE;AAAA,YACL,WAAWG,MAAgBmC,IAAQ,WAAW;AAAA,YAE9C,UAAA,gBAAAoB;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,WAAU;AAAA,gBACV,SAAS,MAAMrB,EAAaC,CAAK;AAAA,gBAEjC,UAAA;AAAA,kBAAA,gBAAAiB,EAACgB,GAAA,EAAY;AAAA,oCACZC,GAAA,EAAS;AAAA,kBAETrE,MAAgBmC,KACf,gBAAAiB,EAAC,OAAA,EAAI,KAAKrD,GACR,UAAA,gBAAAqD,EAACkB,IAAA,EAAc,iBAAiBV,EAAA,CAAM,EAAA,CACxC;AAAA,gBAAA;AAAA,cAAA;AAAA,YAAA;AAAA,UAEJ;AAAA,QAAA,GAEJ,EAAA,CACF;AAAA,MAAA,EAAA,GAxGOA,EAAK,EAyGd;AAAA,IAEJ,CAAC,EAAA,CAEL;AAAA,EAAA,EAAA,CACF,GACF,GACF;AAEJ,GAEMM,KAAkBK,GAAOC,CAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
|
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useApiHook as
|
|
3
|
-
import { notification as H, Skeleton as
|
|
4
|
-
import { format as
|
|
5
|
-
import { useAtom as
|
|
6
|
-
import { useRef as K, useState as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
1
|
+
import { jsx as t, Fragment as se, jsxs as a } from "react/jsx-runtime";
|
|
2
|
+
import { useApiHook as de, Checkbox as B } from "@bjsdistribution/dms-component-library";
|
|
3
|
+
import { notification as H, Skeleton as ue, Empty as he, Tooltip as pe } from "antd";
|
|
4
|
+
import { format as _e } from "date-fns";
|
|
5
|
+
import { useAtom as me } from "jotai";
|
|
6
|
+
import { useRef as K, useState as fe, useMemo as ge, useEffect as b } from "react";
|
|
7
|
+
import Ce from "../../../../assets/icons/DownIcon.js";
|
|
8
|
+
import ye from "../../../../assets/icons/PrinterIcon.js";
|
|
9
9
|
import $ from "../../../../common/CaretDownFilledIcon.js";
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import { useReturnData as
|
|
13
|
-
import { useSelectedOrders as
|
|
14
|
-
import { filtersReducerAtom as
|
|
10
|
+
import Se from "../../../../common/SortIcon.js";
|
|
11
|
+
import Ne from "../../../order-view/details-filters/left-side-filters/dropdowns/PrintDropDownReturn.js";
|
|
12
|
+
import { useReturnData as we, usefetchAgain as De } from "../../../order-view/store.js";
|
|
13
|
+
import { useSelectedOrders as be, useSelectAll as ke, useReturnPayload as Ae, useNewReturnPayload as Pe, useGroupedPayload as Ie, useLocationData as Re, useFlatCustomerData as Oe } from "../../../store.js";
|
|
14
|
+
import { filtersReducerAtom as Le } from "../../header-filters/filterStore.js";
|
|
15
15
|
import { displayValueOrNA as s } from "../../shared/utlis.js";
|
|
16
|
-
import { useLoading as
|
|
17
|
-
import { EmptyDataContainer as
|
|
18
|
-
import { StyledTableWrapper as
|
|
19
|
-
import { useSearchParams as
|
|
20
|
-
import { WEIGHT_UNIT as J } from "../../../../common/utils.js";
|
|
21
|
-
const
|
|
16
|
+
import { useLoading as ve, usePrintOptionTOggle as Ee, UsePaginationData as Te } from "../../store/store.js";
|
|
17
|
+
import { EmptyDataContainer as Fe } from "../../table/table-data/styles.js";
|
|
18
|
+
import { StyledTableWrapper as We, StyledTable as xe, CustomDrop as Me } from "./returnstyles.js";
|
|
19
|
+
import { useSearchParams as Ue, NavLink as je } from "react-router-dom";
|
|
20
|
+
import { WEIGHT_UNIT as J, getAccountTypeLabel as V } from "../../../../common/utils.js";
|
|
21
|
+
const Ge = [
|
|
22
22
|
"RTS",
|
|
23
23
|
"CLAIMS PAID",
|
|
24
24
|
"DISPOSE",
|
|
25
25
|
"RE-ALLOCATE",
|
|
26
26
|
"RECYCLE",
|
|
27
27
|
"UNKNOWN"
|
|
28
|
-
], y = (_) =>
|
|
29
|
-
const [_] =
|
|
30
|
-
|
|
31
|
-
}, x =
|
|
28
|
+
], y = (_) => Ge.includes(_?.product_return_action) && _?.return_location !== "null" && _?.return_location !== null, it = () => {
|
|
29
|
+
const [_] = me(Le), [S, k] = be(), [Y, A] = ke(), { "x-filters": q, "x-pagination": z } = _, [h, E] = we(), [Q, T] = ve(), X = K(null), P = K(null), [F, W] = Ee(), [, Z] = Ae(), [I, N] = Pe(), [, R] = Ie(), [O] = Re(), [, ee] = Te(), [te] = De(), [ne] = Ue(), L = ne.get("customerId"), [m, re] = fe(null), f = (e) => {
|
|
30
|
+
re((n) => n?.key === e && n.direction === "asc" ? { key: e, direction: "desc" } : { key: e, direction: "asc" });
|
|
31
|
+
}, x = ge(() => {
|
|
32
32
|
if (!h || !m) return h;
|
|
33
|
-
const { key:
|
|
33
|
+
const { key: e, direction: n } = m;
|
|
34
34
|
return [...h].sort((o, c) => {
|
|
35
|
-
const
|
|
36
|
-
return typeof
|
|
35
|
+
const l = o[e], i = c[e];
|
|
36
|
+
return typeof l == "number" && typeof i == "number" ? n === "asc" ? l - i : i - l : typeof l == "string" && typeof i == "string" ? n === "asc" ? l.localeCompare(i) : i.localeCompare(l) : 0;
|
|
37
37
|
});
|
|
38
|
-
}, [h, m]), g = (
|
|
39
|
-
W((n) => n ===
|
|
38
|
+
}, [h, m]), g = (e) => !m || m.key !== e ? /* @__PURE__ */ t(Se, {}) : m.direction === "asc" ? /* @__PURE__ */ t($, {}) : /* @__PURE__ */ t($, {}), oe = (e) => {
|
|
39
|
+
W((n) => n === e ? null : e);
|
|
40
40
|
};
|
|
41
|
-
|
|
41
|
+
b(() => (document.addEventListener("mousedown", M), () => {
|
|
42
42
|
document.removeEventListener("mousedown", M);
|
|
43
43
|
}), []);
|
|
44
|
-
const M = (
|
|
45
|
-
|
|
44
|
+
const M = (e) => {
|
|
45
|
+
P.current && !P.current.contains(e.target) && W(null);
|
|
46
46
|
}, {
|
|
47
47
|
data: p,
|
|
48
48
|
loading: w,
|
|
49
49
|
paginationData: U,
|
|
50
|
-
setShouldPerformAction:
|
|
51
|
-
} =
|
|
50
|
+
setShouldPerformAction: ce
|
|
51
|
+
} = de({
|
|
52
52
|
endpoint: "/v1/return/product/pending/",
|
|
53
53
|
method: "GET",
|
|
54
|
-
filters:
|
|
55
|
-
pagination:
|
|
54
|
+
filters: q,
|
|
55
|
+
pagination: z,
|
|
56
56
|
performAction: !1,
|
|
57
57
|
showLoader: !1
|
|
58
58
|
});
|
|
59
|
-
|
|
59
|
+
b(() => {
|
|
60
60
|
if (T(w), p && p?.data)
|
|
61
61
|
if (E(p?.data), U)
|
|
62
62
|
try {
|
|
63
|
-
const { count:
|
|
64
|
-
|
|
65
|
-
} catch (
|
|
66
|
-
console.error("Error parsing paginationData:",
|
|
63
|
+
const { count: e, ...n } = JSON.parse(U);
|
|
64
|
+
ee(n);
|
|
65
|
+
} catch (e) {
|
|
66
|
+
console.error("Error parsing paginationData:", e), H.error({
|
|
67
67
|
message: "Error",
|
|
68
68
|
description: "Failed to parse pagination data"
|
|
69
69
|
});
|
|
@@ -73,9 +73,9 @@ const jt = [
|
|
|
73
73
|
message: "Error",
|
|
74
74
|
description: "Pagination data is null or undefined"
|
|
75
75
|
});
|
|
76
|
-
}, [p, w]),
|
|
77
|
-
if (T(w),
|
|
78
|
-
const
|
|
76
|
+
}, [p, w]), b(() => {
|
|
77
|
+
if (T(w), ce(!0), p && p?.data && O) {
|
|
78
|
+
const e = p.data.map((n) => {
|
|
79
79
|
const o = O.find(
|
|
80
80
|
(c) => c?.token === n?.return_location
|
|
81
81
|
);
|
|
@@ -84,31 +84,31 @@ const jt = [
|
|
|
84
84
|
new_location: o ? o?.location_name : null
|
|
85
85
|
};
|
|
86
86
|
});
|
|
87
|
-
E(
|
|
87
|
+
E(e);
|
|
88
88
|
}
|
|
89
|
-
}, [p, w, O, _,
|
|
90
|
-
const [
|
|
91
|
-
const n =
|
|
89
|
+
}, [p, w, O, _, te]);
|
|
90
|
+
const [ae] = Oe(), j = ae?.find((e) => {
|
|
91
|
+
const n = e?.customer_id?.toString();
|
|
92
92
|
return n && n === L;
|
|
93
93
|
}), G = j?.account_number;
|
|
94
94
|
console.log(j, "selectedCustomer");
|
|
95
|
-
const
|
|
96
|
-
const n =
|
|
97
|
-
if (
|
|
95
|
+
const le = (e) => {
|
|
96
|
+
const n = e.target.checked;
|
|
97
|
+
if (A(n), n) {
|
|
98
98
|
const o = h?.find(
|
|
99
99
|
(r) => y(r)
|
|
100
100
|
), c = S.length > 0 ? S[0]?.product_return_action : o?.product_return_action;
|
|
101
101
|
if (!c) return;
|
|
102
|
-
const
|
|
102
|
+
const l = h?.filter(
|
|
103
103
|
(r) => y(r) && r?.product_return_action === c
|
|
104
|
-
),
|
|
104
|
+
), i = l.map((r) => ({
|
|
105
105
|
id: r.id,
|
|
106
106
|
return_locations: r?.return_location_name,
|
|
107
107
|
return_location: r?.return_location,
|
|
108
108
|
products: r?.legacy_product_id,
|
|
109
109
|
product_return_action: r?.product_return_action,
|
|
110
110
|
return_location_token: r?.return_location
|
|
111
|
-
})), d =
|
|
111
|
+
})), d = l.map((r) => ({
|
|
112
112
|
id: r.id,
|
|
113
113
|
account_number: G,
|
|
114
114
|
customer_id: Number(L),
|
|
@@ -116,45 +116,45 @@ const jt = [
|
|
|
116
116
|
return_action: r?.product_return_action,
|
|
117
117
|
return_location_token: r?.return_location || null
|
|
118
118
|
}));
|
|
119
|
-
console.log(d, "newPayloadnewPayload"),
|
|
119
|
+
console.log(d, "newPayloadnewPayload"), k(i), N(d);
|
|
120
120
|
} else
|
|
121
|
-
|
|
122
|
-
},
|
|
123
|
-
|
|
124
|
-
if (
|
|
125
|
-
(r) => r.id ===
|
|
121
|
+
k([]), N([]), R([]);
|
|
122
|
+
}, ie = (e, n, o, c, l) => {
|
|
123
|
+
k((i) => {
|
|
124
|
+
if (i?.some(
|
|
125
|
+
(r) => r.id === e
|
|
126
126
|
)) {
|
|
127
|
-
const r =
|
|
128
|
-
(u) => u.id !==
|
|
127
|
+
const r = i.filter(
|
|
128
|
+
(u) => u.id !== e
|
|
129
129
|
);
|
|
130
|
-
|
|
130
|
+
Z((u) => ({
|
|
131
131
|
...u,
|
|
132
|
-
products:
|
|
132
|
+
products: l,
|
|
133
133
|
return_action: c || null,
|
|
134
134
|
return_location_token: n || null
|
|
135
135
|
})), N(
|
|
136
|
-
(u) => u.filter((C) => C.id !==
|
|
136
|
+
(u) => u.filter((C) => C.id !== e)
|
|
137
137
|
);
|
|
138
138
|
const D = c, v = h?.filter(
|
|
139
139
|
(u) => y(u) && u?.product_return_action === D
|
|
140
140
|
)?.length;
|
|
141
|
-
return
|
|
141
|
+
return A(
|
|
142
142
|
r?.length > 0 && r?.length === v
|
|
143
143
|
), r;
|
|
144
144
|
} else {
|
|
145
145
|
const r = {
|
|
146
|
-
id:
|
|
146
|
+
id: e,
|
|
147
147
|
account_number: G,
|
|
148
148
|
customer_id: Number(L),
|
|
149
|
-
products: [
|
|
149
|
+
products: [l],
|
|
150
150
|
return_action: c || null,
|
|
151
151
|
return_location_token: n || null
|
|
152
152
|
};
|
|
153
153
|
N((C) => [...C, r]);
|
|
154
154
|
const D = [
|
|
155
|
-
...
|
|
155
|
+
...i,
|
|
156
156
|
{
|
|
157
|
-
id:
|
|
157
|
+
id: e,
|
|
158
158
|
return_location: n,
|
|
159
159
|
return_location_name: o,
|
|
160
160
|
product_return_action: c
|
|
@@ -162,17 +162,17 @@ const jt = [
|
|
|
162
162
|
], v = c, u = h?.filter(
|
|
163
163
|
(C) => y(C) && C?.product_return_action === v
|
|
164
164
|
)?.length;
|
|
165
|
-
return
|
|
165
|
+
return A(D?.length === u), D;
|
|
166
166
|
}
|
|
167
167
|
});
|
|
168
168
|
};
|
|
169
|
-
return
|
|
169
|
+
return b(() => {
|
|
170
170
|
if (I?.length === 0) {
|
|
171
171
|
R([]);
|
|
172
172
|
return;
|
|
173
173
|
}
|
|
174
|
-
const
|
|
175
|
-
const { return_location_token:
|
|
174
|
+
const e = I?.reduce((o, c) => {
|
|
175
|
+
const { return_location_token: l, id: i } = c, d = l || `no_token_${i}`;
|
|
176
176
|
return o[d] || (o[d] = {
|
|
177
177
|
...c,
|
|
178
178
|
products: [],
|
|
@@ -180,71 +180,71 @@ const jt = [
|
|
|
180
180
|
}), o[d].products = [...o[d].products, ...c.products], o[d].return_action = Array.from(
|
|
181
181
|
/* @__PURE__ */ new Set([...o[d].return_action, ...c.return_action])
|
|
182
182
|
), o;
|
|
183
|
-
}, {}), n = Object.values(
|
|
183
|
+
}, {}), n = Object.values(e);
|
|
184
184
|
R(n);
|
|
185
|
-
}, [I]), /* @__PURE__ */
|
|
186
|
-
/* @__PURE__ */
|
|
187
|
-
h?.some((
|
|
188
|
-
/* @__PURE__ */
|
|
185
|
+
}, [I]), /* @__PURE__ */ t(se, { children: /* @__PURE__ */ t(We, { className: "fortables", children: /* @__PURE__ */ a(xe, { children: [
|
|
186
|
+
/* @__PURE__ */ t("thead", { children: /* @__PURE__ */ a("tr", { children: [
|
|
187
|
+
h?.some((e) => y(e)) ? /* @__PURE__ */ t("th", { className: "emailInvoiceCheckbox", children: /* @__PURE__ */ t(B, { checked: Y, onChange: le }) }) : /* @__PURE__ */ t("th", {}),
|
|
188
|
+
/* @__PURE__ */ t("th", { onClick: () => f("location"), children: /* @__PURE__ */ a("div", { className: "sortIconClass", children: [
|
|
189
189
|
"Product Location ",
|
|
190
190
|
g("location")
|
|
191
191
|
] }) }),
|
|
192
|
-
/* @__PURE__ */
|
|
192
|
+
/* @__PURE__ */ t("th", { onClick: () => f("return_location_name"), children: /* @__PURE__ */ a("div", { className: "sortIconClass", children: [
|
|
193
193
|
"Return Location ",
|
|
194
194
|
g("return_location_name")
|
|
195
195
|
] }) }),
|
|
196
|
-
/* @__PURE__ */
|
|
197
|
-
/* @__PURE__ */
|
|
196
|
+
/* @__PURE__ */ t("th", { children: "Client" }),
|
|
197
|
+
/* @__PURE__ */ t("th", { onClick: () => f("recipient_name"), children: /* @__PURE__ */ a("div", { className: "sortIconClass", children: [
|
|
198
198
|
"Recipient ",
|
|
199
199
|
g("recipient_name")
|
|
200
200
|
] }) }),
|
|
201
|
-
/* @__PURE__ */
|
|
202
|
-
/* @__PURE__ */
|
|
203
|
-
/* @__PURE__ */
|
|
204
|
-
/* @__PURE__ */
|
|
205
|
-
/* @__PURE__ */
|
|
201
|
+
/* @__PURE__ */ t("th", { children: "Return Action" }),
|
|
202
|
+
/* @__PURE__ */ t("th", { children: "Code" }),
|
|
203
|
+
/* @__PURE__ */ t("th", { children: "Description" }),
|
|
204
|
+
/* @__PURE__ */ t("th", { children: "Part" }),
|
|
205
|
+
/* @__PURE__ */ t("th", { onClick: () => f("weight"), children: /* @__PURE__ */ a("div", { className: "sortIconClass", children: [
|
|
206
206
|
"Weight (",
|
|
207
207
|
J,
|
|
208
208
|
") ",
|
|
209
209
|
g("weight")
|
|
210
210
|
] }) }),
|
|
211
|
-
/* @__PURE__ */
|
|
212
|
-
/* @__PURE__ */
|
|
211
|
+
/* @__PURE__ */ t("th", { children: "CBM" }),
|
|
212
|
+
/* @__PURE__ */ t("th", { onClick: () => f("return_reason"), children: /* @__PURE__ */ a("div", { className: "sortIconClass", children: [
|
|
213
213
|
"Return Reason ",
|
|
214
214
|
g("return_reason")
|
|
215
215
|
] }) }),
|
|
216
|
-
/* @__PURE__ */
|
|
217
|
-
/* @__PURE__ */
|
|
216
|
+
/* @__PURE__ */ t("th", { children: "Collected" }),
|
|
217
|
+
/* @__PURE__ */ t("th", { onClick: () => f("collection_reason"), children: /* @__PURE__ */ a("div", { className: "sortIconClass", children: [
|
|
218
218
|
"Collection Reason ",
|
|
219
219
|
g("collection_reason")
|
|
220
220
|
] }) }),
|
|
221
|
-
/* @__PURE__ */
|
|
221
|
+
/* @__PURE__ */ t("th", { className: "emailInvoiceShare", children: "Labels" })
|
|
222
222
|
] }) }),
|
|
223
|
-
/* @__PURE__ */
|
|
224
|
-
/* @__PURE__ */
|
|
225
|
-
const o = S?.length > 0 && S[0]?.product_return_action !==
|
|
226
|
-
return /* @__PURE__ */
|
|
227
|
-
|
|
223
|
+
/* @__PURE__ */ t("tbody", { children: Q ? /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ t("td", { colSpan: 14, children: /* @__PURE__ */ t(ue, { active: !0 }) }) }) : x?.length === 0 ? /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ t("td", { colSpan: 14, children: /* @__PURE__ */ t(Fe, { children: /* @__PURE__ */ t(he, {}) }) }) }) : x?.map((e, n) => /* @__PURE__ */ a("tr", { children: [
|
|
224
|
+
/* @__PURE__ */ t("td", { children: y(e) ? (() => {
|
|
225
|
+
const o = S?.length > 0 && S[0]?.product_return_action !== e?.product_return_action;
|
|
226
|
+
return /* @__PURE__ */ t(
|
|
227
|
+
pe,
|
|
228
228
|
{
|
|
229
229
|
title: o ? "Cannot select different return actions" : "",
|
|
230
|
-
children: /* @__PURE__ */
|
|
230
|
+
children: /* @__PURE__ */ t(
|
|
231
231
|
"span",
|
|
232
232
|
{
|
|
233
233
|
className: o ? "disabled-wrapper" : "",
|
|
234
|
-
children: /* @__PURE__ */
|
|
234
|
+
children: /* @__PURE__ */ t(
|
|
235
235
|
B,
|
|
236
236
|
{
|
|
237
237
|
className: "custom-check",
|
|
238
238
|
disabled: o,
|
|
239
239
|
checked: S.some(
|
|
240
|
-
(c) => c?.id ===
|
|
240
|
+
(c) => c?.id === e?.id
|
|
241
241
|
),
|
|
242
|
-
onChange: () =>
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
242
|
+
onChange: () => ie(
|
|
243
|
+
e?.id,
|
|
244
|
+
e?.return_location,
|
|
245
|
+
e?.return_location_name,
|
|
246
|
+
e?.product_return_action,
|
|
247
|
+
e?.legacy_product_id
|
|
248
248
|
)
|
|
249
249
|
}
|
|
250
250
|
)
|
|
@@ -253,14 +253,21 @@ const jt = [
|
|
|
253
253
|
}
|
|
254
254
|
);
|
|
255
255
|
})() : null }),
|
|
256
|
-
/* @__PURE__ */
|
|
257
|
-
/* @__PURE__ */
|
|
256
|
+
/* @__PURE__ */ t("td", { children: e?.location !== null && e?.location !== void 0 ? e?.location : /* @__PURE__ */ t("div", { className: "awaiting", children: "Awaiting" }) }),
|
|
257
|
+
/* @__PURE__ */ a("td", { children: [
|
|
258
258
|
" ",
|
|
259
|
-
s(
|
|
259
|
+
s(e?.return_location_name)
|
|
260
260
|
] }),
|
|
261
|
-
/* @__PURE__ */
|
|
262
|
-
|
|
263
|
-
/* @__PURE__ */
|
|
261
|
+
/* @__PURE__ */ a("td", { title: e?.client_name ?? "", children: [
|
|
262
|
+
s(e?.client_name),
|
|
263
|
+
V(e?.owner_id) && /* @__PURE__ */ a("span", { children: [
|
|
264
|
+
" (",
|
|
265
|
+
V(e?.owner_id),
|
|
266
|
+
")"
|
|
267
|
+
] })
|
|
268
|
+
] }),
|
|
269
|
+
/* @__PURE__ */ t("td", { children: /* @__PURE__ */ a("ul", { style: { listStyleType: "none", padding: 0 }, children: [
|
|
270
|
+
/* @__PURE__ */ t(
|
|
264
271
|
"li",
|
|
265
272
|
{
|
|
266
273
|
style: {
|
|
@@ -268,42 +275,42 @@ const jt = [
|
|
|
268
275
|
fontWeight: 600,
|
|
269
276
|
paddingLeft: 0
|
|
270
277
|
},
|
|
271
|
-
children: /* @__PURE__ */
|
|
278
|
+
children: /* @__PURE__ */ t(je, { to: `/orders/view/${e?.order_id}`, children: s(e?.recipient_name) })
|
|
272
279
|
}
|
|
273
280
|
),
|
|
274
|
-
/* @__PURE__ */
|
|
281
|
+
/* @__PURE__ */ t("li", { style: { color: "#888075" }, children: s(e?.postcode) })
|
|
275
282
|
] }) }),
|
|
276
|
-
/* @__PURE__ */
|
|
277
|
-
/* @__PURE__ */
|
|
278
|
-
/* @__PURE__ */
|
|
279
|
-
/* @__PURE__ */
|
|
280
|
-
/* @__PURE__ */
|
|
281
|
-
s(
|
|
283
|
+
/* @__PURE__ */ t("td", { children: s(e?.product_return_action) }),
|
|
284
|
+
/* @__PURE__ */ t("td", { children: s(e?.code) }),
|
|
285
|
+
/* @__PURE__ */ t("td", { children: s(e?.description) }),
|
|
286
|
+
/* @__PURE__ */ t("td", { children: s(e?.part) }),
|
|
287
|
+
/* @__PURE__ */ a("td", { children: [
|
|
288
|
+
s(e?.weight),
|
|
282
289
|
" ",
|
|
283
|
-
|
|
290
|
+
e?.weight && e?.weight !== null ? J : ""
|
|
284
291
|
] }),
|
|
285
|
-
/* @__PURE__ */
|
|
286
|
-
/* @__PURE__ */
|
|
287
|
-
/* @__PURE__ */
|
|
288
|
-
/* @__PURE__ */
|
|
289
|
-
/* @__PURE__ */
|
|
290
|
-
|
|
292
|
+
/* @__PURE__ */ t("td", { children: s(e?.cube) }),
|
|
293
|
+
/* @__PURE__ */ t("td", { children: s(e?.return_reason) }),
|
|
294
|
+
/* @__PURE__ */ t("td", { children: e?.collected_at ? _e(new Date(e?.collected_at), "dd/MM/yyyy") : "UNKNOWN" }),
|
|
295
|
+
/* @__PURE__ */ t("td", { children: s(e?.collection_reason) }),
|
|
296
|
+
/* @__PURE__ */ t("td", { children: /* @__PURE__ */ t("ul", { className: "actionbox", children: /* @__PURE__ */ t(
|
|
297
|
+
Me,
|
|
291
298
|
{
|
|
292
|
-
ref:
|
|
299
|
+
ref: X,
|
|
293
300
|
className: F === n ? "active" : "",
|
|
294
|
-
children: /* @__PURE__ */
|
|
301
|
+
children: /* @__PURE__ */ a(
|
|
295
302
|
"li",
|
|
296
303
|
{
|
|
297
304
|
className: "shareIconContainer",
|
|
298
|
-
onClick: () =>
|
|
305
|
+
onClick: () => oe(n),
|
|
299
306
|
children: [
|
|
300
|
-
/* @__PURE__ */
|
|
301
|
-
/* @__PURE__ */
|
|
302
|
-
F === n && /* @__PURE__ */
|
|
303
|
-
|
|
307
|
+
/* @__PURE__ */ t(ye, {}),
|
|
308
|
+
/* @__PURE__ */ t(Ce, {}),
|
|
309
|
+
F === n && /* @__PURE__ */ t("div", { ref: P, children: /* @__PURE__ */ t(
|
|
310
|
+
Ne,
|
|
304
311
|
{
|
|
305
|
-
legacyURL:
|
|
306
|
-
legacyProductID:
|
|
312
|
+
legacyURL: e?.return_order_product_label,
|
|
313
|
+
legacyProductID: e?.legacy_product_id
|
|
307
314
|
}
|
|
308
315
|
) })
|
|
309
316
|
]
|
|
@@ -311,10 +318,10 @@ const jt = [
|
|
|
311
318
|
)
|
|
312
319
|
}
|
|
313
320
|
) }) })
|
|
314
|
-
] },
|
|
321
|
+
] }, e.id)) })
|
|
315
322
|
] }) }) });
|
|
316
323
|
};
|
|
317
324
|
export {
|
|
318
|
-
|
|
325
|
+
it as default
|
|
319
326
|
};
|
|
320
327
|
//# sourceMappingURL=ReturnOrderTable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReturnOrderTable.js","sources":["../../../../../src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.tsx"],"sourcesContent":["import { Checkbox, useApiHook } from '@bjsdistribution/dms-component-library';\nimport { Empty, notification, Skeleton, Tooltip } from 'antd';\nimport { format } from 'date-fns';\nimport { useAtom } from 'jotai';\nimport React, { useEffect, useMemo, useRef, useState } from 'react';\nimport DownIcon from '../../../../assets/icons/DownIcon';\nimport PrinterIcon from '../../../../assets/icons/PrinterIcon';\nimport CaretDownFilledIcon from '../../../../common/CaretDownFilledIcon';\nimport SortIcon from '../../../../common/SortIcon';\nimport PrintDropDownReturn from '../../../order-view/details-filters/left-side-filters/dropdowns/PrintDropDownReturn';\nimport { usefetchAgain, useReturnData } from '../../../order-view/store';\nimport {\n useFlatCustomerData,\n useGroupedPayload,\n useLocationData,\n useNewReturnPayload,\n useReturnPayload,\n useSelectAll,\n useSelectedOrders,\n} from '../../../store';\nimport { ApiResponse } from '../../../types';\nimport { filtersReducerAtom } from '../../header-filters/filterStore';\nimport { displayValueOrNA } from '../../shared/utlis';\nimport {\n useLoading,\n UsePaginationData,\n usePrintOptionTOggle,\n} from '../../store/store';\nimport { EmptyDataContainer } from '../../table/table-data/styles';\nimport { CustomDrop, StyledTable, StyledTableWrapper } from './returnstyles';\nimport { NavLink, useSearchParams } from 'react-router-dom';\nimport { WEIGHT_UNIT } from '../../../../common/utils';\n\nconst SELECTABLE_ACTIONS = [\n 'RTS',\n 'CLAIMS PAID',\n 'DISPOSE',\n 'RE-ALLOCATE',\n 'RECYCLE',\n 'UNKNOWN',\n];\n\nconst isSelectableItem = (item: any) =>\n SELECTABLE_ACTIONS.includes(item?.product_return_action) &&\n item?.return_location !== 'null' &&\n item?.return_location !== null;\n\nconst ReturnOrderTable = () => {\n const [state] = useAtom(filtersReducerAtom);\n const [selectedReturnOrder, setSelectedReturnOrder] = useSelectedOrders();\n const [selectAll, setSelectAll] = useSelectAll();\n const { 'x-filters': filters, 'x-pagination': pagination } = state;\n const [returnData, setReturnData] = useReturnData();\n const [load, setLoading] = useLoading();\n const dropdownRefParent = useRef<HTMLDivElement>(null);\n const dropdownRef = useRef<HTMLDivElement>(null);\n const [printToogle, setPrintToggle] = usePrintOptionTOggle();\n const [, setReturnPayload] = useReturnPayload();\n const [newpayload, setNewPayload] = useNewReturnPayload();\n const [, setGrouped] = useGroupedPayload();\n const [locationData] = useLocationData();\n const [, setPaginationObject] = UsePaginationData();\n const [callForFetch] = usefetchAgain();\n const [searchParams] = useSearchParams();\n const urlCustomerId = searchParams.get('customerId');\n //sorting\n const [sortConfig, setSortConfig] = useState<{\n key: string;\n direction: 'asc' | 'desc';\n } | null>(null);\n\n const handleSort = (key: string) => {\n setSortConfig((prev: any) => {\n if (prev?.key === key && prev.direction === 'asc') {\n return { key, direction: 'desc' };\n }\n return { key, direction: 'asc' };\n });\n };\n\n const sortedData = useMemo(() => {\n if (!returnData || !sortConfig) return returnData;\n\n const { key, direction } = sortConfig;\n return [...returnData].sort((a, b) => {\n const valueA = a[key];\n const valueB = b[key];\n\n if (typeof valueA === 'number' && typeof valueB === 'number') {\n return direction === 'asc' ? valueA - valueB : valueB - valueA;\n }\n if (typeof valueA === 'string' && typeof valueB === 'string') {\n return direction === 'asc'\n ? valueA.localeCompare(valueB)\n : valueB.localeCompare(valueA);\n }\n return 0;\n });\n }, [returnData, sortConfig]);\n\n const renderSortIcon = (columnKey: string) => {\n if (!sortConfig || sortConfig.key !== columnKey) {\n return <SortIcon />;\n }\n return sortConfig.direction === 'asc' ? (\n <CaretDownFilledIcon />\n ) : (\n <CaretDownFilledIcon />\n );\n };\n\n const OpenDropDown = (index: number) => {\n setPrintToggle(prevIndex => (prevIndex === index ? null : index));\n };\n // Close dropdown outside click\n useEffect(() => {\n document.addEventListener('mousedown', handleClickOutside);\n return () => {\n document.removeEventListener('mousedown', handleClickOutside);\n };\n }, []);\n const handleClickOutside = (event: MouseEvent) => {\n if (\n dropdownRef.current &&\n !dropdownRef.current.contains(event.target as Node)\n ) {\n setPrintToggle(null);\n }\n };\n\n const {\n data: fetchedOrderData,\n loading: returnDataLoad,\n paginationData,\n setShouldPerformAction,\n } = useApiHook<ApiResponse>({\n endpoint: '/v1/return/product/pending/',\n method: 'GET',\n filters: filters,\n pagination: pagination,\n performAction: false,\n showLoader: false,\n });\n\n useEffect(() => {\n setLoading(returnDataLoad);\n if (fetchedOrderData && fetchedOrderData?.data) {\n setReturnData(fetchedOrderData?.data);\n if (paginationData) {\n try {\n const { count, ...rest } = JSON.parse(paginationData);\n setPaginationObject(rest);\n } catch (error) {\n console.error('Error parsing paginationData:', error);\n notification.error({\n message: 'Error',\n description: 'Failed to parse pagination data',\n });\n }\n } else {\n notification.error({\n message: 'Error',\n description: 'Pagination data is null or undefined',\n });\n }\n }\n }, [fetchedOrderData, returnDataLoad]);\n\n useEffect(() => {\n setLoading(returnDataLoad);\n setShouldPerformAction(true);\n if (fetchedOrderData && fetchedOrderData?.data && locationData) {\n const updatedReturnData = fetchedOrderData.data.map(returnItem => {\n const matchingLocation = locationData.find(\n (location: any) => location?.token === returnItem?.return_location\n );\n return {\n ...returnItem,\n new_location: matchingLocation\n ? matchingLocation?.location_name\n : null,\n };\n });\n\n setReturnData(updatedReturnData);\n }\n // setShouldPerformAction(false);\n }, [fetchedOrderData, returnDataLoad, locationData, state, callForFetch]);\n // const [customers] = useCustomerData();\n const [flatCustomers] = useFlatCustomerData();\n\n const selectedCustomer = flatCustomers?.find((customer: any) => {\n const customerId = customer?.customer_id?.toString();\n return customerId && customerId === urlCustomerId;\n });\n\n const accountNumber = selectedCustomer?.account_number;\n console.log(selectedCustomer, 'selectedCustomer');\n const handleSelectAll = (e: any) => {\n const isChecked = e.target.checked;\n setSelectAll(isChecked);\n\n if (isChecked) {\n const firstSelectable = returnData?.find((loc: any) =>\n isSelectableItem(loc)\n );\n const targetAction =\n selectedReturnOrder.length > 0\n ? selectedReturnOrder[0]?.product_return_action\n : firstSelectable?.product_return_action;\n\n if (!targetAction) return;\n\n const filteredData = returnData?.filter(\n (loc: any) =>\n isSelectableItem(loc) && loc?.product_return_action === targetAction\n );\n\n const selectedOrders = filteredData.map((loc: any) => ({\n id: loc.id,\n return_locations: loc?.return_location_name,\n return_location: loc?.return_location,\n products: loc?.legacy_product_id,\n product_return_action: loc?.product_return_action,\n return_location_token: loc?.return_location,\n }));\n const newPayload = filteredData.map((loc: any) => ({\n id: loc.id,\n account_number: accountNumber,\n customer_id: Number(urlCustomerId),\n products: [loc?.legacy_product_id],\n return_action: loc?.product_return_action,\n return_location_token: loc?.return_location || null,\n }));\n console.log(newPayload, 'newPayloadnewPayload');\n\n setSelectedReturnOrder(selectedOrders);\n setNewPayload(newPayload);\n } else {\n setSelectedReturnOrder([]);\n setNewPayload([]);\n setGrouped([]);\n }\n };\n\n const handleSelectOrderReturn = (\n id: any,\n return_location: any,\n return_location_name: any,\n product_return_action: any,\n legacy_product_id: any\n ) => {\n setSelectedReturnOrder((prevSelectedLocations: any) => {\n const isSelected = prevSelectedLocations?.some(\n (loc: any) => loc.id === id\n );\n if (isSelected) {\n const updatedSelectedLocations = prevSelectedLocations.filter(\n (loc: any) => loc.id !== id\n );\n\n setReturnPayload(prevState => ({\n ...prevState,\n products: legacy_product_id,\n return_action: product_return_action || null,\n return_location_token: return_location || null,\n }));\n\n setNewPayload((prevPayload: any) =>\n prevPayload.filter((item: any) => item.id !== id)\n );\n\n const targetAction = product_return_action;\n const totalItemsOfAction = returnData?.filter(\n (loc: any) =>\n isSelectableItem(loc) && loc?.product_return_action === targetAction\n )?.length;\n\n setSelectAll(\n updatedSelectedLocations?.length > 0 &&\n updatedSelectedLocations?.length === totalItemsOfAction\n );\n return updatedSelectedLocations;\n } else {\n const newReturnPayload = {\n id,\n account_number: accountNumber,\n customer_id: Number(urlCustomerId),\n products: [legacy_product_id],\n return_action: product_return_action || null,\n return_location_token: return_location || null,\n };\n\n setNewPayload((prevPayload: any) => [...prevPayload, newReturnPayload]);\n\n const updatedSelectedLocations = [\n ...prevSelectedLocations,\n {\n id,\n return_location,\n return_location_name,\n product_return_action,\n },\n ];\n\n const targetAction = product_return_action;\n const totalItemsOfAction = returnData?.filter(\n (loc: any) =>\n isSelectableItem(loc) && loc?.product_return_action === targetAction\n )?.length;\n\n setSelectAll(updatedSelectedLocations?.length === totalItemsOfAction);\n return updatedSelectedLocations;\n }\n });\n };\n\n useEffect(() => {\n if (newpayload?.length === 0) {\n setGrouped([]);\n return;\n }\n\n const groupedPayload = newpayload?.reduce((acc: any, item: any) => {\n const { return_location_token, id } = item;\n const key = return_location_token || `no_token_${id}`;\n\n if (!acc[key]) {\n acc[key] = {\n ...item,\n products: [],\n return_action: [],\n };\n }\n\n acc[key].products = [...acc[key].products, ...item.products];\n\n acc[key].return_action = Array.from(\n new Set([...acc[key].return_action, ...item.return_action])\n );\n\n return acc;\n }, {});\n const mergedPayload = Object.values(groupedPayload);\n setGrouped(mergedPayload);\n }, [newpayload]);\n return (\n <>\n <StyledTableWrapper className=\"fortables\">\n <StyledTable>\n <thead>\n <tr>\n {/* <th className=\"emailInvoiceCheckbox\">\n <Checkbox checked={selectAll} onChange={handleSelectAll} />\n </th> */}\n {returnData?.some((item: any) => isSelectableItem(item)) ? (\n <th className=\"emailInvoiceCheckbox\">\n <Checkbox checked={selectAll} onChange={handleSelectAll} />\n </th>\n ) : (\n <th></th>\n )}\n <th onClick={() => handleSort('location')}>\n <div className=\"sortIconClass\">\n Product Location {renderSortIcon('location')}\n </div>\n </th>\n <th onClick={() => handleSort('return_location_name')}>\n <div className=\"sortIconClass\">\n Return Location {renderSortIcon('return_location_name')}\n </div>\n </th>\n <th>Client</th>\n <th onClick={() => handleSort('recipient_name')}>\n <div className=\"sortIconClass\">\n Recipient {renderSortIcon('recipient_name')}\n </div>\n </th>\n <th>Return Action</th>\n <th>Code</th>\n <th>Description</th>\n <th>Part</th>\n <th onClick={() => handleSort('weight')}>\n <div className=\"sortIconClass\">\n Weight ({WEIGHT_UNIT}) {renderSortIcon('weight')}\n </div>\n </th>\n <th>CBM</th>\n <th onClick={() => handleSort('return_reason')}>\n <div className=\"sortIconClass\">\n Return Reason {renderSortIcon('return_reason')}\n </div>\n </th>\n <th>Collected</th>\n <th onClick={() => handleSort('collection_reason')}>\n <div className=\"sortIconClass\">\n Collection Reason {renderSortIcon('collection_reason')}\n </div>\n </th>\n <th className=\"emailInvoiceShare\">Labels</th>\n </tr>\n </thead>\n <tbody>\n {load ? (\n <tr>\n <td colSpan={14}>\n <Skeleton active />\n </td>\n </tr>\n ) : sortedData?.length === 0 ? (\n <tr>\n <td colSpan={14}>\n <EmptyDataContainer>\n <Empty />\n </EmptyDataContainer>\n </td>\n </tr>\n ) : (\n sortedData?.map((item: any, index: any) => (\n <tr key={item.id}>\n <td>\n {isSelectableItem(item) ? (() => {\n const isDisabled =\n selectedReturnOrder?.length > 0 &&\n selectedReturnOrder[0]?.product_return_action !==\n item?.product_return_action;\n\n return (\n <Tooltip\n title={\n isDisabled\n ? 'Cannot select different return actions'\n : ''\n }\n >\n <span\n className={isDisabled ? 'disabled-wrapper' : ''}\n >\n <Checkbox\n className=\"custom-check\"\n disabled={isDisabled}\n checked={selectedReturnOrder.some(\n (selectedInvoice: any) =>\n selectedInvoice?.id === item?.id\n )}\n onChange={() =>\n handleSelectOrderReturn(\n item?.id,\n item?.return_location,\n item?.return_location_name,\n item?.product_return_action,\n item?.legacy_product_id\n )\n }\n />\n </span>\n </Tooltip>\n );\n })() : null}\n </td>\n\n <td>\n {item?.location !== null && item?.location !== undefined ? (\n item?.location\n ) : (\n <div className=\"awaiting\">Awaiting</div>\n )}\n </td>\n <td> {displayValueOrNA(item?.return_location_name)}</td>\n <td title={item?.client_name ?? ''}>\n {displayValueOrNA(item?.client_name)}\n </td>\n <td>\n <ul style={{ listStyleType: 'none', padding: 0 }}>\n <li\n style={{\n color: '#0099ff',\n fontWeight: 600,\n paddingLeft: 0,\n }}\n >\n <NavLink to={`/orders/view/${item?.order_id}`}>\n {displayValueOrNA(item?.recipient_name)}\n </NavLink>\n </li>\n <li style={{ color: '#888075' }}>\n {displayValueOrNA(item?.postcode)}\n </li>\n </ul>\n </td>\n <td>{displayValueOrNA(item?.product_return_action)}</td>\n <td>{displayValueOrNA(item?.code)}</td>\n <td>{displayValueOrNA(item?.description)}</td>\n <td>{displayValueOrNA(item?.part)}</td>\n <td>\n {displayValueOrNA(item?.weight)}{' '}\n {item?.weight && item?.weight !== null ? WEIGHT_UNIT : ''}\n </td>\n <td>{displayValueOrNA(item?.cube)}</td>\n <td>{displayValueOrNA(item?.return_reason)}</td>\n <td>\n {item?.collected_at\n ? format(new Date(item?.collected_at), 'dd/MM/yyyy')\n : 'UNKNOWN'}\n </td>\n\n <td>{displayValueOrNA(item?.collection_reason)}</td>\n <td>\n <ul className=\"actionbox\">\n <CustomDrop\n ref={dropdownRefParent}\n className={printToogle === index ? 'active' : ''}\n >\n <li\n className=\"shareIconContainer\"\n onClick={() => OpenDropDown(index)}\n >\n <PrinterIcon />\n <DownIcon />\n {printToogle === index && (\n <div ref={dropdownRef}>\n <PrintDropDownReturn\n legacyURL={item?.return_order_product_label}\n legacyProductID={item?.legacy_product_id}\n />\n </div>\n )}\n </li>\n </CustomDrop>\n </ul>\n </td>\n </tr>\n ))\n )}\n </tbody>\n </StyledTable>\n </StyledTableWrapper>\n </>\n );\n};\n\nexport default ReturnOrderTable;\n"],"names":["SELECTABLE_ACTIONS","isSelectableItem","item","ReturnOrderTable","state","useAtom","filtersReducerAtom","selectedReturnOrder","setSelectedReturnOrder","useSelectedOrders","selectAll","setSelectAll","useSelectAll","filters","pagination","returnData","setReturnData","useReturnData","load","setLoading","useLoading","dropdownRefParent","useRef","dropdownRef","printToogle","setPrintToggle","usePrintOptionTOggle","setReturnPayload","useReturnPayload","newpayload","setNewPayload","useNewReturnPayload","setGrouped","useGroupedPayload","locationData","useLocationData","setPaginationObject","UsePaginationData","callForFetch","usefetchAgain","searchParams","useSearchParams","urlCustomerId","sortConfig","setSortConfig","useState","handleSort","key","prev","sortedData","useMemo","direction","a","b","valueA","valueB","renderSortIcon","columnKey","SortIcon","CaretDownFilledIcon","OpenDropDown","index","prevIndex","useEffect","handleClickOutside","event","fetchedOrderData","returnDataLoad","paginationData","setShouldPerformAction","useApiHook","count","rest","error","notification","updatedReturnData","returnItem","matchingLocation","location","flatCustomers","useFlatCustomerData","selectedCustomer","customer","customerId","accountNumber","handleSelectAll","e","isChecked","firstSelectable","loc","targetAction","filteredData","selectedOrders","newPayload","handleSelectOrderReturn","id","return_location","return_location_name","product_return_action","legacy_product_id","prevSelectedLocations","updatedSelectedLocations","prevState","prevPayload","totalItemsOfAction","newReturnPayload","groupedPayload","acc","return_location_token","mergedPayload","jsx","StyledTableWrapper","StyledTable","Checkbox","jsxs","WEIGHT_UNIT","Skeleton","EmptyDataContainer","Empty","isDisabled","Tooltip","selectedInvoice","displayValueOrNA","NavLink","format","CustomDrop","PrinterIcon","DownIcon","PrintDropDownReturn"],"mappings":";;;;;;;;;;;;;;;;;;;;AAiCA,MAAMA,KAAqB;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAEMC,IAAmB,CAACC,MACxBF,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AI,GAAE;AAAA,MAClC,gBAAA4G,EAAC,MAAA,EAAI,UAAAY,EAAiBxH,GAAM,aAAa,GAAE;AAAA,MAC3C,gBAAA4G,EAAC,MAAA,EACE,UAAA5G,GAAM,eACH0H,GAAO,IAAI,KAAK1H,GAAM,YAAY,GAAG,YAAY,IACjD,UAAA,CACN;AAAA,MAEA,gBAAA4G,EAAC,MAAA,EAAI,UAAAY,EAAiBxH,GAAM,iBAAiB,GAAE;AAAA,MAC/C,gBAAA4G,EAAC,MAAA,EACC,UAAA,gBAAAA,EAAC,MAAA,EAAG,WAAU,aACZ,UAAA,gBAAAA;AAAA,QAACe;AAAA,QAAA;AAAA,UACC,KAAKxG;AAAA,UACL,WAAWG,MAAgBqC,IAAQ,WAAW;AAAA,UAE9C,UAAA,gBAAAqD;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAU;AAAA,cACV,SAAS,MAAMtD,GAAaC,CAAK;AAAA,cAEjC,UAAA;AAAA,gBAAA,gBAAAiD,EAACgB,IAAA,EAAY;AAAA,kCACZC,IAAA,EAAS;AAAA,gBACTvG,MAAgBqC,KACf,gBAAAiD,EAAC,OAAA,EAAI,KAAKvF,GACR,UAAA,gBAAAuF;AAAA,kBAACkB;AAAA,kBAAA;AAAA,oBACC,WAAW9H,GAAM;AAAA,oBACjB,iBAAiBA,GAAM;AAAA,kBAAA;AAAA,gBAAA,EACzB,CACF;AAAA,cAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QAEJ;AAAA,MAAA,GAEJ,EAAA,CACF;AAAA,IAAA,KA/GOA,EAAK,EAgHd,CACD,EAAA,CAEL;AAAA,EAAA,EAAA,CACF,GACF,GACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"ReturnOrderTable.js","sources":["../../../../../src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.tsx"],"sourcesContent":["import { Checkbox, useApiHook } from '@bjsdistribution/dms-component-library';\nimport { Empty, notification, Skeleton, Tooltip } from 'antd';\nimport { format } from 'date-fns';\nimport { useAtom } from 'jotai';\nimport React, { useEffect, useMemo, useRef, useState } from 'react';\nimport DownIcon from '../../../../assets/icons/DownIcon';\nimport PrinterIcon from '../../../../assets/icons/PrinterIcon';\nimport CaretDownFilledIcon from '../../../../common/CaretDownFilledIcon';\nimport SortIcon from '../../../../common/SortIcon';\nimport PrintDropDownReturn from '../../../order-view/details-filters/left-side-filters/dropdowns/PrintDropDownReturn';\nimport { usefetchAgain, useReturnData } from '../../../order-view/store';\nimport {\n useFlatCustomerData,\n useGroupedPayload,\n useLocationData,\n useNewReturnPayload,\n useReturnPayload,\n useSelectAll,\n useSelectedOrders,\n} from '../../../store';\nimport { ApiResponse } from '../../../types';\nimport { filtersReducerAtom } from '../../header-filters/filterStore';\nimport { displayValueOrNA } from '../../shared/utlis';\nimport {\n useLoading,\n UsePaginationData,\n usePrintOptionTOggle,\n} from '../../store/store';\nimport { EmptyDataContainer } from '../../table/table-data/styles';\nimport { CustomDrop, StyledTable, StyledTableWrapper } from './returnstyles';\nimport { NavLink, useSearchParams } from 'react-router-dom';\nimport { WEIGHT_UNIT, getAccountTypeLabel } from '../../../../common/utils';\n\nconst SELECTABLE_ACTIONS = [\n 'RTS',\n 'CLAIMS PAID',\n 'DISPOSE',\n 'RE-ALLOCATE',\n 'RECYCLE',\n 'UNKNOWN',\n];\n\nconst isSelectableItem = (item: any) =>\n SELECTABLE_ACTIONS.includes(item?.product_return_action) &&\n item?.return_location !== 'null' &&\n item?.return_location !== null;\n\nconst ReturnOrderTable = () => {\n const [state] = useAtom(filtersReducerAtom);\n const [selectedReturnOrder, setSelectedReturnOrder] = useSelectedOrders();\n const [selectAll, setSelectAll] = useSelectAll();\n const { 'x-filters': filters, 'x-pagination': pagination } = state;\n const [returnData, setReturnData] = useReturnData();\n const [load, setLoading] = useLoading();\n const dropdownRefParent = useRef<HTMLDivElement>(null);\n const dropdownRef = useRef<HTMLDivElement>(null);\n const [printToogle, setPrintToggle] = usePrintOptionTOggle();\n const [, setReturnPayload] = useReturnPayload();\n const [newpayload, setNewPayload] = useNewReturnPayload();\n const [, setGrouped] = useGroupedPayload();\n const [locationData] = useLocationData();\n const [, setPaginationObject] = UsePaginationData();\n const [callForFetch] = usefetchAgain();\n const [searchParams] = useSearchParams();\n const urlCustomerId = searchParams.get('customerId');\n //sorting\n const [sortConfig, setSortConfig] = useState<{\n key: string;\n direction: 'asc' | 'desc';\n } | null>(null);\n\n const handleSort = (key: string) => {\n setSortConfig((prev: any) => {\n if (prev?.key === key && prev.direction === 'asc') {\n return { key, direction: 'desc' };\n }\n return { key, direction: 'asc' };\n });\n };\n\n const sortedData = useMemo(() => {\n if (!returnData || !sortConfig) return returnData;\n\n const { key, direction } = sortConfig;\n return [...returnData].sort((a, b) => {\n const valueA = a[key];\n const valueB = b[key];\n\n if (typeof valueA === 'number' && typeof valueB === 'number') {\n return direction === 'asc' ? valueA - valueB : valueB - valueA;\n }\n if (typeof valueA === 'string' && typeof valueB === 'string') {\n return direction === 'asc'\n ? valueA.localeCompare(valueB)\n : valueB.localeCompare(valueA);\n }\n return 0;\n });\n }, [returnData, sortConfig]);\n\n const renderSortIcon = (columnKey: string) => {\n if (!sortConfig || sortConfig.key !== columnKey) {\n return <SortIcon />;\n }\n return sortConfig.direction === 'asc' ? (\n <CaretDownFilledIcon />\n ) : (\n <CaretDownFilledIcon />\n );\n };\n\n const OpenDropDown = (index: number) => {\n setPrintToggle(prevIndex => (prevIndex === index ? null : index));\n };\n // Close dropdown outside click\n useEffect(() => {\n document.addEventListener('mousedown', handleClickOutside);\n return () => {\n document.removeEventListener('mousedown', handleClickOutside);\n };\n }, []);\n const handleClickOutside = (event: MouseEvent) => {\n if (\n dropdownRef.current &&\n !dropdownRef.current.contains(event.target as Node)\n ) {\n setPrintToggle(null);\n }\n };\n\n const {\n data: fetchedOrderData,\n loading: returnDataLoad,\n paginationData,\n setShouldPerformAction,\n } = useApiHook<ApiResponse>({\n endpoint: '/v1/return/product/pending/',\n method: 'GET',\n filters: filters,\n pagination: pagination,\n performAction: false,\n showLoader: false,\n });\n\n useEffect(() => {\n setLoading(returnDataLoad);\n if (fetchedOrderData && fetchedOrderData?.data) {\n setReturnData(fetchedOrderData?.data);\n if (paginationData) {\n try {\n const { count, ...rest } = JSON.parse(paginationData);\n setPaginationObject(rest);\n } catch (error) {\n console.error('Error parsing paginationData:', error);\n notification.error({\n message: 'Error',\n description: 'Failed to parse pagination data',\n });\n }\n } else {\n notification.error({\n message: 'Error',\n description: 'Pagination data is null or undefined',\n });\n }\n }\n }, [fetchedOrderData, returnDataLoad]);\n\n useEffect(() => {\n setLoading(returnDataLoad);\n setShouldPerformAction(true);\n if (fetchedOrderData && fetchedOrderData?.data && locationData) {\n const updatedReturnData = fetchedOrderData.data.map(returnItem => {\n const matchingLocation = locationData.find(\n (location: any) => location?.token === returnItem?.return_location\n );\n return {\n ...returnItem,\n new_location: matchingLocation\n ? matchingLocation?.location_name\n : null,\n };\n });\n\n setReturnData(updatedReturnData);\n }\n // setShouldPerformAction(false);\n }, [fetchedOrderData, returnDataLoad, locationData, state, callForFetch]);\n // const [customers] = useCustomerData();\n const [flatCustomers] = useFlatCustomerData();\n\n const selectedCustomer = flatCustomers?.find((customer: any) => {\n const customerId = customer?.customer_id?.toString();\n return customerId && customerId === urlCustomerId;\n });\n\n const accountNumber = selectedCustomer?.account_number;\n console.log(selectedCustomer, 'selectedCustomer');\n const handleSelectAll = (e: any) => {\n const isChecked = e.target.checked;\n setSelectAll(isChecked);\n\n if (isChecked) {\n const firstSelectable = returnData?.find((loc: any) =>\n isSelectableItem(loc)\n );\n const targetAction =\n selectedReturnOrder.length > 0\n ? selectedReturnOrder[0]?.product_return_action\n : firstSelectable?.product_return_action;\n\n if (!targetAction) return;\n\n const filteredData = returnData?.filter(\n (loc: any) =>\n isSelectableItem(loc) && loc?.product_return_action === targetAction\n );\n\n const selectedOrders = filteredData.map((loc: any) => ({\n id: loc.id,\n return_locations: loc?.return_location_name,\n return_location: loc?.return_location,\n products: loc?.legacy_product_id,\n product_return_action: loc?.product_return_action,\n return_location_token: loc?.return_location,\n }));\n const newPayload = filteredData.map((loc: any) => ({\n id: loc.id,\n account_number: accountNumber,\n customer_id: Number(urlCustomerId),\n products: [loc?.legacy_product_id],\n return_action: loc?.product_return_action,\n return_location_token: loc?.return_location || null,\n }));\n console.log(newPayload, 'newPayloadnewPayload');\n\n setSelectedReturnOrder(selectedOrders);\n setNewPayload(newPayload);\n } else {\n setSelectedReturnOrder([]);\n setNewPayload([]);\n setGrouped([]);\n }\n };\n\n const handleSelectOrderReturn = (\n id: any,\n return_location: any,\n return_location_name: any,\n product_return_action: any,\n legacy_product_id: any\n ) => {\n setSelectedReturnOrder((prevSelectedLocations: any) => {\n const isSelected = prevSelectedLocations?.some(\n (loc: any) => loc.id === id\n );\n if (isSelected) {\n const updatedSelectedLocations = prevSelectedLocations.filter(\n (loc: any) => loc.id !== id\n );\n\n setReturnPayload(prevState => ({\n ...prevState,\n products: legacy_product_id,\n return_action: product_return_action || null,\n return_location_token: return_location || null,\n }));\n\n setNewPayload((prevPayload: any) =>\n prevPayload.filter((item: any) => item.id !== id)\n );\n\n const targetAction = product_return_action;\n const totalItemsOfAction = returnData?.filter(\n (loc: any) =>\n isSelectableItem(loc) && loc?.product_return_action === targetAction\n )?.length;\n\n setSelectAll(\n updatedSelectedLocations?.length > 0 &&\n updatedSelectedLocations?.length === totalItemsOfAction\n );\n return updatedSelectedLocations;\n } else {\n const newReturnPayload = {\n id,\n account_number: accountNumber,\n customer_id: Number(urlCustomerId),\n products: [legacy_product_id],\n return_action: product_return_action || null,\n return_location_token: return_location || null,\n };\n\n setNewPayload((prevPayload: any) => [...prevPayload, newReturnPayload]);\n\n const updatedSelectedLocations = [\n ...prevSelectedLocations,\n {\n id,\n return_location,\n return_location_name,\n product_return_action,\n },\n ];\n\n const targetAction = product_return_action;\n const totalItemsOfAction = returnData?.filter(\n (loc: any) =>\n isSelectableItem(loc) && loc?.product_return_action === targetAction\n )?.length;\n\n setSelectAll(updatedSelectedLocations?.length === totalItemsOfAction);\n return updatedSelectedLocations;\n }\n });\n };\n\n useEffect(() => {\n if (newpayload?.length === 0) {\n setGrouped([]);\n return;\n }\n\n const groupedPayload = newpayload?.reduce((acc: any, item: any) => {\n const { return_location_token, id } = item;\n const key = return_location_token || `no_token_${id}`;\n\n if (!acc[key]) {\n acc[key] = {\n ...item,\n products: [],\n return_action: [],\n };\n }\n\n acc[key].products = [...acc[key].products, ...item.products];\n\n acc[key].return_action = Array.from(\n new Set([...acc[key].return_action, ...item.return_action])\n );\n\n return acc;\n }, {});\n const mergedPayload = Object.values(groupedPayload);\n setGrouped(mergedPayload);\n }, [newpayload]);\n return (\n <>\n <StyledTableWrapper className=\"fortables\">\n <StyledTable>\n <thead>\n <tr>\n {/* <th className=\"emailInvoiceCheckbox\">\n <Checkbox checked={selectAll} onChange={handleSelectAll} />\n </th> */}\n {returnData?.some((item: any) => isSelectableItem(item)) ? (\n <th className=\"emailInvoiceCheckbox\">\n <Checkbox checked={selectAll} onChange={handleSelectAll} />\n </th>\n ) : (\n <th></th>\n )}\n <th onClick={() => handleSort('location')}>\n <div className=\"sortIconClass\">\n Product Location {renderSortIcon('location')}\n </div>\n </th>\n <th onClick={() => handleSort('return_location_name')}>\n <div className=\"sortIconClass\">\n Return Location {renderSortIcon('return_location_name')}\n </div>\n </th>\n <th>Client</th>\n <th onClick={() => handleSort('recipient_name')}>\n <div className=\"sortIconClass\">\n Recipient {renderSortIcon('recipient_name')}\n </div>\n </th>\n <th>Return Action</th>\n <th>Code</th>\n <th>Description</th>\n <th>Part</th>\n <th onClick={() => handleSort('weight')}>\n <div className=\"sortIconClass\">\n Weight ({WEIGHT_UNIT}) {renderSortIcon('weight')}\n </div>\n </th>\n <th>CBM</th>\n <th onClick={() => handleSort('return_reason')}>\n <div className=\"sortIconClass\">\n Return Reason {renderSortIcon('return_reason')}\n </div>\n </th>\n <th>Collected</th>\n <th onClick={() => handleSort('collection_reason')}>\n <div className=\"sortIconClass\">\n Collection Reason {renderSortIcon('collection_reason')}\n </div>\n </th>\n <th className=\"emailInvoiceShare\">Labels</th>\n </tr>\n </thead>\n <tbody>\n {load ? (\n <tr>\n <td colSpan={14}>\n <Skeleton active />\n </td>\n </tr>\n ) : sortedData?.length === 0 ? (\n <tr>\n <td colSpan={14}>\n <EmptyDataContainer>\n <Empty />\n </EmptyDataContainer>\n </td>\n </tr>\n ) : (\n sortedData?.map((item: any, index: any) => (\n <tr key={item.id}>\n <td>\n {isSelectableItem(item) ? (() => {\n const isDisabled =\n selectedReturnOrder?.length > 0 &&\n selectedReturnOrder[0]?.product_return_action !==\n item?.product_return_action;\n\n return (\n <Tooltip\n title={\n isDisabled\n ? 'Cannot select different return actions'\n : ''\n }\n >\n <span\n className={isDisabled ? 'disabled-wrapper' : ''}\n >\n <Checkbox\n className=\"custom-check\"\n disabled={isDisabled}\n checked={selectedReturnOrder.some(\n (selectedInvoice: any) =>\n selectedInvoice?.id === item?.id\n )}\n onChange={() =>\n handleSelectOrderReturn(\n item?.id,\n item?.return_location,\n item?.return_location_name,\n item?.product_return_action,\n item?.legacy_product_id\n )\n }\n />\n </span>\n </Tooltip>\n );\n })() : null}\n </td>\n\n <td>\n {item?.location !== null && item?.location !== undefined ? (\n item?.location\n ) : (\n <div className=\"awaiting\">Awaiting</div>\n )}\n </td>\n <td> {displayValueOrNA(item?.return_location_name)}</td>\n <td title={item?.client_name ?? ''}>\n {displayValueOrNA(item?.client_name)}\n {getAccountTypeLabel(item?.owner_id) && (\n <span> ({getAccountTypeLabel(item?.owner_id)})</span>\n )}\n </td>\n <td>\n <ul style={{ listStyleType: 'none', padding: 0 }}>\n <li\n style={{\n color: '#0099ff',\n fontWeight: 600,\n paddingLeft: 0,\n }}\n >\n <NavLink to={`/orders/view/${item?.order_id}`}>\n {displayValueOrNA(item?.recipient_name)}\n </NavLink>\n </li>\n <li style={{ color: '#888075' }}>\n {displayValueOrNA(item?.postcode)}\n </li>\n </ul>\n </td>\n <td>{displayValueOrNA(item?.product_return_action)}</td>\n <td>{displayValueOrNA(item?.code)}</td>\n <td>{displayValueOrNA(item?.description)}</td>\n <td>{displayValueOrNA(item?.part)}</td>\n <td>\n {displayValueOrNA(item?.weight)}{' '}\n {item?.weight && item?.weight !== null ? WEIGHT_UNIT : ''}\n </td>\n <td>{displayValueOrNA(item?.cube)}</td>\n <td>{displayValueOrNA(item?.return_reason)}</td>\n <td>\n {item?.collected_at\n ? format(new Date(item?.collected_at), 'dd/MM/yyyy')\n : 'UNKNOWN'}\n </td>\n\n <td>{displayValueOrNA(item?.collection_reason)}</td>\n <td>\n <ul className=\"actionbox\">\n <CustomDrop\n ref={dropdownRefParent}\n className={printToogle === index ? 'active' : ''}\n >\n <li\n className=\"shareIconContainer\"\n onClick={() => OpenDropDown(index)}\n >\n <PrinterIcon />\n <DownIcon />\n {printToogle === index && (\n <div ref={dropdownRef}>\n <PrintDropDownReturn\n legacyURL={item?.return_order_product_label}\n legacyProductID={item?.legacy_product_id}\n />\n </div>\n )}\n </li>\n </CustomDrop>\n </ul>\n </td>\n </tr>\n ))\n )}\n </tbody>\n </StyledTable>\n </StyledTableWrapper>\n </>\n );\n};\n\nexport default ReturnOrderTable;\n"],"names":["SELECTABLE_ACTIONS","isSelectableItem","item","ReturnOrderTable","state","useAtom","filtersReducerAtom","selectedReturnOrder","setSelectedReturnOrder","useSelectedOrders","selectAll","setSelectAll","useSelectAll","filters","pagination","returnData","setReturnData","useReturnData","load","setLoading","useLoading","dropdownRefParent","useRef","dropdownRef","printToogle","setPrintToggle","usePrintOptionTOggle","setReturnPayload","useReturnPayload","newpayload","setNewPayload","useNewReturnPayload","setGrouped","useGroupedPayload","locationData","useLocationData","setPaginationObject","UsePaginationData","callForFetch","usefetchAgain","searchParams","useSearchParams","urlCustomerId","sortConfig","setSortConfig","useState","handleSort","key","prev","sortedData","useMemo","direction","a","b","valueA","valueB","renderSortIcon","columnKey","SortIcon","CaretDownFilledIcon","OpenDropDown","index","prevIndex","useEffect","handleClickOutside","event","fetchedOrderData","returnDataLoad","paginationData","setShouldPerformAction","useApiHook","count","rest","error","notification","updatedReturnData","returnItem","matchingLocation","location","flatCustomers","useFlatCustomerData","selectedCustomer","customer","customerId","accountNumber","handleSelectAll","isChecked","firstSelectable","loc","targetAction","filteredData","selectedOrders","newPayload","handleSelectOrderReturn","id","return_location","return_location_name","product_return_action","legacy_product_id","prevSelectedLocations","updatedSelectedLocations","prevState","prevPayload","totalItemsOfAction","newReturnPayload","groupedPayload","acc","return_location_token","mergedPayload","jsx","StyledTableWrapper","StyledTable","Checkbox","jsxs","WEIGHT_UNIT","Skeleton","EmptyDataContainer","Empty","isDisabled","Tooltip","selectedInvoice","displayValueOrNA","getAccountTypeLabel","NavLink","format","CustomDrop","PrinterIcon","DownIcon","PrintDropDownReturn"],"mappings":";;;;;;;;;;;;;;;;;;;;AAiCA,MAAMA,KAAqB;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAEMC,IAAmB,CAACC,MACxBF,GAAmB,SAASE,GAAM,qBAAqB,KACvDA,GAAM,oBAAoB,UAC1BA,GAAM,oBAAoB,MAEtBC,KAAmB,MAAM;AAC7B,QAAM,CAACC,CAAK,IAAIC,GAAQC,EAAkB,GACpC,CAACC,GAAqBC,CAAsB,IAAIC,GAAA,GAChD,CAACC,GAAWC,CAAY,IAAIC,GAAA,GAC5B,EAAE,aAAaC,GAAS,gBAAgBC,MAAeV,GACvD,CAACW,GAAYC,CAAa,IAAIC,GAAA,GAC9B,CAACC,GAAMC,CAAU,IAAIC,GAAA,GACrBC,IAAoBC,EAAuB,IAAI,GAC/CC,IAAcD,EAAuB,IAAI,GACzC,CAACE,GAAaC,CAAc,IAAIC,GAAA,GAChC,CAAA,EAAGC,CAAgB,IAAIC,GAAA,GACvB,CAACC,GAAYC,CAAa,IAAIC,GAAA,GAC9B,CAAA,EAAGC,CAAU,IAAIC,GAAA,GACjB,CAACC,CAAY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AA;AAAA,UACC,KAAKxG;AAAA,UACL,WAAWG,MAAgBqC,IAAQ,WAAW;AAAA,UAE9C,UAAA,gBAAAoD;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAU;AAAA,cACV,SAAS,MAAMrD,GAAaC,CAAK;AAAA,cAEjC,UAAA;AAAA,gBAAA,gBAAAgD,EAACiB,IAAA,EAAY;AAAA,kCACZC,IAAA,EAAS;AAAA,gBACTvG,MAAgBqC,KACf,gBAAAgD,EAAC,OAAA,EAAI,KAAKtF,GACR,UAAA,gBAAAsF;AAAA,kBAACmB;AAAA,kBAAA;AAAA,oBACC,WAAW9H,GAAM;AAAA,oBACjB,iBAAiBA,GAAM;AAAA,kBAAA;AAAA,gBAAA,EACzB,CACF;AAAA,cAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QAEJ;AAAA,MAAA,GAEJ,EAAA,CACF;AAAA,IAAA,KAlHOA,EAAK,EAmHd,CACD,EAAA,CAEL;AAAA,EAAA,EAAA,CACF,GACF,GACF;AAEJ;"}
|
|
@@ -2,3 +2,4 @@ export declare const POSTCODE_LABEL: string;
|
|
|
2
2
|
export declare const CURRENCY_SYMBOL: string;
|
|
3
3
|
export declare const WEIGHT_UNIT: string;
|
|
4
4
|
export declare const getEnvironment: () => import('@bjsdistribution/dms-component-library').ProjectEnv;
|
|
5
|
+
export declare const getAccountTypeLabel: (ownerId: number | string | undefined) => string;
|
package/package.json
CHANGED