@bjsdistribution/dms-client-return 0.1.77-prod → 0.1.78-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 (68) hide show
  1. package/dist/common/utils.js +8 -7
  2. package/dist/common/utils.js.map +1 -1
  3. package/dist/components/client-portal/OutstandingTable.js +122 -116
  4. package/dist/components/client-portal/OutstandingTable.js.map +1 -1
  5. package/dist/components/fakeData.js.map +1 -1
  6. package/dist/components/order-daily-overview/common/fakedata.js.map +1 -1
  7. package/dist/components/order-daily-overview/header-filters/overViewFilter.js +7 -11
  8. package/dist/components/order-daily-overview/header-filters/overViewFilter.js.map +1 -1
  9. package/dist/components/order-daily-overview/return-after-table/table/OrderTable.js +32 -30
  10. package/dist/components/order-daily-overview/return-after-table/table/OrderTable.js.map +1 -1
  11. package/dist/components/order-daily-overview/return-after-table/table-filters/ReturnOrderFilter.js +58 -54
  12. package/dist/components/order-daily-overview/return-after-table/table-filters/ReturnOrderFilter.js.map +1 -1
  13. package/dist/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.js +157 -151
  14. package/dist/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.js.map +1 -1
  15. package/dist/components/order-view/details-filters/left-side-filters/dropdowns/OptionsDropDown.js.map +1 -1
  16. package/dist/components/order-view/fakedata.js.map +1 -1
  17. package/dist/components/order-view/general-information/dropdowns/Print.js +11 -11
  18. package/dist/components/order-view/general-information/dropdowns/Print.js.map +1 -1
  19. package/dist/components/order-view/index.js +154 -133
  20. package/dist/components/order-view/index.js.map +1 -1
  21. package/dist/components/order-view/order-actions/Dropdown.js +3 -3
  22. package/dist/components/order-view/order-actions/Dropdown.js.map +1 -1
  23. package/dist/components/order-view/order-actions/actions/cancel-order/CancelOrderTable.js +47 -45
  24. package/dist/components/order-view/order-actions/actions/cancel-order/CancelOrderTable.js.map +1 -1
  25. package/dist/components/order-view/order-actions/actions/cancel-order/ReturnReason.js +36 -23
  26. package/dist/components/order-view/order-actions/actions/cancel-order/ReturnReason.js.map +1 -1
  27. package/dist/components/order-view/order-actions/actions/cancel-order/index.js.map +1 -1
  28. package/dist/components/order-view/order-actions/actions/confirm-order/tables/ProductTable.js +25 -23
  29. package/dist/components/order-view/order-actions/actions/confirm-order/tables/ProductTable.js.map +1 -1
  30. package/dist/components/order-view/order-actions/actions/force-debrief/ForceDebriefModal.js +90 -88
  31. package/dist/components/order-view/order-actions/actions/force-debrief/ForceDebriefModal.js.map +1 -1
  32. package/dist/components/order-view/order-actions/actions/force-debrief/charges/collection-add-ons/index.js +16 -16
  33. package/dist/components/order-view/order-actions/actions/force-debrief/charges/collection-add-ons/index.js.map +1 -1
  34. package/dist/components/order-view/order-actions/actions/force-debrief/escalation/EscalationReason.js +24 -22
  35. package/dist/components/order-view/order-actions/actions/force-debrief/escalation/EscalationReason.js.map +1 -1
  36. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/RadioButtons.js +56 -51
  37. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/RadioButtons.js.map +1 -1
  38. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/CancellationReasonDropdown.js.map +1 -1
  39. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/FailureReasonDropdown.js +26 -24
  40. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/FailureReasonDropdown.js.map +1 -1
  41. package/dist/components/order-view/order-actions/actions/hold-order/HoldOrderModal.js +30 -29
  42. package/dist/components/order-view/order-actions/actions/hold-order/HoldOrderModal.js.map +1 -1
  43. package/dist/components/order-view/order-actions/actions/split-order/SplitOrderTable.js +25 -23
  44. package/dist/components/order-view/order-actions/actions/split-order/SplitOrderTable.js.map +1 -1
  45. package/dist/components/order-view/order-actions/actions/uncancel-order/UncancelOrderTable.js +37 -35
  46. package/dist/components/order-view/order-actions/actions/uncancel-order/UncancelOrderTable.js.map +1 -1
  47. package/dist/components/order-view/order-details/expanded-content/services-section/OrderServices.js +20 -18
  48. package/dist/components/order-view/order-details/expanded-content/services-section/OrderServices.js.map +1 -1
  49. package/dist/components/order-view/order-details/expanded-content/services-section/ServiceType.js +27 -22
  50. package/dist/components/order-view/order-details/expanded-content/services-section/ServiceType.js.map +1 -1
  51. package/dist/components/order-view/order-details/helper.js.map +1 -1
  52. package/dist/components/order-view/return-client-products/product-table/ReturnProductTable.js +179 -151
  53. package/dist/components/order-view/return-client-products/product-table/ReturnProductTable.js.map +1 -1
  54. package/dist/components/order-view/store.js +160 -144
  55. package/dist/components/order-view/store.js.map +1 -1
  56. package/dist/components/order-view/toolbox-resources/collapsed-content/index.js +16 -0
  57. package/dist/components/order-view/toolbox-resources/collapsed-content/index.js.map +1 -0
  58. package/dist/components/order-view/toolbox-resources/expanded-content/index.js +534 -0
  59. package/dist/components/order-view/toolbox-resources/expanded-content/index.js.map +1 -0
  60. package/dist/components/utils.js +5 -4
  61. package/dist/components/utils.js.map +1 -1
  62. package/dist/types/common/utils.d.ts +1 -0
  63. package/dist/types/components/order-view/order-actions/Dropdown.d.ts +1 -0
  64. package/dist/types/components/order-view/store.d.ts +6 -0
  65. package/dist/types/components/order-view/toolbox-resources/collapsed-content/index.d.ts +2 -0
  66. package/dist/types/components/order-view/toolbox-resources/expanded-content/index.d.ts +2 -0
  67. package/dist/types/components/utils.d.ts +1 -0
  68. package/package.json +2 -3
@@ -1,65 +1,67 @@
1
- import { jsx as e, jsxs as o, Fragment as g } from "react/jsx-runtime";
2
- import { useCancelOrderProducts as y, useOrderStaticData as w } from "../../../store.js";
3
- import { useLoading as v } from "../../../../order-daily-overview/store/store.js";
4
- import { Select as S, Skeleton as _, Empty as O } from "antd";
5
- import R from "../../Dropdown.js";
6
- import d from "styled-components";
7
- import b from "../../../../../assets/icons/DeliverProductIcon.js";
8
- import s from "../../../../../assets/icons/ReturnProductIcon.js";
9
- import { EmptyDataContainer as C } from "../charge-log/index.js";
10
- const D = [
1
+ import { jsx as e, jsxs as o, Fragment as y } from "react/jsx-runtime";
2
+ import { useCancelOrderProducts as v, useOrderStaticData as w } from "../../../store.js";
3
+ import { useLoading as S } from "../../../../order-daily-overview/store/store.js";
4
+ import { Select as _, Skeleton as R, Empty as C } from "antd";
5
+ import O from "../../Dropdown.js";
6
+ import l from "styled-components";
7
+ import x from "../../../../../assets/icons/DeliverProductIcon.js";
8
+ import c from "../../../../../assets/icons/ReturnProductIcon.js";
9
+ import { EmptyDataContainer as D } from "../charge-log/index.js";
10
+ import { toReverseDeliveryLabel as k } from "../../../../../common/utils.js";
11
+ import { useClientPortal as T } from "../../../../store.js";
12
+ const P = [
11
13
  {
12
14
  label: "Deliver",
13
15
  value: "deliver",
14
- icon: /* @__PURE__ */ e(b, {})
16
+ icon: /* @__PURE__ */ e(x, {})
15
17
  },
16
18
  {
17
19
  label: "Return",
18
20
  value: "return",
19
- icon: /* @__PURE__ */ e(s, {})
21
+ icon: /* @__PURE__ */ e(c, {})
20
22
  }
21
- ], k = [
23
+ ], I = [
22
24
  {
23
25
  label: "Return",
24
26
  value: "return",
25
- icon: /* @__PURE__ */ e(s, {})
27
+ icon: /* @__PURE__ */ e(c, {})
26
28
  }
27
- ], Y = () => {
29
+ ], M = () => {
28
30
  const [
29
- l,
31
+ d,
30
32
  f
31
- ] = y(), [m] = v(), [p] = w();
32
- if (!l?.length)
33
+ ] = v(), [m] = S(), [p] = w(), [g] = T();
34
+ if (!d?.length)
33
35
  return null;
34
- const h = p?.return_reasons?.map(
36
+ const u = p?.return_reasons?.map(
35
37
  (r) => ({
36
- label: r?.reason,
38
+ label: g ? r?.reason : k(r?.reason),
37
39
  value: r?.reason
38
40
  })
39
- ), u = p?.order_product_return_action?.map(
41
+ ), h = p?.order_product_return_action?.map(
40
42
  (r) => ({
41
43
  label: r?.value,
42
44
  value: r?.value
43
45
  })
44
46
  ), i = (r, n, a) => {
45
47
  console.log(r, n, a);
46
- const t = l?.map(
47
- (c) => c.order_product_id === n ? {
48
- ...c,
48
+ const t = d?.map(
49
+ (s) => s.order_product_id === n ? {
50
+ ...s,
49
51
  [a]: r
50
- } : c
52
+ } : s
51
53
  );
52
54
  f(t);
53
55
  };
54
- return /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(I, { children: /* @__PURE__ */ o(P, { className: "scrollClass", children: [
56
+ return /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(A, { children: /* @__PURE__ */ o(N, { className: "scrollClass", children: [
55
57
  /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ o("tr", { children: [
56
58
  /* @__PURE__ */ e("th", { children: "Status" }),
57
59
  /* @__PURE__ */ e("th", { children: "Code" }),
58
60
  /* @__PURE__ */ e("th", { children: "Description" }),
59
61
  /* @__PURE__ */ e("th", { children: "SKU" })
60
62
  ] }) }),
61
- /* @__PURE__ */ e("tbody", { children: m ? /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: 4, children: /* @__PURE__ */ e(_, { active: !0 }) }) }) : l?.length === 0 ? /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { className: "emptyTd", colSpan: 4, children: /* @__PURE__ */ e(C, { children: /* @__PURE__ */ e(O, {}) }) }) }) : l?.map((r) => {
62
- const n = r?.product_type === "deliver" ? D : k, a = r?.action === "return";
63
+ /* @__PURE__ */ e("tbody", { children: m ? /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: 4, children: /* @__PURE__ */ e(R, { active: !0 }) }) }) : d?.length === 0 ? /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { className: "emptyTd", colSpan: 4, children: /* @__PURE__ */ e(D, { children: /* @__PURE__ */ e(C, {}) }) }) }) : d?.map((r) => {
64
+ const n = r?.product_type === "deliver" ? P : I, a = r?.action === "return";
63
65
  return /* @__PURE__ */ e(
64
66
  "tr",
65
67
  {
@@ -69,7 +71,7 @@ const D = [
69
71
  children: /* @__PURE__ */ e("td", { colSpan: 4, children: /* @__PURE__ */ e("table", { style: { width: "100%" }, children: /* @__PURE__ */ o("tbody", { children: [
70
72
  /* @__PURE__ */ o("tr", { children: [
71
73
  /* @__PURE__ */ e("td", { style: { width: "25%" }, children: /* @__PURE__ */ e(
72
- T,
74
+ L,
73
75
  {
74
76
  options: n,
75
77
  placeholder: "Select",
@@ -78,7 +80,7 @@ const D = [
78
80
  r?.order_product_id,
79
81
  "action"
80
82
  ),
81
- prefix: r?.action === "deliver" ? /* @__PURE__ */ e(b, {}) : r?.action === "return" ? /* @__PURE__ */ e(s, {}) : /* @__PURE__ */ e(g, {}),
83
+ prefix: r?.action === "deliver" ? /* @__PURE__ */ e(x, {}) : r?.action === "return" ? /* @__PURE__ */ e(c, {}) : /* @__PURE__ */ e(y, {}),
82
84
  style: { width: "100%" },
83
85
  value: n?.filter(
84
86
  (t) => t?.value === r?.action
@@ -110,37 +112,37 @@ const D = [
110
112
  /* @__PURE__ */ e("td", { style: { width: "25%" }, children: r?.description }),
111
113
  /* @__PURE__ */ e("td", { style: { width: "25%" }, children: r?.sku })
112
114
  ] }),
113
- a && /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: 4, children: /* @__PURE__ */ o(A, { children: [
115
+ a && /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: 4, children: /* @__PURE__ */ o(j, { children: [
114
116
  /* @__PURE__ */ e(
115
- x,
117
+ b,
116
118
  {
117
119
  label: "Return Action",
118
120
  required: !0,
119
121
  placeholder: "Select action",
120
- options: u,
122
+ options: h,
121
123
  onSelect: (t) => i(
122
124
  t,
123
125
  r?.order_product_id,
124
126
  "return_action"
125
127
  ),
126
- value: u?.filter(
128
+ value: h?.filter(
127
129
  (t) => t.value === r?.return_action
128
130
  )
129
131
  }
130
132
  ),
131
133
  /* @__PURE__ */ e(
132
- x,
134
+ b,
133
135
  {
134
136
  label: "Return Reason",
135
137
  required: !0,
136
138
  placeholder: "Select reason",
137
- options: h,
139
+ options: u,
138
140
  onSelect: (t) => i(
139
141
  t,
140
142
  r?.order_product_id,
141
143
  "return_reason"
142
144
  ),
143
- value: h?.filter(
145
+ value: u?.filter(
144
146
  (t) => t.value === r?.return_reason
145
147
  )
146
148
  }
@@ -152,7 +154,7 @@ const D = [
152
154
  );
153
155
  }) })
154
156
  ] }) }) });
155
- }, T = d(S)`
157
+ }, L = l(_)`
156
158
  .ant-select-selector {
157
159
  border-radius: 25px !important;
158
160
  /* border: none !important; */
@@ -170,16 +172,16 @@ const D = [
170
172
  font-weight: 400;
171
173
  font-size: 13px;
172
174
  }
173
- `, I = d.div`
175
+ `, A = l.div`
174
176
  width: 100%;
175
177
  overflow-x: auto;
176
178
  background-color: #fff;
177
179
  border-radius: 12px;
178
180
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
179
181
  padding: 16px;
180
- `, x = d(R)`
182
+ `, b = l(O)`
181
183
  flex: 1;
182
- `, P = d.table`
184
+ `, N = l.table`
183
185
  width: 100%;
184
186
  font-size: 14px;
185
187
  color: #333;
@@ -244,7 +246,7 @@ const D = [
244
246
  background: transparent;
245
247
  padding: 8px 12px;
246
248
  }
247
- `, A = d.div`
249
+ `, j = l.div`
248
250
  display: flex;
249
251
  flex-direction: row;
250
252
  gap: 12px;
@@ -252,8 +254,8 @@ const D = [
252
254
  width: 100%;
253
255
  `;
254
256
  export {
255
- P as StyledTable,
256
- I as StyledTableWrapper,
257
- Y as default
257
+ N as StyledTable,
258
+ A as StyledTableWrapper,
259
+ M as default
258
260
  };
259
261
  //# sourceMappingURL=CancelOrderTable.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CancelOrderTable.js","sources":["../../../../../../src/components/order-view/order-actions/actions/cancel-order/CancelOrderTable.tsx"],"sourcesContent":["import React from 'react';\nimport { useCancelOrderProducts, useOrderStaticData } from '../../../store';\nimport { useLoading } from '../../../../order-daily-overview/store/store';\nimport { Empty, Select, Skeleton } from 'antd';\n// import { AntSelect } from '@bjsdistribution/dms-component-library';\nimport { CancelOrderProductsType } from '../../../types';\nimport OrderActionsDropdown from '../../Dropdown';\nimport styled from 'styled-components';\nimport DeliverProductIcon from '../../../../../assets/icons/DeliverProductIcon';\nimport ReturnProductIcon from '../../../../../assets/icons/ReturnProductIcon';\nimport { EmptyDataContainer } from '../charge-log';\n\nconst deliverTypeOptions = [\n {\n label: 'Deliver',\n value: 'deliver',\n icon: <DeliverProductIcon />,\n },\n {\n label: 'Return',\n value: 'return',\n icon: <ReturnProductIcon />,\n },\n];\n\nconst collectTypeOptions = [\n {\n label: 'Return',\n value: 'return',\n icon: <ReturnProductIcon />,\n },\n];\n\nconst CancelOrderTable = () => {\n const [\n cancelOrderProducts,\n setCancelOrderProducts,\n ] = useCancelOrderProducts();\n\n const [loading] = useLoading();\n const [orderStaticData] = useOrderStaticData();\n\n if (!cancelOrderProducts?.length) {\n return null;\n }\n\n const returnReasonsOptions = orderStaticData?.return_reasons?.map(\n (option: any) => ({\n label: option?.reason,\n value: option?.reason,\n })\n );\n\n const returnActionOptions = orderStaticData?.order_product_return_action?.map(\n (option: any) => ({\n label: option?.value,\n value: option?.value,\n })\n );\n\n const onChange = (\n selectedVal: string,\n id: number,\n type: keyof CancelOrderProductsType\n ) => {\n console.log(selectedVal, id, type);\n const updatedList = cancelOrderProducts?.map(\n (item: CancelOrderProductsType) => {\n const newItem =\n item.order_product_id === id\n ? {\n ...item,\n [type]: selectedVal,\n }\n : item;\n return newItem;\n }\n );\n setCancelOrderProducts(updatedList);\n };\n\n return (\n <div>\n <StyledTableWrapper>\n <StyledTable className=\"scrollClass\">\n <thead>\n <tr>\n <th>Status</th>\n <th>Code</th>\n <th>Description</th>\n <th>SKU</th>\n </tr>\n </thead>\n <tbody>\n {loading ? (\n <tr>\n <td colSpan={4}>\n <Skeleton active />\n </td>\n </tr>\n ) : cancelOrderProducts?.length === 0 ? (\n <tr>\n <td className=\"emptyTd\" colSpan={4}>\n <EmptyDataContainer>\n <Empty />\n </EmptyDataContainer>\n </td>\n </tr>\n ) : (\n cancelOrderProducts?.map((product: CancelOrderProductsType) => {\n const dropdownOptions =\n product?.product_type === 'deliver'\n ? deliverTypeOptions\n : collectTypeOptions;\n\n const isReturn = product?.action === 'return';\n\n return (\n <tr\n key={product?.order_product_id}\n style={{\n boxShadow: '0px 1px 3px 0px rgba(16, 24, 40, 0.1)',\n }}\n >\n <td colSpan={4}>\n <table style={{ width: '100%' }}>\n <tbody>\n <tr>\n <td style={{ width: '25%' }}>\n <CustomSelectDropdown\n options={dropdownOptions}\n placeholder=\"Select\"\n onChange={(val: any) =>\n onChange(\n val,\n product?.order_product_id!,\n 'action'\n )\n }\n prefix={\n product?.action === 'deliver' ? (\n <DeliverProductIcon />\n ) : product?.action === 'return' ? (\n <ReturnProductIcon />\n ) : (\n <></>\n )\n }\n style={{ width: '100%' }}\n value={dropdownOptions?.filter(\n (item: any) => item?.value === product?.action\n )}\n optionRender={(option: any) => (\n <div\n style={{\n display: 'flex',\n gap: '8px',\n alignItems: 'center',\n }}\n >\n <span\n style={{ display: 'flex' }}\n aria-label={option.data.label}\n >\n {option.data.icon}\n </span>\n <span style={{ color: '#8D8F90' }}>\n {option.data.label}\n </span>\n </div>\n )}\n />\n </td>\n <td style={{ width: '25%' }}>{product?.code}</td>\n <td style={{ width: '25%' }}>\n {product?.description}\n </td>\n <td style={{ width: '25%' }}>{product?.sku}</td>\n </tr>\n\n {isReturn && (\n <tr>\n <td colSpan={4}>\n <ReturnRowWrapper>\n <StyledDropdown\n label=\"Return Action\"\n required\n placeholder=\"Select action\"\n options={returnActionOptions}\n onSelect={(val: any) =>\n onChange(\n val,\n product?.order_product_id!,\n 'return_action'\n )\n }\n value={returnActionOptions?.filter(\n (option: any) =>\n option.value === product?.return_action\n )}\n />\n <StyledDropdown\n label=\"Return Reason\"\n required\n placeholder=\"Select reason\"\n options={returnReasonsOptions}\n onSelect={(val: any) =>\n onChange(\n val,\n product?.order_product_id!,\n 'return_reason'\n )\n }\n value={returnReasonsOptions?.filter(\n (option: any) =>\n option.value === product?.return_reason\n )}\n />\n </ReturnRowWrapper>\n </td>\n </tr>\n )}\n </tbody>\n </table>\n </td>\n </tr>\n );\n })\n )}\n </tbody>\n </StyledTable>\n </StyledTableWrapper>\n </div>\n );\n};\n\nconst CustomSelectDropdown: any = styled(Select)`\n .ant-select-selector {\n border-radius: 25px !important;\n /* border: none !important; */\n min-width: 100px;\n padding: 0 10px;\n display: flex;\n gap: 10px;\n align-items: center;\n\n .ant-select-prefix {\n margin-top: 3px;\n }\n }\n .ant-select-selection-item {\n font-weight: 400;\n font-size: 13px;\n }\n`;\n\nexport const StyledTableWrapper = styled.div`\n width: 100%;\n overflow-x: auto;\n background-color: #fff;\n border-radius: 12px;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);\n padding: 16px;\n`;\n\nconst StyledDropdown = styled(OrderActionsDropdown)`\n flex: 1;\n`;\n\nexport const StyledTable = styled.table`\n width: 100%;\n font-size: 14px;\n color: #333;\n border-spacing: 0 10px;\n\n th,\n td {\n padding: 12px 16px;\n background: #fff;\n }\n\n th {\n background: #f0f2f2;\n\n &:first-child {\n border-top-left-radius: 40px;\n border-bottom-left-radius: 40px;\n }\n\n &:last-child {\n border-top-right-radius: 40px;\n border-bottom-right-radius: 40px;\n }\n }\n\n // This affects ONLY top-level rows\n > tbody > tr {\n background: #fff;\n border-radius: 40px;\n box-shadow: 0px 1px 3px rgba(16, 24, 40, 0.1);\n }\n\n // Round the outer row's corners only on first/last td\n > tbody > tr > td:first-child {\n border-top-left-radius: 40px;\n border-bottom-left-radius: 40px;\n }\n\n > tbody > tr > td:last-child {\n border-top-right-radius: 40px;\n border-bottom-right-radius: 40px;\n }\n\n .scrollClass {\n overflow-x: auto;\n }\n\n .emptyTd {\n text-align: center;\n padding: 40px 0;\n color: #999;\n background: transparent;\n box-shadow: none;\n }\n\n td table {\n border-spacing: 0;\n width: 100%;\n }\n\n td table td {\n background: transparent;\n padding: 8px 12px;\n }\n`;\n\nconst ReturnRowWrapper = styled.div`\n display: flex;\n flex-direction: row;\n gap: 12px;\n padding: 0 12px;\n width: 100%;\n`;\n\nexport default CancelOrderTable;\n"],"names":["deliverTypeOptions","DeliverProductIcon","ReturnProductIcon","collectTypeOptions","CancelOrderTable","cancelOrderProducts","setCancelOrderProducts","useCancelOrderProducts","loading","useLoading","orderStaticData","useOrderStaticData","returnReasonsOptions","option","returnActionOptions","onChange","selectedVal","id","type","updatedList","item","jsx","StyledTableWrapper","jsxs","StyledTable","Skeleton","EmptyDataContainer","Empty","product","dropdownOptions","isReturn","CustomSelectDropdown","val","Fragment","ReturnRowWrapper","StyledDropdown","styled","Select","OrderActionsDropdown"],"mappings":";;;;;;;;;AAYA,MAAMA,IAAqB;AAAA,EACzB;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,IACP,wBAAOC,GAAA,CAAA,CAAmB;AAAA,EAAA;AAAA,EAE5B;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,IACP,wBAAOC,GAAA,CAAA,CAAkB;AAAA,EAAA;AAE7B,GAEMC,IAAqB;AAAA,EACzB;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,IACP,wBAAOD,GAAA,CAAA,CAAkB;AAAA,EAAA;AAE7B,GAEME,IAAmB,MAAM;AAC7B,QAAM;AAAA,IACJC;AAAA,IACAC;AAAA,EAAA,IACEC,EAAA,GAEE,CAACC,CAAO,IAAIC,EAAA,GACZ,CAACC,CAAe,IAAIC,EAAA;AAE1B,MAAI,CAACN,GAAqB;AACxB,WAAO;AAGT,QAAMO,IAAuBF,GAAiB,gBAAgB;AAAA,IAC5D,CAACG,OAAiB;AAAA,MAChB,OAAOA,GAAQ;AAAA,MACf,OAAOA,GAAQ;AAAA,IAAA;AAAA,EACjB,GAGIC,IAAsBJ,GAAiB,6BAA6B;AAAA,IACxE,CAACG,OAAiB;AAAA,MAChB,OAAOA,GAAQ;AAAA,MACf,OAAOA,GAAQ;AAAA,IAAA;AAAA,EACjB,GAGIE,IAAW,CACfC,GACAC,GACAC,MACG;AACH,YAAQ,IAAIF,GAAaC,GAAI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f,IAAqBc,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GASnCD,IAAiBC,EAAOE,CAAoB;AAAA;AAAA,GAIrCd,IAAcY,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAmE5BF,IAAmBE,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
1
+ {"version":3,"file":"CancelOrderTable.js","sources":["../../../../../../src/components/order-view/order-actions/actions/cancel-order/CancelOrderTable.tsx"],"sourcesContent":["import React from 'react';\nimport { useCancelOrderProducts, useOrderStaticData } from '../../../store';\nimport { useLoading } from '../../../../order-daily-overview/store/store';\nimport { Empty, Select, Skeleton } from 'antd';\n// import { AntSelect } from '@bjsdistribution/dms-component-library';\nimport { CancelOrderProductsType } from '../../../types';\nimport OrderActionsDropdown from '../../Dropdown';\nimport styled from 'styled-components';\nimport DeliverProductIcon from '../../../../../assets/icons/DeliverProductIcon';\nimport ReturnProductIcon from '../../../../../assets/icons/ReturnProductIcon';\nimport { EmptyDataContainer } from '../charge-log';\nimport { toReverseDeliveryLabel } from '../../../../../common/utils';\nimport { useClientPortal } from '../../../../store';\n\nconst deliverTypeOptions = [\n {\n label: 'Deliver',\n value: 'deliver',\n icon: <DeliverProductIcon />,\n },\n {\n label: 'Return',\n value: 'return',\n icon: <ReturnProductIcon />,\n },\n];\n\nconst collectTypeOptions = [\n {\n label: 'Return',\n value: 'return',\n icon: <ReturnProductIcon />,\n },\n];\n\nconst CancelOrderTable = () => {\n const [\n cancelOrderProducts,\n setCancelOrderProducts,\n ] = useCancelOrderProducts();\n\n const [loading] = useLoading();\n const [orderStaticData] = useOrderStaticData();\n const [isClientPortal] = useClientPortal();\n\n if (!cancelOrderProducts?.length) {\n return null;\n }\n\n const returnReasonsOptions = orderStaticData?.return_reasons?.map(\n (option: any) => ({\n label: isClientPortal\n ? option?.reason\n : toReverseDeliveryLabel(option?.reason),\n value: option?.reason,\n })\n );\n\n const returnActionOptions = orderStaticData?.order_product_return_action?.map(\n (option: any) => ({\n label: option?.value,\n value: option?.value,\n })\n );\n\n const onChange = (\n selectedVal: string,\n id: number,\n type: keyof CancelOrderProductsType\n ) => {\n console.log(selectedVal, id, type);\n const updatedList = cancelOrderProducts?.map(\n (item: CancelOrderProductsType) => {\n const newItem =\n item.order_product_id === id\n ? {\n ...item,\n [type]: selectedVal,\n }\n : item;\n return newItem;\n }\n );\n setCancelOrderProducts(updatedList);\n };\n\n return (\n <div>\n <StyledTableWrapper>\n <StyledTable className=\"scrollClass\">\n <thead>\n <tr>\n <th>Status</th>\n <th>Code</th>\n <th>Description</th>\n <th>SKU</th>\n </tr>\n </thead>\n <tbody>\n {loading ? (\n <tr>\n <td colSpan={4}>\n <Skeleton active />\n </td>\n </tr>\n ) : cancelOrderProducts?.length === 0 ? (\n <tr>\n <td className=\"emptyTd\" colSpan={4}>\n <EmptyDataContainer>\n <Empty />\n </EmptyDataContainer>\n </td>\n </tr>\n ) : (\n cancelOrderProducts?.map((product: CancelOrderProductsType) => {\n const dropdownOptions =\n product?.product_type === 'deliver'\n ? deliverTypeOptions\n : collectTypeOptions;\n\n const isReturn = product?.action === 'return';\n\n return (\n <tr\n key={product?.order_product_id}\n style={{\n boxShadow: '0px 1px 3px 0px rgba(16, 24, 40, 0.1)',\n }}\n >\n <td colSpan={4}>\n <table style={{ width: '100%' }}>\n <tbody>\n <tr>\n <td style={{ width: '25%' }}>\n <CustomSelectDropdown\n options={dropdownOptions}\n placeholder=\"Select\"\n onChange={(val: any) =>\n onChange(\n val,\n product?.order_product_id!,\n 'action'\n )\n }\n prefix={\n product?.action === 'deliver' ? (\n <DeliverProductIcon />\n ) : product?.action === 'return' ? (\n <ReturnProductIcon />\n ) : (\n <></>\n )\n }\n style={{ width: '100%' }}\n value={dropdownOptions?.filter(\n (item: any) => item?.value === product?.action\n )}\n optionRender={(option: any) => (\n <div\n style={{\n display: 'flex',\n gap: '8px',\n alignItems: 'center',\n }}\n >\n <span\n style={{ display: 'flex' }}\n aria-label={option.data.label}\n >\n {option.data.icon}\n </span>\n <span style={{ color: '#8D8F90' }}>\n {option.data.label}\n </span>\n </div>\n )}\n />\n </td>\n <td style={{ width: '25%' }}>{product?.code}</td>\n <td style={{ width: '25%' }}>\n {product?.description}\n </td>\n <td style={{ width: '25%' }}>{product?.sku}</td>\n </tr>\n\n {isReturn && (\n <tr>\n <td colSpan={4}>\n <ReturnRowWrapper>\n <StyledDropdown\n label=\"Return Action\"\n required\n placeholder=\"Select action\"\n options={returnActionOptions}\n onSelect={(val: any) =>\n onChange(\n val,\n product?.order_product_id!,\n 'return_action'\n )\n }\n value={returnActionOptions?.filter(\n (option: any) =>\n option.value === product?.return_action\n )}\n />\n <StyledDropdown\n label=\"Return Reason\"\n required\n placeholder=\"Select reason\"\n options={returnReasonsOptions}\n onSelect={(val: any) =>\n onChange(\n val,\n product?.order_product_id!,\n 'return_reason'\n )\n }\n value={returnReasonsOptions?.filter(\n (option: any) =>\n option.value === product?.return_reason\n )}\n />\n </ReturnRowWrapper>\n </td>\n </tr>\n )}\n </tbody>\n </table>\n </td>\n </tr>\n );\n })\n )}\n </tbody>\n </StyledTable>\n </StyledTableWrapper>\n </div>\n );\n};\n\nconst CustomSelectDropdown: any = styled(Select)`\n .ant-select-selector {\n border-radius: 25px !important;\n /* border: none !important; */\n min-width: 100px;\n padding: 0 10px;\n display: flex;\n gap: 10px;\n align-items: center;\n\n .ant-select-prefix {\n margin-top: 3px;\n }\n }\n .ant-select-selection-item {\n font-weight: 400;\n font-size: 13px;\n }\n`;\n\nexport const StyledTableWrapper = styled.div`\n width: 100%;\n overflow-x: auto;\n background-color: #fff;\n border-radius: 12px;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);\n padding: 16px;\n`;\n\nconst StyledDropdown = styled(OrderActionsDropdown)`\n flex: 1;\n`;\n\nexport const StyledTable = styled.table`\n width: 100%;\n font-size: 14px;\n color: #333;\n border-spacing: 0 10px;\n\n th,\n td {\n padding: 12px 16px;\n background: #fff;\n }\n\n th {\n background: #f0f2f2;\n\n &:first-child {\n border-top-left-radius: 40px;\n border-bottom-left-radius: 40px;\n }\n\n &:last-child {\n border-top-right-radius: 40px;\n border-bottom-right-radius: 40px;\n }\n }\n\n // This affects ONLY top-level rows\n > tbody > tr {\n background: #fff;\n border-radius: 40px;\n box-shadow: 0px 1px 3px rgba(16, 24, 40, 0.1);\n }\n\n // Round the outer row's corners only on first/last td\n > tbody > tr > td:first-child {\n border-top-left-radius: 40px;\n border-bottom-left-radius: 40px;\n }\n\n > tbody > tr > td:last-child {\n border-top-right-radius: 40px;\n border-bottom-right-radius: 40px;\n }\n\n .scrollClass {\n overflow-x: auto;\n }\n\n .emptyTd {\n text-align: center;\n padding: 40px 0;\n color: #999;\n background: transparent;\n box-shadow: none;\n }\n\n td table {\n border-spacing: 0;\n width: 100%;\n }\n\n td table td {\n background: transparent;\n padding: 8px 12px;\n }\n`;\n\nconst ReturnRowWrapper = styled.div`\n display: flex;\n flex-direction: row;\n gap: 12px;\n padding: 0 12px;\n width: 100%;\n`;\n\nexport default CancelOrderTable;\n"],"names":["deliverTypeOptions","DeliverProductIcon","ReturnProductIcon","collectTypeOptions","CancelOrderTable","cancelOrderProducts","setCancelOrderProducts","useCancelOrderProducts","loading","useLoading","orderStaticData","useOrderStaticData","isClientPortal","useClientPortal","returnReasonsOptions","option","toReverseDeliveryLabel","returnActionOptions","onChange","selectedVal","id","type","updatedList","item","jsx","StyledTableWrapper","jsxs","StyledTable","Skeleton","EmptyDataContainer","Empty","product","dropdownOptions","isReturn","CustomSelectDropdown","val","Fragment","ReturnRowWrapper","StyledDropdown","styled","Select","OrderActionsDropdown"],"mappings":";;;;;;;;;;;AAcA,MAAMA,IAAqB;AAAA,EACzB;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,IACP,wBAAOC,GAAA,CAAA,CAAmB;AAAA,EAAA;AAAA,EAE5B;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,IACP,wBAAOC,GAAA,CAAA,CAAkB;AAAA,EAAA;AAE7B,GAEMC,IAAqB;AAAA,EACzB;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,IACP,wBAAOD,GAAA,CAAA,CAAkB;AAAA,EAAA;AAE7B,GAEME,IAAmB,MAAM;AAC7B,QAAM;AAAA,IACJC;AAAA,IACAC;AAAA,EAAA,IACEC,EAAA,GAEE,CAACC,CAAO,IAAIC,EAAA,GACZ,CAACC,CAAe,IAAIC,EAAA,GACpB,CAACC,CAAc,IAAIC,EAAA;AAEzB,MAAI,CAACR,GAAqB;AACxB,WAAO;AAGT,QAAMS,IAAuBJ,GAAiB,gBAAgB;AAAA,IAC5D,CAACK,OAAiB;AAAA,MAChB,OAAOH,IACHG,GAAQ,SACRC,EAAuBD,GAAQ,MAAM;AAAA,MACzC,OAAOA,GAAQ;AAAA,IAAA;AAAA,EACjB,GAGIE,IAAsBP,GAAiB,6BAA6B;AAAA,IACxE,CAACK,OAAiB;AAAA,MAChB,OAAOA,GAAQ;AAAA,MACf,OAAOA,GAAQ;AAAA,IAAA;AAAA,EACjB,GAGIG,IAAW,CACfC,GACAC,GACAC,MACG;AACH,YAAQ,IAAIF,GAAaC,GAAIC,CAAI;AACjC,UAAMC,IAAcjB,GAAqB;AAAA,MACvC,CAACkB,MAEGA,EAAK,qBAAqBH,IACtB;AAAA,QACE,GAAGG;AAAA,QACH,CAACF,CAAI,GAAGF;AA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A;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAmE5BF,IAAmBE,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
@@ -1,32 +1,45 @@
1
- import { jsx as s } from "react/jsx-runtime";
2
- import { useOrderStaticData as c, useCancelOrderProducts as u } from "../../../store.js";
3
- import l from "../../Dropdown.js";
4
- function R() {
5
- const [r] = c(), [, t] = u(), o = r?.return_reasons?.map(
1
+ import { jsxs as c, Fragment as i, jsx as r } from "react/jsx-runtime";
2
+ import { useOrderStaticData as p, useCancelOrderProducts as m } from "../../../store.js";
3
+ import u from "../../Dropdown.js";
4
+ import { createGlobalStyle as d } from "styled-components";
5
+ import { toReverseDeliveryLabel as R } from "../../../../../common/utils.js";
6
+ import { useClientPortal as f } from "../../../../store.js";
7
+ const w = d`
8
+ .returnReasonDropdown.ant-select-dropdown {
9
+ min-width: 420px !important;
10
+ max-width: 90vw !important;
11
+ }
12
+ `;
13
+ function v() {
14
+ const [t] = p(), [, o] = m(), [n] = f(), a = t?.return_reasons?.map(
6
15
  (e) => ({
7
- label: e?.reason,
16
+ label: n ? e?.reason : R(e?.reason),
8
17
  value: e?.reason
9
18
  })
10
19
  );
11
- return /* @__PURE__ */ s(
12
- l,
13
- {
14
- label: "Return Reason",
15
- placeholder: "Select Return Reason",
16
- options: o,
17
- onSelect: (e) => {
18
- t(
19
- (n) => n?.map((a) => ({
20
- ...a,
21
- action: "return",
22
- return_reason: e
23
- }))
24
- );
20
+ return /* @__PURE__ */ c(i, { children: [
21
+ /* @__PURE__ */ r(w, {}),
22
+ /* @__PURE__ */ r(
23
+ u,
24
+ {
25
+ label: "Return Reason",
26
+ placeholder: "Select Return Reason",
27
+ options: a,
28
+ onSelect: (e) => {
29
+ o(
30
+ (s) => s?.map((l) => ({
31
+ ...l,
32
+ action: "return",
33
+ return_reason: e
34
+ }))
35
+ );
36
+ },
37
+ popupClassName: "returnReasonDropdown"
25
38
  }
26
- }
27
- );
39
+ )
40
+ ] });
28
41
  }
29
42
  export {
30
- R as default
43
+ v as default
31
44
  };
32
45
  //# sourceMappingURL=ReturnReason.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ReturnReason.js","sources":["../../../../../../src/components/order-view/order-actions/actions/cancel-order/ReturnReason.tsx"],"sourcesContent":["import { useCancelOrderProducts, useOrderStaticData } from '../../../store';\nimport { CancelOrderProductsType } from '../../../types';\nimport OrderActionsDropdown from '../../Dropdown';\nimport React from 'react';\nfunction ReturnReason() {\n const [orderStaticData] = useOrderStaticData();\n const [, setCancelOrderProducts] = useCancelOrderProducts();\n\n const returnReasonsOptions = orderStaticData?.return_reasons?.map(\n (option: any) => ({\n label: option?.reason,\n value: option?.reason,\n })\n );\n const onSelect = (selectedValue: any) => {\n setCancelOrderProducts((prev: CancelOrderProductsType[]) =>\n prev?.map((item: any) => ({\n ...item,\n action: 'return',\n return_reason: selectedValue,\n }))\n );\n };\n // const onSearch = () => {};\n\n return (\n <OrderActionsDropdown\n label=\"Return Reason\"\n placeholder=\"Select Return Reason\"\n options={returnReasonsOptions}\n onSelect={onSelect}\n // onSearch={onSearch}\n />\n );\n}\n\nexport default ReturnReason;\n"],"names":["ReturnReason","orderStaticData","useOrderStaticData","setCancelOrderProducts","useCancelOrderProducts","returnReasonsOptions","option","jsx","OrderActionsDropdown","selectedValue","prev","item"],"mappings":";;;AAIA,SAASA,IAAe;AACtB,QAAM,CAACC,CAAe,IAAIC,EAAA,GACpB,CAAA,EAAGC,CAAsB,IAAIC,EAAA,GAE7BC,IAAuBJ,GAAiB,gBAAgB;AAAA,IAC5D,CAACK,OAAiB;AAAA,MAChB,OAAOA,GAAQ;AAAA,MACf,OAAOA,GAAQ;AAAA,IAAA;AAAA,EACjB;AAaF,SACE,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,OAAM;AAAA,MACN,aAAY;AAAA,MACZ,SAASH;AAAA,MACT,UAhBa,CAACI,MAAuB;AACvC,QAAAN;AAAA,UAAuB,CAACO,MACtBA,GAAM,IAAI,CAACC,OAAe;AAAA,YACxB,GAAGA;AAAA,YACH,QAAQ;AAAA,YACR,eAAeF;AAAA,UAAA,EACf;AAAA,QAAA;AAAA,MAEN;AAAA,IAQI;AAAA,EAAA;AAIN;"}
1
+ {"version":3,"file":"ReturnReason.js","sources":["../../../../../../src/components/order-view/order-actions/actions/cancel-order/ReturnReason.tsx"],"sourcesContent":["import { useCancelOrderProducts, useOrderStaticData } from '../../../store';\nimport { CancelOrderProductsType } from '../../../types';\nimport OrderActionsDropdown from '../../Dropdown';\nimport React from 'react';\nimport { createGlobalStyle } from 'styled-components';\nimport { toReverseDeliveryLabel } from '../../../../../common/utils';\nimport { useClientPortal } from '../../../../store';\n\nconst ReturnReasonDropdownStyle = createGlobalStyle`\n .returnReasonDropdown.ant-select-dropdown {\n min-width: 420px !important;\n max-width: 90vw !important;\n }\n`;\n\nfunction ReturnReason() {\n const [orderStaticData] = useOrderStaticData();\n const [, setCancelOrderProducts] = useCancelOrderProducts();\n const [isClientPortal] = useClientPortal();\n\n const returnReasonsOptions = orderStaticData?.return_reasons?.map(\n (option: any) => ({\n label: isClientPortal\n ? option?.reason\n : toReverseDeliveryLabel(option?.reason),\n value: option?.reason,\n })\n );\n const onSelect = (selectedValue: any) => {\n setCancelOrderProducts((prev: CancelOrderProductsType[]) =>\n prev?.map((item: any) => ({\n ...item,\n action: 'return',\n return_reason: selectedValue,\n }))\n );\n };\n // const onSearch = () => {};\n\n return (\n <>\n <ReturnReasonDropdownStyle />\n <OrderActionsDropdown\n label=\"Return Reason\"\n placeholder=\"Select Return Reason\"\n options={returnReasonsOptions}\n onSelect={onSelect}\n popupClassName=\"returnReasonDropdown\"\n // onSearch={onSearch}\n />\n </>\n );\n}\n\nexport default ReturnReason;\n"],"names":["ReturnReasonDropdownStyle","createGlobalStyle","ReturnReason","orderStaticData","useOrderStaticData","setCancelOrderProducts","useCancelOrderProducts","isClientPortal","useClientPortal","returnReasonsOptions","option","toReverseDeliveryLabel","jsxs","Fragment","jsx","OrderActionsDropdown","selectedValue","prev","item"],"mappings":";;;;;;AAQA,MAAMA,IAA4BC;AAAA;AAAA;AAAA;AAAA;AAAA;AAOlC,SAASC,IAAe;AACtB,QAAM,CAACC,CAAe,IAAIC,EAAA,GACpB,CAAA,EAAGC,CAAsB,IAAIC,EAAA,GAC7B,CAACC,CAAc,IAAIC,EAAA,GAEnBC,IAAuBN,GAAiB,gBAAgB;AAAA,IAC5D,CAACO,OAAiB;AAAA,MAChB,OAAOH,IACHG,GAAQ,SACRC,EAAuBD,GAAQ,MAAM;AAAA,MACzC,OAAOA,GAAQ;AAAA,IAAA;AAAA,EACjB;AAaF,SACE,gBAAAE,EAAAC,GAAA,EACE,UAAA;AAAA,IAAA,gBAAAC,EAACd,GAAA,EAA0B;AAAA,IAC3B,gBAAAc;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,OAAM;AAAA,QACN,aAAY;AAAA,QACZ,SAASN;AAAA,QACT,UAlBW,CAACO,MAAuB;AACvC,UAAAX;AAAA,YAAuB,CAACY,MACtBA,GAAM,IAAI,CAACC,OAAe;AAAA,cACxB,GAAGA;AAAA,cACH,QAAQ;AAAA,cACR,eAAeF;AAAA,YAAA,EACf;AAAA,UAAA;AAAA,QAEN;AAAA,QAWM,gBAAe;AAAA,MAAA;AAAA,IAAA;AAAA,EAEjB,GACF;AAEJ;"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../../../src/components/order-view/order-actions/actions/cancel-order/index.tsx"],"sourcesContent":["import styled from 'styled-components';\nimport React, { useEffect, useState } from 'react';\nimport OrderActionModal from '../../../../../common/modals/order-action-modal/OrderActionModal';\nimport ReturnAction from './ReturnAction';\nimport ReturnReason from './ReturnReason';\nimport {\n useCancelOrderProducts,\n useCurrentAction,\n useCustomerInfo,\n useOrderId,\n useOrderStaticData,\n useProductDetails,\n} from '../../../store';\nimport OrderActionsDropdown from '../../Dropdown';\nimport { TextArea, useAxios } from '@bjsdistribution/dms-component-library';\nimport { ApiResponse, CancelOrderProductsType } from '../../../types';\nimport { notification } from 'antd';\nimport CancelOrderTable from './CancelOrderTable';\n\ninterface IProps {\n callOrdersApi: any;\n callOrderStatusApi: any;\n callOrderAlertsApi: any;\n callOrderProductsApi: any;\n}\n\nfunction CancelOrder(props: IProps) {\n const [orderId] = useOrderId();\n const [, setCurrentAction] = useCurrentAction();\n const [orderProductDetails] = useProductDetails();\n const [\n cancelOrderProducts,\n setCancelOrderProducts,\n ] = useCancelOrderProducts();\n const [customerInfo] = useCustomerInfo();\n const infoText = `${customerInfo?.recipient_name}, ${customerInfo?.postcode}`;\n\n const [orderStaticData] = useOrderStaticData();\n\n const [cancelReason, setCancelReason] = useState<string | undefined>(\n undefined\n );\n\n const [cancelNotes, setCancelNotes] = useState<string>('');\n\n const cancelReasonOptions = orderStaticData?.return_cancellation_reasons?.map(\n (item: any) => {\n return {\n label: item?.reason,\n value: item?.reason,\n };\n }\n );\n\n const { fetchData: callCancelApi } = useAxios<{\n data: ApiResponse[];\n }>({\n endpoint: `v1/orders/cancel/?order_id=${orderId}`,\n method: 'POST',\n });\n\n useEffect(() => {\n const receivedProducts = orderProductDetails?.filter(\n (product: any) =>\n product?.status_value === 'received' &&\n product?.order_product_type?.type !== 'return'\n );\n const modifiedReceivedProducts =\n receivedProducts?.length > 0\n ? receivedProducts?.map((product: any) => {\n return {\n order_product_id: product?.id,\n action: '',\n return_action: '',\n return_reason: '',\n code: product?.code,\n description: product?.description,\n sku: product?.sku,\n product_type: product?.order_product_type?.type,\n };\n })\n : [];\n setCancelOrderProducts(modifiedReceivedProducts);\n }, [orderProductDetails]);\n\n const onClose = () => {\n setCurrentAction(undefined);\n setCancelOrderProducts([]);\n };\n\n const onSelectCancelReason = (value: string) => {\n setCancelReason(value);\n };\n\n const onChangeNotes = (event: any) => {\n setCancelNotes(event.target.value);\n };\n\n const onSubmitCancel = async () => {\n const productsPayload = cancelOrderProducts?.map(\n (product: CancelOrderProductsType) => {\n if (product?.action === 'deliver') {\n return {\n order_product_id: product?.order_product_id,\n action: product?.action,\n };\n }\n return {\n order_product_id: product?.order_product_id,\n action: product?.action,\n return_action: product?.return_action,\n return_reason: product?.return_reason,\n };\n }\n );\n\n // VALIDATIONS START\n\n const productsPayloadActions = productsPayload?.map(\n (product: CancelOrderProductsType) => {\n if (product?.action !== '') {\n return true;\n }\n return false;\n }\n );\n\n if (productsPayloadActions?.includes(false)) {\n notification.error({\n message: 'Error',\n description: `please fill product status field`,\n });\n return;\n }\n\n const productsPayloadValidate = productsPayload?.map(\n (product: CancelOrderProductsType) => {\n if (product?.action === 'return') {\n return product?.return_action !== '' && product?.return_reason !== '';\n }\n return true;\n }\n );\n\n if (productsPayloadValidate?.includes(false)) {\n notification.error({\n message: 'Error',\n description: `please fill all the mandatory fields`,\n });\n return;\n }\n\n // VALIDATIONS END\n\n const apiPayload = {\n cancelled_reason: cancelReason,\n cancelled_notes: cancelNotes,\n products: productsPayload,\n };\n\n if (orderId) {\n const response = (await callCancelApi({\n payload: apiPayload,\n })) as {\n code: number | null;\n error?: string | null | undefined;\n [key: string]: any;\n };\n if (response?.code === 200) {\n notification.success({\n message: 'Success',\n description: `${response.message}`,\n });\n // call orders api to update status\n await props?.callOrderProductsApi();\n await props?.callOrderAlertsApi();\n await props?.callOrderStatusApi();\n await props?.callOrdersApi();\n }\n if (response?.code !== 200) {\n notification.error({\n message: 'Error',\n description: `${response.error}`,\n });\n setCurrentAction(undefined);\n }\n }\n };\n\n const showSubmitBtn = cancelReason !== undefined;\n\n return (\n <OrderActionModal\n headerTitle=\"Cancel Order\"\n showAdditionalInfo\n infoText={infoText}\n onCloseHeader={onClose}\n onSubmit={onSubmitCancel}\n submitBtnTitle=\"Save Details\"\n isSubmitDisabled={!showSubmitBtn}\n >\n <ContentContainer>\n <Top>\n <TopLeft>\n <OrderActionsDropdown\n required\n label=\"Cancellation Reason\"\n placeholder=\"Select Cancellation Reason\"\n options={cancelReasonOptions || []}\n onSelect={onSelectCancelReason}\n value={cancelReason}\n />\n <Wrapper>\n <ReturnAction />\n <ReturnReason />\n </Wrapper>\n </TopLeft>\n <TopRight>\n <Container>\n <div style={{ display: 'flex', flexDirection: 'row' }}>\n <Label>Cancellation Note</Label>\n </div>\n <TArea\n rows={5}\n onChange={onChangeNotes}\n value={cancelNotes}\n placeholder=\"Reason for Cancel Order\"\n />\n </Container>\n </TopRight>\n </Top>\n <Bottom>\n <CancelOrderTable />\n </Bottom>\n </ContentContainer>\n </OrderActionModal>\n );\n}\n\nconst TArea = styled(TextArea)`\n resize: none;\n`;\n\nconst Label = styled.label`\n color: #6a7378;\n font-family: 'Lato', sans-serif;\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n`;\n\nconst Container = styled.div`\n display: flex;\n flex-direction: column;\n gap: 6px;\n`;\n\nconst Wrapper = styled.div`\n display: flex;\n gap: 15px;\n width: 100%;\n > div {\n width: 50%;\n }\n`;\n\nconst TopLeft = styled.div`\n display: flex;\n flex-direction: column;\n gap: 15px;\n width: 50%;\n`;\n\nconst TopRight = styled.div`\n width: 50%;\n`;\n\nconst Top = styled.div`\n width: 100%;\n border-radius: 16px;\n border: 1px solid #edebe8;\n background: #f8fafc;\n display: flex;\n padding: 15px;\n align-items: flex-start;\n gap: 30px;\n align-self: stretch;\n`;\n\nconst Bottom = styled.div``;\n\nconst ContentContainer = styled.div`\n display: flex;\n padding: 15px;\n align-items: flex-start;\n flex-direction: column;\n width: 100%;\n`;\n\nexport default CancelOrder;\n"],"names":["CancelOrder","props","orderId","useOrderId","setCurrentAction","useCurrentAction","orderProductDetails","useProductDetails","cancelOrderProducts","setCancelOrderProducts","useCancelOrderProducts","customerInfo","useCustomerInfo","infoText","orderStaticData","useOrderStaticData","cancelReason","setCancelReason","useState","cancelNotes","setCancelNotes","cancelReasonOptions","item","callCancelApi","useAxios","useEffect","receivedProducts","product","modifiedReceivedProducts","jsx","OrderActionModal","productsPayload","notification","apiPayload","response","ContentContainer","jsxs","Top","TopLeft","OrderActionsDropdown","value","Wrapper","ReturnAction","ReturnReason","TopRight","Container","Label","TArea","event","Bottom","CancelOrderTable","styled","TextArea"],"mappings":";;;;;;;;;;;AA0BA,SAASA,GAAYC,GAAe;AAClC,QAAM,CAACC,CAAO,IAAIC,EAAA,GACZ,CAAA,EAAGC,CAAgB,IAAIC,EAAA,GACvB,CAACC,CAAmB,IAAIC,EAAA,GACxB;AAAA,IACJC;AAAA,IACAC;AAAA,EAAA,IACEC,EAAA,GACE,CAACC,CAAY,IAAIC,EAAA,GACjBC,IAAW,GAAGF,GAAc,cAAc,KAAKA,GAAc,QAAQ,IAErE,CAACG,CAAe,IAAIC,EAAA,GAEpB,CAACC,GAAcC,CAAe,IAAIC;AAAA,IACtC;AAAA,EAAA,GAGI,CAACC,GAAaC,CAAc,IAAIF,EAAiB,EAAE,GAEnDG,IAAsBP,GAAiB,6BAA6B;AAAA,IACxE,CAACQ,OACQ;AAAA,MACL,OAAOA,GAAM;AAAA,MACb,OAAOA,GAAM;AAAA,IAAA;AAAA,EAEjB,GAGI,EAAE,WAAWC,EAAA,IAAkBC,EAElC;AAAA,IACD,UAAU,8BAA8BtB,CAAO;AAAA,IAC/C,QAAQ;AAAA,EAAA,CACT;AAED,SAAAuB,EAAU,MAAM;AACd,UAAMC,IAAmBpB,GAAqB;AAAA,MAC5C,CAACqB,MACCA,GAAS,iBAAiB,cAC1BA,GAAS,oBAAoB,SAAS;AAAA,IAAA,GAEpC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,GAAA,EACC,UAAA;AAAA,YAAA,gBAAAhB,EAAC,OAAA,EAAI,OAAO,EAAE,SAAS,QAAQ,eAAe,MAAA,GAC5C,UAAA,gBAAAA,EAACiB,GAAA,EAAM,UAAA,oBAAA,CAAiB,GAC1B;AAAA,YACA,gBAAAjB;AAAA,cAACkB;AAAA,cAAA;AAAA,gBACC,MAAM;AAAA,gBACN,UAlIQ,CAACC,MAAe;AACpC,kBAAA5B,EAAe4B,EAAM,OAAO,KAAK;AAAA,gBACnC;AAAA,gBAiIc,OAAO7B;AAAA,gBACP,aAAY;AAAA,cAAA;AAAA,YAAA;AAAA,UACd,EAAA,CACF,EAAA,CACF;AAAA,QAAA,GACF;AAAA,QACA,gBAAAU,EAACoB,GAAA,EACC,UAAA,gBAAApB,EAACqB,GAAA,CAAA,CAAiB,EAAA,CACpB;AAAA,MAAA,EAAA,CACF;AAAA,IAAA;AAAA,EAAA;AAGN;AAEA,MAAMH,IAAQI,EAAOC,CAAQ;AAAA;AAAA,GAIvBN,IAAQK,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAQfN,IAAYM,EAAO;AAAA;AAAA;AAAA;AAAA,GAMnBV,IAAUU,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GASjBb,IAAUa,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA,GAOjBP,IAAWO,EAAO;AAAA;AAAA,GAIlBd,IAAMc,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAYbF,IAASE,EAAO,OAEhBhB,IAAmBgB,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../../../src/components/order-view/order-actions/actions/cancel-order/index.tsx"],"sourcesContent":["import styled from 'styled-components';\nimport React, { useEffect, useState } from 'react';\nimport OrderActionModal from '../../../../../common/modals/order-action-modal/OrderActionModal';\nimport ReturnAction from './ReturnAction';\nimport ReturnReason from './ReturnReason';\nimport {\n useCancelOrderProducts,\n useCurrentAction,\n useCustomerInfo,\n useOrderId,\n useOrderStaticData,\n useProductDetails,\n} from '../../../store';\nimport OrderActionsDropdown from '../../Dropdown';\nimport { TextArea, useAxios } from '@bjsdistribution/dms-component-library';\nimport { ApiResponse, CancelOrderProductsType } from '../../../types';\nimport { notification } from 'antd';\nimport CancelOrderTable from './CancelOrderTable';\n\ninterface IProps {\n callOrdersApi: any;\n callOrderStatusApi: any;\n callOrderAlertsApi: any;\n callOrderProductsApi: any;\n}\n\nfunction CancelOrder(props: IProps) {\n const [orderId] = useOrderId();\n const [, setCurrentAction] = useCurrentAction();\n const [orderProductDetails] = useProductDetails();\n const [\n cancelOrderProducts,\n setCancelOrderProducts,\n ] = useCancelOrderProducts();\n const [customerInfo] = useCustomerInfo();\n const infoText = `${customerInfo?.recipient_name}, ${customerInfo?.postcode}`;\n\n const [orderStaticData] = useOrderStaticData();\n\n const [cancelReason, setCancelReason] = useState<string | undefined>(\n undefined\n );\n\n const [cancelNotes, setCancelNotes] = useState<string>('');\n\n const cancelReasonOptions = orderStaticData?.return_cancellation_reasons?.map(\n (item: any) => {\n return {\n label: item?.reason,\n value: item?.reason,\n };\n }\n );\n\n const { fetchData: callCancelApi } = useAxios<{\n data: ApiResponse[];\n }>({\n endpoint: `v1/orders/cancel/?order_id=${orderId}`,\n method: 'POST',\n });\n\n useEffect(() => {\n const receivedProducts = orderProductDetails?.filter(\n (product: any) =>\n product?.status_value === 'received' &&\n product?.order_product_type?.type !== 'return'\n );\n const modifiedReceivedProducts =\n receivedProducts?.length > 0\n ? receivedProducts?.map((product: any) => {\n return {\n order_product_id: product?.id,\n action: '',\n return_action: '',\n return_reason: '',\n code: product?.code,\n description: product?.description,\n sku: product?.sku,\n product_type: product?.order_product_type?.type,\n };\n })\n : [];\n setCancelOrderProducts(modifiedReceivedProducts);\n }, [orderProductDetails]);\n\n const onClose = () => {\n setCurrentAction(undefined);\n setCancelOrderProducts([]);\n };\n\n const onSelectCancelReason = (value: string) => {\n setCancelReason(value);\n };\n\n const onChangeNotes = (event: any) => {\n setCancelNotes(event.target.value);\n };\n\n const onSubmitCancel = async () => {\n const productsPayload = cancelOrderProducts?.map(\n (product: CancelOrderProductsType) => {\n if (product?.action === 'deliver') {\n return {\n order_product_id: product?.order_product_id,\n action: product?.action,\n };\n }\n return {\n order_product_id: product?.order_product_id,\n action: product?.action,\n return_action: product?.return_action,\n return_reason: product?.return_reason,\n };\n }\n );\n\n // VALIDATIONS START\n\n const productsPayloadActions = productsPayload?.map(\n (product: CancelOrderProductsType) => {\n if (product?.action !== '') {\n return true;\n }\n return false;\n }\n );\n\n if (productsPayloadActions?.includes(false)) {\n notification.error({\n message: 'Error',\n description: `please fill product status field`,\n });\n return;\n }\n\n const productsPayloadValidate = productsPayload?.map(\n (product: CancelOrderProductsType) => {\n if (product?.action === 'return') {\n return product?.return_action !== '' && product?.return_reason !== '';\n }\n return true;\n }\n );\n\n if (productsPayloadValidate?.includes(false)) {\n notification.error({\n message: 'Error',\n description: `please fill all the mandatory fields`,\n });\n return;\n }\n\n // VALIDATIONS END\n\n const apiPayload = {\n cancelled_reason: cancelReason,\n cancelled_notes: cancelNotes,\n products: productsPayload,\n };\n\n if (orderId) {\n const response = (await callCancelApi({\n payload: apiPayload,\n })) as {\n code: number | null;\n error?: string | null | undefined;\n [key: string]: any;\n };\n if (response?.code === 200) {\n notification.success({\n message: 'Success',\n description: `${response.message}`,\n });\n // call orders api to update status\n await props?.callOrderProductsApi();\n await props?.callOrderAlertsApi();\n await props?.callOrderStatusApi();\n await props?.callOrdersApi();\n }\n if (response?.code !== 200) {\n notification.error({\n message: 'Error',\n description: `${response.error}`,\n });\n setCurrentAction(undefined);\n }\n }\n };\n\n const showSubmitBtn = cancelReason !== undefined;\n\n return (\n <OrderActionModal\n headerTitle=\"Cancel Order\"\n showAdditionalInfo\n infoText={infoText}\n onCloseHeader={onClose}\n onSubmit={onSubmitCancel}\n submitBtnTitle=\"Save Details\"\n isSubmitDisabled={!showSubmitBtn}\n >\n <ContentContainer>\n <Top>\n <TopLeft>\n <OrderActionsDropdown\n required\n label=\"Cancellation Reason\"\n placeholder=\"Select Cancellation Reason\"\n options={cancelReasonOptions || []}\n onSelect={onSelectCancelReason}\n value={cancelReason}\n />\n <Wrapper>\n <ReturnAction />\n <ReturnReason />\n </Wrapper>\n </TopLeft>\n <TopRight>\n <Container>\n <div style={{ display: 'flex', flexDirection: 'row' }}>\n <Label>Cancellation Note</Label>\n </div>\n <TArea\n rows={5}\n onChange={onChangeNotes}\n value={cancelNotes}\n placeholder=\"Reason for Cancel Order\"\n />\n </Container>\n </TopRight>\n </Top>\n <Bottom>\n <CancelOrderTable />\n </Bottom>\n </ContentContainer>\n </OrderActionModal>\n );\n}\nconst TArea = styled(TextArea)`\n resize: none;\n`;\n\nconst Label = styled.label`\n color: #6a7378;\n font-family: 'Lato', sans-serif;\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n`;\n\nconst Container = styled.div`\n display: flex;\n flex-direction: column;\n gap: 6px;\n`;\n\nconst Wrapper = styled.div`\n display: flex;\n gap: 15px;\n width: 100%;\n > div {\n width: 50%;\n }\n`;\n\nconst TopLeft = styled.div`\n display: flex;\n flex-direction: column;\n gap: 15px;\n width: 50%;\n`;\n\nconst TopRight = styled.div`\n width: 50%;\n`;\n\nconst Top = styled.div`\n width: 100%;\n border-radius: 16px;\n border: 1px solid #edebe8;\n background: #f8fafc;\n display: flex;\n padding: 15px;\n align-items: flex-start;\n gap: 30px;\n align-self: stretch;\n`;\n\nconst Bottom = styled.div``;\n\nconst ContentContainer = styled.div`\n display: flex;\n padding: 15px;\n align-items: flex-start;\n flex-direction: column;\n width: 100%;\n`;\n\nexport default CancelOrder;\n"],"names":["CancelOrder","props","orderId","useOrderId","setCurrentAction","useCurrentAction","orderProductDetails","useProductDetails","cancelOrderProducts","setCancelOrderProducts","useCancelOrderProducts","customerInfo","useCustomerInfo","infoText","orderStaticData","useOrderStaticData","cancelReason","setCancelReason","useState","cancelNotes","setCancelNotes","cancelReasonOptions","item","callCancelApi","useAxios","useEffect","receivedProducts","product","modifiedReceivedProducts","jsx","OrderActionModal","productsPayload","notification","apiPayload","response","ContentContainer","jsxs","Top","TopLeft","OrderActionsDropdown","value","Wrapper","ReturnAction","ReturnReason","TopRight","Container","Label","TArea","event","Bottom","CancelOrderTable","styled","TextArea"],"mappings":";;;;;;;;;;;AA0BA,SAASA,GAAYC,GAAe;AAClC,QAAM,CAACC,CAAO,IAAIC,EAAA,GACZ,CAAA,EAAGC,CAAgB,IAAIC,EAAA,GACvB,CAACC,CAAmB,IAAIC,EAAA,GACxB;AAAA,IACJC;AAAA,IACAC;AAAA,EAAA,IACEC,EAAA,GACE,CAACC,CAAY,IAAIC,EAAA,GACjBC,IAAW,GAAGF,GAAc,cAAc,KAAKA,GAAc,QAAQ,IAErE,CAACG,CAAe,IAAIC,EAAA,GAEpB,CAACC,GAAcC,CAAe,IAAIC;AAAA,IACtC;AAAA,EAAA,GAGI,CAACC,GAAaC,CAAc,IAAIF,EAAiB,EAAE,GAEnDG,IAAsBP,GAAiB,6BAA6B;AAAA,IACxE,CAACQ,OACQ;AAAA,MACL,OAAOA,GAAM;AAAA,MACb,OAAOA,GAAM;AAAA,IAAA;AAAA,EAEjB,GAGI,EAAE,WAAWC,EAAA,IAAkBC,EAElC;AAAA,IACD,UAAU,8BAA8BtB,CAAO;AAAA,IAC/C,QAAQ;AAAA,EAAA,CACT;AAED,SAAAuB,EAAU,MAAM;AACd,UAAMC,IAAmBpB,GAAqB;AAAA,MAC5C,CAACqB,MACCA,GAAS,iBAAiB,cAC1BA,GAAS,oBAAoB,SAAS;AAAA,IAAA,GAEpCC,IACJF,GAAkB,SAAS,IACvBA,GAAkB,IAAI,CAACC,OAChB;AAAA,MACL,kBAAkBA,GAAS;AAAA,MAC3B,QAAQ;AAAA,MACR,eAAe;AAAA,MACf,eAAe;AAAA,MACf,MAAMA,GAAS;AAAA,MACf,aAA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,gBAAAjB;AAAA,cAACkB;AAAA,cAAA;AAAA,gBACC,MAAM;AAAA,gBACN,UAlIQ,CAACC,MAAe;AACpC,kBAAA5B,EAAe4B,EAAM,OAAO,KAAK;AAAA,gBACnC;AAAA,gBAiIc,OAAO7B;AAAA,gBACP,aAAY;AAAA,cAAA;AAAA,YAAA;AAAA,UACd,EAAA,CACF,EAAA,CACF;AAAA,QAAA,GACF;AAAA,QACA,gBAAAU,EAACoB,GAAA,EACC,UAAA,gBAAApB,EAACqB,GAAA,CAAA,CAAiB,EAAA,CACpB;AAAA,MAAA,EAAA,CACF;AAAA,IAAA;AAAA,EAAA;AAGN;AACA,MAAMH,IAAQI,EAAOC,CAAQ;AAAA;AAAA,GAIvBN,IAAQK,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAQfN,IAAYM,EAAO;AAAA;AAAA;AAAA;AAAA,GAMnBV,IAAUU,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GASjBb,IAAUa,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA,GAOjBP,IAAWO,EAAO;AAAA;AAAA,GAIlBd,IAAMc,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAYbF,IAASE,EAAO,OAEhBhB,IAAmBgB,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
@@ -1,38 +1,40 @@
1
- import { jsxs as e, jsx as t } from "react/jsx-runtime";
2
- import i from "styled-components";
1
+ import { jsxs as r, jsx as t } from "react/jsx-runtime";
2
+ import n from "styled-components";
3
3
  import { useProductDetails as d } from "../../../../store.js";
4
- import { Skeleton as o, Empty as c } from "antd";
5
- import { useLoading as a } from "../../../../../order-daily-overview/store/store.js";
6
- import { StyledTableWrapper as s, StyledTable as h, EmptyDataContainer as p } from "./ReminderStyles.js";
7
- function P() {
8
- const [n] = d(), [l] = a();
9
- return n ? /* @__PURE__ */ e(f, { children: [
10
- /* @__PURE__ */ e(m, { children: [
4
+ import { Skeleton as c, Empty as a } from "antd";
5
+ import { useLoading as s } from "../../../../../order-daily-overview/store/store.js";
6
+ import { StyledTableWrapper as p, StyledTable as h, EmptyDataContainer as m } from "./ReminderStyles.js";
7
+ import { toReverseDeliveryLabel as f } from "../../../../../../common/utils.js";
8
+ import { useClientPortal as u } from "../../../../../store.js";
9
+ function _() {
10
+ const [i] = d(), [l] = s(), [o] = u();
11
+ return i ? /* @__PURE__ */ r(g, { children: [
12
+ /* @__PURE__ */ r(y, { children: [
11
13
  "Products (",
12
- n?.length,
14
+ i?.length,
13
15
  ")"
14
16
  ] }),
15
- /* @__PURE__ */ t(s, { children: /* @__PURE__ */ e(h, { className: "scrollClass", children: [
16
- /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ e("tr", { children: [
17
+ /* @__PURE__ */ t(p, { children: /* @__PURE__ */ r(h, { className: "scrollClass", children: [
18
+ /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ r("tr", { children: [
17
19
  /* @__PURE__ */ t("th", { children: "Action" }),
18
20
  /* @__PURE__ */ t("th", { children: "Code" }),
19
21
  /* @__PURE__ */ t("th", { children: "Description" }),
20
22
  /* @__PURE__ */ t("th", { children: "Parts" })
21
23
  ] }) }),
22
- /* @__PURE__ */ t("tbody", { children: l ? /* @__PURE__ */ e("tr", { children: [
23
- /* @__PURE__ */ t("td", { colSpan: 6, children: /* @__PURE__ */ t(o, { active: !0 }) }),
24
+ /* @__PURE__ */ t("tbody", { children: l ? /* @__PURE__ */ r("tr", { children: [
25
+ /* @__PURE__ */ t("td", { colSpan: 6, children: /* @__PURE__ */ t(c, { active: !0 }) }),
24
26
  /* @__PURE__ */ t("td", { colSpan: 6 })
25
- ] }) : n?.length === 0 ? /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ t("td", { className: "emptyTd", colSpan: 7, children: /* @__PURE__ */ t(p, { children: /* @__PURE__ */ t(c, {}) }) }) }) : n?.map((r) => /* @__PURE__ */ e("tr", { children: [
26
- /* @__PURE__ */ t("td", { children: r?.order_product_type?.type }),
27
+ ] }) : i?.length === 0 ? /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ t("td", { className: "emptyTd", colSpan: 7, children: /* @__PURE__ */ t(m, { children: /* @__PURE__ */ t(a, {}) }) }) }) : i?.map((e) => /* @__PURE__ */ r("tr", { children: [
28
+ /* @__PURE__ */ t("td", { children: o ? e?.order_product_type?.type : f(e?.order_product_type?.type) }),
27
29
  " ",
28
- /* @__PURE__ */ t("td", { children: r?.code }),
29
- /* @__PURE__ */ t("td", { children: r?.description }),
30
- /* @__PURE__ */ t("td", { children: r?.sku })
31
- ] }, r.id)) })
30
+ /* @__PURE__ */ t("td", { children: e?.code }),
31
+ /* @__PURE__ */ t("td", { children: e?.description }),
32
+ /* @__PURE__ */ t("td", { children: e?.sku })
33
+ ] }, e.id)) })
32
34
  ] }) })
33
35
  ] }) : null;
34
36
  }
35
- const m = i.h2`
37
+ const y = n.h2`
36
38
  color: #3a3630;
37
39
  font-family: 'Roboto', sans-serif;
38
40
  font-size: 16px;
@@ -41,7 +43,7 @@ const m = i.h2`
41
43
  text-transform: uppercase;
42
44
  padding: 0;
43
45
  margin: 0;
44
- `, f = i.div`
46
+ `, g = n.div`
45
47
  display: flex;
46
48
  flex-direction: column;
47
49
  gap: 8px;
@@ -50,6 +52,6 @@ const m = i.h2`
50
52
  }
51
53
  `;
52
54
  export {
53
- P as default
55
+ _ as default
54
56
  };
55
57
  //# sourceMappingURL=ProductTable.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ProductTable.js","sources":["../../../../../../../src/components/order-view/order-actions/actions/confirm-order/tables/ProductTable.tsx"],"sourcesContent":["import React from 'react';\nimport styled from 'styled-components';\nimport { useProductDetails } from '../../../../store';\n\nimport { Empty, Skeleton } from 'antd';\nimport { useLoading } from '../../../../../order-daily-overview/store/store';\nimport {\n EmptyDataContainer,\n StyledTable,\n StyledTableWrapper,\n} from './ReminderStyles';\n\nfunction ProductTable() {\n const [orderProductDetails] = useProductDetails();\n const [loading] = useLoading();\n\n if (!orderProductDetails) {\n return null;\n }\n\n return (\n <Container>\n <Title>Products ({orderProductDetails?.length})</Title>\n <StyledTableWrapper>\n <StyledTable className=\"scrollClass\">\n <thead>\n <tr>\n <th>Action</th>\n <th>Code</th>\n <th>Description</th>\n <th>Parts</th>\n </tr>\n </thead>\n <tbody>\n {loading ? (\n <tr>\n <td colSpan={6}>\n <Skeleton active />\n </td>\n <td colSpan={6}></td>\n </tr>\n ) : orderProductDetails?.length === 0 ? (\n <tr>\n <td className=\"emptyTd\" colSpan={7}>\n <EmptyDataContainer>\n <Empty />\n </EmptyDataContainer>\n </td>\n </tr>\n ) : (\n orderProductDetails?.map((order: any) => (\n <tr key={order.id}>\n <td>{order?.order_product_type?.type}</td>{' '}\n <td>{order?.code}</td>\n <td>{order?.description}</td>\n <td>{order?.sku}</td>\n </tr>\n ))\n )}\n </tbody>\n </StyledTable>\n </StyledTableWrapper>\n </Container>\n );\n}\n\nconst Title = styled.h2`\n color: #3a3630;\n font-family: 'Roboto', sans-serif;\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n text-transform: uppercase;\n padding: 0;\n margin: 0;\n`;\n\nconst Container = styled.div`\n display: flex;\n flex-direction: column;\n gap: 8px;\n > div {\n min-height: 165px;\n }\n`;\n\nexport default ProductTable;\n"],"names":["ProductTable","orderProductDetails","useProductDetails","loading","useLoading","Container","jsxs","Title","jsx","StyledTableWrapper","StyledTable","Skeleton","EmptyDataContainer","Empty","order","styled"],"mappings":";;;;;;AAYA,SAASA,IAAe;AACtB,QAAM,CAACC,CAAmB,IAAIC,EAAA,GACxB,CAACC,CAAO,IAAIC,EAAA;AAElB,SAAKH,sBAKFI,GAAA,EACC,UAAA;AAAA,IAAA,gBAAAC,EAACC,GAAA,EAAM,UAAA;AAAA,MAAA;AAAA,MAAWN,GAAqB;AAAA,MAAO;AAAA,IAAA,GAAC;AAAA,IAC/C,gBAAAO,EAACC,GAAA,EACC,U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AMP,IAAQQ,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAWfV,IAAYU,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
1
+ {"version":3,"file":"ProductTable.js","sources":["../../../../../../../src/components/order-view/order-actions/actions/confirm-order/tables/ProductTable.tsx"],"sourcesContent":["import React from 'react';\nimport styled from 'styled-components';\nimport { useProductDetails } from '../../../../store';\n\nimport { Empty, Skeleton } from 'antd';\nimport { useLoading } from '../../../../../order-daily-overview/store/store';\nimport {\n EmptyDataContainer,\n StyledTable,\n StyledTableWrapper,\n} from './ReminderStyles';\nimport { toReverseDeliveryLabel } from '../../../../../../common/utils';\nimport { useClientPortal } from '../../../../../store';\n\nfunction ProductTable() {\n const [orderProductDetails] = useProductDetails();\n const [loading] = useLoading();\n const [isClientPortal] = useClientPortal();\n\n if (!orderProductDetails) {\n return null;\n }\n\n return (\n <Container>\n <Title>Products ({orderProductDetails?.length})</Title>\n <StyledTableWrapper>\n <StyledTable className=\"scrollClass\">\n <thead>\n <tr>\n <th>Action</th>\n <th>Code</th>\n <th>Description</th>\n <th>Parts</th>\n </tr>\n </thead>\n <tbody>\n {loading ? (\n <tr>\n <td colSpan={6}>\n <Skeleton active />\n </td>\n <td colSpan={6}></td>\n </tr>\n ) : orderProductDetails?.length === 0 ? (\n <tr>\n <td className=\"emptyTd\" colSpan={7}>\n <EmptyDataContainer>\n <Empty />\n </EmptyDataContainer>\n </td>\n </tr>\n ) : (\n orderProductDetails?.map((order: any) => (\n <tr key={order.id}>\n <td>\n {isClientPortal\n ? order?.order_product_type?.type\n : toReverseDeliveryLabel(order?.order_product_type?.type)}\n </td>{' '}\n <td>{order?.code}</td>\n <td>{order?.description}</td>\n <td>{order?.sku}</td>\n </tr>\n ))\n )}\n </tbody>\n </StyledTable>\n </StyledTableWrapper>\n </Container>\n );\n}\n\nconst Title = styled.h2`\n color: #3a3630;\n font-family: 'Roboto', sans-serif;\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n text-transform: uppercase;\n padding: 0;\n margin: 0;\n`;\n\nconst Container = styled.div`\n display: flex;\n flex-direction: column;\n gap: 8px;\n > div {\n min-height: 165px;\n }\n`;\n\nexport default ProductTable;\n"],"names":["ProductTable","orderProductDetails","useProductDetails","loading","useLoading","isClientPortal","useClientPortal","Container","jsxs","Title","jsx","StyledTableWrapper","StyledTable","Skeleton","EmptyDataContainer","Empty","order","toReverseDeliveryLabel","styled"],"mappings":";;;;;;;;AAcA,SAASA,IAAe;AACtB,QAAM,CAACC,CAAmB,IAAIC,EAAA,GACxB,CAACC,CAAO,IAAIC,EAAA,GACZ,CAACC,CAAc,IAAIC,EAAA;AAEzB,SAAKL,sBAKFM,GAAA,EACC,UAAA;AAAA,IAAA,gBAAAC,EAACC,GAAA,EAAM,UAAA;AAAA,MAAA;AAAA,MAAWR,GAAqB;AAAA,MAAO;AAAA,IAAA,GAAC;AAAA,IAC/C,gBAAAS,EAACC,GAAA,EACC,UAAA,gBAAAH,EAACI,GAAA,EAAY,WAAU,eACrB,UAAA;AAAA,MAAA,gBAAAF,EAAC,SAAA,EACC,4BAAC,MAAA,EACC,UAAA;AAAA,QAAA,gBAAAA,EAAC,QAAG,UAAA,SAAA,CAAM;AAAA,QACV,gBAAAA,EAAC,QAAG,UAAA,OAAA,CAAI;AAAA,QACR,gBAAAA,EAAC,QAAG,UAAA,cAAA,CAAW;AAAA,QACf,gBAAAA,EAAC,QAAG,UAAA,QAAA,CAAK;AAAA,MAAA,EAAA,CACX,EAAA,CACF;AAAA,MACA,gBAAAA,EAAC,SAAA,EACE,UAAAP,IACC,gBAAAK,EAAC,MAAA,EACC,UAAA;AAAA,QAAA,gBAAAE,EAAC,QAAG,SAAS,GACX,4BAACG,GAAA,EAAS,QAAM,IAAC,EAAA,CACnB;AAAA,QACA,gBAAAH,EAAC,MAAA,EAAG,SAAS,EAAA,CAAG;AAAA,MAAA,EAAA,CAClB,IACET,GAAqB,WAA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