@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.
- package/dist/common/expand-collapse/index.js +44 -26
- package/dist/common/expand-collapse/index.js.map +1 -1
- package/dist/common/modals/order-action-modal/OrderActionModal.js.map +1 -1
- package/dist/common/modals/order-action-modal/footer/OrderActionFooter.js.map +1 -1
- package/dist/components/client-portal/ClientPortalResponsive.js +148 -0
- package/dist/components/client-portal/ClientPortalResponsive.js.map +1 -0
- package/dist/components/client-portal/OutstandingTable.js +112 -118
- package/dist/components/client-portal/OutstandingTable.js.map +1 -1
- package/dist/components/client-portal/ReturnOverview.js +38 -37
- package/dist/components/client-portal/ReturnOverview.js.map +1 -1
- package/dist/components/client-portal/return-confirm/ConfirmedMain.js +4 -4
- package/dist/components/client-portal/return-confirm/ConfirmedMain.js.map +1 -1
- package/dist/components/client-portal/return-confirm/ReturnConfirmedTable.js +445 -185
- package/dist/components/client-portal/return-confirm/ReturnConfirmedTable.js.map +1 -1
- package/dist/components/fakeData.js.map +1 -1
- package/dist/components/order-daily-overview/common/fakedata.js.map +1 -1
- package/dist/components/order-daily-overview/common/mediaQuery.js +17 -0
- package/dist/components/order-daily-overview/common/mediaQuery.js.map +1 -0
- package/dist/components/order-daily-overview/filters/FilterStyle.js +174 -11
- package/dist/components/order-daily-overview/filters/FilterStyle.js.map +1 -1
- package/dist/components/order-daily-overview/header/route-header/RouterHeaderStyle.js +9 -4
- package/dist/components/order-daily-overview/header/route-header/RouterHeaderStyle.js.map +1 -1
- package/dist/components/order-daily-overview/header/route-header/title/HeaderTitle.js +11 -1
- package/dist/components/order-daily-overview/header/route-header/title/HeaderTitle.js.map +1 -1
- package/dist/components/order-daily-overview/header-filters/Styledfilters.js +46 -17
- package/dist/components/order-daily-overview/header-filters/Styledfilters.js.map +1 -1
- package/dist/components/order-daily-overview/index.js +76 -53
- package/dist/components/order-daily-overview/index.js.map +1 -1
- package/dist/components/order-daily-overview/return-after-table/table/OrderTable.js +101 -103
- package/dist/components/order-daily-overview/return-after-table/table/OrderTable.js.map +1 -1
- package/dist/components/order-daily-overview/return-after-table/table-filters/ReturnOrderFilter.js +135 -134
- package/dist/components/order-daily-overview/return-after-table/table-filters/ReturnOrderFilter.js.map +1 -1
- package/dist/components/order-daily-overview/return-after-table/table-filters/TableFilters.js +17 -11
- package/dist/components/order-daily-overview/return-after-table/table-filters/TableFilters.js.map +1 -1
- package/dist/components/order-daily-overview/return-order-table/return-orders-filters/ReturnFilter.js +5 -5
- package/dist/components/order-daily-overview/return-order-table/return-orders-filters/ReturnFilter.js.map +1 -1
- package/dist/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.js +129 -135
- package/dist/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.js.map +1 -1
- package/dist/components/order-daily-overview/return-order-table/return-orders-filters/returnstyles.js +346 -27
- package/dist/components/order-daily-overview/return-order-table/return-orders-filters/returnstyles.js.map +1 -1
- package/dist/components/order-daily-overview/table/ReturnTable.js +199 -183
- package/dist/components/order-daily-overview/table/ReturnTable.js.map +1 -1
- package/dist/components/order-daily-overview/table/table-data/styles.js +159 -38
- package/dist/components/order-daily-overview/table/table-data/styles.js.map +1 -1
- package/dist/components/order-daily-overview/table-view/PaginationStyle.js +21 -6
- package/dist/components/order-daily-overview/table-view/PaginationStyle.js.map +1 -1
- package/dist/components/order-view/DynamicTable.js +136 -35
- package/dist/components/order-view/DynamicTable.js.map +1 -1
- package/dist/components/order-view/details-filters/DetailsFilters.js +33 -8
- package/dist/components/order-view/details-filters/DetailsFilters.js.map +1 -1
- package/dist/components/order-view/details-filters/left-side-filters/ActionsMenu.js +23 -5
- package/dist/components/order-view/details-filters/left-side-filters/ActionsMenu.js.map +1 -1
- package/dist/components/order-view/details-filters/left-side-filters/dropdowns/DropDowns.js +39 -22
- package/dist/components/order-view/details-filters/left-side-filters/dropdowns/DropDowns.js.map +1 -1
- package/dist/components/order-view/details-filters/right-side-filters/Details.js +25 -12
- package/dist/components/order-view/details-filters/right-side-filters/Details.js.map +1 -1
- package/dist/components/order-view/general-information/Status.js +58 -28
- package/dist/components/order-view/general-information/Status.js.map +1 -1
- package/dist/components/order-view/generic-table/AuditLogs.js +129 -24
- package/dist/components/order-view/generic-table/AuditLogs.js.map +1 -1
- package/dist/components/order-view/notes/logs/index.js +15 -7
- package/dist/components/order-view/notes/logs/index.js.map +1 -1
- package/dist/components/order-view/notes/order-dropdown/NewReturnDropdown.js +7 -7
- package/dist/components/order-view/notes/order-dropdown/NewReturnDropdown.js.map +1 -1
- package/dist/components/order-view/notification/index.js +68 -55
- package/dist/components/order-view/notification/index.js.map +1 -1
- package/dist/components/order-view/order-actions/Dropdown.js +3 -3
- package/dist/components/order-view/order-actions/Dropdown.js.map +1 -1
- package/dist/components/order-view/order-actions/actions/cancel-order/CancelOrderTable.js +45 -47
- package/dist/components/order-view/order-actions/actions/cancel-order/CancelOrderTable.js.map +1 -1
- package/dist/components/order-view/order-actions/actions/cancel-order/ReturnReason.js +23 -36
- package/dist/components/order-view/order-actions/actions/cancel-order/ReturnReason.js.map +1 -1
- package/dist/components/order-view/order-actions/actions/confirm-order/tables/ProductTable.js +23 -25
- package/dist/components/order-view/order-actions/actions/confirm-order/tables/ProductTable.js.map +1 -1
- package/dist/components/order-view/order-actions/actions/force-debrief/ForceDebriefModal.js +88 -89
- package/dist/components/order-view/order-actions/actions/force-debrief/ForceDebriefModal.js.map +1 -1
- package/dist/components/order-view/order-actions/actions/force-debrief/charges/collection-add-ons/index.js +16 -16
- package/dist/components/order-view/order-actions/actions/force-debrief/charges/collection-add-ons/index.js.map +1 -1
- package/dist/components/order-view/order-actions/actions/force-debrief/escalation/EscalationReason.js +22 -23
- package/dist/components/order-view/order-actions/actions/force-debrief/escalation/EscalationReason.js.map +1 -1
- package/dist/components/order-view/order-actions/actions/force-debrief/order-info/RadioButtons.js +52 -56
- package/dist/components/order-view/order-actions/actions/force-debrief/order-info/RadioButtons.js.map +1 -1
- package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/FailureReasonDropdown.js +26 -27
- package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/FailureReasonDropdown.js.map +1 -1
- package/dist/components/order-view/order-actions/actions/hold-order/HoldOrderModal.js +29 -29
- package/dist/components/order-view/order-actions/actions/hold-order/HoldOrderModal.js.map +1 -1
- package/dist/components/order-view/order-actions/actions/split-order/SplitOrderTable.js +54 -222
- package/dist/components/order-view/order-actions/actions/split-order/SplitOrderTable.js.map +1 -1
- package/dist/components/order-view/order-actions/actions/split-order/index.js +37 -50
- package/dist/components/order-view/order-actions/actions/split-order/index.js.map +1 -1
- package/dist/components/order-view/order-actions/actions/uncancel-order/UncancelOrderTable.js +35 -37
- package/dist/components/order-view/order-actions/actions/uncancel-order/UncancelOrderTable.js.map +1 -1
- package/dist/components/order-view/order-actions/actions/what3words/What3WordsModal.tsx.js +85 -85
- package/dist/components/order-view/order-actions/actions/what3words/What3WordsModal.tsx.js.map +1 -1
- package/dist/components/order-view/order-details/expanded-content/customer-section/contact-info/ContactHome.js +12 -8
- package/dist/components/order-view/order-details/expanded-content/customer-section/contact-info/ContactHome.js.map +1 -1
- package/dist/components/order-view/order-details/expanded-content/customer-section/contact-info/ContactMobile.js +22 -18
- package/dist/components/order-view/order-details/expanded-content/customer-section/contact-info/ContactMobile.js.map +1 -1
- package/dist/components/order-view/order-details/expanded-content/customer-section/contact-info/index.js +14 -8
- package/dist/components/order-view/order-details/expanded-content/customer-section/contact-info/index.js.map +1 -1
- package/dist/components/order-view/order-details/expanded-content/customer-section/index.js +19 -13
- package/dist/components/order-view/order-details/expanded-content/customer-section/index.js.map +1 -1
- package/dist/components/order-view/order-details/expanded-content/customer-section/location-info/Address.js +11 -6
- package/dist/components/order-view/order-details/expanded-content/customer-section/location-info/Address.js.map +1 -1
- package/dist/components/order-view/order-details/expanded-content/customer-section/location-info/Latitude.js +23 -21
- package/dist/components/order-view/order-details/expanded-content/customer-section/location-info/Latitude.js.map +1 -1
- package/dist/components/order-view/order-details/expanded-content/customer-section/location-info/Longitude.js +23 -21
- package/dist/components/order-view/order-details/expanded-content/customer-section/location-info/Longitude.js.map +1 -1
- package/dist/components/order-view/order-details/expanded-content/customer-section/location-info/index.js +39 -21
- package/dist/components/order-view/order-details/expanded-content/customer-section/location-info/index.js.map +1 -1
- package/dist/components/order-view/order-details/expanded-content/footer/index.js +28 -14
- package/dist/components/order-view/order-details/expanded-content/footer/index.js.map +1 -1
- package/dist/components/order-view/order-details/expanded-content/orders-section/index.js +44 -28
- package/dist/components/order-view/order-details/expanded-content/orders-section/index.js.map +1 -1
- package/dist/components/order-view/order-details/expanded-content/services-section/OrderServices.js +28 -20
- package/dist/components/order-view/order-details/expanded-content/services-section/OrderServices.js.map +1 -1
- package/dist/components/order-view/order-details/expanded-content/services-section/ServiceLevel.js +17 -18
- package/dist/components/order-view/order-details/expanded-content/services-section/ServiceLevel.js.map +1 -1
- package/dist/components/order-view/order-details/expanded-content/services-section/ServiceType.js +22 -26
- package/dist/components/order-view/order-details/expanded-content/services-section/ServiceType.js.map +1 -1
- package/dist/components/order-view/order-details/expanded-content/services-section/index.js +79 -25
- package/dist/components/order-view/order-details/expanded-content/services-section/index.js.map +1 -1
- package/dist/components/order-view/order-details/helper.js.map +1 -1
- package/dist/components/order-view/products-info/collapsed-content/index.js +21 -15
- package/dist/components/order-view/products-info/collapsed-content/index.js.map +1 -1
- package/dist/components/order-view/products-info/index.js +36 -36
- package/dist/components/order-view/products-info/index.js.map +1 -1
- package/dist/components/order-view/return-client-products/product-table/ReturnProductTable.js +265 -334
- package/dist/components/order-view/return-client-products/product-table/ReturnProductTable.js.map +1 -1
- package/dist/components/order-view/store.js +155 -162
- package/dist/components/order-view/store.js.map +1 -1
- package/dist/components/order-view/toolbox-resources/expanded-content/index.js +281 -173
- package/dist/components/order-view/toolbox-resources/expanded-content/index.js.map +1 -1
- package/dist/components/utils.js +5 -4
- package/dist/components/utils.js.map +1 -1
- package/dist/types/common/modals/order-action-modal/OrderActionModal.d.ts +1 -2
- package/dist/types/common/modals/order-action-modal/footer/OrderActionFooter.d.ts +1 -1
- package/dist/types/components/client-portal/ClientPortalResponsive.d.ts +15 -0
- package/dist/types/components/order-daily-overview/common/mediaQuery.d.ts +4 -0
- package/dist/types/components/order-daily-overview/filters/FilterStyle.d.ts +1 -0
- package/dist/types/components/order-view/order-actions/Dropdown.d.ts +0 -1
- package/dist/types/components/order-view/return-client-products/product-table/ReturnProductTable.d.ts +1 -0
- package/dist/types/components/order-view/store.d.ts +0 -1
- package/dist/types/components/order-view/types.d.ts +1 -1
- package/dist/types/components/utils.d.ts +1 -0
- package/package.json +2 -2
- package/dist/assets/icons/ChevronDownIcon.js +0 -26
- package/dist/assets/icons/ChevronDownIcon.js.map +0 -1
- package/dist/components/order-view/return-client-products/product-table/palletGrouping.js +0 -47
- package/dist/components/order-view/return-client-products/product-table/palletGrouping.js.map +0 -1
- package/dist/types/components/order-view/return-client-products/product-table/palletGrouping.d.ts +0 -23
package/dist/components/order-view/order-actions/actions/uncancel-order/UncancelOrderTable.js
CHANGED
|
@@ -1,41 +1,39 @@
|
|
|
1
|
-
import { jsx as e, jsxs as o, Fragment as
|
|
2
|
-
import { useCancelOrderProducts as
|
|
3
|
-
import { useLoading as
|
|
4
|
-
import { Select as
|
|
5
|
-
import
|
|
1
|
+
import { jsx as e, jsxs as o, Fragment as g } from "react/jsx-runtime";
|
|
2
|
+
import { useCancelOrderProducts as y, useOrderStaticData as v } from "../../../store.js";
|
|
3
|
+
import { useLoading as w } from "../../../../order-daily-overview/store/store.js";
|
|
4
|
+
import { Select as _, Skeleton as S, Empty as O } from "antd";
|
|
5
|
+
import R from "../../Dropdown.js";
|
|
6
6
|
import l from "styled-components";
|
|
7
|
-
import { EmptyDataContainer as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
import { toReverseDeliveryLabel as k } from "@bjsdistribution/dms-component-library";
|
|
12
|
-
const P = [
|
|
7
|
+
import { EmptyDataContainer as C } from "../confirm-order/tables/ReminderStyles.js";
|
|
8
|
+
import b from "../../../../../assets/icons/DeliverProductIcon.js";
|
|
9
|
+
import s from "../../../../../assets/icons/ReturnProductIcon.js";
|
|
10
|
+
const D = [
|
|
13
11
|
{
|
|
14
12
|
label: "Deliver",
|
|
15
13
|
value: "deliver",
|
|
16
|
-
icon: /* @__PURE__ */ e(
|
|
14
|
+
icon: /* @__PURE__ */ e(b, {})
|
|
17
15
|
},
|
|
18
16
|
{
|
|
19
17
|
label: "Return",
|
|
20
18
|
value: "return",
|
|
21
|
-
icon: /* @__PURE__ */ e(
|
|
19
|
+
icon: /* @__PURE__ */ e(s, {})
|
|
22
20
|
}
|
|
23
|
-
],
|
|
21
|
+
], T = [
|
|
24
22
|
{
|
|
25
23
|
label: "Return",
|
|
26
24
|
value: "return",
|
|
27
|
-
icon: /* @__PURE__ */ e(
|
|
25
|
+
icon: /* @__PURE__ */ e(s, {})
|
|
28
26
|
}
|
|
29
|
-
],
|
|
27
|
+
], Y = () => {
|
|
30
28
|
const [
|
|
31
29
|
d,
|
|
32
30
|
f
|
|
33
|
-
] =
|
|
31
|
+
] = y(), [m] = w(), [p] = v();
|
|
34
32
|
if (!d?.length)
|
|
35
33
|
return null;
|
|
36
34
|
const h = p?.return_reasons?.map(
|
|
37
35
|
(r) => ({
|
|
38
|
-
label:
|
|
36
|
+
label: r?.reason,
|
|
39
37
|
value: r?.reason
|
|
40
38
|
})
|
|
41
39
|
), u = p?.order_product_return_action?.map(
|
|
@@ -46,14 +44,14 @@ const P = [
|
|
|
46
44
|
), a = (r, n, i) => {
|
|
47
45
|
console.log(r, n, i);
|
|
48
46
|
const t = d?.map(
|
|
49
|
-
(
|
|
50
|
-
...
|
|
47
|
+
(c) => c.order_product_id === n ? {
|
|
48
|
+
...c,
|
|
51
49
|
[i]: r
|
|
52
|
-
} :
|
|
50
|
+
} : c
|
|
53
51
|
);
|
|
54
52
|
f(t);
|
|
55
53
|
};
|
|
56
|
-
return /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
|
|
54
|
+
return /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(I, { children: /* @__PURE__ */ o(P, { className: "scrollClass", children: [
|
|
57
55
|
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ o("tr", { children: [
|
|
58
56
|
/* @__PURE__ */ e("th", { children: "Status" }),
|
|
59
57
|
/* @__PURE__ */ e("th", { children: "Original Type" }),
|
|
@@ -61,8 +59,8 @@ const P = [
|
|
|
61
59
|
/* @__PURE__ */ e("th", { children: "Description" }),
|
|
62
60
|
/* @__PURE__ */ e("th", { children: "SKU" })
|
|
63
61
|
] }) }),
|
|
64
|
-
/* @__PURE__ */ e("tbody", { children: m ? /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: 5, children: /* @__PURE__ */ e(
|
|
65
|
-
const n = r?.product_type === "deliver" ?
|
|
62
|
+
/* @__PURE__ */ e("tbody", { children: m ? /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: 5, children: /* @__PURE__ */ e(S, { active: !0 }) }) }) : d?.length === 0 ? /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { className: "emptyTd", colSpan: 5, children: /* @__PURE__ */ e(C, { children: /* @__PURE__ */ e(O, {}) }) }) }) : d?.map((r) => {
|
|
63
|
+
const n = r?.product_type === "deliver" ? D : T, i = r?.action === "return";
|
|
66
64
|
return /* @__PURE__ */ e(
|
|
67
65
|
"tr",
|
|
68
66
|
{
|
|
@@ -72,7 +70,7 @@ const P = [
|
|
|
72
70
|
children: /* @__PURE__ */ e("td", { colSpan: 5, children: /* @__PURE__ */ e("table", { style: { width: "100%" }, children: /* @__PURE__ */ o("tbody", { children: [
|
|
73
71
|
/* @__PURE__ */ o("tr", { children: [
|
|
74
72
|
/* @__PURE__ */ e("td", { style: { width: "20%" }, children: /* @__PURE__ */ e(
|
|
75
|
-
|
|
73
|
+
k,
|
|
76
74
|
{
|
|
77
75
|
options: n,
|
|
78
76
|
placeholder: "Select",
|
|
@@ -81,7 +79,7 @@ const P = [
|
|
|
81
79
|
r?.order_product_id,
|
|
82
80
|
"action"
|
|
83
81
|
),
|
|
84
|
-
prefix: r?.action === "deliver" ? /* @__PURE__ */ e(
|
|
82
|
+
prefix: r?.action === "deliver" ? /* @__PURE__ */ e(b, {}) : r?.action === "return" ? /* @__PURE__ */ e(s, {}) : /* @__PURE__ */ e(g, {}),
|
|
85
83
|
style: { width: "100%" },
|
|
86
84
|
value: n?.filter(
|
|
87
85
|
(t) => t?.value === r?.action
|
|
@@ -114,9 +112,9 @@ const P = [
|
|
|
114
112
|
/* @__PURE__ */ e("td", { style: { width: "20%" }, children: r?.description }),
|
|
115
113
|
/* @__PURE__ */ e("td", { style: { width: "20%" }, children: r?.sku })
|
|
116
114
|
] }),
|
|
117
|
-
i && /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: 5, children: /* @__PURE__ */ o(
|
|
115
|
+
i && /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: 5, children: /* @__PURE__ */ o(A, { children: [
|
|
118
116
|
/* @__PURE__ */ e(
|
|
119
|
-
|
|
117
|
+
x,
|
|
120
118
|
{
|
|
121
119
|
label: "Return Action",
|
|
122
120
|
required: !0,
|
|
@@ -133,7 +131,7 @@ const P = [
|
|
|
133
131
|
}
|
|
134
132
|
),
|
|
135
133
|
/* @__PURE__ */ e(
|
|
136
|
-
|
|
134
|
+
x,
|
|
137
135
|
{
|
|
138
136
|
label: "Return Reason",
|
|
139
137
|
required: !0,
|
|
@@ -156,7 +154,7 @@ const P = [
|
|
|
156
154
|
);
|
|
157
155
|
}) })
|
|
158
156
|
] }) }) });
|
|
159
|
-
},
|
|
157
|
+
}, k = l(_)`
|
|
160
158
|
.ant-select-selector {
|
|
161
159
|
border-radius: 25px !important;
|
|
162
160
|
/* border: none !important; */
|
|
@@ -174,16 +172,16 @@ const P = [
|
|
|
174
172
|
font-weight: 400;
|
|
175
173
|
font-size: 13px;
|
|
176
174
|
}
|
|
177
|
-
`,
|
|
175
|
+
`, I = l.div`
|
|
178
176
|
width: 100%;
|
|
179
177
|
overflow-x: auto;
|
|
180
178
|
background-color: #fff;
|
|
181
179
|
border-radius: 12px;
|
|
182
180
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
|
|
183
181
|
padding: 16px;
|
|
184
|
-
`,
|
|
182
|
+
`, x = l(R)`
|
|
185
183
|
flex: 1;
|
|
186
|
-
`,
|
|
184
|
+
`, P = l.table`
|
|
187
185
|
width: 100%;
|
|
188
186
|
font-size: 14px;
|
|
189
187
|
color: #333;
|
|
@@ -248,7 +246,7 @@ const P = [
|
|
|
248
246
|
background: transparent;
|
|
249
247
|
padding: 8px 12px;
|
|
250
248
|
}
|
|
251
|
-
`,
|
|
249
|
+
`, A = l.div`
|
|
252
250
|
display: flex;
|
|
253
251
|
flex-direction: row;
|
|
254
252
|
gap: 12px;
|
|
@@ -256,8 +254,8 @@ const P = [
|
|
|
256
254
|
width: 100%;
|
|
257
255
|
`;
|
|
258
256
|
export {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
257
|
+
P as StyledTable,
|
|
258
|
+
I as StyledTableWrapper,
|
|
259
|
+
Y as default
|
|
262
260
|
};
|
|
263
261
|
//# sourceMappingURL=UncancelOrderTable.js.map
|
package/dist/components/order-view/order-actions/actions/uncancel-order/UncancelOrderTable.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UncancelOrderTable.js","sources":["../../../../../../src/components/order-view/order-actions/actions/uncancel-order/UncancelOrderTable.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';\nimport { CancelOrderProductsType } from '../../../types';\nimport OrderActionsDropdown from '../../Dropdown';\nimport styled from 'styled-components';\nimport { EmptyDataContainer } from '../confirm-order/tables/ReminderStyles';\nimport DeliverProductIcon from '../../../../../assets/icons/DeliverProductIcon';\nimport ReturnProductIcon from '../../../../../assets/icons/ReturnProductIcon';\nimport { useClientPortal } from '../../../../store';\nimport { toReverseDeliveryLabel } from '@bjsdistribution/dms-component-library';\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 UnCancelOrderTable = () => {\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>Original Type</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={5}>\n <Skeleton active />\n </td>\n </tr>\n ) : cancelOrderProducts?.length === 0 ? (\n <tr>\n <td className=\"emptyTd\" colSpan={5}>\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={5}>\n <table style={{ width: '100%' }}>\n <tbody>\n <tr>\n <td style={{ width: '20%' }}>\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 // popupClassName={'dropDownStyle'}\n // selectWrapperClass={'rounded'}\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: '20%' }}>\n {product?.previous_product_type === null\n ? 'N/A'\n : product?.previous_product_type}\n </td>\n <td style={{ width: '20%' }}>{product?.code}</td>\n <td style={{ width: '20%' }}>\n {product?.description}\n </td>\n <td style={{ width: '20%' }}>{product?.sku}</td>\n </tr>\n\n {isReturn && (\n <tr>\n <td colSpan={5}>\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: 8px;\n align-items: center !important;\n\n .ant-select-prefix {\n margin-top: 4px;\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 UnCancelOrderTable;\n"],"names":["deliverTypeOptions","DeliverProductIcon","ReturnProductIcon","collectTypeOptions","UnCancelOrderTable","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":";;;;;;;;;;;AAaA,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,IAAqB,MAAM;AAC/B,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,C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el-order/UncancelOrderTable.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';\nimport { CancelOrderProductsType } from '../../../types';\nimport OrderActionsDropdown from '../../Dropdown';\nimport styled from 'styled-components';\nimport { EmptyDataContainer } from '../confirm-order/tables/ReminderStyles';\nimport DeliverProductIcon from '../../../../../assets/icons/DeliverProductIcon';\nimport ReturnProductIcon from '../../../../../assets/icons/ReturnProductIcon';\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 UnCancelOrderTable = () => {\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>Original Type</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={5}>\n <Skeleton active />\n </td>\n </tr>\n ) : cancelOrderProducts?.length === 0 ? (\n <tr>\n <td className=\"emptyTd\" colSpan={5}>\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={5}>\n <table style={{ width: '100%' }}>\n <tbody>\n <tr>\n <td style={{ width: '20%' }}>\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 // popupClassName={'dropDownStyle'}\n // selectWrapperClass={'rounded'}\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: '20%' }}>\n {product?.previous_product_type === null\n ? 'N/A'\n : product?.previous_product_type}\n </td>\n <td style={{ width: '20%' }}>{product?.code}</td>\n <td style={{ width: '20%' }}>\n {product?.description}\n </td>\n <td style={{ width: '20%' }}>{product?.sku}</td>\n </tr>\n\n {isReturn && (\n <tr>\n <td colSpan={5}>\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: 8px;\n align-items: center !important;\n\n .ant-select-prefix {\n margin-top: 4px;\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 UnCancelOrderTable;\n"],"names":["deliverTypeOptions","DeliverProductIcon","ReturnProductIcon","collectTypeOptions","UnCancelOrderTable","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":";;;;;;;;;AAWA,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,IAAqB,MAAM;AAC/B,QAAM;AAAA,IACJC;AAAA,IACAC;AAAA,EAAA,IACEC,EAAA,GAEE,CAACC,CAAO,IAAIC,EAAA,GACZ,CAACC,CAAe,IAAIC,EAAA;AAE1B,MAAI,CAACN,GAAqB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|
|
3
|
-
import { useCurrentAction as
|
|
4
|
-
import
|
|
3
|
+
import { useCurrentAction as B, useOrderDetails as Q, usePrevOrderDetails as q, useCustomerInfo as J } from "../../../store.js";
|
|
4
|
+
import N from "../../../../../common/modals/order-action-modal/OrderActionModal.js";
|
|
5
5
|
import { notification as L } from "antd";
|
|
6
|
-
import { useAxios as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import { compareOrderDetailsStates as
|
|
10
|
-
import { useClientPortal as
|
|
11
|
-
function ge(
|
|
12
|
-
const
|
|
6
|
+
import { useAxios as O, Label as m } from "@bjsdistribution/dms-component-library";
|
|
7
|
+
import r from "styled-components";
|
|
8
|
+
import X from "../../../../../common/custom-input/CustomInput.js";
|
|
9
|
+
import { compareOrderDetailsStates as Y } from "../../../utils.js";
|
|
10
|
+
import { useClientPortal as Z } from "../../../../store.js";
|
|
11
|
+
function ge(A) {
|
|
12
|
+
const I = /^\/{0,}[^0-9`~!@#$%^&*()+\-_=[{\]}\\|'<,.>?/";:£§º©®\s]{1,}[・.。][^0-9`~!@#$%^&*()+\-_=[{\]}\\|'<,.>?/";:£§º©®\s]{1,}[・.。][^0-9`~!@#$%^&*()+\-_=[{\]}\\|'<,.>?/";:£§º©®\s]{1,}$/, [, P] = B(), [o, h] = Q(), [g, T] = q(), [w] = J(), [l, x] = s(""), [v] = Z(), a = o?.order_recipient || {}, [W, k] = s(), [c, E] = s(""), [p, y] = s(a?.latitude || ""), [u, b] = s(a?.longitude || ""), _ = () => P(void 0), F = (e) => e.replace(/^\/+/, ""), R = (e) => {
|
|
13
13
|
if (e.trim()) {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
const d = I.test(e);
|
|
15
|
+
x(
|
|
16
|
+
d ? "" : "Please enter a valid input (format: word.word.word)"
|
|
17
17
|
);
|
|
18
18
|
} else
|
|
19
|
-
|
|
20
|
-
}, R = (e) => {
|
|
21
|
-
const i = e.target.value, r = E(i);
|
|
22
|
-
F(i), k(r);
|
|
19
|
+
x("Input cannot be empty or only spaces");
|
|
23
20
|
}, U = (e) => {
|
|
24
|
-
|
|
21
|
+
const d = e.target.value, n = F(d);
|
|
22
|
+
R(d), E(n);
|
|
25
23
|
}, j = (e) => {
|
|
26
24
|
y(e.target.value);
|
|
25
|
+
}, K = (e) => {
|
|
26
|
+
b(e.target.value);
|
|
27
27
|
}, D = (e) => {
|
|
28
28
|
["e", "E", "+", "-"].includes(e.key) && e.preventDefault();
|
|
29
|
-
}, { fetchData:
|
|
29
|
+
}, { fetchData: M } = O({
|
|
30
30
|
endpoint: "/orders/update/",
|
|
31
31
|
method: "PUT"
|
|
32
|
-
}), { fetchData:
|
|
32
|
+
}), { fetchData: z } = O({
|
|
33
33
|
endpoint: "/v1/orders/coordinates_to_w3w/?",
|
|
34
34
|
method: "GET"
|
|
35
35
|
});
|
|
36
36
|
C(() => {
|
|
37
|
-
|
|
38
|
-
endPointQuery: `latitude=${
|
|
37
|
+
o?.order_recipient?.latitude && o?.order_recipient?.longitude && z({
|
|
38
|
+
endPointQuery: `latitude=${o?.order_recipient?.latitude}&longitude=${o?.order_recipient?.longitude}`
|
|
39
39
|
}).then((e) => {
|
|
40
|
-
console.log(e?.data),
|
|
40
|
+
console.log(e?.data), k(e?.data?.words);
|
|
41
41
|
});
|
|
42
42
|
}, [
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
o?.order_recipient?.latitude,
|
|
44
|
+
o?.order_recipient?.longitude
|
|
45
45
|
]);
|
|
46
|
-
const
|
|
46
|
+
const G = async () => {
|
|
47
47
|
const e = {
|
|
48
|
-
...
|
|
49
|
-
latitude: c,
|
|
50
|
-
longitude: p,
|
|
48
|
+
...o,
|
|
51
49
|
order_recipient: {
|
|
52
|
-
...
|
|
53
|
-
what_3words_address:
|
|
50
|
+
...o?.order_recipient || {},
|
|
51
|
+
what_3words_address: c,
|
|
52
|
+
latitude: p,
|
|
53
|
+
longitude: u
|
|
54
54
|
}
|
|
55
|
-
},
|
|
55
|
+
}, d = Y(
|
|
56
56
|
g,
|
|
57
57
|
e
|
|
58
58
|
);
|
|
59
|
-
let
|
|
60
|
-
payload: [
|
|
59
|
+
let n = await M({
|
|
60
|
+
payload: [d]
|
|
61
61
|
});
|
|
62
|
-
|
|
62
|
+
n.code === 200 && n?.data?.length > 0 ? (L.success({
|
|
63
63
|
message: "Success",
|
|
64
|
-
description: `${
|
|
65
|
-
}), await
|
|
64
|
+
description: `${n?.message}`
|
|
65
|
+
}), await A?.callOrdersApi(), h(n?.data[0]), T(n?.data[0]), _()) : (L.error({
|
|
66
66
|
message: "Update Failed",
|
|
67
|
-
description:
|
|
68
|
-
}),
|
|
69
|
-
},
|
|
70
|
-
const e =
|
|
71
|
-
return
|
|
67
|
+
description: n?.error || "Unknown error"
|
|
68
|
+
}), h(g));
|
|
69
|
+
}, H = `${w?.recipient_name}, ${w?.postcode}`, V = () => {
|
|
70
|
+
const e = a || {};
|
|
71
|
+
return c !== (e.what_3words_address || "") || p !== (e.latitude || "") || u !== (e.longitude || "");
|
|
72
72
|
};
|
|
73
73
|
return C(() => {
|
|
74
|
-
|
|
75
|
-
}, [
|
|
76
|
-
|
|
74
|
+
y(a?.latitude || ""), b(a?.longitude || "");
|
|
75
|
+
}, [a]), /* @__PURE__ */ i(
|
|
76
|
+
N,
|
|
77
77
|
{
|
|
78
78
|
headerTitle: "WHAT3WORDS",
|
|
79
|
-
onCloseHeader:
|
|
80
|
-
onSubmit:
|
|
79
|
+
onCloseHeader: _,
|
|
80
|
+
onSubmit: G,
|
|
81
81
|
showAdditionalInfo: !0,
|
|
82
|
-
infoText:
|
|
83
|
-
isSubmitDisabled:
|
|
82
|
+
infoText: H,
|
|
83
|
+
isSubmitDisabled: v ? !0 : !V() || !!l,
|
|
84
84
|
submitBtnTitle: "Save Details",
|
|
85
85
|
children: [
|
|
86
|
-
/* @__PURE__ */
|
|
87
|
-
/* @__PURE__ */
|
|
88
|
-
/* @__PURE__ */
|
|
89
|
-
/* @__PURE__ */
|
|
90
|
-
|
|
86
|
+
/* @__PURE__ */ t(S, { children: /* @__PURE__ */ t(ne, { children: /* @__PURE__ */ i(ee, { children: [
|
|
87
|
+
/* @__PURE__ */ t(m, { label: "Words" }),
|
|
88
|
+
/* @__PURE__ */ i(te, { children: [
|
|
89
|
+
/* @__PURE__ */ t(
|
|
90
|
+
f,
|
|
91
91
|
{
|
|
92
92
|
name: "w3w",
|
|
93
93
|
type: "text",
|
|
94
94
|
placeholder: "Format: word.word.word",
|
|
95
|
-
value:
|
|
96
|
-
onChange:
|
|
97
|
-
disabled:
|
|
95
|
+
value: c,
|
|
96
|
+
onChange: U,
|
|
97
|
+
disabled: v
|
|
98
98
|
}
|
|
99
99
|
),
|
|
100
|
-
l && /* @__PURE__ */
|
|
100
|
+
l && /* @__PURE__ */ t(re, { children: l })
|
|
101
101
|
] }),
|
|
102
|
-
/* @__PURE__ */
|
|
103
|
-
/* @__PURE__ */
|
|
102
|
+
/* @__PURE__ */ i(oe, { children: [
|
|
103
|
+
/* @__PURE__ */ t("strong", { children: "Current:" }),
|
|
104
104
|
" ",
|
|
105
|
-
/* @__PURE__ */
|
|
105
|
+
/* @__PURE__ */ t(
|
|
106
106
|
"a",
|
|
107
107
|
{
|
|
108
|
-
href: `https://what3words.com/${
|
|
108
|
+
href: `https://what3words.com/${W}`,
|
|
109
109
|
target: "_blank",
|
|
110
110
|
rel: "noopener noreferrer",
|
|
111
|
-
children:
|
|
111
|
+
children: W
|
|
112
112
|
}
|
|
113
113
|
)
|
|
114
114
|
] })
|
|
115
115
|
] }) }) }),
|
|
116
|
-
/* @__PURE__ */
|
|
117
|
-
/* @__PURE__ */
|
|
118
|
-
/* @__PURE__ */
|
|
119
|
-
/* @__PURE__ */
|
|
120
|
-
|
|
116
|
+
/* @__PURE__ */ t(S, { children: /* @__PURE__ */ i(ie, { children: [
|
|
117
|
+
/* @__PURE__ */ i($, { children: [
|
|
118
|
+
/* @__PURE__ */ t(m, { label: "Latitude", htmlFor: "lat" }),
|
|
119
|
+
/* @__PURE__ */ t(
|
|
120
|
+
f,
|
|
121
121
|
{
|
|
122
122
|
name: "lat",
|
|
123
123
|
type: "number",
|
|
124
124
|
placeholder: "Lat",
|
|
125
|
-
value:
|
|
126
|
-
onChange:
|
|
125
|
+
value: p,
|
|
126
|
+
onChange: j,
|
|
127
127
|
onKeyDown: D
|
|
128
128
|
}
|
|
129
129
|
)
|
|
130
130
|
] }),
|
|
131
|
-
/* @__PURE__ */
|
|
132
|
-
/* @__PURE__ */
|
|
133
|
-
/* @__PURE__ */
|
|
134
|
-
|
|
131
|
+
/* @__PURE__ */ i($, { children: [
|
|
132
|
+
/* @__PURE__ */ t(m, { label: "Longitude", htmlFor: "long" }),
|
|
133
|
+
/* @__PURE__ */ t(
|
|
134
|
+
f,
|
|
135
135
|
{
|
|
136
136
|
name: "long",
|
|
137
137
|
type: "number",
|
|
138
138
|
placeholder: "Long",
|
|
139
|
-
value:
|
|
140
|
-
onChange:
|
|
139
|
+
value: u,
|
|
140
|
+
onChange: K,
|
|
141
141
|
onKeyDown: D
|
|
142
142
|
}
|
|
143
143
|
)
|
|
@@ -147,17 +147,17 @@ function ge($) {
|
|
|
147
147
|
}
|
|
148
148
|
);
|
|
149
149
|
}
|
|
150
|
-
const
|
|
150
|
+
const ee = r.div`
|
|
151
151
|
display: flex;
|
|
152
152
|
flex-direction: row;
|
|
153
153
|
gap: 15px;
|
|
154
154
|
align-items: center;
|
|
155
|
-
`,
|
|
155
|
+
`, te = r.div`
|
|
156
156
|
display: flex;
|
|
157
157
|
flex-direction: column;
|
|
158
158
|
gap: 4px;
|
|
159
159
|
width: 100%;
|
|
160
|
-
`,
|
|
160
|
+
`, oe = r.div`
|
|
161
161
|
font-size: 13px;
|
|
162
162
|
color: #444;
|
|
163
163
|
white-space: nowrap;
|
|
@@ -170,30 +170,30 @@ const Z = n.div`
|
|
|
170
170
|
a:hover {
|
|
171
171
|
text-decoration: underline;
|
|
172
172
|
}
|
|
173
|
-
`,
|
|
173
|
+
`, re = r.span`
|
|
174
174
|
color: red;
|
|
175
175
|
font-size: 0.85rem;
|
|
176
176
|
margin-top: 4px;
|
|
177
|
-
`,
|
|
177
|
+
`, S = r.div`
|
|
178
178
|
padding: 15px;
|
|
179
179
|
display: flex;
|
|
180
180
|
flex-direction: column;
|
|
181
181
|
gap: 16px;
|
|
182
|
-
`, ne =
|
|
182
|
+
`, ne = r.div`
|
|
183
183
|
display: flex;
|
|
184
184
|
align-items: center;
|
|
185
185
|
gap: 10px;
|
|
186
186
|
flex-wrap: wrap;
|
|
187
|
-
`,
|
|
187
|
+
`, ie = r.div`
|
|
188
188
|
display: flex;
|
|
189
189
|
justify-content: space-between;
|
|
190
190
|
gap: 14px;
|
|
191
|
-
`,
|
|
191
|
+
`, $ = r.div`
|
|
192
192
|
flex: 1;
|
|
193
193
|
display: flex;
|
|
194
194
|
flex-direction: column;
|
|
195
195
|
gap: 5px;
|
|
196
|
-
`,
|
|
196
|
+
`, f = r(X)`
|
|
197
197
|
width: 100%;
|
|
198
198
|
&::-webkit-outer-spin-button,
|
|
199
199
|
&::-webkit-inner-spin-button {
|
package/dist/components/order-view/order-actions/actions/what3words/What3WordsModal.tsx.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"What3WordsModal.tsx.js","sources":["../../../../../../src/components/order-view/order-actions/actions/what3words/What3WordsModal.tsx.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport {\n useCurrentAction,\n useCustomerInfo,\n useOrderDetails,\n usePrevOrderDetails,\n} from '../../../store';\nimport OrderActionModal from '../../../../../common/modals/order-action-modal/OrderActionModal';\nimport { notification } from 'antd';\nimport { Label, useAxios } from '@bjsdistribution/dms-component-library';\nimport styled from 'styled-components';\nimport GenericInput from '../../../../../common/custom-input/CustomInput';\nimport { compareOrderDetailsStates } from '../../../utils';\nimport { ApiResponse } from '../../../types';\nimport { useClientPortal } from '../../../../store';\n\nfunction What3WordsModal(props: any) {\n const w3wRegex = /^\\/{0,}[^0-9`~!@#$%^&*()+\\-_=[{\\]}\\\\|'<,.>?/\";:£§º©®\\s]{1,}[・.。][^0-9`~!@#$%^&*()+\\-_=[{\\]}\\\\|'<,.>?/\";:£§º©®\\s]{1,}[・.。][^0-9`~!@#$%^&*()+\\-_=[{\\]}\\\\|'<,.>?/\";:£§º©®\\s]{1,}$/;\n const [, setCurrentAction] = useCurrentAction();\n const [orderDetails, setOrderDetails] = useOrderDetails();\n const [prevOrderDetails, setPrevOrderDetails] = usePrevOrderDetails();\n const [customerInfo] = useCustomerInfo();\n const [w3wError, setW3wError] = useState('');\n const [isClientPortal] = useClientPortal();\n const [currentWhat3Words, setWhat3Words] = useState();\n const [localW3W, setLocalW3W] = useState('');\n const [localLat, setLocalLat] = useState(orderDetails?.latitude || '');\n const [localLong, setLocalLong] = useState(orderDetails?.longitude || '');\n\n const closeModal = () => setCurrentAction(undefined);\n\n const cleanW3WAddress = (w3wStr: string) => {\n return w3wStr.replace(/^\\/+/, '');\n };\n\n const validateInput = (value: string) => {\n if (value.trim()) {\n const isValid = w3wRegex.test(value);\n setW3wError(\n isValid ? '' : 'Please enter a valid input (format: word.word.word)'\n );\n } else {\n setW3wError('Input cannot be empty or only spaces');\n }\n };\n\n const onChangeW3W = (e: React.ChangeEvent<HTMLInputElement>) => {\n const rawVal = e.target.value;\n const val = cleanW3WAddress(rawVal);\n validateInput(rawVal); // still validate raw input for dots, etc.\n setLocalW3W(val);\n };\n\n const onChangeLatitude = (e: React.ChangeEvent<HTMLInputElement>) => {\n setLocalLat(e.target.value);\n };\n\n const onChangeLongitude = (e: React.ChangeEvent<HTMLInputElement>) => {\n setLocalLong(e.target.value);\n };\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (['e', 'E', '+', '-'].includes(e.key)) {\n e.preventDefault();\n }\n };\n\n const { fetchData: callUpdateOrderAPI } = useAxios<{\n data: ApiResponse[];\n }>({\n endpoint: `/orders/update/`,\n method: 'PUT',\n });\n\n const { fetchData: getWhat3Words } = useAxios<{\n data: ApiResponse[];\n }>({\n endpoint: `/v1/orders/coordinates_to_w3w/?`,\n method: 'GET',\n });\n\n useEffect(() => {\n if (\n orderDetails?.latitude &&\n orderDetails?.longitude\n ) {\n getWhat3Words({\n endPointQuery: `latitude=${orderDetails?.latitude}&longitude=${orderDetails?.longitude}`,\n }).then((response: any) => {\n console.log(response?.data);\n setWhat3Words(response?.data?.words);\n });\n }\n }, [\n orderDetails?.latitude,\n orderDetails?.longitude,\n ]);\n\n const onSave = async () => {\n const updatedOrderDetails = {\n ...orderDetails,\n latitude: localLat,\n longitude: localLong,\n order_recipient: {\n ...(orderDetails?.order_recipient || {}),\n what_3words_address: localW3W,\n },\n };\n\n const payload = compareOrderDetailsStates(\n prevOrderDetails,\n updatedOrderDetails\n );\n\n let response = (await callUpdateOrderAPI({\n payload: [payload],\n })) as {\n code: number | null;\n error?: string | null | undefined;\n [key: string]: any;\n };\n\n if (response.code === 200 && response?.data?.length > 0) {\n notification.success({\n message: 'Success',\n description: `${response?.message}`,\n });\n\n await props?.callOrdersApi();\n setOrderDetails(response?.data[0]);\n setPrevOrderDetails(response?.data[0]);\n closeModal();\n } else {\n notification.error({\n message: 'Update Failed',\n description: response?.error || 'Unknown error',\n });\n\n setOrderDetails(prevOrderDetails);\n }\n };\n\n const infoText = `${customerInfo?.recipient_name}, ${customerInfo?.postcode}`;\n\n const isDifferent = () => {\n const originalRecipient = orderDetails?.order_recipient || {};\n return (\n localW3W !== (originalRecipient.what_3words_address || '') ||\n localLat !== (orderDetails?.latitude || '') ||\n localLong !== (orderDetails?.longitude || '')\n );\n };\n\n useEffect(() => {\n setLocalLat(orderDetails?.latitude || '');\n setLocalLong(orderDetails?.longitude || '');\n }, [orderDetails?.latitude, orderDetails?.longitude]);\n\n return (\n <OrderActionModal\n headerTitle=\"WHAT3WORDS\"\n onCloseHeader={closeModal}\n onSubmit={onSave}\n showAdditionalInfo\n infoText={infoText}\n isSubmitDisabled={isClientPortal ? true : !isDifferent() || !!w3wError}\n submitBtnTitle=\"Save Details\"\n >\n <Section>\n <FieldRow>\n <WordsSection>\n <Label label=\"Words\" />\n <WordInputWrapper>\n <CustomInput\n name=\"w3w\"\n type=\"text\"\n placeholder=\"Format: word.word.word\"\n value={localW3W}\n onChange={onChangeW3W}\n disabled={isClientPortal}\n />\n\n {w3wError && <ErrorText>{w3wError}</ErrorText>}\n </WordInputWrapper>\n\n <CurrentText>\n <strong>Current:</strong>{' '}\n <a\n href={`https://what3words.com/${currentWhat3Words}`}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n {currentWhat3Words}\n </a>\n </CurrentText>\n </WordsSection>\n </FieldRow>\n </Section>\n\n <Section>\n <CoordRow>\n <Coordinate>\n <Label label=\"Latitude\" htmlFor=\"lat\" />\n <CustomInput\n name=\"lat\"\n type=\"number\"\n placeholder=\"Lat\"\n value={localLat}\n onChange={onChangeLatitude}\n onKeyDown={handleKeyDown}\n />\n </Coordinate>\n <Coordinate>\n <Label label=\"Longitude\" htmlFor=\"long\" />\n\n <CustomInput\n name=\"long\"\n type=\"number\"\n placeholder=\"Long\"\n value={localLong}\n onChange={onChangeLongitude}\n onKeyDown={handleKeyDown}\n />\n </Coordinate>\n </CoordRow>\n </Section>\n </OrderActionModal>\n );\n}\n\nconst WordsSection = styled.div`\n display: flex;\n flex-direction: row;\n gap: 15px;\n align-items: center;\n`;\n\nconst WordInputWrapper = styled.div`\n display: flex;\n flex-direction: column;\n gap: 4px;\n width: 100%;\n`;\n\nconst CurrentText = styled.div`\n font-size: 13px;\n color: #444;\n white-space: nowrap;\n\n a {\n color: #1677ff;\n text-decoration: none;\n }\n\n a:hover {\n text-decoration: underline;\n }\n`;\n\nconst ErrorText = styled.span`\n color: red;\n font-size: 0.85rem;\n margin-top: 4px;\n`;\n\nconst Section = styled.div`\n padding: 15px;\n display: flex;\n flex-direction: column;\n gap: 16px;\n`;\n\nconst FieldRow = styled.div`\n display: flex;\n align-items: center;\n gap: 10px;\n flex-wrap: wrap;\n`;\n\nconst CoordRow = styled.div`\n display: flex;\n justify-content: space-between;\n gap: 14px;\n`;\n\nconst Coordinate = styled.div`\n flex: 1;\n display: flex;\n flex-direction: column;\n gap: 5px;\n`;\n\nconst CustomInput = styled(GenericInput)`\n width: 100%;\n &::-webkit-outer-spin-button,\n &::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n &:focus-visible {\n outline: none;\n }\n`;\n\nexport default What3WordsModal;\n"],"names":["What3WordsModal","props","w3wRegex","setCurrentAction","useCurrentAction","orderDetails","setOrderDetails","useOrderDetails","prevOrderDetails","setPrevOrderDetails","usePrevOrderDetails","customerInfo","useCustomerInfo","w3wError","setW3wError","useState","isClientPortal","useClientPortal","currentWhat3Words","setWhat3Words","localW3W","setLocalW3W","localLat","setLocalLat","localLong","setLocalLong","closeModal","cleanW3WAddress","w3wStr","validateInput","value","isValid","onChangeW3W","rawVal","val","onChangeLatitude","onChangeLongitude","handleKeyDown","callUpdateOrderAPI","useAxios","getWhat3Words","useEffect","response","onSave","updatedOrderDetails","payload","compareOrderDetailsStates","notification","infoText","isDifferent","originalRecipient","jsxs","OrderActionModal","jsx","Section","FieldRow","WordsSection","Label","WordInputWrapper","CustomInput","ErrorText","CurrentText","CoordRow","Coordinate","styled","GenericInput"],"mappings":";;;;;;;;;;AAgBA,SAASA,GAAgBC,GAAY;AACnC,QAAMC,IAAW,kLACX,CAAA,EAAGC,CAAgB,IAAIC,EAAA,GACvB,CAACC,GAAcC,CAAe,IAAIC,EAAA,GAClC,CAACC,GAAkBC,CAAmB,IAAIC,EAAA,GAC1C,CAACC,CAAY,IAAIC,EAAA,GACjB,CAACC,GAAUC,CAAW,IAAIC,EAAS,EAAE,GACrC,CAACC,CAAc,IAAIC,EAAA,GACnB,CAACC,GAAmBC,CAAa,IAAIJ,EAAA,GACrC,CAACK,GAAUC,CAAW,IAAIN,EAAS,EAAE,GACrC,CAACO,GAAUC,CAAW,IAAIR,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A,gBACC,MAAK;AAAA,gBACL,MAAK;AAAA,gBACL,aAAY;AAAA,gBACZ,OAAOrC;AAAA,gBACP,UAAUa;AAAA,gBACV,WAAWE;AAAA,cAAA;AAAA,YAAA;AAAA,UACb,GACF;AAAA,4BACC0B,GAAA,EACC,UAAA;AAAA,YAAA,gBAAAV,EAACI,GAAA,EAAM,OAAM,aAAY,SAAQ,QAAO;AAAA,YAExC,gBAAAJ;AAAA,cAACM;AAAA,cAAA;AAAA,gBACC,MAAK;AAAA,gBACL,MAAK;AAAA,gBACL,aAAY;AAAA,gBACZ,OAAOnC;AAAA,gBACP,UAAUY;AAAA,gBACV,WAAWC;AAAA,cAAA;AAAA,YAAA;AAAA,UACb,EAAA,CACF;AAAA,QAAA,EAAA,CACF,EAAA,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;AAEA,MAAMmB,IAAeQ,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA,GAOtBN,KAAmBM,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA,GAO1BH,KAAcG,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAerBJ,KAAYI,EAAO;AAAA;AAAA;AAAA;AAAA,GAMnBV,IAAUU,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA,GAOjBT,KAAWS,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA,GAOlBF,KAAWE,EAAO;AAAA;AAAA;AAAA;AAAA,GAMlBD,IAAaC,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA,GAOpBL,IAAcK,EAAOC,CAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
|
|
1
|
+
{"version":3,"file":"What3WordsModal.tsx.js","sources":["../../../../../../src/components/order-view/order-actions/actions/what3words/What3WordsModal.tsx.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport {\n useCurrentAction,\n useCustomerInfo,\n useOrderDetails,\n usePrevOrderDetails,\n} from '../../../store';\nimport OrderActionModal from '../../../../../common/modals/order-action-modal/OrderActionModal';\nimport { notification } from 'antd';\nimport { Label, useAxios } from '@bjsdistribution/dms-component-library';\nimport styled from 'styled-components';\nimport GenericInput from '../../../../../common/custom-input/CustomInput';\nimport { compareOrderDetailsStates } from '../../../utils';\nimport { ApiResponse } from '../../../types';\nimport { useClientPortal } from '../../../../store';\n\nfunction What3WordsModal(props: any) {\n const w3wRegex = /^\\/{0,}[^0-9`~!@#$%^&*()+\\-_=[{\\]}\\\\|'<,.>?/\";:£§º©®\\s]{1,}[・.。][^0-9`~!@#$%^&*()+\\-_=[{\\]}\\\\|'<,.>?/\";:£§º©®\\s]{1,}[・.。][^0-9`~!@#$%^&*()+\\-_=[{\\]}\\\\|'<,.>?/\";:£§º©®\\s]{1,}$/;\n const [, setCurrentAction] = useCurrentAction();\n const [orderDetails, setOrderDetails] = useOrderDetails();\n const [prevOrderDetails, setPrevOrderDetails] = usePrevOrderDetails();\n const [customerInfo] = useCustomerInfo();\n const [w3wError, setW3wError] = useState('');\n const [isClientPortal] = useClientPortal();\n const orderRecipient = orderDetails?.order_recipient || {};\n const [currentWhat3Words, setWhat3Words] = useState();\n const [localW3W, setLocalW3W] = useState('');\n const [localLat, setLocalLat] = useState(orderRecipient?.latitude || '');\n const [localLong, setLocalLong] = useState(orderRecipient?.longitude || '');\n\n const closeModal = () => setCurrentAction(undefined);\n\n const cleanW3WAddress = (w3wStr: string) => {\n return w3wStr.replace(/^\\/+/, '');\n };\n\n const validateInput = (value: string) => {\n if (value.trim()) {\n const isValid = w3wRegex.test(value);\n setW3wError(\n isValid ? '' : 'Please enter a valid input (format: word.word.word)'\n );\n } else {\n setW3wError('Input cannot be empty or only spaces');\n }\n };\n\n const onChangeW3W = (e: React.ChangeEvent<HTMLInputElement>) => {\n const rawVal = e.target.value;\n const val = cleanW3WAddress(rawVal);\n validateInput(rawVal); // still validate raw input for dots, etc.\n setLocalW3W(val);\n };\n\n const onChangeLatitude = (e: React.ChangeEvent<HTMLInputElement>) => {\n setLocalLat(e.target.value);\n };\n\n const onChangeLongitude = (e: React.ChangeEvent<HTMLInputElement>) => {\n setLocalLong(e.target.value);\n };\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (['e', 'E', '+', '-'].includes(e.key)) {\n e.preventDefault();\n }\n };\n\n const { fetchData: callUpdateOrderAPI } = useAxios<{\n data: ApiResponse[];\n }>({\n endpoint: `/orders/update/`,\n method: 'PUT',\n });\n\n const { fetchData: getWhat3Words } = useAxios<{\n data: ApiResponse[];\n }>({\n endpoint: `/v1/orders/coordinates_to_w3w/?`,\n method: 'GET',\n });\n\n useEffect(() => {\n if (\n orderDetails?.order_recipient?.latitude &&\n orderDetails?.order_recipient?.longitude\n ) {\n getWhat3Words({\n endPointQuery: `latitude=${orderDetails?.order_recipient?.latitude}&longitude=${orderDetails?.order_recipient?.longitude}`,\n }).then((response: any) => {\n console.log(response?.data);\n setWhat3Words(response?.data?.words);\n });\n }\n }, [\n orderDetails?.order_recipient?.latitude,\n orderDetails?.order_recipient?.longitude,\n ]);\n\n const onSave = async () => {\n const updatedOrderDetails = {\n ...orderDetails,\n order_recipient: {\n ...(orderDetails?.order_recipient || {}),\n what_3words_address: localW3W,\n latitude: localLat,\n longitude: localLong,\n },\n };\n\n const payload = compareOrderDetailsStates(\n prevOrderDetails,\n updatedOrderDetails\n );\n\n let response = (await callUpdateOrderAPI({\n payload: [payload],\n })) as {\n code: number | null;\n error?: string | null | undefined;\n [key: string]: any;\n };\n\n if (response.code === 200 && response?.data?.length > 0) {\n notification.success({\n message: 'Success',\n description: `${response?.message}`,\n });\n\n await props?.callOrdersApi();\n setOrderDetails(response?.data[0]);\n setPrevOrderDetails(response?.data[0]);\n closeModal();\n } else {\n notification.error({\n message: 'Update Failed',\n description: response?.error || 'Unknown error',\n });\n\n setOrderDetails(prevOrderDetails);\n }\n };\n\n const infoText = `${customerInfo?.recipient_name}, ${customerInfo?.postcode}`;\n\n const isDifferent = () => {\n const original = orderRecipient || {};\n return (\n localW3W !== (original.what_3words_address || '') ||\n localLat !== (original.latitude || '') ||\n localLong !== (original.longitude || '')\n );\n };\n\n useEffect(() => {\n setLocalLat(orderRecipient?.latitude || '');\n setLocalLong(orderRecipient?.longitude || '');\n }, [orderRecipient]);\n\n return (\n <OrderActionModal\n headerTitle=\"WHAT3WORDS\"\n onCloseHeader={closeModal}\n onSubmit={onSave}\n showAdditionalInfo\n infoText={infoText}\n isSubmitDisabled={isClientPortal ? true : !isDifferent() || !!w3wError}\n submitBtnTitle=\"Save Details\"\n >\n <Section>\n <FieldRow>\n <WordsSection>\n <Label label=\"Words\" />\n <WordInputWrapper>\n <CustomInput\n name=\"w3w\"\n type=\"text\"\n placeholder=\"Format: word.word.word\"\n value={localW3W}\n onChange={onChangeW3W}\n disabled={isClientPortal}\n />\n\n {w3wError && <ErrorText>{w3wError}</ErrorText>}\n </WordInputWrapper>\n\n <CurrentText>\n <strong>Current:</strong>{' '}\n <a\n href={`https://what3words.com/${currentWhat3Words}`}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n {currentWhat3Words}\n </a>\n </CurrentText>\n </WordsSection>\n </FieldRow>\n </Section>\n\n <Section>\n <CoordRow>\n <Coordinate>\n <Label label=\"Latitude\" htmlFor=\"lat\" />\n <CustomInput\n name=\"lat\"\n type=\"number\"\n placeholder=\"Lat\"\n value={localLat}\n onChange={onChangeLatitude}\n onKeyDown={handleKeyDown}\n />\n </Coordinate>\n <Coordinate>\n <Label label=\"Longitude\" htmlFor=\"long\" />\n\n <CustomInput\n name=\"long\"\n type=\"number\"\n placeholder=\"Long\"\n value={localLong}\n onChange={onChangeLongitude}\n onKeyDown={handleKeyDown}\n />\n </Coordinate>\n </CoordRow>\n </Section>\n </OrderActionModal>\n );\n}\n\nconst WordsSection = styled.div`\n display: flex;\n flex-direction: row;\n gap: 15px;\n align-items: center;\n`;\n\nconst WordInputWrapper = styled.div`\n display: flex;\n flex-direction: column;\n gap: 4px;\n width: 100%;\n`;\n\nconst CurrentText = styled.div`\n font-size: 13px;\n color: #444;\n white-space: nowrap;\n\n a {\n color: #1677ff;\n text-decoration: none;\n }\n\n a:hover {\n text-decoration: underline;\n }\n`;\n\nconst ErrorText = styled.span`\n color: red;\n font-size: 0.85rem;\n margin-top: 4px;\n`;\n\nconst Section = styled.div`\n padding: 15px;\n display: flex;\n flex-direction: column;\n gap: 16px;\n`;\n\nconst FieldRow = styled.div`\n display: flex;\n align-items: center;\n gap: 10px;\n flex-wrap: wrap;\n`;\n\nconst CoordRow = styled.div`\n display: flex;\n justify-content: space-between;\n gap: 14px;\n`;\n\nconst Coordinate = styled.div`\n flex: 1;\n display: flex;\n flex-direction: column;\n gap: 5px;\n`;\n\nconst CustomInput = styled(GenericInput)`\n width: 100%;\n &::-webkit-outer-spin-button,\n &::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n &:focus-visible {\n outline: none;\n }\n`;\n\nexport default What3WordsModal;\n"],"names":["What3WordsModal","props","w3wRegex","setCurrentAction","useCurrentAction","orderDetails","setOrderDetails","useOrderDetails","prevOrderDetails","setPrevOrderDetails","usePrevOrderDetails","customerInfo","useCustomerInfo","w3wError","setW3wError","useState","isClientPortal","useClientPortal","orderRecipient","currentWhat3Words","setWhat3Words","localW3W","setLocalW3W","localLat","setLocalLat","localLong","setLocalLong","closeModal","cleanW3WAddress","w3wStr","validateInput","value","isValid","onChangeW3W","rawVal","val","onChangeLatitude","onChangeLongitude","handleKeyDown","callUpdateOrderAPI","useAxios","getWhat3Words","useEffect","response","onSave","updatedOrderDetails","payload","compareOrderDetailsStates","notification","infoText","isDifferent","original","jsxs","OrderActionModal","jsx","Section","FieldRow","WordsSection","Label","WordInputWrapper","CustomInput","ErrorText","CurrentText","CoordRow","Coordinate","styled","GenericInput"],"mappings":";;;;;;;;;;AAgBA,SAASA,GAAgBC,GAAY;AACnC,QAAMC,IAAW,k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