@bjsdistribution/dms-client-return 0.1.74-prod → 0.1.75-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/components/client-portal/OutstandingTable.js +75 -81
- package/dist/components/client-portal/OutstandingTable.js.map +1 -1
- package/dist/components/client-portal/ReturnSearchBar.js +39 -39
- package/dist/components/client-portal/ReturnSearchBar.js.map +1 -1
- package/dist/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.js +123 -129
- package/dist/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,78 +1,72 @@
|
|
|
1
|
-
import { jsx as e, Fragment as
|
|
2
|
-
import { useAxios as
|
|
3
|
-
import { notification as
|
|
4
|
-
import { format as
|
|
5
|
-
import { useAtom as
|
|
6
|
-
import { useRef as
|
|
7
|
-
import { NavLink as
|
|
8
|
-
import { filtersReducerAtom as
|
|
9
|
-
import { useClientOutstandingReturnData as
|
|
10
|
-
import { usefetchAgain as
|
|
11
|
-
import { useLoading as
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import { StyledTableWrapper as
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import { dateFilterCPReducer as
|
|
19
|
-
import { WEIGHT_UNIT as
|
|
1
|
+
import { jsx as e, Fragment as Q, jsxs as r } from "react/jsx-runtime";
|
|
2
|
+
import { useAxios as X, Checkbox as w, displayValueOrNA as o } from "@bjsdistribution/dms-component-library";
|
|
3
|
+
import { notification as Y, Skeleton as Z, Empty as ee } from "antd";
|
|
4
|
+
import { format as te } from "date-fns";
|
|
5
|
+
import { useAtom as P } from "jotai";
|
|
6
|
+
import { useRef as T, useState as L, useMemo as ne, useEffect as f } from "react";
|
|
7
|
+
import { NavLink as re } from "react-router-dom";
|
|
8
|
+
import { filtersReducerAtom as oe } from "../order-daily-overview/header-filters/filterStore.js";
|
|
9
|
+
import { useClientOutstandingReturnData as ce, useLocationData as ie, useClientPortal as ae, useSelectedClientPortOrders as le, useSearchText as de } from "../store.js";
|
|
10
|
+
import { usefetchAgain as se } from "../order-view/store.js";
|
|
11
|
+
import { useLoading as he, usePrintOptionTOggle as ue, UsePaginationData as pe } from "../order-daily-overview/store/store.js";
|
|
12
|
+
import fe from "../../common/SortIcon.js";
|
|
13
|
+
import A from "../../common/CaretDownFilledIcon.js";
|
|
14
|
+
import { StyledTableWrapper as me, StyledTable as ge, EmptyDataContainer as _e, CustomDrop as Ce } from "../order-daily-overview/return-order-table/return-orders-filters/returnstyles.js";
|
|
15
|
+
import ye from "../../assets/icons/PrinterIcon.js";
|
|
16
|
+
import De from "../../assets/icons/DownIcon.js";
|
|
17
|
+
import Se from "../order-view/details-filters/left-side-filters/dropdowns/PrintDropDownReturn.js";
|
|
18
|
+
import { dateFilterCPReducer as Ne } from "./DateFilterStore.js";
|
|
19
|
+
import { WEIGHT_UNIT as E, VOLUME_UNIT as Ie } from "../../common/utils.js";
|
|
20
20
|
const Ke = () => {
|
|
21
|
-
const [
|
|
21
|
+
const [F] = P(oe), { "x-pagination": Oe } = F, [
|
|
22
22
|
s,
|
|
23
|
-
|
|
24
|
-
] =
|
|
25
|
-
|
|
26
|
-
},
|
|
27
|
-
if (!s || !
|
|
28
|
-
const { key: t, direction: n } =
|
|
23
|
+
y
|
|
24
|
+
] = ce(), [x, D] = he(), U = T(null), m = T(null), [S, N] = ue(), [g] = ie(), [, W] = pe(), [M] = se(), [j] = ae(), [G, _] = le(), [J, V] = L(!1), [I] = de(), [O] = P(Ne), { "x-filters": B } = O, [a, H] = L(null), h = (t) => {
|
|
25
|
+
H((n) => n?.key === t && n.direction === "asc" ? { key: t, direction: "desc" } : { key: t, direction: "asc" });
|
|
26
|
+
}, R = ne(() => {
|
|
27
|
+
if (!s || !a) return s;
|
|
28
|
+
const { key: t, direction: n } = a;
|
|
29
29
|
return [...s].sort((i, C) => {
|
|
30
|
-
const
|
|
31
|
-
return typeof
|
|
30
|
+
const l = i[t], d = C[t];
|
|
31
|
+
return typeof l == "number" && typeof d == "number" ? n === "asc" ? l - d : d - l : typeof l == "string" && typeof d == "string" ? n === "asc" ? l.localeCompare(d) : d.localeCompare(l) : 0;
|
|
32
32
|
});
|
|
33
|
-
}, [s,
|
|
34
|
-
|
|
33
|
+
}, [s, a]), u = (t) => !a || a.key !== t ? /* @__PURE__ */ e(fe, {}) : a.direction === "asc" ? /* @__PURE__ */ e(A, {}) : /* @__PURE__ */ e(A, {}), K = (t) => {
|
|
34
|
+
N((n) => n === t ? null : t);
|
|
35
35
|
};
|
|
36
|
-
f(() => (document.addEventListener("mousedown",
|
|
37
|
-
document.removeEventListener("mousedown",
|
|
36
|
+
f(() => (document.addEventListener("mousedown", b), () => {
|
|
37
|
+
document.removeEventListener("mousedown", b);
|
|
38
38
|
}), []);
|
|
39
|
-
const
|
|
40
|
-
m.current && !m.current.contains(t.target) &&
|
|
41
|
-
},
|
|
39
|
+
const b = (t) => {
|
|
40
|
+
m.current && !m.current.contains(t.target) && N(null);
|
|
41
|
+
}, $ = B.filter((t) => t.field !== "order_status"), k = [...[
|
|
42
42
|
{ field: "isdeleted", op: "=", value: 0 },
|
|
43
43
|
{ field: "product_return_action_id", op: "=", value: "RTS" }
|
|
44
|
-
],
|
|
44
|
+
], ...$], {
|
|
45
45
|
data: c,
|
|
46
46
|
loading: p,
|
|
47
|
-
paginationData:
|
|
48
|
-
fetchData:
|
|
49
|
-
} =
|
|
47
|
+
paginationData: v,
|
|
48
|
+
fetchData: q
|
|
49
|
+
} = X({
|
|
50
50
|
endpoint: "/v1/return/product/pending/",
|
|
51
51
|
method: "GET",
|
|
52
|
-
filters:
|
|
53
|
-
pagination:
|
|
52
|
+
filters: k,
|
|
53
|
+
pagination: { is_pagination: !1 }
|
|
54
54
|
});
|
|
55
55
|
f(() => {
|
|
56
|
-
|
|
57
|
-
}, [JSON.stringify(
|
|
58
|
-
if (
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
console.error("Error parsing paginationData:", t), T.error({
|
|
65
|
-
message: "Error",
|
|
66
|
-
description: "Failed to parse pagination data"
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
else
|
|
70
|
-
T.error({
|
|
56
|
+
j && I === "" && q();
|
|
57
|
+
}, [JSON.stringify(k), I]), f(() => {
|
|
58
|
+
if (D(p), c && c?.data && (y(c?.data), v))
|
|
59
|
+
try {
|
|
60
|
+
const { count: t, ...n } = JSON.parse(v);
|
|
61
|
+
W(n);
|
|
62
|
+
} catch (t) {
|
|
63
|
+
console.error("Error parsing paginationData:", t), Y.error({
|
|
71
64
|
message: "Error",
|
|
72
|
-
description: "
|
|
65
|
+
description: "Failed to parse pagination data"
|
|
73
66
|
});
|
|
67
|
+
}
|
|
74
68
|
}, [c, p]), f(() => {
|
|
75
|
-
if (
|
|
69
|
+
if (D(p), c && c?.data && g) {
|
|
76
70
|
const t = c.data.map((n) => {
|
|
77
71
|
const i = g.find(
|
|
78
72
|
(C) => C?.token === n?.return_location
|
|
@@ -82,23 +76,23 @@ const Ke = () => {
|
|
|
82
76
|
new_location: i ? i?.location_name : null
|
|
83
77
|
};
|
|
84
78
|
});
|
|
85
|
-
|
|
79
|
+
y(t);
|
|
86
80
|
}
|
|
87
|
-
}, [c, p, g,
|
|
88
|
-
const
|
|
81
|
+
}, [c, p, g, O, M]);
|
|
82
|
+
const z = (t) => {
|
|
89
83
|
_(
|
|
90
84
|
(n) => n.includes(t) ? n.filter((i) => i !== t) : [...n, t]
|
|
91
85
|
);
|
|
92
86
|
};
|
|
93
|
-
return /* @__PURE__ */ e(
|
|
87
|
+
return /* @__PURE__ */ e(Q, { children: /* @__PURE__ */ e(me, { className: "fortables", children: /* @__PURE__ */ r(ge, { children: [
|
|
94
88
|
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ r("tr", { children: [
|
|
95
89
|
/* @__PURE__ */ e("th", { className: "emailInvoiceCheckbox", children: /* @__PURE__ */ e(
|
|
96
|
-
|
|
90
|
+
w,
|
|
97
91
|
{
|
|
98
|
-
checked:
|
|
92
|
+
checked: J,
|
|
99
93
|
onChange: (t) => {
|
|
100
94
|
const n = t.target.checked;
|
|
101
|
-
|
|
95
|
+
V(n), _(
|
|
102
96
|
n ? s?.map((i) => i?.order_id) || [] : []
|
|
103
97
|
);
|
|
104
98
|
}
|
|
@@ -118,11 +112,11 @@ const Ke = () => {
|
|
|
118
112
|
/* @__PURE__ */ e("th", { children: "Part" }),
|
|
119
113
|
/* @__PURE__ */ e("th", { onClick: () => h("weight"), children: /* @__PURE__ */ r("div", { className: "sortIconClass", children: [
|
|
120
114
|
"Weight (",
|
|
121
|
-
|
|
115
|
+
E,
|
|
122
116
|
") ",
|
|
123
117
|
u("weight")
|
|
124
118
|
] }) }),
|
|
125
|
-
/* @__PURE__ */ e("th", { children:
|
|
119
|
+
/* @__PURE__ */ e("th", { children: Ie }),
|
|
126
120
|
/* @__PURE__ */ e("th", { onClick: () => h("return_reason"), children: /* @__PURE__ */ r("div", { className: "sortIconClass", children: [
|
|
127
121
|
"Return Reason ",
|
|
128
122
|
u("return_reason")
|
|
@@ -134,12 +128,12 @@ const Ke = () => {
|
|
|
134
128
|
] }) }),
|
|
135
129
|
/* @__PURE__ */ e("th", { className: "emailInvoiceShare", children: "Labels" })
|
|
136
130
|
] }) }),
|
|
137
|
-
/* @__PURE__ */ e("tbody", { children:
|
|
131
|
+
/* @__PURE__ */ e("tbody", { children: x ? /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: 14, children: /* @__PURE__ */ e(Z, { active: !0 }) }) }) : R?.length === 0 ? /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: 14, children: /* @__PURE__ */ e(_e, { children: /* @__PURE__ */ e(ee, {}) }) }) }) : R?.map((t, n) => /* @__PURE__ */ r("tr", { children: [
|
|
138
132
|
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ e(
|
|
139
|
-
|
|
133
|
+
w,
|
|
140
134
|
{
|
|
141
|
-
checked:
|
|
142
|
-
onChange: () =>
|
|
135
|
+
checked: G.includes(t?.order_id),
|
|
136
|
+
onChange: () => z(t?.order_id)
|
|
143
137
|
}
|
|
144
138
|
) }),
|
|
145
139
|
/* @__PURE__ */ r("td", { children: [
|
|
@@ -155,7 +149,7 @@ const Ke = () => {
|
|
|
155
149
|
fontWeight: 600,
|
|
156
150
|
paddingLeft: 0
|
|
157
151
|
},
|
|
158
|
-
children: /* @__PURE__ */ e(
|
|
152
|
+
children: /* @__PURE__ */ e(re, { to: `/orders/view/${t?.order_id}`, children: o(t?.recipient_name) })
|
|
159
153
|
}
|
|
160
154
|
),
|
|
161
155
|
/* @__PURE__ */ e("li", { style: { color: "#888075" }, children: o(t?.postcode) })
|
|
@@ -167,27 +161,27 @@ const Ke = () => {
|
|
|
167
161
|
/* @__PURE__ */ r("td", { children: [
|
|
168
162
|
o(t?.weight),
|
|
169
163
|
" ",
|
|
170
|
-
t?.weight && t?.weight !== null ?
|
|
164
|
+
t?.weight && t?.weight !== null ? E : ""
|
|
171
165
|
] }),
|
|
172
166
|
/* @__PURE__ */ e("td", { children: o(t?.cube) }),
|
|
173
167
|
/* @__PURE__ */ e("td", { children: o(t?.return_reason) }),
|
|
174
|
-
/* @__PURE__ */ e("td", { children: t?.collected_at ?
|
|
168
|
+
/* @__PURE__ */ e("td", { children: t?.collected_at ? te(new Date(t?.collected_at), "dd/MM/yyyy") : "UNKNOWN" }),
|
|
175
169
|
/* @__PURE__ */ e("td", { children: o(t?.collection_reason) }),
|
|
176
170
|
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("ul", { className: "actionbox", children: /* @__PURE__ */ e(
|
|
177
|
-
|
|
171
|
+
Ce,
|
|
178
172
|
{
|
|
179
|
-
ref:
|
|
180
|
-
className:
|
|
173
|
+
ref: U,
|
|
174
|
+
className: S === n ? "active" : "",
|
|
181
175
|
children: /* @__PURE__ */ r(
|
|
182
176
|
"li",
|
|
183
177
|
{
|
|
184
178
|
className: "shareIconContainer",
|
|
185
|
-
onClick: () =>
|
|
179
|
+
onClick: () => K(n),
|
|
186
180
|
children: [
|
|
181
|
+
/* @__PURE__ */ e(ye, {}),
|
|
187
182
|
/* @__PURE__ */ e(De, {}),
|
|
188
|
-
/* @__PURE__ */ e(
|
|
189
|
-
|
|
190
|
-
Ne,
|
|
183
|
+
S === n && /* @__PURE__ */ e("div", { ref: m, children: /* @__PURE__ */ e(
|
|
184
|
+
Se,
|
|
191
185
|
{
|
|
192
186
|
legacyURL: t?.return_order_product_label,
|
|
193
187
|
legacyProductID: t?.legacy_product_id
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OutstandingTable.js","sources":["../../../src/components/client-portal/OutstandingTable.tsx"],"sourcesContent":["import {\n Checkbox,\n displayValueOrNA,\n useAxios,\n} from '@bjsdistribution/dms-component-library';\nimport { Empty, notification, Skeleton } from 'antd';\nimport { format } from 'date-fns';\nimport { useAtom } from 'jotai';\nimport React, { useEffect, useMemo, useRef, useState } from 'react';\nimport { NavLink } from 'react-router-dom';\nimport { filtersReducerAtom } from '../order-daily-overview/header-filters/filterStore';\nimport {\n useClientOutstandingReturnData,\n useClientPortal,\n useLocationData,\n useSearchText,\n useSelectedClientPortOrders,\n} from '../store';\nimport { usefetchAgain } from '../order-view/store';\nimport {\n useLoading,\n UsePaginationData,\n usePrintOptionTOggle,\n} from '../order-daily-overview/store/store';\nimport SortIcon from '../../common/SortIcon';\nimport CaretDownFilledIcon from '../../common/CaretDownFilledIcon';\nimport { ApiResponse } from '../types';\nimport {\n CustomDrop,\n EmptyDataContainer,\n StyledTable,\n StyledTableWrapper,\n} from '../order-daily-overview/return-order-table/return-orders-filters/returnstyles';\nimport PrinterIcon from '../../assets/icons/PrinterIcon';\nimport DownIcon from '../../assets/icons/DownIcon';\nimport PrintDropDownReturn from '../order-view/details-filters/left-side-filters/dropdowns/PrintDropDownReturn';\nimport { dateFilterCPReducer } from './DateFilterStore';\nimport { WEIGHT_UNIT, VOLUME_UNIT } from '../../common/utils';\n\nconst OutstandingTable = () => {\n const [statePagination] = useAtom(filtersReducerAtom);\n const { 'x-pagination': pagination } = statePagination;\n const [\n outstandingReturnData,\n setOutstandingReturnData,\n ] = useClientOutstandingReturnData();\n const [load, setLoading] = useLoading();\n const dropdownRefParent = useRef<HTMLDivElement>(null);\n const dropdownRef = useRef<HTMLDivElement>(null);\n const [printToogle, setPrintToggle] = usePrintOptionTOggle();\n const [locationData] = useLocationData();\n const [, setPaginationObject] = UsePaginationData();\n const [callForFetch] = usefetchAgain();\n const [clientPortal] = useClientPortal();\n const [selectedOrderIds, setSelectedOrderIds] = useSelectedClientPortOrders();\n const [selectClientAll, setSelectClientAll] = useState(false);\n const [debouncedSearchText] = useSearchText();\n\n const [state] = useAtom(dateFilterCPReducer);\n const { 'x-filters': filters } = state;\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 (!outstandingReturnData || !sortConfig) return outstandingReturnData;\n\n const { key, direction } = sortConfig;\n return [...outstandingReturnData].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 }, [outstandingReturnData, 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 cleanedFilters = filters.filter(f => f.field !== 'order_status');\n const baseFilters = [\n { field: 'isdeleted', op: '=', value: 0 },\n { field: 'product_return_action_id', op: '=', value: 'RTS' },\n ];\n\n const modifiedFilters = [...baseFilters, ...cleanedFilters];\n const {\n data: fetchedOrderData,\n loading: returnDataLoad,\n paginationData,\n fetchData,\n } = useAxios<ApiResponse>({\n endpoint: '/v1/return/product/pending/',\n method: 'GET',\n filters: modifiedFilters,\n pagination: pagination,\n });\n\n useEffect(() => {\n if (clientPortal && debouncedSearchText === '') {\n fetchData();\n }\n }, [JSON.stringify(modifiedFilters), debouncedSearchText, pagination]);\n\n useEffect(() => {\n setLoading(returnDataLoad);\n if (fetchedOrderData && fetchedOrderData?.data) {\n setOutstandingReturnData(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 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 setOutstandingReturnData(updatedReturnData);\n }\n }, [fetchedOrderData, returnDataLoad, locationData, state, callForFetch]);\n\n //Client Portal\n const handleSelectOrderId = (id: string | number) => {\n setSelectedOrderIds(prev =>\n prev.includes(id) ? prev.filter(orderId => orderId !== id) : [...prev, id]\n );\n };\n\n const handleClientSelectAll = (e: React.ChangeEvent<HTMLInputElement>) => {\n const isChecked = e.target.checked;\n setSelectClientAll(isChecked);\n\n if (isChecked) {\n setSelectedOrderIds(\n outstandingReturnData?.map((item: any) => item?.order_id) || []\n );\n } else {\n setSelectedOrderIds([]);\n }\n };\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 <th className=\"emailInvoiceCheckbox\">\n <Checkbox\n checked={selectClientAll}\n onChange={handleClientSelectAll}\n />\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 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>{VOLUME_UNIT}</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 <Checkbox\n checked={selectedOrderIds.includes(item?.order_id)}\n onChange={() => handleSelectOrderId(item?.order_id)}\n />\n </td>\n <td> {displayValueOrNA(item?.return_location_name)}</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 OutstandingTable;\n"],"names":["OutstandingTable","statePagination","useAtom","filtersReducerAtom","pagination","outstandingReturnData","setOutstandingReturnData","useClientOutstandingReturnData","load","setLoading","useLoading","dropdownRefParent","useRef","dropdownRef","printToogle","setPrintToggle","usePrintOptionTOggle","locationData","useLocationData","setPaginationObject","UsePaginationData","callForFetch","usefetchAgain","clientPortal","useClientPortal","selectedOrderIds","setSelectedOrderIds","useSelectedClientPortOrders","selectClientAll","setSelectClientAll","useState","debouncedSearchText","useSearchText","state","dateFilterCPReducer","filters","sortConfig","setSortConfig","handleSort","key","prev","sortedData","useMemo","direction","a","b","valueA","valueB","renderSortIcon","columnKey","SortIcon","CaretDownFilledIcon","OpenDropDown","index","prevIndex","useEffect","handleClickOutside","event","cleanedFilters","f","modifiedFilters","fetchedOrderData","returnDataLoad","paginationData","fetchData","useAxios","count","rest","error","notification","updatedReturnData","returnItem","matchingLocation","location","handleSelectOrderId","id","orderId","jsx","StyledTableWrapper","StyledTable","Checkbox","e","isChecked","item","jsxs","WEIGHT_UNIT","VOLUME_UNIT","Skeleton","EmptyDataContainer","Empty","displayValueOrNA","NavLink","format","CustomDrop","PrinterIcon","DownIcon","PrintDropDownReturn"],"mappings":";;;;;;;;;;;;;;;;;;;AAuCA,MAAMA,KAAmB,MAAM;AAC7B,QAAM,CAACC,CAAe,IAAIC,EAAQC,EAAkB,GAC9C,EAAE,gBAAgBC,EAAA,IAAeH,GACjC;AAAA,IACJI;AAAA,IACAC;AAAA,EAAA,IACEC,GAAA,GACE,CAACC,GAAMC,CAAU,IAAIC,GAAA,GACrBC,IAAoBC,EAAuB,IAAI,GAC/CC,IAAcD,EAAuB,IAAI,GACzC,CAACE,GAAaC,CAAc,IAAIC,GAAA,GAChC,CAACC,CAAY,IAAIC,GAAA,GACjB,CAAA,EAAGC,CAAmB,IAAIC,GAAA,GAC1B,CAACC,CAAY,IAAIC,GAAA,GACjB,CAACC,CAAY,IAAIC,GAAA,GACjB,CAACC,GAAkBC,CAAmB,IAAIC,GAAA,GAC1C,CAACC,GAAi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AAAA,kCACZC,IAAA,EAAS;AAAA,gBACTjF,MAAgBuC,KACf,gBAAAwB,EAAC,OAAA,EAAI,KAAKhE,GACR,UAAA,gBAAAgE;AAAA,kBAACmB;AAAA,kBAAA;AAAA,oBACC,WAAWb,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,KAlEOA,EAAK,EAmEd,CACD,EAAA,CAEL;AAAA,EAAA,EAAA,CACF,GACF,GACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"OutstandingTable.js","sources":["../../../src/components/client-portal/OutstandingTable.tsx"],"sourcesContent":["import {\n Checkbox,\n displayValueOrNA,\n useAxios,\n} from '@bjsdistribution/dms-component-library';\nimport { Empty, notification, Skeleton } from 'antd';\nimport { format } from 'date-fns';\nimport { useAtom } from 'jotai';\nimport React, { useEffect, useMemo, useRef, useState } from 'react';\nimport { NavLink } from 'react-router-dom';\nimport { filtersReducerAtom } from '../order-daily-overview/header-filters/filterStore';\nimport {\n useClientOutstandingReturnData,\n useClientPortal,\n useLocationData,\n useSearchText,\n useSelectedClientPortOrders,\n} from '../store';\nimport { usefetchAgain } from '../order-view/store';\nimport {\n useLoading,\n UsePaginationData,\n usePrintOptionTOggle,\n} from '../order-daily-overview/store/store';\nimport SortIcon from '../../common/SortIcon';\nimport CaretDownFilledIcon from '../../common/CaretDownFilledIcon';\nimport { ApiResponse } from '../types';\nimport {\n CustomDrop,\n EmptyDataContainer,\n StyledTable,\n StyledTableWrapper,\n} from '../order-daily-overview/return-order-table/return-orders-filters/returnstyles';\nimport PrinterIcon from '../../assets/icons/PrinterIcon';\nimport DownIcon from '../../assets/icons/DownIcon';\nimport PrintDropDownReturn from '../order-view/details-filters/left-side-filters/dropdowns/PrintDropDownReturn';\nimport { dateFilterCPReducer } from './DateFilterStore';\nimport { WEIGHT_UNIT, VOLUME_UNIT } from '../../common/utils';\n\nconst OutstandingTable = () => {\n const [statePagination] = useAtom(filtersReducerAtom);\n const { 'x-pagination': pagination } = statePagination;\n const [\n outstandingReturnData,\n setOutstandingReturnData,\n ] = useClientOutstandingReturnData();\n const [load, setLoading] = useLoading();\n const dropdownRefParent = useRef<HTMLDivElement>(null);\n const dropdownRef = useRef<HTMLDivElement>(null);\n const [printToogle, setPrintToggle] = usePrintOptionTOggle();\n const [locationData] = useLocationData();\n const [, setPaginationObject] = UsePaginationData();\n const [callForFetch] = usefetchAgain();\n const [clientPortal] = useClientPortal();\n const [selectedOrderIds, setSelectedOrderIds] = useSelectedClientPortOrders();\n const [selectClientAll, setSelectClientAll] = useState(false);\n const [debouncedSearchText] = useSearchText();\n\n const [state] = useAtom(dateFilterCPReducer);\n const { 'x-filters': filters } = state;\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 (!outstandingReturnData || !sortConfig) return outstandingReturnData;\n\n const { key, direction } = sortConfig;\n return [...outstandingReturnData].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 }, [outstandingReturnData, 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 cleanedFilters = filters.filter(f => f.field !== 'order_status');\n const baseFilters = [\n { field: 'isdeleted', op: '=', value: 0 },\n { field: 'product_return_action_id', op: '=', value: 'RTS' },\n ];\n\n const modifiedFilters = [...baseFilters, ...cleanedFilters];\n const {\n data: fetchedOrderData,\n loading: returnDataLoad,\n paginationData,\n fetchData,\n } = useAxios<ApiResponse>({\n endpoint: '/v1/return/product/pending/',\n method: 'GET',\n filters: modifiedFilters,\n pagination: { is_pagination: false },\n });\n\n useEffect(() => {\n if (clientPortal && debouncedSearchText === '') {\n fetchData();\n }\n }, [JSON.stringify(modifiedFilters), debouncedSearchText]);\n\n useEffect(() => {\n setLoading(returnDataLoad);\n if (fetchedOrderData && fetchedOrderData?.data) {\n setOutstandingReturnData(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 }\n }\n }, [fetchedOrderData, returnDataLoad]);\n\n useEffect(() => {\n setLoading(returnDataLoad);\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 setOutstandingReturnData(updatedReturnData);\n }\n }, [fetchedOrderData, returnDataLoad, locationData, state, callForFetch]);\n\n //Client Portal\n const handleSelectOrderId = (id: string | number) => {\n setSelectedOrderIds(prev =>\n prev.includes(id) ? prev.filter(orderId => orderId !== id) : [...prev, id]\n );\n };\n\n const handleClientSelectAll = (e: React.ChangeEvent<HTMLInputElement>) => {\n const isChecked = e.target.checked;\n setSelectClientAll(isChecked);\n\n if (isChecked) {\n setSelectedOrderIds(\n outstandingReturnData?.map((item: any) => item?.order_id) || []\n );\n } else {\n setSelectedOrderIds([]);\n }\n };\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 <th className=\"emailInvoiceCheckbox\">\n <Checkbox\n checked={selectClientAll}\n onChange={handleClientSelectAll}\n />\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 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>{VOLUME_UNIT}</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 <Checkbox\n checked={selectedOrderIds.includes(item?.order_id)}\n onChange={() => handleSelectOrderId(item?.order_id)}\n />\n </td>\n <td> {displayValueOrNA(item?.return_location_name)}</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 OutstandingTable;\n"],"names":["OutstandingTable","statePagination","useAtom","filtersReducerAtom","pagination","outstandingReturnData","setOutstandingReturnData","useClientOutstandingReturnData","load","setLoading","useLoading","dropdownRefParent","useRef","dropdownRef","printToogle","setPrintToggle","usePrintOptionTOggle","locationData","useLocationData","setPaginationObject","UsePaginationData","callForFetch","usefetchAgain","clientPortal","useClientPortal","selectedOrderIds","setSelectedOrderIds","useSelectedClientPortOrders","selectClientAll","setSelectClientAll","useState","debouncedSearchText","useSearchText","state","dateFilterCPReducer","filters","sortConfig","setSortConfig","handleSort","key","prev","sortedData","useMemo","direction","a","b","valueA","valueB","renderSortIcon","columnKey","SortIcon","CaretDownFilledIcon","OpenDropDown","index","prevIndex","useEffect","handleClickOutside","event","cleanedFilters","f","modifiedFilters","fetchedOrderData","returnDataLoad","paginationData","fetchData","useAxios","count","rest","error","notification","updatedReturnData","returnItem","matchingLocation","location","handleSelectOrderId","id","orderId","jsx","StyledTableWrapper","StyledTable","Checkbox","e","isChecked","item","jsxs","WEIGHT_UNIT","VOLUME_UNIT","Skeleton","EmptyDataContainer","Empty","displayValueOrNA","NavLink","format","CustomDrop","PrinterIcon","DownIcon","PrintDropDownReturn"],"mappings":";;;;;;;;;;;;;;;;;;;AAuCA,MAAMA,KAAmB,MAAM;AAC7B,QAAM,CAACC,CAAe,IAAIC,EAAQC,EAAkB,GAC9C,EAAE,gBAAgBC,GAAA,IAAeH,GACjC;AAAA,IACJI;AAAA,IACAC;AAAA,EAAA,IACEC,GAAA,GACE,CAACC,GAAMC,CAAU,IAAIC,GAAA,GACrBC,IAAoBC,EAAuB,IAAI,GAC/CC,IAAcD,EAAuB,IAAI,GACzC,CAACE,GAAaC,CAAc,IAAIC,GAAA,GAChC,CAACC,CAAY,IAAIC,GAAA,GACjB,CAAA,EAAGC,CAAmB,IAAIC,GAAA,GAC1B,CAACC,CAAY,IAAIC,GAAA,GACjB,CAACC,CAAY,IAAIC,GAAA,GACjB,CAACC,GAAkBC,CAAmB,IAAIC,GAAA,GAC1C,CAACC,GAAiBC,CAAkB,IAAIC,EAAS,EAAK,GACtD,CAACC,CAAmB,IAAIC,GAAA,GAExB,CAACC,CAAK,IAAI/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A,oBACjB,iBAAiBA,GAAM;AAAA,kBAAA;AAAA,gBAAA,EACzB,CACF;AAAA,cAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QAEJ;AAAA,MAAA,GAEJ,EAAA,CACF;AAAA,IAAA,KAlEOA,EAAK,EAmEd,CACD,EAAA,CAEL;AAAA,EAAA,EAAA,CACF,GACF,GACF;AAEJ;"}
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useAxios as f, SearchIcon as
|
|
3
|
-
import
|
|
1
|
+
import { jsxs as w, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { useAxios as f, SearchIcon as R, CrossIcon as O } from "@bjsdistribution/dms-component-library";
|
|
3
|
+
import k, { useState as F, useEffect as o } from "react";
|
|
4
4
|
import l from "styled-components";
|
|
5
|
-
import { useSearchText as
|
|
6
|
-
import { filtersReducerAtom as
|
|
7
|
-
import { javascriptStringDumpToJSON as
|
|
8
|
-
import { UsePaginationData as
|
|
9
|
-
import { notification as
|
|
10
|
-
import { dateFilterCPReducer as
|
|
11
|
-
import { useAtom as
|
|
12
|
-
function
|
|
13
|
-
const [n,
|
|
14
|
-
|
|
15
|
-
}, [T] =
|
|
5
|
+
import { useSearchText as N, useClientOutstandingReturnData as j, useStatsCPCount as G } from "../store.js";
|
|
6
|
+
import { filtersReducerAtom as I } from "../order-daily-overview/header-filters/filterStore.js";
|
|
7
|
+
import { javascriptStringDumpToJSON as A } from "../utils.js";
|
|
8
|
+
import { UsePaginationData as B } from "../order-daily-overview/store/store.js";
|
|
9
|
+
import { notification as g } from "antd";
|
|
10
|
+
import { dateFilterCPReducer as E } from "./DateFilterStore.js";
|
|
11
|
+
import { useAtom as m } from "jotai";
|
|
12
|
+
function J() {
|
|
13
|
+
const [n, i] = F(""), [e, x] = N(), [, d] = j(), [, S] = B(), b = (t) => {
|
|
14
|
+
i(t.target.value);
|
|
15
|
+
}, [T] = m(E), { "x-filters": v } = T, [C] = m(I), [, p] = G(), { "x-pagination": U } = C, y = [
|
|
16
16
|
{ field: "isdeleted", op: "=", value: 0 },
|
|
17
17
|
{ field: "product_return_action_id", op: "=", value: "RTS" }
|
|
18
|
-
],
|
|
18
|
+
], h = v.filter((t) => t.field !== "order_status"), s = [...y, ...h], { paginationData: u, fetchData: D } = f({
|
|
19
19
|
endpoint: "/v1/return/product/pending/",
|
|
20
20
|
method: "GET",
|
|
21
|
-
filters:
|
|
22
|
-
pagination:
|
|
21
|
+
filters: s,
|
|
22
|
+
pagination: { is_pagination: !1 }
|
|
23
23
|
});
|
|
24
24
|
o(() => {
|
|
25
25
|
const t = e?.trim() || "";
|
|
26
|
-
t.length > 2 ?
|
|
26
|
+
t.length > 2 ? D({
|
|
27
27
|
endPointQuery: `?search_term=${t}`
|
|
28
28
|
}).then((c) => {
|
|
29
29
|
if (u) {
|
|
30
|
-
const a =
|
|
30
|
+
const a = A(
|
|
31
31
|
u
|
|
32
|
-
), { ...
|
|
33
|
-
S(
|
|
32
|
+
), { ..._ } = a;
|
|
33
|
+
S(_);
|
|
34
34
|
}
|
|
35
35
|
c?.data?.length > 0 ? d(c.data) : d([]);
|
|
36
|
-
}) : t.length > 0 && t.length <= 2 &&
|
|
36
|
+
}) : t.length > 0 && t.length <= 2 && g.warning({
|
|
37
37
|
message: "Search phrase cannot be less than 2 characters"
|
|
38
38
|
});
|
|
39
|
-
}, [e, JSON.stringify(
|
|
39
|
+
}, [e, JSON.stringify(s)]), o(() => {
|
|
40
40
|
const t = setTimeout(() => {
|
|
41
41
|
x(n);
|
|
42
42
|
}, 1e3);
|
|
@@ -44,28 +44,28 @@ function $() {
|
|
|
44
44
|
clearTimeout(t);
|
|
45
45
|
};
|
|
46
46
|
}, [n]), o(() => {
|
|
47
|
-
e?.length === 0 &&
|
|
47
|
+
e?.length === 0 && i("");
|
|
48
48
|
}, [e]);
|
|
49
|
-
const { fetchData:
|
|
49
|
+
const { fetchData: P } = f({
|
|
50
50
|
endpoint: "v1/portal/return/stats/",
|
|
51
51
|
method: "GET",
|
|
52
52
|
pagination: { is_pagination: !1 },
|
|
53
|
-
filters: [...
|
|
53
|
+
filters: [...h]
|
|
54
54
|
});
|
|
55
55
|
return o(() => {
|
|
56
56
|
const t = e?.trim() || "";
|
|
57
57
|
t.length > 2 ? (async () => {
|
|
58
|
-
const a = await
|
|
58
|
+
const a = await P({
|
|
59
59
|
endPointQuery: `?search_term=${t}&type=outstanding`
|
|
60
60
|
});
|
|
61
|
-
a?.data ?
|
|
62
|
-
})() : t.length > 0 && t.length <= 2 &&
|
|
61
|
+
a?.data ? p(a?.data) : p(null);
|
|
62
|
+
})() : t.length > 0 && t.length <= 2 && g.warning({
|
|
63
63
|
message: "Search phrase cannot be less than 3 characters"
|
|
64
64
|
});
|
|
65
|
-
}, [e, JSON.stringify(
|
|
66
|
-
/* @__PURE__ */ r(
|
|
65
|
+
}, [e, JSON.stringify(s)]), /* @__PURE__ */ w(Q, { children: [
|
|
66
|
+
/* @__PURE__ */ r(R, {}),
|
|
67
67
|
/* @__PURE__ */ r(
|
|
68
|
-
|
|
68
|
+
z,
|
|
69
69
|
{
|
|
70
70
|
type: "text",
|
|
71
71
|
placeholder: "Search",
|
|
@@ -73,12 +73,12 @@ function $() {
|
|
|
73
73
|
onChange: b
|
|
74
74
|
}
|
|
75
75
|
),
|
|
76
|
-
n ? /* @__PURE__ */ r(
|
|
77
|
-
|
|
78
|
-
}, children: /* @__PURE__ */ r(
|
|
76
|
+
n ? /* @__PURE__ */ r($, { className: "clear", onClick: () => {
|
|
77
|
+
i("");
|
|
78
|
+
}, children: /* @__PURE__ */ r(O, {}) }) : null
|
|
79
79
|
] });
|
|
80
80
|
}
|
|
81
|
-
const
|
|
81
|
+
const $ = l.button`
|
|
82
82
|
border: none;
|
|
83
83
|
background: none;
|
|
84
84
|
position: relative;
|
|
@@ -89,7 +89,7 @@ const Q = l.button`
|
|
|
89
89
|
&:hover {
|
|
90
90
|
color: #000;
|
|
91
91
|
}
|
|
92
|
-
`,
|
|
92
|
+
`, Q = l.div`
|
|
93
93
|
display: flex;
|
|
94
94
|
padding: 4px 12px;
|
|
95
95
|
align-items: center;
|
|
@@ -100,13 +100,13 @@ const Q = l.button`
|
|
|
100
100
|
background-color: var(--Flowkit-White, #fff);
|
|
101
101
|
height: 35px;
|
|
102
102
|
box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);
|
|
103
|
-
`,
|
|
103
|
+
`, z = l.input`
|
|
104
104
|
border: none;
|
|
105
105
|
outline: none;
|
|
106
106
|
flex-grow: 1;
|
|
107
107
|
width: 100%;
|
|
108
108
|
background: transparent;
|
|
109
|
-
`, nt =
|
|
109
|
+
`, nt = k.memo(J);
|
|
110
110
|
export {
|
|
111
111
|
nt as default
|
|
112
112
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReturnSearchBar.js","sources":["../../../src/components/client-portal/ReturnSearchBar.tsx"],"sourcesContent":["import {\n CrossIcon,\n SearchIcon,\n useAxios,\n} from '@bjsdistribution/dms-component-library';\nimport React, { useEffect, useState } from 'react';\nimport styled from 'styled-components';\nimport {\n useAtom,\n useClientOutstandingReturnData,\n useSearchText,\n useStatsCPCount,\n} from '../store';\nimport { filtersReducerAtom } from '../order-daily-overview/header-filters/filterStore';\nimport { ApiResponse } from '../types';\nimport { javascriptStringDumpToJSON } from '../utils';\nimport { UsePaginationData } from '../order-daily-overview/store/store';\nimport { notification } from 'antd';\nimport { returnCountType } from './ReturnStatus';\nimport { dateFilterCPReducer } from './DateFilterStore';\n\nfunction ReturnSearchBar() {\n const [searchText, setSearchText] = useState('');\n const [debouncedSearchText, setDebouncedSearchText] = useSearchText();\n const [, setOutstandingData] = useClientOutstandingReturnData();\n const [, setPaginationObject] = UsePaginationData();\n const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n setSearchText(event.target.value);\n };\n const [state] = useAtom(dateFilterCPReducer);\n const { 'x-filters': filters } = state;\n const [statePagination] = useAtom(filtersReducerAtom);\n const [, setCount] = useStatsCPCount();\n const { 'x-pagination': pagination } = statePagination;\n\n const baseFilters = [\n { field: 'isdeleted', op: '=', value: 0 },\n { field: 'product_return_action_id', op: '=', value: 'RTS' },\n ];\n const cleanedFilters = filters.filter(f => f.field !== 'order_status');\n\n const modifiedFilters = [...baseFilters, ...cleanedFilters];\n const { paginationData, fetchData: getPendingData } = useAxios<ApiResponse>({\n endpoint: '/v1/return/product/pending/',\n method: 'GET',\n filters: modifiedFilters,\n pagination:
|
|
1
|
+
{"version":3,"file":"ReturnSearchBar.js","sources":["../../../src/components/client-portal/ReturnSearchBar.tsx"],"sourcesContent":["import {\n CrossIcon,\n SearchIcon,\n useAxios,\n} from '@bjsdistribution/dms-component-library';\nimport React, { useEffect, useState } from 'react';\nimport styled from 'styled-components';\nimport {\n useAtom,\n useClientOutstandingReturnData,\n useSearchText,\n useStatsCPCount,\n} from '../store';\nimport { filtersReducerAtom } from '../order-daily-overview/header-filters/filterStore';\nimport { ApiResponse } from '../types';\nimport { javascriptStringDumpToJSON } from '../utils';\nimport { UsePaginationData } from '../order-daily-overview/store/store';\nimport { notification } from 'antd';\nimport { returnCountType } from './ReturnStatus';\nimport { dateFilterCPReducer } from './DateFilterStore';\n\nfunction ReturnSearchBar() {\n const [searchText, setSearchText] = useState('');\n const [debouncedSearchText, setDebouncedSearchText] = useSearchText();\n const [, setOutstandingData] = useClientOutstandingReturnData();\n const [, setPaginationObject] = UsePaginationData();\n const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n setSearchText(event.target.value);\n };\n const [state] = useAtom(dateFilterCPReducer);\n const { 'x-filters': filters } = state;\n const [statePagination] = useAtom(filtersReducerAtom);\n const [, setCount] = useStatsCPCount();\n const { 'x-pagination': pagination } = statePagination;\n\n const baseFilters = [\n { field: 'isdeleted', op: '=', value: 0 },\n { field: 'product_return_action_id', op: '=', value: 'RTS' },\n ];\n const cleanedFilters = filters.filter(f => f.field !== 'order_status');\n\n const modifiedFilters = [...baseFilters, ...cleanedFilters];\n const { paginationData, fetchData: getPendingData } = useAxios<ApiResponse>({\n endpoint: '/v1/return/product/pending/',\n method: 'GET',\n filters: modifiedFilters,\n pagination: { is_pagination: false },\n });\n\n // Debouncing effect\n useEffect(() => {\n const trimmedText = debouncedSearchText?.trim() || '';\n\n if (trimmedText.length > 2) {\n getPendingData({\n endPointQuery: `?search_term=${trimmedText}`,\n }).then((response: any) => {\n if (paginationData) {\n const formattedPagination = javascriptStringDumpToJSON(\n paginationData\n );\n const { ...rest } = formattedPagination;\n setPaginationObject(rest);\n }\n\n if (response?.data?.length > 0) {\n setOutstandingData(response.data);\n } else {\n setOutstandingData([]);\n }\n });\n } else if (trimmedText.length > 0 && trimmedText.length <= 2) {\n notification.warning({\n message: 'Search phrase cannot be less than 2 characters',\n });\n }\n }, [debouncedSearchText, JSON.stringify(modifiedFilters)]);\n\n useEffect(() => {\n const handler = setTimeout(() => {\n setDebouncedSearchText(searchText);\n }, 1000);\n return () => {\n clearTimeout(handler);\n };\n }, [searchText]);\n\n useEffect(() => {\n if (debouncedSearchText?.length === 0) {\n setSearchText('');\n }\n }, [debouncedSearchText]);\n //\n const { fetchData: fetchStatsData } = useAxios<{\n data: returnCountType[];\n }>({\n endpoint: `v1/portal/return/stats/`,\n method: 'GET',\n pagination: { is_pagination: false },\n filters: [...cleanedFilters],\n });\n\n useEffect(() => {\n const trimmedText = debouncedSearchText?.trim() || '';\n\n if (trimmedText.length > 2) {\n const fetchStats = async () => {\n const response = await fetchStatsData({\n endPointQuery: `?search_term=${trimmedText}&type=outstanding`,\n });\n //@ts-ignore\n if (response?.data) {\n //@ts-ignore\n setCount(response?.data);\n } else {\n setCount(null);\n }\n };\n\n fetchStats();\n } else if (trimmedText.length > 0 && trimmedText.length <= 2) {\n notification.warning({\n message: 'Search phrase cannot be less than 3 characters',\n });\n }\n }, [debouncedSearchText, JSON.stringify(modifiedFilters)]);\n\n const handleClear = () => {\n setSearchText('');\n };\n return (\n <Search>\n <SearchIcon />\n\n <SearchInput\n type=\"text\"\n placeholder=\"Search\"\n value={searchText}\n onChange={handleInputChange}\n />\n {searchText ? (\n <ClearButton className=\"clear\" onClick={handleClear}>\n <CrossIcon />\n </ClearButton>\n ) : null}\n </Search>\n );\n}\n\nconst ClearButton = styled.button`\n border: none;\n background: none;\n position: relative;\n border: none;\n cursor: pointer;\n padding: 0 4px;\n font-size: 0;\n &:hover {\n color: #000;\n }\n`;\n\nconst Search = styled.div`\n display: flex;\n padding: 4px 12px;\n align-items: center;\n gap: 8px;\n align-self: stretch;\n border-radius: 20px;\n border: 1px solid var(--Neutral-Gray-Gray-100, #e0e2e7);\n background-color: var(--Flowkit-White, #fff);\n height: 35px;\n box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);\n`;\nconst SearchInput = styled.input`\n border: none;\n outline: none;\n flex-grow: 1;\n width: 100%;\n background: transparent;\n`;\n\nexport default React.memo(ReturnSearchBar);\n"],"names":["ReturnSearchBar","searchText","setSearchText","useState","debouncedSearchText","setDebouncedSearchText","useSearchText","setOutstandingData","useClientOutstandingReturnData","setPaginationObject","UsePaginationData","handleInputChange","event","state","useAtom","dateFilterCPReducer","filters","statePagination","filtersReducerAtom","setCount","useStatsCPCount","pagination","baseFilters","cleanedFilters","f","modifiedFilters","paginationData","getPendingData","useAxios","useEffect","trimmedText","response","formattedPagination","javascriptStringDumpToJSON","rest","notification","handler","fetchStatsData","Search","jsx","SearchIcon","SearchInput","ClearButton","CrossIcon","styled","ReturnSearchBar$1","React"],"mappings":";;;;;;;;;;;AAqBA,SAASA,IAAkB;AACzB,QAAM,CAACC,GAAYC,CAAa,IAAIC,EAAS,EAAE,GACzC,CAACC,GAAqBC,CAAsB,IAAIC,EAAA,GAChD,CAAA,EAAGC,CAAkB,IAAIC,EAAA,GACzB,CAAA,EAAGC,CAAmB,IAAIC,EAAA,GAC1BC,IAAoB,CAACC,MAA+C;AACxE,IAAAV,EAAcU,EAAM,OAAO,KAAK;AAAA,EAClC,GACM,CAACC,C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,IACE;AAAA,EAAA,GACN;AAEJ;AAEA,MAAMD,IAAcE,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAarBN,IAASM,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAYhBH,IAAcG,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAQ3BC,KAAeC,EAAM,KAAK9C,CAAe;"}
|
|
@@ -1,81 +1,75 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useApiHook as
|
|
3
|
-
import { notification as
|
|
4
|
-
import { format as
|
|
5
|
-
import { useAtom as
|
|
6
|
-
import { useRef as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import { useReturnData as
|
|
13
|
-
import { useSelectedOrders as
|
|
14
|
-
import { filtersReducerAtom as
|
|
1
|
+
import { jsx as e, Fragment as lt, jsxs as a } from "react/jsx-runtime";
|
|
2
|
+
import { useApiHook as it, Checkbox as B } from "@bjsdistribution/dms-component-library";
|
|
3
|
+
import { notification as st, Skeleton as dt, Empty as ut, Tooltip as ht } from "antd";
|
|
4
|
+
import { format as pt } from "date-fns";
|
|
5
|
+
import { useAtom as _t } from "jotai";
|
|
6
|
+
import { useRef as H, useState as mt, useMemo as ft, useEffect as b } from "react";
|
|
7
|
+
import gt from "../../../../assets/icons/DownIcon.js";
|
|
8
|
+
import Ct from "../../../../assets/icons/PrinterIcon.js";
|
|
9
|
+
import K from "../../../../common/CaretDownFilledIcon.js";
|
|
10
|
+
import yt from "../../../../common/SortIcon.js";
|
|
11
|
+
import St from "../../../order-view/details-filters/left-side-filters/dropdowns/PrintDropDownReturn.js";
|
|
12
|
+
import { useReturnData as Nt, usefetchAgain as wt } from "../../../order-view/store.js";
|
|
13
|
+
import { useSelectedOrders as Dt, useSelectAll as bt, useReturnPayload as kt, useNewReturnPayload as At, useGroupedPayload as It, useLocationData as Pt, useFlatCustomerData as Rt } from "../../../store.js";
|
|
14
|
+
import { filtersReducerAtom as Ot } 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
|
|
21
|
-
const
|
|
16
|
+
import { useLoading as Lt, usePrintOptionTOggle as vt, UsePaginationData as Et } from "../../store/store.js";
|
|
17
|
+
import { EmptyDataContainer as Tt } from "../../table/table-data/styles.js";
|
|
18
|
+
import { StyledTableWrapper as Ut, StyledTable as Ft, CustomDrop as Wt } from "./returnstyles.js";
|
|
19
|
+
import { useSearchParams as xt, NavLink as Mt } from "react-router-dom";
|
|
20
|
+
import { WEIGHT_UNIT as V, VOLUME_UNIT as jt, getAccountTypeLabel as $ } from "../../../../common/utils.js";
|
|
21
|
+
const Gt = [
|
|
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
|
-
}, W =
|
|
28
|
+
], y = (_) => Gt.includes(_?.product_return_action) && _?.return_location !== "null" && _?.return_location !== null, se = () => {
|
|
29
|
+
const [_] = _t(Ot), [S, k] = Dt(), [J, A] = bt(), { "x-filters": Y, "x-pagination": Bt } = _, [h, E] = Nt(), [q, T] = Lt(), z = H(null), I = H(null), [U, F] = vt(), [, Q] = kt(), [P, N] = At(), [, R] = It(), [O] = Pt(), [, X] = Et(), [Z] = wt(), [tt] = xt(), L = tt.get("customerId"), [m, et] = mt(null), f = (t) => {
|
|
30
|
+
et((n) => n?.key === t && n.direction === "asc" ? { key: t, direction: "desc" } : { key: t, direction: "asc" });
|
|
31
|
+
}, W = ft(() => {
|
|
32
32
|
if (!h || !m) return h;
|
|
33
|
-
const { key:
|
|
33
|
+
const { key: t, direction: n } = m;
|
|
34
34
|
return [...h].sort((o, c) => {
|
|
35
|
-
const l = o[
|
|
35
|
+
const l = o[t], i = c[t];
|
|
36
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
|
-
F((n) => n ===
|
|
38
|
+
}, [h, m]), g = (t) => !m || m.key !== t ? /* @__PURE__ */ e(yt, {}) : m.direction === "asc" ? /* @__PURE__ */ e(K, {}) : /* @__PURE__ */ e(K, {}), nt = (t) => {
|
|
39
|
+
F((n) => n === t ? null : t);
|
|
40
40
|
};
|
|
41
41
|
b(() => (document.addEventListener("mousedown", x), () => {
|
|
42
42
|
document.removeEventListener("mousedown", x);
|
|
43
43
|
}), []);
|
|
44
|
-
const x = (
|
|
45
|
-
I.current && !I.current.contains(
|
|
44
|
+
const x = (t) => {
|
|
45
|
+
I.current && !I.current.contains(t.target) && F(null);
|
|
46
46
|
}, {
|
|
47
47
|
data: p,
|
|
48
48
|
loading: w,
|
|
49
49
|
paginationData: M,
|
|
50
|
-
setShouldPerformAction:
|
|
51
|
-
} =
|
|
50
|
+
setShouldPerformAction: rt
|
|
51
|
+
} = it({
|
|
52
52
|
endpoint: "/v1/return/product/pending/",
|
|
53
53
|
method: "GET",
|
|
54
|
-
filters:
|
|
55
|
-
pagination:
|
|
54
|
+
filters: Y,
|
|
55
|
+
pagination: { is_pagination: !1 },
|
|
56
56
|
performAction: !1,
|
|
57
57
|
showLoader: !1
|
|
58
58
|
});
|
|
59
59
|
b(() => {
|
|
60
|
-
if (T(w), p && p?.data)
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
console.error("Error parsing paginationData:", e), H.error({
|
|
67
|
-
message: "Error",
|
|
68
|
-
description: "Failed to parse pagination data"
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
else
|
|
72
|
-
H.error({
|
|
60
|
+
if (T(w), p && p?.data && (E(p?.data), M))
|
|
61
|
+
try {
|
|
62
|
+
const { count: t, ...n } = JSON.parse(M);
|
|
63
|
+
X(n);
|
|
64
|
+
} catch (t) {
|
|
65
|
+
console.error("Error parsing paginationData:", t), st.error({
|
|
73
66
|
message: "Error",
|
|
74
|
-
description: "
|
|
67
|
+
description: "Failed to parse pagination data"
|
|
75
68
|
});
|
|
69
|
+
}
|
|
76
70
|
}, [p, w]), b(() => {
|
|
77
|
-
if (T(w),
|
|
78
|
-
const
|
|
71
|
+
if (T(w), rt(!0), p && p?.data && O) {
|
|
72
|
+
const t = p.data.map((n) => {
|
|
79
73
|
const o = O.find(
|
|
80
74
|
(c) => c?.token === n?.return_location
|
|
81
75
|
);
|
|
@@ -84,16 +78,16 @@ const Be = [
|
|
|
84
78
|
new_location: o ? o?.location_name : null
|
|
85
79
|
};
|
|
86
80
|
});
|
|
87
|
-
E(
|
|
81
|
+
E(t);
|
|
88
82
|
}
|
|
89
|
-
}, [p, w, O, _,
|
|
90
|
-
const [
|
|
91
|
-
const n =
|
|
83
|
+
}, [p, w, O, _, Z]);
|
|
84
|
+
const [ot] = Rt(), j = ot?.find((t) => {
|
|
85
|
+
const n = t?.customer_id?.toString();
|
|
92
86
|
return n && n === L;
|
|
93
87
|
}), G = j?.account_number;
|
|
94
88
|
console.log(j, "selectedCustomer");
|
|
95
|
-
const
|
|
96
|
-
const n =
|
|
89
|
+
const ct = (t) => {
|
|
90
|
+
const n = t.target.checked;
|
|
97
91
|
if (A(n), n) {
|
|
98
92
|
const o = h?.find(
|
|
99
93
|
(r) => y(r)
|
|
@@ -119,21 +113,21 @@ const Be = [
|
|
|
119
113
|
console.log(d, "newPayloadnewPayload"), k(i), N(d);
|
|
120
114
|
} else
|
|
121
115
|
k([]), N([]), R([]);
|
|
122
|
-
},
|
|
116
|
+
}, at = (t, n, o, c, l) => {
|
|
123
117
|
k((i) => {
|
|
124
118
|
if (i?.some(
|
|
125
|
-
(r) => r.id ===
|
|
119
|
+
(r) => r.id === t
|
|
126
120
|
)) {
|
|
127
121
|
const r = i.filter(
|
|
128
|
-
(u) => u.id !==
|
|
122
|
+
(u) => u.id !== t
|
|
129
123
|
);
|
|
130
|
-
|
|
124
|
+
Q((u) => ({
|
|
131
125
|
...u,
|
|
132
126
|
products: l,
|
|
133
127
|
return_action: c || null,
|
|
134
128
|
return_location_token: n || null
|
|
135
129
|
})), N(
|
|
136
|
-
(u) => u.filter((C) => C.id !==
|
|
130
|
+
(u) => u.filter((C) => C.id !== t)
|
|
137
131
|
);
|
|
138
132
|
const D = c, v = h?.filter(
|
|
139
133
|
(u) => y(u) && u?.product_return_action === D
|
|
@@ -143,7 +137,7 @@ const Be = [
|
|
|
143
137
|
), r;
|
|
144
138
|
} else {
|
|
145
139
|
const r = {
|
|
146
|
-
id:
|
|
140
|
+
id: t,
|
|
147
141
|
account_number: G,
|
|
148
142
|
customer_id: Number(L),
|
|
149
143
|
products: [l],
|
|
@@ -154,7 +148,7 @@ const Be = [
|
|
|
154
148
|
const D = [
|
|
155
149
|
...i,
|
|
156
150
|
{
|
|
157
|
-
id:
|
|
151
|
+
id: t,
|
|
158
152
|
return_location: n,
|
|
159
153
|
return_location_name: o,
|
|
160
154
|
product_return_action: c
|
|
@@ -171,7 +165,7 @@ const Be = [
|
|
|
171
165
|
R([]);
|
|
172
166
|
return;
|
|
173
167
|
}
|
|
174
|
-
const
|
|
168
|
+
const t = P?.reduce((o, c) => {
|
|
175
169
|
const { return_location_token: l, id: i } = c, d = l || `no_token_${i}`;
|
|
176
170
|
return o[d] || (o[d] = {
|
|
177
171
|
...c,
|
|
@@ -180,71 +174,71 @@ const Be = [
|
|
|
180
174
|
}), o[d].products = [...o[d].products, ...c.products], o[d].return_action = Array.from(
|
|
181
175
|
/* @__PURE__ */ new Set([...o[d].return_action, ...c.return_action])
|
|
182
176
|
), o;
|
|
183
|
-
}, {}), n = Object.values(
|
|
177
|
+
}, {}), n = Object.values(t);
|
|
184
178
|
R(n);
|
|
185
|
-
}, [P]), /* @__PURE__ */
|
|
186
|
-
/* @__PURE__ */
|
|
187
|
-
h?.some((
|
|
188
|
-
/* @__PURE__ */
|
|
179
|
+
}, [P]), /* @__PURE__ */ e(lt, { children: /* @__PURE__ */ e(Ut, { className: "fortables", children: /* @__PURE__ */ a(Ft, { children: [
|
|
180
|
+
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ a("tr", { children: [
|
|
181
|
+
h?.some((t) => y(t)) ? /* @__PURE__ */ e("th", { className: "emailInvoiceCheckbox", children: /* @__PURE__ */ e(B, { checked: J, onChange: ct }) }) : /* @__PURE__ */ e("th", {}),
|
|
182
|
+
/* @__PURE__ */ e("th", { onClick: () => f("location"), children: /* @__PURE__ */ a("div", { className: "sortIconClass", children: [
|
|
189
183
|
"Product Location ",
|
|
190
184
|
g("location")
|
|
191
185
|
] }) }),
|
|
192
|
-
/* @__PURE__ */
|
|
186
|
+
/* @__PURE__ */ e("th", { onClick: () => f("return_location_name"), children: /* @__PURE__ */ a("div", { className: "sortIconClass", children: [
|
|
193
187
|
"Return Location ",
|
|
194
188
|
g("return_location_name")
|
|
195
189
|
] }) }),
|
|
196
|
-
/* @__PURE__ */
|
|
197
|
-
/* @__PURE__ */
|
|
190
|
+
/* @__PURE__ */ e("th", { children: "Client" }),
|
|
191
|
+
/* @__PURE__ */ e("th", { onClick: () => f("recipient_name"), children: /* @__PURE__ */ a("div", { className: "sortIconClass", children: [
|
|
198
192
|
"Recipient ",
|
|
199
193
|
g("recipient_name")
|
|
200
194
|
] }) }),
|
|
201
|
-
/* @__PURE__ */
|
|
202
|
-
/* @__PURE__ */
|
|
203
|
-
/* @__PURE__ */
|
|
204
|
-
/* @__PURE__ */
|
|
205
|
-
/* @__PURE__ */
|
|
195
|
+
/* @__PURE__ */ e("th", { children: "Return Action" }),
|
|
196
|
+
/* @__PURE__ */ e("th", { children: "Code" }),
|
|
197
|
+
/* @__PURE__ */ e("th", { children: "Description" }),
|
|
198
|
+
/* @__PURE__ */ e("th", { children: "Part" }),
|
|
199
|
+
/* @__PURE__ */ e("th", { onClick: () => f("weight"), children: /* @__PURE__ */ a("div", { className: "sortIconClass", children: [
|
|
206
200
|
"Weight (",
|
|
207
|
-
|
|
201
|
+
V,
|
|
208
202
|
") ",
|
|
209
203
|
g("weight")
|
|
210
204
|
] }) }),
|
|
211
|
-
/* @__PURE__ */
|
|
212
|
-
/* @__PURE__ */
|
|
205
|
+
/* @__PURE__ */ e("th", { children: jt }),
|
|
206
|
+
/* @__PURE__ */ e("th", { onClick: () => f("return_reason"), children: /* @__PURE__ */ a("div", { className: "sortIconClass", children: [
|
|
213
207
|
"Return Reason ",
|
|
214
208
|
g("return_reason")
|
|
215
209
|
] }) }),
|
|
216
|
-
/* @__PURE__ */
|
|
217
|
-
/* @__PURE__ */
|
|
210
|
+
/* @__PURE__ */ e("th", { children: "Collected" }),
|
|
211
|
+
/* @__PURE__ */ e("th", { onClick: () => f("collection_reason"), children: /* @__PURE__ */ a("div", { className: "sortIconClass", children: [
|
|
218
212
|
"Collection Reason ",
|
|
219
213
|
g("collection_reason")
|
|
220
214
|
] }) }),
|
|
221
|
-
/* @__PURE__ */
|
|
215
|
+
/* @__PURE__ */ e("th", { className: "emailInvoiceShare", children: "Labels" })
|
|
222
216
|
] }) }),
|
|
223
|
-
/* @__PURE__ */
|
|
224
|
-
/* @__PURE__ */
|
|
225
|
-
const o = S?.length > 0 && S[0]?.product_return_action !==
|
|
226
|
-
return /* @__PURE__ */
|
|
227
|
-
|
|
217
|
+
/* @__PURE__ */ e("tbody", { children: q ? /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: 14, children: /* @__PURE__ */ e(dt, { active: !0 }) }) }) : W?.length === 0 ? /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: 14, children: /* @__PURE__ */ e(Tt, { children: /* @__PURE__ */ e(ut, {}) }) }) }) : W?.map((t, n) => /* @__PURE__ */ a("tr", { children: [
|
|
218
|
+
/* @__PURE__ */ e("td", { children: y(t) ? (() => {
|
|
219
|
+
const o = S?.length > 0 && S[0]?.product_return_action !== t?.product_return_action;
|
|
220
|
+
return /* @__PURE__ */ e(
|
|
221
|
+
ht,
|
|
228
222
|
{
|
|
229
223
|
title: o ? "Cannot select different return actions" : "",
|
|
230
|
-
children: /* @__PURE__ */
|
|
224
|
+
children: /* @__PURE__ */ e(
|
|
231
225
|
"span",
|
|
232
226
|
{
|
|
233
227
|
className: o ? "disabled-wrapper" : "",
|
|
234
|
-
children: /* @__PURE__ */
|
|
228
|
+
children: /* @__PURE__ */ e(
|
|
235
229
|
B,
|
|
236
230
|
{
|
|
237
231
|
className: "custom-check",
|
|
238
232
|
disabled: o,
|
|
239
233
|
checked: S.some(
|
|
240
|
-
(c) => c?.id ===
|
|
234
|
+
(c) => c?.id === t?.id
|
|
241
235
|
),
|
|
242
|
-
onChange: () =>
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
236
|
+
onChange: () => at(
|
|
237
|
+
t?.id,
|
|
238
|
+
t?.return_location,
|
|
239
|
+
t?.return_location_name,
|
|
240
|
+
t?.product_return_action,
|
|
241
|
+
t?.legacy_product_id
|
|
248
242
|
)
|
|
249
243
|
}
|
|
250
244
|
)
|
|
@@ -253,21 +247,21 @@ const Be = [
|
|
|
253
247
|
}
|
|
254
248
|
);
|
|
255
249
|
})() : null }),
|
|
256
|
-
/* @__PURE__ */
|
|
250
|
+
/* @__PURE__ */ e("td", { children: t?.location !== null && t?.location !== void 0 ? t?.location : /* @__PURE__ */ e("div", { className: "awaiting", children: "Awaiting" }) }),
|
|
257
251
|
/* @__PURE__ */ a("td", { children: [
|
|
258
252
|
" ",
|
|
259
|
-
s(
|
|
253
|
+
s(t?.return_location_name)
|
|
260
254
|
] }),
|
|
261
|
-
/* @__PURE__ */ a("td", { title:
|
|
262
|
-
s(
|
|
263
|
-
|
|
255
|
+
/* @__PURE__ */ a("td", { title: t?.client_name ?? "", children: [
|
|
256
|
+
s(t?.client_name),
|
|
257
|
+
$(t?.owner_id) && /* @__PURE__ */ a("span", { children: [
|
|
264
258
|
" (",
|
|
265
|
-
|
|
259
|
+
$(t?.owner_id),
|
|
266
260
|
")"
|
|
267
261
|
] })
|
|
268
262
|
] }),
|
|
269
|
-
/* @__PURE__ */
|
|
270
|
-
/* @__PURE__ */
|
|
263
|
+
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ a("ul", { style: { listStyleType: "none", padding: 0 }, children: [
|
|
264
|
+
/* @__PURE__ */ e(
|
|
271
265
|
"li",
|
|
272
266
|
{
|
|
273
267
|
style: {
|
|
@@ -275,42 +269,42 @@ const Be = [
|
|
|
275
269
|
fontWeight: 600,
|
|
276
270
|
paddingLeft: 0
|
|
277
271
|
},
|
|
278
|
-
children: /* @__PURE__ */
|
|
272
|
+
children: /* @__PURE__ */ e(Mt, { to: `/orders/view/${t?.order_id}`, children: s(t?.recipient_name) })
|
|
279
273
|
}
|
|
280
274
|
),
|
|
281
|
-
/* @__PURE__ */
|
|
275
|
+
/* @__PURE__ */ e("li", { style: { color: "#888075" }, children: s(t?.postcode) })
|
|
282
276
|
] }) }),
|
|
283
|
-
/* @__PURE__ */
|
|
284
|
-
/* @__PURE__ */
|
|
285
|
-
/* @__PURE__ */
|
|
286
|
-
/* @__PURE__ */
|
|
277
|
+
/* @__PURE__ */ e("td", { children: s(t?.product_return_action) }),
|
|
278
|
+
/* @__PURE__ */ e("td", { children: s(t?.code) }),
|
|
279
|
+
/* @__PURE__ */ e("td", { children: s(t?.description) }),
|
|
280
|
+
/* @__PURE__ */ e("td", { children: s(t?.part) }),
|
|
287
281
|
/* @__PURE__ */ a("td", { children: [
|
|
288
|
-
s(
|
|
282
|
+
s(t?.weight),
|
|
289
283
|
" ",
|
|
290
|
-
|
|
284
|
+
t?.weight && t?.weight !== null ? V : ""
|
|
291
285
|
] }),
|
|
292
|
-
/* @__PURE__ */
|
|
293
|
-
/* @__PURE__ */
|
|
294
|
-
/* @__PURE__ */
|
|
295
|
-
/* @__PURE__ */
|
|
296
|
-
/* @__PURE__ */
|
|
297
|
-
|
|
286
|
+
/* @__PURE__ */ e("td", { children: s(t?.cube) }),
|
|
287
|
+
/* @__PURE__ */ e("td", { children: s(t?.return_reason) }),
|
|
288
|
+
/* @__PURE__ */ e("td", { children: t?.collected_at ? pt(new Date(t?.collected_at), "dd/MM/yyyy") : "UNKNOWN" }),
|
|
289
|
+
/* @__PURE__ */ e("td", { children: s(t?.collection_reason) }),
|
|
290
|
+
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("ul", { className: "actionbox", children: /* @__PURE__ */ e(
|
|
291
|
+
Wt,
|
|
298
292
|
{
|
|
299
|
-
ref:
|
|
293
|
+
ref: z,
|
|
300
294
|
className: U === n ? "active" : "",
|
|
301
295
|
children: /* @__PURE__ */ a(
|
|
302
296
|
"li",
|
|
303
297
|
{
|
|
304
298
|
className: "shareIconContainer",
|
|
305
|
-
onClick: () =>
|
|
299
|
+
onClick: () => nt(n),
|
|
306
300
|
children: [
|
|
307
|
-
/* @__PURE__ */
|
|
308
|
-
/* @__PURE__ */
|
|
309
|
-
U === n && /* @__PURE__ */
|
|
310
|
-
|
|
301
|
+
/* @__PURE__ */ e(Ct, {}),
|
|
302
|
+
/* @__PURE__ */ e(gt, {}),
|
|
303
|
+
U === n && /* @__PURE__ */ e("div", { ref: I, children: /* @__PURE__ */ e(
|
|
304
|
+
St,
|
|
311
305
|
{
|
|
312
|
-
legacyURL:
|
|
313
|
-
legacyProductID:
|
|
306
|
+
legacyURL: t?.return_order_product_label,
|
|
307
|
+
legacyProductID: t?.legacy_product_id
|
|
314
308
|
}
|
|
315
309
|
) })
|
|
316
310
|
]
|
|
@@ -318,10 +312,10 @@ const Be = [
|
|
|
318
312
|
)
|
|
319
313
|
}
|
|
320
314
|
) }) })
|
|
321
|
-
] },
|
|
315
|
+
] }, t.id)) })
|
|
322
316
|
] }) }) });
|
|
323
317
|
};
|
|
324
318
|
export {
|
|
325
|
-
|
|
319
|
+
se as default
|
|
326
320
|
};
|
|
327
321
|
//# 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 { VOLUME_UNIT } from '../../../../common/utils';\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>{VOLUME_UNIT}</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","VOLUME_UNIT","Skeleton","EmptyDataContainer","Empty","isDisabled","Tooltip","selectedInvoice","displayValueOrNA","getAccountTypeLabel","NavLink","format","CustomDrop","PrinterIcon","DownIcon","PrintDropDownReturn"],"mappings":";;;;;;;;;;;;;;;;;;;;AAkCA,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,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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 { VOLUME_UNIT } from '../../../../common/utils';\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: { is_pagination: false } as any,\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 }\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>{VOLUME_UNIT}</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","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","VOLUME_UNIT","Skeleton","EmptyDataContainer","Empty","isDisabled","Tooltip","selectedInvoice","displayValueOrNA","getAccountTypeLabel","NavLink","format","CustomDrop","PrinterIcon","DownIcon","PrintDropDownReturn"],"mappings":";;;;;;;;;;;;;;;;;;;;AAkCA,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,OAAeV,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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