@bjsdistribution/dms-client-return 0.2.2-prod → 0.2.3-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.
Files changed (151) hide show
  1. package/dist/common/expand-collapse/index.js +44 -26
  2. package/dist/common/expand-collapse/index.js.map +1 -1
  3. package/dist/common/modals/order-action-modal/OrderActionModal.js.map +1 -1
  4. package/dist/common/modals/order-action-modal/footer/OrderActionFooter.js.map +1 -1
  5. package/dist/components/client-portal/ClientPortalResponsive.js +148 -0
  6. package/dist/components/client-portal/ClientPortalResponsive.js.map +1 -0
  7. package/dist/components/client-portal/OutstandingTable.js +112 -118
  8. package/dist/components/client-portal/OutstandingTable.js.map +1 -1
  9. package/dist/components/client-portal/ReturnOverview.js +38 -37
  10. package/dist/components/client-portal/ReturnOverview.js.map +1 -1
  11. package/dist/components/client-portal/return-confirm/ConfirmedMain.js +4 -4
  12. package/dist/components/client-portal/return-confirm/ConfirmedMain.js.map +1 -1
  13. package/dist/components/client-portal/return-confirm/ReturnConfirmedTable.js +445 -185
  14. package/dist/components/client-portal/return-confirm/ReturnConfirmedTable.js.map +1 -1
  15. package/dist/components/fakeData.js.map +1 -1
  16. package/dist/components/order-daily-overview/common/fakedata.js.map +1 -1
  17. package/dist/components/order-daily-overview/common/mediaQuery.js +17 -0
  18. package/dist/components/order-daily-overview/common/mediaQuery.js.map +1 -0
  19. package/dist/components/order-daily-overview/filters/FilterStyle.js +174 -11
  20. package/dist/components/order-daily-overview/filters/FilterStyle.js.map +1 -1
  21. package/dist/components/order-daily-overview/header/route-header/RouterHeaderStyle.js +9 -4
  22. package/dist/components/order-daily-overview/header/route-header/RouterHeaderStyle.js.map +1 -1
  23. package/dist/components/order-daily-overview/header/route-header/title/HeaderTitle.js +11 -1
  24. package/dist/components/order-daily-overview/header/route-header/title/HeaderTitle.js.map +1 -1
  25. package/dist/components/order-daily-overview/header-filters/Styledfilters.js +46 -17
  26. package/dist/components/order-daily-overview/header-filters/Styledfilters.js.map +1 -1
  27. package/dist/components/order-daily-overview/index.js +76 -53
  28. package/dist/components/order-daily-overview/index.js.map +1 -1
  29. package/dist/components/order-daily-overview/return-after-table/table/OrderTable.js +101 -103
  30. package/dist/components/order-daily-overview/return-after-table/table/OrderTable.js.map +1 -1
  31. package/dist/components/order-daily-overview/return-after-table/table-filters/ReturnOrderFilter.js +135 -134
  32. package/dist/components/order-daily-overview/return-after-table/table-filters/ReturnOrderFilter.js.map +1 -1
  33. package/dist/components/order-daily-overview/return-after-table/table-filters/TableFilters.js +17 -11
  34. package/dist/components/order-daily-overview/return-after-table/table-filters/TableFilters.js.map +1 -1
  35. package/dist/components/order-daily-overview/return-order-table/return-orders-filters/ReturnFilter.js +5 -5
  36. package/dist/components/order-daily-overview/return-order-table/return-orders-filters/ReturnFilter.js.map +1 -1
  37. package/dist/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.js +129 -135
  38. package/dist/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.js.map +1 -1
  39. package/dist/components/order-daily-overview/return-order-table/return-orders-filters/returnstyles.js +346 -27
  40. package/dist/components/order-daily-overview/return-order-table/return-orders-filters/returnstyles.js.map +1 -1
  41. package/dist/components/order-daily-overview/table/ReturnTable.js +199 -183
  42. package/dist/components/order-daily-overview/table/ReturnTable.js.map +1 -1
  43. package/dist/components/order-daily-overview/table/table-data/styles.js +159 -38
  44. package/dist/components/order-daily-overview/table/table-data/styles.js.map +1 -1
  45. package/dist/components/order-daily-overview/table-view/PaginationStyle.js +21 -6
  46. package/dist/components/order-daily-overview/table-view/PaginationStyle.js.map +1 -1
  47. package/dist/components/order-view/DynamicTable.js +136 -35
  48. package/dist/components/order-view/DynamicTable.js.map +1 -1
  49. package/dist/components/order-view/details-filters/DetailsFilters.js +33 -8
  50. package/dist/components/order-view/details-filters/DetailsFilters.js.map +1 -1
  51. package/dist/components/order-view/details-filters/left-side-filters/ActionsMenu.js +23 -5
  52. package/dist/components/order-view/details-filters/left-side-filters/ActionsMenu.js.map +1 -1
  53. package/dist/components/order-view/details-filters/left-side-filters/dropdowns/DropDowns.js +39 -22
  54. package/dist/components/order-view/details-filters/left-side-filters/dropdowns/DropDowns.js.map +1 -1
  55. package/dist/components/order-view/details-filters/right-side-filters/Details.js +25 -12
  56. package/dist/components/order-view/details-filters/right-side-filters/Details.js.map +1 -1
  57. package/dist/components/order-view/general-information/Status.js +58 -28
  58. package/dist/components/order-view/general-information/Status.js.map +1 -1
  59. package/dist/components/order-view/generic-table/AuditLogs.js +129 -24
  60. package/dist/components/order-view/generic-table/AuditLogs.js.map +1 -1
  61. package/dist/components/order-view/notes/logs/index.js +15 -7
  62. package/dist/components/order-view/notes/logs/index.js.map +1 -1
  63. package/dist/components/order-view/notes/order-dropdown/NewReturnDropdown.js +7 -7
  64. package/dist/components/order-view/notes/order-dropdown/NewReturnDropdown.js.map +1 -1
  65. package/dist/components/order-view/notification/index.js +68 -55
  66. package/dist/components/order-view/notification/index.js.map +1 -1
  67. package/dist/components/order-view/order-actions/Dropdown.js +3 -3
  68. package/dist/components/order-view/order-actions/Dropdown.js.map +1 -1
  69. package/dist/components/order-view/order-actions/actions/cancel-order/CancelOrderTable.js +45 -47
  70. package/dist/components/order-view/order-actions/actions/cancel-order/CancelOrderTable.js.map +1 -1
  71. package/dist/components/order-view/order-actions/actions/cancel-order/ReturnReason.js +23 -36
  72. package/dist/components/order-view/order-actions/actions/cancel-order/ReturnReason.js.map +1 -1
  73. package/dist/components/order-view/order-actions/actions/confirm-order/tables/ProductTable.js +23 -25
  74. package/dist/components/order-view/order-actions/actions/confirm-order/tables/ProductTable.js.map +1 -1
  75. package/dist/components/order-view/order-actions/actions/force-debrief/ForceDebriefModal.js +88 -89
  76. package/dist/components/order-view/order-actions/actions/force-debrief/ForceDebriefModal.js.map +1 -1
  77. package/dist/components/order-view/order-actions/actions/force-debrief/charges/collection-add-ons/index.js +16 -16
  78. package/dist/components/order-view/order-actions/actions/force-debrief/charges/collection-add-ons/index.js.map +1 -1
  79. package/dist/components/order-view/order-actions/actions/force-debrief/escalation/EscalationReason.js +22 -23
  80. package/dist/components/order-view/order-actions/actions/force-debrief/escalation/EscalationReason.js.map +1 -1
  81. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/RadioButtons.js +52 -56
  82. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/RadioButtons.js.map +1 -1
  83. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/FailureReasonDropdown.js +26 -27
  84. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/FailureReasonDropdown.js.map +1 -1
  85. package/dist/components/order-view/order-actions/actions/hold-order/HoldOrderModal.js +29 -29
  86. package/dist/components/order-view/order-actions/actions/hold-order/HoldOrderModal.js.map +1 -1
  87. package/dist/components/order-view/order-actions/actions/split-order/SplitOrderTable.js +54 -222
  88. package/dist/components/order-view/order-actions/actions/split-order/SplitOrderTable.js.map +1 -1
  89. package/dist/components/order-view/order-actions/actions/split-order/index.js +37 -50
  90. package/dist/components/order-view/order-actions/actions/split-order/index.js.map +1 -1
  91. package/dist/components/order-view/order-actions/actions/uncancel-order/UncancelOrderTable.js +35 -37
  92. package/dist/components/order-view/order-actions/actions/uncancel-order/UncancelOrderTable.js.map +1 -1
  93. package/dist/components/order-view/order-actions/actions/what3words/What3WordsModal.tsx.js +85 -85
  94. package/dist/components/order-view/order-actions/actions/what3words/What3WordsModal.tsx.js.map +1 -1
  95. package/dist/components/order-view/order-details/expanded-content/customer-section/contact-info/ContactHome.js +12 -8
  96. package/dist/components/order-view/order-details/expanded-content/customer-section/contact-info/ContactHome.js.map +1 -1
  97. package/dist/components/order-view/order-details/expanded-content/customer-section/contact-info/ContactMobile.js +22 -18
  98. package/dist/components/order-view/order-details/expanded-content/customer-section/contact-info/ContactMobile.js.map +1 -1
  99. package/dist/components/order-view/order-details/expanded-content/customer-section/contact-info/index.js +14 -8
  100. package/dist/components/order-view/order-details/expanded-content/customer-section/contact-info/index.js.map +1 -1
  101. package/dist/components/order-view/order-details/expanded-content/customer-section/index.js +19 -13
  102. package/dist/components/order-view/order-details/expanded-content/customer-section/index.js.map +1 -1
  103. package/dist/components/order-view/order-details/expanded-content/customer-section/location-info/Address.js +11 -6
  104. package/dist/components/order-view/order-details/expanded-content/customer-section/location-info/Address.js.map +1 -1
  105. package/dist/components/order-view/order-details/expanded-content/customer-section/location-info/Latitude.js +23 -21
  106. package/dist/components/order-view/order-details/expanded-content/customer-section/location-info/Latitude.js.map +1 -1
  107. package/dist/components/order-view/order-details/expanded-content/customer-section/location-info/Longitude.js +23 -21
  108. package/dist/components/order-view/order-details/expanded-content/customer-section/location-info/Longitude.js.map +1 -1
  109. package/dist/components/order-view/order-details/expanded-content/customer-section/location-info/index.js +39 -21
  110. package/dist/components/order-view/order-details/expanded-content/customer-section/location-info/index.js.map +1 -1
  111. package/dist/components/order-view/order-details/expanded-content/footer/index.js +28 -14
  112. package/dist/components/order-view/order-details/expanded-content/footer/index.js.map +1 -1
  113. package/dist/components/order-view/order-details/expanded-content/orders-section/index.js +44 -28
  114. package/dist/components/order-view/order-details/expanded-content/orders-section/index.js.map +1 -1
  115. package/dist/components/order-view/order-details/expanded-content/services-section/OrderServices.js +28 -20
  116. package/dist/components/order-view/order-details/expanded-content/services-section/OrderServices.js.map +1 -1
  117. package/dist/components/order-view/order-details/expanded-content/services-section/ServiceLevel.js +17 -18
  118. package/dist/components/order-view/order-details/expanded-content/services-section/ServiceLevel.js.map +1 -1
  119. package/dist/components/order-view/order-details/expanded-content/services-section/ServiceType.js +22 -26
  120. package/dist/components/order-view/order-details/expanded-content/services-section/ServiceType.js.map +1 -1
  121. package/dist/components/order-view/order-details/expanded-content/services-section/index.js +79 -25
  122. package/dist/components/order-view/order-details/expanded-content/services-section/index.js.map +1 -1
  123. package/dist/components/order-view/order-details/helper.js.map +1 -1
  124. package/dist/components/order-view/products-info/collapsed-content/index.js +21 -15
  125. package/dist/components/order-view/products-info/collapsed-content/index.js.map +1 -1
  126. package/dist/components/order-view/products-info/index.js +36 -36
  127. package/dist/components/order-view/products-info/index.js.map +1 -1
  128. package/dist/components/order-view/return-client-products/product-table/ReturnProductTable.js +265 -334
  129. package/dist/components/order-view/return-client-products/product-table/ReturnProductTable.js.map +1 -1
  130. package/dist/components/order-view/store.js +155 -162
  131. package/dist/components/order-view/store.js.map +1 -1
  132. package/dist/components/order-view/toolbox-resources/expanded-content/index.js +281 -173
  133. package/dist/components/order-view/toolbox-resources/expanded-content/index.js.map +1 -1
  134. package/dist/components/utils.js +5 -4
  135. package/dist/components/utils.js.map +1 -1
  136. package/dist/types/common/modals/order-action-modal/OrderActionModal.d.ts +1 -2
  137. package/dist/types/common/modals/order-action-modal/footer/OrderActionFooter.d.ts +1 -1
  138. package/dist/types/components/client-portal/ClientPortalResponsive.d.ts +15 -0
  139. package/dist/types/components/order-daily-overview/common/mediaQuery.d.ts +4 -0
  140. package/dist/types/components/order-daily-overview/filters/FilterStyle.d.ts +1 -0
  141. package/dist/types/components/order-view/order-actions/Dropdown.d.ts +0 -1
  142. package/dist/types/components/order-view/return-client-products/product-table/ReturnProductTable.d.ts +1 -0
  143. package/dist/types/components/order-view/store.d.ts +0 -1
  144. package/dist/types/components/order-view/types.d.ts +1 -1
  145. package/dist/types/components/utils.d.ts +1 -0
  146. package/package.json +2 -2
  147. package/dist/assets/icons/ChevronDownIcon.js +0 -26
  148. package/dist/assets/icons/ChevronDownIcon.js.map +0 -1
  149. package/dist/components/order-view/return-client-products/product-table/palletGrouping.js +0 -47
  150. package/dist/components/order-view/return-client-products/product-table/palletGrouping.js.map +0 -1
  151. package/dist/types/components/order-view/return-client-products/product-table/palletGrouping.d.ts +0 -23
@@ -1,100 +1,100 @@
1
- import { jsx as t, Fragment as se, jsxs as a } from "react/jsx-runtime";
2
- import { useApiHook as de, Checkbox as H, toReverseDeliveryLabel as K } from "@bjsdistribution/dms-component-library";
3
- import { notification as ue, Skeleton as he, Empty as pe, Tooltip as _e } from "antd";
4
- import { format as fe } from "date-fns";
5
- import { useAtom as me } from "jotai";
6
- import { useRef as V, useState as ge, useMemo as Ce, useEffect as b } from "react";
7
- import ye from "../../../../assets/icons/DownIcon.js";
8
- import Se from "../../../../assets/icons/PrinterIcon.js";
9
- import $ from "../../../../common/CaretDownFilledIcon.js";
10
- import Ne from "../../../../common/SortIcon.js";
11
- import De from "../../../order-view/details-filters/left-side-filters/dropdowns/PrintDropDownReturn.js";
12
- import { useReturnData as we, usefetchAgain as be } from "../../../order-view/store.js";
13
- import { useSelectedOrders as Pe, useSelectAll as Re, useReturnPayload as ke, useNewReturnPayload as Ae, useGroupedPayload as Ie, useLocationData as ve, useClientPortal as Le, useFlatCustomerData as Oe } from "../../../store.js";
14
- import { filtersReducerAtom as Ee } from "../../header-filters/filterStore.js";
1
+ import { jsx as t, Fragment as le, jsxs as c } from "react/jsx-runtime";
2
+ import { useApiHook as ie, Checkbox as B } from "@bjsdistribution/dms-component-library";
3
+ import { notification as se, Skeleton as de, Empty as ue, Tooltip as he } from "antd";
4
+ import { format as pe } from "date-fns";
5
+ import { useAtom as _e } from "jotai";
6
+ import { useRef as H, useState as me, useMemo as fe, useEffect as R } from "react";
7
+ import ge from "../../../../assets/icons/DownIcon.js";
8
+ import Ce from "../../../../assets/icons/PrinterIcon.js";
9
+ import K from "../../../../common/CaretDownFilledIcon.js";
10
+ import be from "../../../../common/SortIcon.js";
11
+ import ye from "../../../order-view/details-filters/left-side-filters/dropdowns/PrintDropDownReturn.js";
12
+ import { useReturnData as Ne, usefetchAgain as Se } from "../../../order-view/store.js";
13
+ import { useSelectedOrders as we, useSelectAll as Re, useReturnPayload as De, useNewReturnPayload as Ae, useGroupedPayload as Pe, useLocationData as ke, useFlatCustomerData as Ie } from "../../../store.js";
14
+ import { filtersReducerAtom as Le } from "../../header-filters/filterStore.js";
15
15
  import { displayValueOrNA as s } from "../../shared/utlis.js";
16
- import { useLoading as Te, usePrintOptionTOggle as Ue, UsePaginationData as Fe } from "../../store/store.js";
17
- import { EmptyDataContainer as We } from "../../table/table-data/styles.js";
18
- import { StyledTableWrapper as xe, StyledTable as Me, CustomDrop as je } from "./returnstyles.js";
19
- import { useSearchParams as Ge, NavLink as Be } from "react-router-dom";
20
- import { WEIGHT_UNIT as J, VOLUME_UNIT as He, getAccountTypeLabel as Y } from "../../../../common/utils.js";
21
- const Ke = [
16
+ import { useLoading as Oe, usePrintOptionTOggle as ve, UsePaginationData as Ee } from "../../store/store.js";
17
+ import { EmptyDataContainer as Te } from "../../table/table-data/styles.js";
18
+ import { StyledTableWrapper as Ue, StyledTable as We, CustomDrop as Fe } from "./returnstyles.js";
19
+ import { useSearchParams as Me, NavLink as xe } from "react-router-dom";
20
+ import { WEIGHT_UNIT as V, VOLUME_UNIT as je, getAccountTypeLabel as $ } from "../../../../common/utils.js";
21
+ const Ge = [
22
22
  "RTS",
23
23
  "CLAIMS PAID",
24
24
  "DISPOSE",
25
25
  "RE-ALLOCATE",
26
26
  "RECYCLE",
27
27
  "UNKNOWN"
28
- ], y = (_) => Ke.includes(_?.product_return_action) && _?.return_location !== "null" && _?.return_location !== null, ht = () => {
29
- const [_] = me(Ee), [S, P] = Pe(), [q, R] = Re(), { "x-filters": z, "x-pagination": Ve } = _, [h, T] = we(), [Q, U] = Te(), X = V(null), k = V(null), [F, W] = Ue(), [, Z] = ke(), [A, N] = Ae(), [, I] = Ie(), [v] = ve(), [, ee] = Fe(), [te] = be(), [L] = Le(), [ne] = Ge(), O = ne.get("customerId"), [f, re] = ge(null), m = (e) => {
30
- re((n) => n?.key === e && n.direction === "asc" ? { key: e, direction: "desc" } : { key: e, direction: "asc" });
31
- }, x = Ce(() => {
32
- if (!h || !f) return h;
33
- const { key: e, direction: n } = f;
34
- return [...h].sort((o, c) => {
35
- const l = o[e], i = c[e];
28
+ ], b = (_) => Ge.includes(_?.product_return_action) && _?.return_location !== "null" && _?.return_location !== null, st = () => {
29
+ const [_] = _e(Le), [y, D] = we(), [J, A] = Re(), { "x-filters": Y, "x-pagination": Be } = _, [h, E] = Ne(), [q, T] = Oe(), z = H(null), P = H(null), [U, W] = ve(), [, Q] = De(), [k, N] = Ae(), [, I] = Pe(), [L] = ke(), [, X] = Ee(), [Z] = Se(), [ee] = Me(), O = ee.get("customerId"), [m, te] = me(null), f = (e) => {
30
+ te((n) => n?.key === e && n.direction === "asc" ? { key: e, direction: "desc" } : { key: e, direction: "asc" });
31
+ }, F = fe(() => {
32
+ if (!h || !m) return h;
33
+ const { key: e, direction: n } = m;
34
+ return [...h].sort((o, a) => {
35
+ const l = o[e], i = a[e];
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, f]), g = (e) => !f || f.key !== e ? /* @__PURE__ */ t(Ne, {}) : f.direction === "asc" ? /* @__PURE__ */ t($, {}) : /* @__PURE__ */ t($, {}), oe = (e) => {
38
+ }, [h, m]), g = (e) => !m || m.key !== e ? /* @__PURE__ */ t(be, {}) : m.direction === "asc" ? /* @__PURE__ */ t(K, {}) : /* @__PURE__ */ t(K, {}), ne = (e) => {
39
39
  W((n) => n === e ? null : e);
40
40
  };
41
- b(() => (document.addEventListener("mousedown", M), () => {
41
+ R(() => (document.addEventListener("mousedown", M), () => {
42
42
  document.removeEventListener("mousedown", M);
43
43
  }), []);
44
44
  const M = (e) => {
45
- k.current && !k.current.contains(e.target) && W(null);
45
+ P.current && !P.current.contains(e.target) && W(null);
46
46
  }, {
47
47
  data: p,
48
- loading: D,
49
- paginationData: j,
50
- setShouldPerformAction: ce
51
- } = de({
48
+ loading: S,
49
+ paginationData: x,
50
+ setShouldPerformAction: re
51
+ } = ie({
52
52
  endpoint: "/v1/return/product/pending/",
53
53
  method: "GET",
54
- filters: z,
54
+ filters: Y,
55
55
  pagination: { is_pagination: !1 },
56
56
  performAction: !1,
57
57
  showLoader: !1
58
58
  });
59
- b(() => {
60
- if (U(D), p && p?.data && (T(p?.data), j))
59
+ R(() => {
60
+ if (T(S), p && p?.data && (E(p?.data), x))
61
61
  try {
62
- const { count: e, ...n } = JSON.parse(j);
63
- ee(n);
62
+ const { count: e, ...n } = JSON.parse(x);
63
+ X(n);
64
64
  } catch (e) {
65
- console.error("Error parsing paginationData:", e), ue.error({
65
+ console.error("Error parsing paginationData:", e), se.error({
66
66
  message: "Error",
67
67
  description: "Failed to parse pagination data"
68
68
  });
69
69
  }
70
- }, [p, D]), b(() => {
71
- if (U(D), ce(!0), p && p?.data && v) {
70
+ }, [p, S]), R(() => {
71
+ if (T(S), re(!0), p && p?.data && L) {
72
72
  const e = p.data.map((n) => {
73
- const o = v.find(
74
- (c) => c?.token === n?.return_location
73
+ const o = L.find(
74
+ (a) => a?.token === n?.return_location
75
75
  );
76
76
  return {
77
77
  ...n,
78
78
  new_location: o ? o?.location_name : null
79
79
  };
80
80
  });
81
- T(e);
81
+ E(e);
82
82
  }
83
- }, [p, D, v, _, te]);
84
- const [ae] = Oe(), G = ae?.find((e) => {
83
+ }, [p, S, L, _, Z]);
84
+ const [oe] = Ie(), j = oe?.find((e) => {
85
85
  const n = e?.customer_id?.toString();
86
86
  return n && n === O;
87
- }), B = G?.account_number;
88
- console.log(G, "selectedCustomer");
89
- const le = (e) => {
87
+ }), G = j?.account_number;
88
+ console.log(j, "selectedCustomer");
89
+ const ae = (e) => {
90
90
  const n = e.target.checked;
91
- if (R(n), n) {
91
+ if (A(n), n) {
92
92
  const o = h?.find(
93
- (r) => y(r)
94
- ), c = S.length > 0 ? S[0]?.product_return_action : o?.product_return_action;
95
- if (!c) return;
93
+ (r) => b(r)
94
+ ), a = y.length > 0 ? y[0]?.product_return_action : o?.product_return_action;
95
+ if (!a) return;
96
96
  const l = h?.filter(
97
- (r) => y(r) && r?.product_return_action === c
97
+ (r) => b(r) && r?.product_return_action === a
98
98
  ), i = l.map((r) => ({
99
99
  id: r.id,
100
100
  return_locations: r?.return_location_name,
@@ -104,44 +104,44 @@ const Ke = [
104
104
  return_location_token: r?.return_location
105
105
  })), d = l.map((r) => ({
106
106
  id: r.id,
107
- account_number: B,
107
+ account_number: G,
108
108
  customer_id: Number(O),
109
109
  products: [r?.legacy_product_id],
110
110
  return_action: r?.product_return_action,
111
111
  return_location_token: r?.return_location || null
112
112
  }));
113
- console.log(d, "newPayloadnewPayload"), P(i), N(d);
113
+ console.log(d, "newPayloadnewPayload"), D(i), N(d);
114
114
  } else
115
- P([]), N([]), I([]);
116
- }, ie = (e, n, o, c, l) => {
117
- P((i) => {
115
+ D([]), N([]), I([]);
116
+ }, ce = (e, n, o, a, l) => {
117
+ D((i) => {
118
118
  if (i?.some(
119
119
  (r) => r.id === e
120
120
  )) {
121
121
  const r = i.filter(
122
122
  (u) => u.id !== e
123
123
  );
124
- Z((u) => ({
124
+ Q((u) => ({
125
125
  ...u,
126
126
  products: l,
127
- return_action: c || null,
127
+ return_action: a || null,
128
128
  return_location_token: n || null
129
129
  })), N(
130
130
  (u) => u.filter((C) => C.id !== e)
131
131
  );
132
- const w = c, E = h?.filter(
133
- (u) => y(u) && u?.product_return_action === w
132
+ const w = a, v = h?.filter(
133
+ (u) => b(u) && u?.product_return_action === w
134
134
  )?.length;
135
- return R(
136
- r?.length > 0 && r?.length === E
135
+ return A(
136
+ r?.length > 0 && r?.length === v
137
137
  ), r;
138
138
  } else {
139
139
  const r = {
140
140
  id: e,
141
- account_number: B,
141
+ account_number: G,
142
142
  customer_id: Number(O),
143
143
  products: [l],
144
- return_action: c || null,
144
+ return_action: a || null,
145
145
  return_location_token: n || null
146
146
  };
147
147
  N((C) => [...C, r]);
@@ -151,44 +151,44 @@ const Ke = [
151
151
  id: e,
152
152
  return_location: n,
153
153
  return_location_name: o,
154
- product_return_action: c
154
+ product_return_action: a
155
155
  }
156
- ], E = c, u = h?.filter(
157
- (C) => y(C) && C?.product_return_action === E
156
+ ], v = a, u = h?.filter(
157
+ (C) => b(C) && C?.product_return_action === v
158
158
  )?.length;
159
- return R(w?.length === u), w;
159
+ return A(w?.length === u), w;
160
160
  }
161
161
  });
162
162
  };
163
- return b(() => {
164
- if (A?.length === 0) {
163
+ return R(() => {
164
+ if (k?.length === 0) {
165
165
  I([]);
166
166
  return;
167
167
  }
168
- const e = A?.reduce((o, c) => {
169
- const { return_location_token: l, id: i } = c, d = l || `no_token_${i}`;
168
+ const e = k?.reduce((o, a) => {
169
+ const { return_location_token: l, id: i } = a, d = l || `no_token_${i}`;
170
170
  return o[d] || (o[d] = {
171
- ...c,
171
+ ...a,
172
172
  products: [],
173
173
  return_action: []
174
- }), o[d].products = [...o[d].products, ...c.products], o[d].return_action = Array.from(
175
- /* @__PURE__ */ new Set([...o[d].return_action, ...c.return_action])
174
+ }), o[d].products = [...o[d].products, ...a.products], o[d].return_action = Array.from(
175
+ /* @__PURE__ */ new Set([...o[d].return_action, ...a.return_action])
176
176
  ), o;
177
177
  }, {}), n = Object.values(e);
178
178
  I(n);
179
- }, [A]), /* @__PURE__ */ t(se, { children: /* @__PURE__ */ t(xe, { className: "fortables", children: /* @__PURE__ */ a(Me, { children: [
180
- /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ a("tr", { children: [
181
- h?.some((e) => y(e)) ? /* @__PURE__ */ t("th", { className: "emailInvoiceCheckbox", children: /* @__PURE__ */ t(H, { checked: q, onChange: le }) }) : /* @__PURE__ */ t("th", {}),
182
- /* @__PURE__ */ t("th", { onClick: () => m("location"), children: /* @__PURE__ */ a("div", { className: "sortIconClass", children: [
179
+ }, [k]), /* @__PURE__ */ t(le, { children: /* @__PURE__ */ t(Ue, { className: "fortables return-cards-wrapper", children: /* @__PURE__ */ c(We, { className: "return-cards", children: [
180
+ /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ c("tr", { children: [
181
+ h?.some((e) => b(e)) ? /* @__PURE__ */ t("th", { className: "emailInvoiceCheckbox", children: /* @__PURE__ */ t(B, { checked: J, onChange: ae }) }) : /* @__PURE__ */ t("th", {}),
182
+ /* @__PURE__ */ t("th", { onClick: () => f("location"), children: /* @__PURE__ */ c("div", { className: "sortIconClass", children: [
183
183
  "Product Location ",
184
184
  g("location")
185
185
  ] }) }),
186
- /* @__PURE__ */ t("th", { onClick: () => m("return_location_name"), children: /* @__PURE__ */ a("div", { className: "sortIconClass", children: [
186
+ /* @__PURE__ */ t("th", { onClick: () => f("return_location_name"), children: /* @__PURE__ */ c("div", { className: "sortIconClass", children: [
187
187
  "Return Location ",
188
188
  g("return_location_name")
189
189
  ] }) }),
190
190
  /* @__PURE__ */ t("th", { children: "Client" }),
191
- /* @__PURE__ */ t("th", { onClick: () => m("recipient_name"), children: /* @__PURE__ */ a("div", { className: "sortIconClass", children: [
191
+ /* @__PURE__ */ t("th", { onClick: () => f("recipient_name"), children: /* @__PURE__ */ c("div", { className: "sortIconClass", children: [
192
192
  "Recipient ",
193
193
  g("recipient_name")
194
194
  ] }) }),
@@ -196,31 +196,29 @@ const Ke = [
196
196
  /* @__PURE__ */ t("th", { children: "Code" }),
197
197
  /* @__PURE__ */ t("th", { children: "Description" }),
198
198
  /* @__PURE__ */ t("th", { children: "Part" }),
199
- /* @__PURE__ */ t("th", { onClick: () => m("weight"), children: /* @__PURE__ */ a("div", { className: "sortIconClass", children: [
199
+ /* @__PURE__ */ t("th", { onClick: () => f("weight"), children: /* @__PURE__ */ c("div", { className: "sortIconClass", children: [
200
200
  "Weight (",
201
- J,
201
+ V,
202
202
  ") ",
203
203
  g("weight")
204
204
  ] }) }),
205
- /* @__PURE__ */ t("th", { children: He }),
206
- /* @__PURE__ */ t("th", { onClick: () => m("return_reason"), children: /* @__PURE__ */ a("div", { className: "sortIconClass", children: [
205
+ /* @__PURE__ */ t("th", { children: je }),
206
+ /* @__PURE__ */ t("th", { onClick: () => f("return_reason"), children: /* @__PURE__ */ c("div", { className: "sortIconClass", children: [
207
207
  "Return Reason ",
208
208
  g("return_reason")
209
209
  ] }) }),
210
- /* @__PURE__ */ t("th", { children: "Collected Date" }),
211
- /* @__PURE__ */ t("th", { onClick: () => m("collection_reason"), children: /* @__PURE__ */ a("div", { className: "sortIconClass", children: [
212
- L ? "Collection" : "Reverse Delivery",
213
- " Reason",
214
- " ",
210
+ /* @__PURE__ */ t("th", { children: "Collected" }),
211
+ /* @__PURE__ */ t("th", { onClick: () => f("collection_reason"), children: /* @__PURE__ */ c("div", { className: "sortIconClass", children: [
212
+ "Collection Reason ",
215
213
  g("collection_reason")
216
214
  ] }) }),
217
215
  /* @__PURE__ */ t("th", { className: "emailInvoiceShare", children: "Labels" })
218
216
  ] }) }),
219
- /* @__PURE__ */ t("tbody", { children: Q ? /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ t("td", { colSpan: 14, children: /* @__PURE__ */ t(he, { active: !0 }) }) }) : x?.length === 0 ? /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ t("td", { colSpan: 14, children: /* @__PURE__ */ t(We, { children: /* @__PURE__ */ t(pe, {}) }) }) }) : x?.map((e, n) => /* @__PURE__ */ a("tr", { children: [
220
- /* @__PURE__ */ t("td", { children: y(e) ? (() => {
221
- const o = S?.length > 0 && S[0]?.product_return_action !== e?.product_return_action;
217
+ /* @__PURE__ */ t("tbody", { children: q ? /* @__PURE__ */ t("tr", { className: "state-row", children: /* @__PURE__ */ t("td", { colSpan: 14, className: "state-cell", children: /* @__PURE__ */ t(de, { active: !0 }) }) }) : F?.length === 0 ? /* @__PURE__ */ t("tr", { className: "state-row", children: /* @__PURE__ */ t("td", { colSpan: 14, className: "state-cell", children: /* @__PURE__ */ t(Te, { children: /* @__PURE__ */ t(ue, {}) }) }) }) : F?.map((e, n) => /* @__PURE__ */ c("tr", { children: [
218
+ /* @__PURE__ */ t("td", { "data-label": "Select", children: b(e) ? (() => {
219
+ const o = y?.length > 0 && y[0]?.product_return_action !== e?.product_return_action;
222
220
  return /* @__PURE__ */ t(
223
- _e,
221
+ he,
224
222
  {
225
223
  title: o ? "Cannot select different return actions" : "",
226
224
  children: /* @__PURE__ */ t(
@@ -228,14 +226,14 @@ const Ke = [
228
226
  {
229
227
  className: o ? "disabled-wrapper" : "",
230
228
  children: /* @__PURE__ */ t(
231
- H,
229
+ B,
232
230
  {
233
231
  className: "custom-check",
234
232
  disabled: o,
235
- checked: S.some(
236
- (c) => c?.id === e?.id
233
+ checked: y.some(
234
+ (a) => a?.id === e?.id
237
235
  ),
238
- onChange: () => ie(
236
+ onChange: () => ce(
239
237
  e?.id,
240
238
  e?.return_location,
241
239
  e?.return_location_name,
@@ -249,20 +247,20 @@ const Ke = [
249
247
  }
250
248
  );
251
249
  })() : null }),
252
- /* @__PURE__ */ t("td", { children: e?.location !== null && e?.location !== void 0 ? e?.location : /* @__PURE__ */ t("div", { className: "awaiting", children: "Awaiting" }) }),
253
- /* @__PURE__ */ a("td", { children: [
250
+ /* @__PURE__ */ t("td", { "data-label": "Product Location", children: e?.location !== null && e?.location !== void 0 ? e?.location : /* @__PURE__ */ t("div", { className: "awaiting", children: "Awaiting" }) }),
251
+ /* @__PURE__ */ c("td", { "data-label": "Return Location", children: [
254
252
  " ",
255
253
  s(e?.return_location_name)
256
254
  ] }),
257
- /* @__PURE__ */ a("td", { title: e?.client_name ?? "", children: [
255
+ /* @__PURE__ */ c("td", { "data-label": "Client", title: e?.client_name ?? "", children: [
258
256
  s(e?.client_name),
259
- Y(e?.owner_id) && /* @__PURE__ */ a("span", { children: [
257
+ $(e?.owner_id) && /* @__PURE__ */ c("span", { children: [
260
258
  " (",
261
- Y(e?.owner_id),
259
+ $(e?.owner_id),
262
260
  ")"
263
261
  ] })
264
262
  ] }),
265
- /* @__PURE__ */ t("td", { children: /* @__PURE__ */ a("ul", { style: { listStyleType: "none", padding: 0 }, children: [
263
+ /* @__PURE__ */ t("td", { "data-label": "Recipient", children: /* @__PURE__ */ c("ul", { style: { listStyleType: "none", padding: 0 }, children: [
266
264
  /* @__PURE__ */ t(
267
265
  "li",
268
266
  {
@@ -271,43 +269,39 @@ const Ke = [
271
269
  fontWeight: 600,
272
270
  paddingLeft: 0
273
271
  },
274
- children: /* @__PURE__ */ t(Be, { to: `/orders/view/${e?.order_id}`, children: s(e?.recipient_name) })
272
+ children: /* @__PURE__ */ t(xe, { to: `/orders/view/${e?.order_id}`, children: s(e?.recipient_name) })
275
273
  }
276
274
  ),
277
275
  /* @__PURE__ */ t("li", { style: { color: "#888075" }, children: s(e?.postcode) })
278
276
  ] }) }),
279
- /* @__PURE__ */ t("td", { children: s(e?.product_return_action) }),
280
- /* @__PURE__ */ t("td", { children: s(e?.code) }),
281
- /* @__PURE__ */ t("td", { children: s(e?.description) }),
282
- /* @__PURE__ */ t("td", { children: s(e?.part) }),
283
- /* @__PURE__ */ a("td", { children: [
277
+ /* @__PURE__ */ t("td", { "data-label": "Return Action", children: s(e?.product_return_action) }),
278
+ /* @__PURE__ */ t("td", { "data-label": "Code", children: s(e?.code) }),
279
+ /* @__PURE__ */ t("td", { "data-label": "Description", children: s(e?.description) }),
280
+ /* @__PURE__ */ t("td", { "data-label": "Part", children: s(e?.part) }),
281
+ /* @__PURE__ */ c("td", { "data-label": "Weight", children: [
284
282
  s(e?.weight),
285
283
  " ",
286
- e?.weight && e?.weight !== null ? J : ""
284
+ e?.weight && e?.weight !== null ? V : ""
287
285
  ] }),
288
- /* @__PURE__ */ t("td", { children: s(e?.cube) }),
289
- /* @__PURE__ */ t("td", { children: s(
290
- L ? e?.return_reason : K(e?.return_reason)
291
- ) }),
292
- /* @__PURE__ */ t("td", { children: e?.collected_at ? fe(new Date(e?.collected_at), "dd/MM/yyyy") : "UNKNOWN" }),
293
- /* @__PURE__ */ t("td", { children: s(
294
- L ? e?.collection_reason : K(e?.collection_reason)
295
- ) }),
296
- /* @__PURE__ */ t("td", { children: /* @__PURE__ */ t("ul", { className: "actionbox", children: /* @__PURE__ */ t(
297
- je,
286
+ /* @__PURE__ */ t("td", { "data-label": "CBM", children: s(e?.cube) }),
287
+ /* @__PURE__ */ t("td", { "data-label": "Return Reason", children: s(e?.return_reason) }),
288
+ /* @__PURE__ */ t("td", { "data-label": "Collected", children: e?.collected_at ? pe(new Date(e?.collected_at), "dd/MM/yyyy") : "UNKNOWN" }),
289
+ /* @__PURE__ */ t("td", { "data-label": "Collection Reason", children: s(e?.collection_reason) }),
290
+ /* @__PURE__ */ t("td", { "data-label": "Labels", children: /* @__PURE__ */ t("ul", { className: "actionbox", children: /* @__PURE__ */ t(
291
+ Fe,
298
292
  {
299
- ref: X,
300
- className: F === n ? "active" : "",
301
- children: /* @__PURE__ */ a(
293
+ ref: z,
294
+ className: U === n ? "active" : "",
295
+ children: /* @__PURE__ */ c(
302
296
  "li",
303
297
  {
304
298
  className: "shareIconContainer",
305
- onClick: () => oe(n),
299
+ onClick: () => ne(n),
306
300
  children: [
307
- /* @__PURE__ */ t(Se, {}),
308
- /* @__PURE__ */ t(ye, {}),
309
- F === n && /* @__PURE__ */ t("div", { ref: k, children: /* @__PURE__ */ t(
310
- De,
301
+ /* @__PURE__ */ t(Ce, {}),
302
+ /* @__PURE__ */ t(ge, {}),
303
+ U === n && /* @__PURE__ */ t("div", { ref: P, children: /* @__PURE__ */ t(
304
+ ye,
311
305
  {
312
306
  legacyURL: e?.return_order_product_label,
313
307
  legacyProductID: e?.legacy_product_id
@@ -322,6 +316,6 @@ const Ke = [
322
316
  ] }) }) });
323
317
  };
324
318
  export {
325
- ht as default
319
+ st 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, toReverseDeliveryLabel, 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 useClientPortal,\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 [isClientPortal] = useClientPortal();\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 Date'}</th>\n <th onClick={() => handleSort('collection_reason')}>\n <div className=\"sortIconClass\">\n {isClientPortal ? 'Collection' : 'Reverse Delivery'} Reason{' '}\n {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>\n {displayValueOrNA(\n isClientPortal\n ? item?.return_reason\n : toReverseDeliveryLabel(item?.return_reason)\n )}\n </td>\n <td>\n {item?.collected_at\n ? format(new Date(item?.collected_at), 'dd/MM/yyyy')\n : 'UNKNOWN'}\n </td>\n\n <td>\n {displayValueOrNA(\n isClientPortal\n ? item?.collection_reason\n : toReverseDeliveryLabel(item?.collection_reason)\n )}\n </td>\n <td>\n <ul className=\"actionbox\">\n <CustomDrop\n ref={dropdownRefParent}\n className={printToogle === index ? 'active' : ''}\n >\n <li\n className=\"shareIconContainer\"\n onClick={() => OpenDropDown(index)}\n >\n <PrinterIcon />\n <DownIcon />\n {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","isClientPortal","useClientPortal","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","toReverseDeliveryLabel","format","CustomDrop","PrinterIcon","DownIcon","PrintDropDownReturn"],"mappings":";;;;;;;;;;;;;;;;;;;;AAmCA,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,IAAIC,GAAA,GAChC,CAAA,EAAGC,CAAgB,IAAIC,GAAA,GACvB,CAACC,GAAYC,CAAa,IAA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iB;AAAA,MAAA,GAEtD;AAAA,MACA,gBAAA6G,EAAC,MAAA,EACC,UAAA,gBAAAA,EAAC,MAAA,EAAG,WAAU,aACZ,UAAA,gBAAAA;AAAA,QAACkB;AAAA,QAAA;AAAA,UACC,KAAK5G;AAAA,UACL,WAAWG,MAAgBuC,IAAQ,WAAW;AAAA,UAE9C,UAAA,gBAAAoD;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAU;AAAA,cACV,SAAS,MAAMrD,GAAaC,CAAK;AAAA,cAEjC,UAAA;AAAA,gBAAA,gBAAAgD,EAACmB,IAAA,EAAY;AAAA,kCACZC,IAAA,EAAS;AAAA,gBACT3G,MAAgBuC,KACf,gBAAAgD,EAAC,OAAA,EAAI,KAAKxF,GACR,UAAA,gBAAAwF;AAAA,kBAACqB;AAAA,kBAAA;AAAA,oBACC,WAAWlI,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,KA9HOA,EAAK,EA+Hd,CACD,EAAA,CAEL;AAAA,EAAA,EAAA,CACF,GACF,GACF;AAEJ;"}
1
+ {"version":3,"file":"ReturnOrderTable.js","sources":["../../../../../src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.tsx"],"sourcesContent":["import { Checkbox, useApiHook } from '@bjsdistribution/dms-component-library';\nimport { Empty, notification, Skeleton, Tooltip } from 'antd';\nimport { format } from 'date-fns';\nimport { useAtom } from 'jotai';\nimport React, { useEffect, useMemo, useRef, useState } from 'react';\nimport DownIcon from '../../../../assets/icons/DownIcon';\nimport PrinterIcon from '../../../../assets/icons/PrinterIcon';\nimport CaretDownFilledIcon from '../../../../common/CaretDownFilledIcon';\nimport SortIcon from '../../../../common/SortIcon';\nimport PrintDropDownReturn from '../../../order-view/details-filters/left-side-filters/dropdowns/PrintDropDownReturn';\nimport { usefetchAgain, useReturnData } from '../../../order-view/store';\nimport {\n useFlatCustomerData,\n useGroupedPayload,\n useLocationData,\n useNewReturnPayload,\n useReturnPayload,\n useSelectAll,\n useSelectedOrders,\n} from '../../../store';\nimport { ApiResponse } from '../../../types';\nimport { filtersReducerAtom } from '../../header-filters/filterStore';\nimport { displayValueOrNA } from '../../shared/utlis';\nimport {\n useLoading,\n UsePaginationData,\n usePrintOptionTOggle,\n} from '../../store/store';\nimport { EmptyDataContainer } from '../../table/table-data/styles';\nimport { CustomDrop, StyledTable, StyledTableWrapper } from './returnstyles';\nimport { NavLink, useSearchParams } from 'react-router-dom';\nimport { 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 return-cards-wrapper\">\n <StyledTable className=\"return-cards\">\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 className=\"state-row\">\n <td colSpan={14} className=\"state-cell\">\n <Skeleton active />\n </td>\n </tr>\n ) : sortedData?.length === 0 ? (\n <tr className=\"state-row\">\n <td colSpan={14} className=\"state-cell\">\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 data-label=\"Select\">\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 data-label=\"Product Location\">\n {item?.location !== null && item?.location !== undefined ? (\n item?.location\n ) : (\n <div className=\"awaiting\">Awaiting</div>\n )}\n </td>\n <td data-label=\"Return Location\"> {displayValueOrNA(item?.return_location_name)}</td>\n <td data-label=\"Client\" 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 data-label=\"Recipient\">\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 data-label=\"Return Action\">{displayValueOrNA(item?.product_return_action)}</td>\n <td data-label=\"Code\">{displayValueOrNA(item?.code)}</td>\n <td data-label=\"Description\">{displayValueOrNA(item?.description)}</td>\n <td data-label=\"Part\">{displayValueOrNA(item?.part)}</td>\n <td data-label=\"Weight\">\n {displayValueOrNA(item?.weight)}{' '}\n {item?.weight && item?.weight !== null ? WEIGHT_UNIT : ''}\n </td>\n <td data-label=\"CBM\">{displayValueOrNA(item?.cube)}</td>\n <td data-label=\"Return Reason\">{displayValueOrNA(item?.return_reason)}</td>\n <td data-label=\"Collected\">\n {item?.collected_at\n ? format(new Date(item?.collected_at), 'dd/MM/yyyy')\n : 'UNKNOWN'}\n </td>\n\n <td data-label=\"Collection Reason\">{displayValueOrNA(item?.collection_reason)}</td>\n <td data-label=\"Labels\">\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","Fragment","StyledTableWrapper","jsxs","StyledTable","Checkbox","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,IAAIC,GAAA,GAChC,CAAA,EAAGC,CAAgB,IAAIC,GAAA,GACvB,CAACC,GAAYC,CAAa,IAAIC,GAAA,GAC9B,CAAA,EAAGC,CAAU,IAAIC,GAAA,GACjB,CAACC,C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