@burdenoff/microfe-movethewheels 2026.929.4 → 2026.930.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/CustomerPicker.js +52 -48
- package/dist/components/EntityCombobox.js +25 -23
- package/dist/components/OrderItemRow.js +123 -78
- package/dist/hooks/useCustomers.js +52 -17
- package/dist/hooks/useFleet.js +126 -44
- package/dist/hooks/useInventory.js +43 -7
- package/dist/hooks/useMultiModalShipments.js +30 -26
- package/dist/hooks/useRefetchOnLeaveEdit.js +10 -0
- package/dist/hooks/useRoutes.js +55 -15
- package/dist/movethewheels/components/CustomerPicker.d.ts +5 -1
- package/dist/movethewheels/components/EntityCombobox.d.ts +6 -3
- package/dist/movethewheels/components/OrderItemRow.d.ts +7 -1
- package/dist/movethewheels/hooks/useCustomers.d.ts +3 -0
- package/dist/movethewheels/hooks/useFleet.d.ts +6 -0
- package/dist/movethewheels/hooks/useInventory.d.ts +2 -0
- package/dist/movethewheels/hooks/useMultiModalShipments.d.ts +1 -0
- package/dist/movethewheels/hooks/useRefetchOnLeaveEdit.d.ts +7 -0
- package/dist/movethewheels/hooks/useRoutes.d.ts +3 -0
- package/dist/movethewheels/utils/orderValidation.d.ts +11 -0
- package/dist/pages/CreateOrderPage.js +349 -297
- package/dist/pages/DriverDetailsPage.js +258 -251
- package/dist/pages/DriversPage.js +3 -1
- package/dist/pages/MultiModalShipmentPage.js +139 -125
- package/dist/pages/OrderDetailsPage.js +132 -140
- package/dist/pages/ProductDetailsPage.js +22 -19
- package/dist/pages/RouteDetailsPage.js +284 -281
- package/dist/pages/TrackingPage.js +2 -1
- package/dist/pages/VehicleDetailsPage.js +28 -25
- package/dist/utils/orderValidation.js +18 -0
- package/package.json +1 -1
- package/src/movethewheels/components/CustomerPicker.tsx +12 -0
- package/src/movethewheels/components/EntityCombobox.tsx +30 -11
- package/src/movethewheels/components/OrderItemRow.tsx +44 -0
- package/src/movethewheels/hooks/useCustomers.ts +38 -0
- package/src/movethewheels/hooks/useFleet.ts +125 -5
- package/src/movethewheels/hooks/useInventory.ts +42 -0
- package/src/movethewheels/hooks/useMultiModalShipments.ts +9 -7
- package/src/movethewheels/hooks/useRefetchOnLeaveEdit.ts +18 -0
- package/src/movethewheels/hooks/useRoutes.ts +51 -0
- package/src/movethewheels/pages/CreateOrderPage.tsx +66 -2
- package/src/movethewheels/pages/DriverDetailsPage.tsx +14 -1
- package/src/movethewheels/pages/DriversPage.tsx +7 -1
- package/src/movethewheels/pages/MultiModalShipmentPage.tsx +15 -1
- package/src/movethewheels/pages/OrderDetailsPage.tsx +25 -25
- package/src/movethewheels/pages/ProductDetailsPage.tsx +2 -0
- package/src/movethewheels/pages/RouteDetailsPage.tsx +10 -4
- package/src/movethewheels/pages/TrackingPage.tsx +7 -2
- package/src/movethewheels/pages/VehicleDetailsPage.tsx +2 -0
- package/src/movethewheels/utils/orderValidation.ts +53 -0
|
@@ -14,11 +14,11 @@ var C = {
|
|
|
14
14
|
phone: "",
|
|
15
15
|
company: ""
|
|
16
16
|
};
|
|
17
|
-
function w({ customers: w, value: T, onValueChange: E, onCreated: D, createCustomer: O, isLoading: k,
|
|
18
|
-
let [
|
|
19
|
-
|
|
20
|
-
},
|
|
21
|
-
|
|
17
|
+
function w({ customers: w, value: T, onValueChange: E, onCreated: D, createCustomer: O, isLoading: k, isLoadingMore: A = !1, error: j, onRetry: M, onLoadMore: N, hasMore: P = !1, totalCount: F, onOpenCustomers: I, selectedCustomer: L, onSearchQueryChange: R, disabled: z = !1 }) {
|
|
18
|
+
let [B, V] = y(!1), [H, U] = y(C), [W, G] = y(!1), [K, q] = y(null), J = () => {
|
|
19
|
+
q(null), U(C), V(!0);
|
|
20
|
+
}, Y = () => {
|
|
21
|
+
W || V(!1);
|
|
22
22
|
};
|
|
23
23
|
return /* @__PURE__ */ S("div", {
|
|
24
24
|
className: "space-y-2",
|
|
@@ -32,8 +32,8 @@ function w({ customers: w, value: T, onValueChange: E, onCreated: D, createCusto
|
|
|
32
32
|
type: "button",
|
|
33
33
|
variant: "ghost",
|
|
34
34
|
size: "sm",
|
|
35
|
-
onClick:
|
|
36
|
-
disabled:
|
|
35
|
+
onClick: J,
|
|
36
|
+
disabled: z || k,
|
|
37
37
|
children: [/* @__PURE__ */ x(e, {
|
|
38
38
|
size: 14,
|
|
39
39
|
className: "mr-1"
|
|
@@ -55,37 +55,41 @@ function w({ customers: w, value: T, onValueChange: E, onCreated: D, createCusto
|
|
|
55
55
|
" ",
|
|
56
56
|
e.email ? `(${e.email})` : ""
|
|
57
57
|
] }),
|
|
58
|
-
selectedOption:
|
|
58
|
+
selectedOption: L,
|
|
59
59
|
required: !0,
|
|
60
60
|
placeholder: k ? "Loading customers..." : "Select customer",
|
|
61
61
|
searchPlaceholder: "Search customers",
|
|
62
62
|
emptyText: "No customers found.",
|
|
63
|
-
disabled:
|
|
64
|
-
error:
|
|
65
|
-
onSearchChange:
|
|
63
|
+
disabled: z || !!j,
|
|
64
|
+
error: j ? "Customers could not be loaded" : void 0,
|
|
65
|
+
onSearchChange: R,
|
|
66
|
+
hasMore: P,
|
|
67
|
+
totalCount: F,
|
|
68
|
+
onLoadMore: N,
|
|
69
|
+
loadingMore: A,
|
|
66
70
|
className: "flex-1"
|
|
67
|
-
}),
|
|
71
|
+
}), j && /* @__PURE__ */ S(r, {
|
|
68
72
|
type: "button",
|
|
69
73
|
variant: "outline",
|
|
70
74
|
size: "sm",
|
|
71
|
-
onClick:
|
|
75
|
+
onClick: M,
|
|
72
76
|
children: [/* @__PURE__ */ x(t, {
|
|
73
77
|
size: 14,
|
|
74
78
|
className: "mr-1"
|
|
75
79
|
}), "Retry"]
|
|
76
80
|
})]
|
|
77
81
|
}),
|
|
78
|
-
|
|
82
|
+
j ? /* @__PURE__ */ S("div", {
|
|
79
83
|
className: "flex flex-wrap items-center gap-2",
|
|
80
84
|
children: [/* @__PURE__ */ x("p", {
|
|
81
85
|
role: "alert",
|
|
82
86
|
className: "text-sm text-status-error-text",
|
|
83
87
|
children: "Customers could not be loaded. Retry or add a customer to continue."
|
|
84
|
-
}),
|
|
88
|
+
}), I && /* @__PURE__ */ x(r, {
|
|
85
89
|
type: "button",
|
|
86
90
|
variant: "outline",
|
|
87
91
|
size: "sm",
|
|
88
|
-
onClick:
|
|
92
|
+
onClick: I,
|
|
89
93
|
children: "Open customer page"
|
|
90
94
|
})]
|
|
91
95
|
}) : !k && w.length === 0 ? /* @__PURE__ */ S("div", {
|
|
@@ -106,8 +110,8 @@ function w({ customers: w, value: T, onValueChange: E, onCreated: D, createCusto
|
|
|
106
110
|
type: "button",
|
|
107
111
|
size: "sm",
|
|
108
112
|
className: "mt-3",
|
|
109
|
-
onClick:
|
|
110
|
-
disabled:
|
|
113
|
+
onClick: J,
|
|
114
|
+
disabled: z,
|
|
111
115
|
children: [/* @__PURE__ */ x(e, {
|
|
112
116
|
size: 14,
|
|
113
117
|
className: "mr-1.5"
|
|
@@ -115,34 +119,34 @@ function w({ customers: w, value: T, onValueChange: E, onCreated: D, createCusto
|
|
|
115
119
|
})]
|
|
116
120
|
}) : null,
|
|
117
121
|
/* @__PURE__ */ x(i, {
|
|
118
|
-
open:
|
|
119
|
-
onOpenChange: (e) => e ?
|
|
122
|
+
open: B,
|
|
123
|
+
onOpenChange: (e) => e ? V(!0) : Y(),
|
|
120
124
|
children: /* @__PURE__ */ S(a, { children: [/* @__PURE__ */ S(c, { children: [/* @__PURE__ */ x(l, { children: "Create customer" }), /* @__PURE__ */ x(o, { children: "Add the customer without leaving this order. They will be selected automatically." })] }), /* @__PURE__ */ S("form", {
|
|
121
125
|
onSubmit: async (e) => {
|
|
122
126
|
e.preventDefault(), e.stopPropagation();
|
|
123
|
-
let t =
|
|
127
|
+
let t = H.name.trim();
|
|
124
128
|
if (!t) {
|
|
125
|
-
|
|
129
|
+
q("Customer name is required.");
|
|
126
130
|
return;
|
|
127
131
|
}
|
|
128
|
-
|
|
132
|
+
G(!0), q(null);
|
|
129
133
|
try {
|
|
130
134
|
D(await O({
|
|
131
135
|
name: t,
|
|
132
|
-
type:
|
|
133
|
-
email:
|
|
134
|
-
phone:
|
|
135
|
-
company:
|
|
136
|
-
})),
|
|
136
|
+
type: H.type,
|
|
137
|
+
email: H.email.trim() || void 0,
|
|
138
|
+
phone: H.phone.trim() || void 0,
|
|
139
|
+
company: H.company.trim() || void 0
|
|
140
|
+
})), V(!1), U(C);
|
|
137
141
|
} catch (e) {
|
|
138
|
-
|
|
142
|
+
q(e instanceof Error ? e.message : "Could not create the customer. Please try again.");
|
|
139
143
|
} finally {
|
|
140
|
-
|
|
144
|
+
G(!1);
|
|
141
145
|
}
|
|
142
146
|
},
|
|
143
147
|
className: "space-y-4",
|
|
144
148
|
children: [
|
|
145
|
-
/* @__PURE__ */ x(_, { message:
|
|
149
|
+
/* @__PURE__ */ x(_, { message: K }),
|
|
146
150
|
/* @__PURE__ */ S("div", {
|
|
147
151
|
className: "space-y-2",
|
|
148
152
|
children: [/* @__PURE__ */ x(d, {
|
|
@@ -150,8 +154,8 @@ function w({ customers: w, value: T, onValueChange: E, onCreated: D, createCusto
|
|
|
150
154
|
children: "Name"
|
|
151
155
|
}), /* @__PURE__ */ x(u, {
|
|
152
156
|
id: "quick-customer-name",
|
|
153
|
-
value:
|
|
154
|
-
onChange: (e) =>
|
|
157
|
+
value: H.name,
|
|
158
|
+
onChange: (e) => U((t) => ({
|
|
155
159
|
...t,
|
|
156
160
|
name: e.target.value
|
|
157
161
|
})),
|
|
@@ -166,8 +170,8 @@ function w({ customers: w, value: T, onValueChange: E, onCreated: D, createCusto
|
|
|
166
170
|
htmlFor: "quick-customer-type",
|
|
167
171
|
children: "Customer type"
|
|
168
172
|
}), /* @__PURE__ */ S(f, {
|
|
169
|
-
value:
|
|
170
|
-
onValueChange: (e) =>
|
|
173
|
+
value: H.type,
|
|
174
|
+
onValueChange: (e) => U((t) => ({
|
|
171
175
|
...t,
|
|
172
176
|
type: e
|
|
173
177
|
})),
|
|
@@ -193,8 +197,8 @@ function w({ customers: w, value: T, onValueChange: E, onCreated: D, createCusto
|
|
|
193
197
|
}), /* @__PURE__ */ x(u, {
|
|
194
198
|
id: "quick-customer-email",
|
|
195
199
|
type: "email",
|
|
196
|
-
value:
|
|
197
|
-
onChange: (e) =>
|
|
200
|
+
value: H.email,
|
|
201
|
+
onChange: (e) => U((t) => ({
|
|
198
202
|
...t,
|
|
199
203
|
email: e.target.value
|
|
200
204
|
})),
|
|
@@ -207,8 +211,8 @@ function w({ customers: w, value: T, onValueChange: E, onCreated: D, createCusto
|
|
|
207
211
|
children: "Phone"
|
|
208
212
|
}), /* @__PURE__ */ x(u, {
|
|
209
213
|
id: "quick-customer-phone",
|
|
210
|
-
value:
|
|
211
|
-
onChange: (e) =>
|
|
214
|
+
value: H.phone,
|
|
215
|
+
onChange: (e) => U((t) => ({
|
|
212
216
|
...t,
|
|
213
217
|
phone: e.target.value
|
|
214
218
|
})),
|
|
@@ -223,8 +227,8 @@ function w({ customers: w, value: T, onValueChange: E, onCreated: D, createCusto
|
|
|
223
227
|
children: "Company"
|
|
224
228
|
}), /* @__PURE__ */ x(u, {
|
|
225
229
|
id: "quick-customer-company",
|
|
226
|
-
value:
|
|
227
|
-
onChange: (e) =>
|
|
230
|
+
value: H.company,
|
|
231
|
+
onChange: (e) => U((t) => ({
|
|
228
232
|
...t,
|
|
229
233
|
company: e.target.value
|
|
230
234
|
})),
|
|
@@ -232,26 +236,26 @@ function w({ customers: w, value: T, onValueChange: E, onCreated: D, createCusto
|
|
|
232
236
|
})]
|
|
233
237
|
}),
|
|
234
238
|
/* @__PURE__ */ S(s, { children: [
|
|
235
|
-
|
|
239
|
+
I && /* @__PURE__ */ x(r, {
|
|
236
240
|
type: "button",
|
|
237
241
|
variant: "outline",
|
|
238
242
|
onClick: () => {
|
|
239
|
-
|
|
243
|
+
Y(), I();
|
|
240
244
|
},
|
|
241
|
-
disabled:
|
|
245
|
+
disabled: W,
|
|
242
246
|
children: "Use customer page"
|
|
243
247
|
}),
|
|
244
248
|
/* @__PURE__ */ x(r, {
|
|
245
249
|
type: "button",
|
|
246
250
|
variant: "outline",
|
|
247
|
-
onClick:
|
|
248
|
-
disabled:
|
|
251
|
+
onClick: Y,
|
|
252
|
+
disabled: W,
|
|
249
253
|
children: "Cancel"
|
|
250
254
|
}),
|
|
251
255
|
/* @__PURE__ */ S(r, {
|
|
252
256
|
type: "submit",
|
|
253
|
-
disabled:
|
|
254
|
-
children: [/* @__PURE__ */ x(e, { size: 16 }),
|
|
257
|
+
disabled: W,
|
|
258
|
+
children: [/* @__PURE__ */ x(e, { size: 16 }), W ? "Creating..." : "Create and select"]
|
|
255
259
|
})
|
|
256
260
|
] })
|
|
257
261
|
]
|
|
@@ -6,16 +6,16 @@ import { useDebouncedValue as d } from "../hooks/useDebouncedValue.js";
|
|
|
6
6
|
import { useEffect as f, useState as p } from "react";
|
|
7
7
|
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
8
8
|
//#region src/movethewheels/components/EntityCombobox.tsx
|
|
9
|
-
function g({ value: g, onChange: _, options: v, loading: y = !1, getId: b, renderOption: x, getLabel: S, selectedOption: C = null, selectedLoading: w = !1, required: T = !1, placeholder: E = "Select…", searchPlaceholder: D = "Search…", emptyText: O = "No results found.", noneLabel: k = "None", disabled: A = !1, id: j, error: M, className: N, onSearchChange: P, hasMore: F = !1, totalCount: I }) {
|
|
10
|
-
let [
|
|
9
|
+
function g({ value: g, onChange: _, options: v, loading: y = !1, getId: b, renderOption: x, getLabel: S, selectedOption: C = null, selectedLoading: w = !1, required: T = !1, placeholder: E = "Select…", searchPlaceholder: D = "Search…", emptyText: O = "No results found.", noneLabel: k = "None", disabled: A = !1, id: j, error: M, className: N, onSearchChange: P, hasMore: F = !1, totalCount: I, onLoadMore: L, loadingMore: R = !1 }) {
|
|
10
|
+
let [z, B] = p(!1), [V, H] = p(""), U = d(V.trim(), 200);
|
|
11
11
|
f(() => {
|
|
12
|
-
P && P(
|
|
13
|
-
}, [
|
|
14
|
-
let
|
|
12
|
+
P && P(U);
|
|
13
|
+
}, [U]);
|
|
14
|
+
let W = C ? S(C) : g ? w ? "Loading…" : g : E, G = n("w-full flex items-center justify-between gap-2 px-3 py-2", "bg-surface", "border border-default", "rounded-lg", "text-left text-sm text-text-primary", "focus:outline-none focus:ring-2 focus:ring-[var(--color-border-focus)]", "disabled:bg-bg-sunken disabled:cursor-not-allowed", "transition-all duration-200", M && "border-[var(--color-status-error)]", !C && "text-text-tertiary", N), K = !!(L && F);
|
|
15
15
|
return /* @__PURE__ */ h(c, {
|
|
16
|
-
open:
|
|
16
|
+
open: z,
|
|
17
17
|
onOpenChange: (e) => {
|
|
18
|
-
|
|
18
|
+
B(e), e || H("");
|
|
19
19
|
},
|
|
20
20
|
children: [/* @__PURE__ */ m(u, {
|
|
21
21
|
asChild: !0,
|
|
@@ -23,14 +23,14 @@ function g({ value: g, onChange: _, options: v, loading: y = !1, getId: b, rende
|
|
|
23
23
|
type: "button",
|
|
24
24
|
id: j,
|
|
25
25
|
role: "combobox",
|
|
26
|
-
"aria-expanded":
|
|
26
|
+
"aria-expanded": z,
|
|
27
27
|
"aria-required": T,
|
|
28
28
|
"aria-invalid": M ? !0 : void 0,
|
|
29
29
|
disabled: A,
|
|
30
|
-
className:
|
|
30
|
+
className: G,
|
|
31
31
|
children: [/* @__PURE__ */ m("span", {
|
|
32
32
|
className: "truncate",
|
|
33
|
-
children:
|
|
33
|
+
children: W
|
|
34
34
|
}), /* @__PURE__ */ m(t, {
|
|
35
35
|
size: 16,
|
|
36
36
|
className: "shrink-0 text-text-tertiary",
|
|
@@ -44,8 +44,8 @@ function g({ value: g, onChange: _, options: v, loading: y = !1, getId: b, rende
|
|
|
44
44
|
shouldFilter: !1,
|
|
45
45
|
className: "bg-surface text-text-primary",
|
|
46
46
|
children: [P && /* @__PURE__ */ m(a, {
|
|
47
|
-
value:
|
|
48
|
-
onValueChange:
|
|
47
|
+
value: V,
|
|
48
|
+
onValueChange: H,
|
|
49
49
|
placeholder: D,
|
|
50
50
|
className: "text-text-primary placeholder:text-text-tertiary"
|
|
51
51
|
}), /* @__PURE__ */ h(s, { children: [
|
|
@@ -56,7 +56,7 @@ function g({ value: g, onChange: _, options: v, loading: y = !1, getId: b, rende
|
|
|
56
56
|
!T && /* @__PURE__ */ h(o, {
|
|
57
57
|
value: "__none__",
|
|
58
58
|
onSelect: () => {
|
|
59
|
-
_(""),
|
|
59
|
+
_(""), B(!1);
|
|
60
60
|
},
|
|
61
61
|
className: "text-text-tertiary",
|
|
62
62
|
children: [/* @__PURE__ */ m(e, {
|
|
@@ -73,7 +73,7 @@ function g({ value: g, onChange: _, options: v, loading: y = !1, getId: b, rende
|
|
|
73
73
|
return /* @__PURE__ */ h(o, {
|
|
74
74
|
value: r,
|
|
75
75
|
onSelect: () => {
|
|
76
|
-
_(r),
|
|
76
|
+
_(r), B(!1);
|
|
77
77
|
},
|
|
78
78
|
className: "text-text-primary",
|
|
79
79
|
children: [/* @__PURE__ */ m(e, {
|
|
@@ -86,15 +86,17 @@ function g({ value: g, onChange: _, options: v, loading: y = !1, getId: b, rende
|
|
|
86
86
|
})]
|
|
87
87
|
}, r);
|
|
88
88
|
}),
|
|
89
|
-
|
|
90
|
-
className: "
|
|
91
|
-
children:
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
89
|
+
K && /* @__PURE__ */ m("div", {
|
|
90
|
+
className: "border-t border-border-seam p-2",
|
|
91
|
+
children: /* @__PURE__ */ m("button", {
|
|
92
|
+
type: "button",
|
|
93
|
+
className: "w-full rounded-md px-3 py-2 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/10 focus:outline-none focus:ring-2 focus:ring-[var(--color-border-focus)] disabled:cursor-not-allowed disabled:opacity-60",
|
|
94
|
+
onClick: () => void L?.(),
|
|
95
|
+
disabled: y || R,
|
|
96
|
+
"aria-busy": R,
|
|
97
|
+
"aria-label": R ? "Loading more options" : `Load more options${typeof I == "number" ? ` (${v.length} of ${I} shown)` : ""}`,
|
|
98
|
+
children: R ? "Loading more…" : `Load more${typeof I == "number" ? ` (${v.length} of ${I})` : ""}`
|
|
99
|
+
})
|
|
98
100
|
})
|
|
99
101
|
] })]
|
|
100
102
|
})
|
|
@@ -7,25 +7,30 @@ import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
|
7
7
|
function u(e, t) {
|
|
8
8
|
return e <= 0 ? "No stock recorded for this item." : t.length === 1 ? `${e.toLocaleString()} available at ${t[0].warehouseName}` : `${e.toLocaleString()} available across ${t.length} warehouses`;
|
|
9
9
|
}
|
|
10
|
-
function d({ item: d, index: f, products: p, productsLoading: m,
|
|
11
|
-
let { product:
|
|
10
|
+
function d({ item: d, index: f, products: p, productsLoading: m, productsLoadingMore: h = !1, productsHasMore: g = !1, productsTotalCount: _, onLoadMoreProducts: v, errors: y = {}, onUpdate: b, onRemove: x }) {
|
|
11
|
+
let { product: S, isLoading: C } = t(d.productId || void 0), { levels: w, totalAvailable: T, isLoading: E } = n(d.productId || void 0), D = d.dimensions ?? {
|
|
12
12
|
length: 0,
|
|
13
13
|
width: 0,
|
|
14
14
|
height: 0,
|
|
15
15
|
unit: "cm"
|
|
16
|
-
},
|
|
16
|
+
}, O = (e) => {
|
|
17
17
|
if (!e) {
|
|
18
|
-
|
|
18
|
+
b(f, "productId", "");
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
21
21
|
let t = p.find((t) => t.id === e);
|
|
22
|
-
t && (
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
...
|
|
22
|
+
t && (b(f, "productId", t.id), b(f, "name", t.name), b(f, "sku", t.sku), b(f, "weight", t.weight), b(f, "value", t.value), b(f, "dimensions", t.dimensions));
|
|
23
|
+
}, k = (e, t) => {
|
|
24
|
+
b(f, "dimensions", {
|
|
25
|
+
...D,
|
|
26
26
|
[e]: Number.parseFloat(t) || 0
|
|
27
27
|
});
|
|
28
|
-
}
|
|
28
|
+
}, A = (e) => y[e] ? /* @__PURE__ */ c("p", {
|
|
29
|
+
id: `item-${e}-${d.id}-error`,
|
|
30
|
+
className: "text-xs text-status-error-text",
|
|
31
|
+
role: "alert",
|
|
32
|
+
children: y[e]
|
|
33
|
+
}) : null;
|
|
29
34
|
return /* @__PURE__ */ l("div", {
|
|
30
35
|
className: "rounded-card border border-border-subtle bg-bg-surface p-4 shadow-elevation-1 sm:p-5",
|
|
31
36
|
"aria-labelledby": `order-item-${d.id}-title`,
|
|
@@ -43,7 +48,7 @@ function d({ item: d, index: f, products: p, productsLoading: m, onUpdate: h, on
|
|
|
43
48
|
variant: "ghost",
|
|
44
49
|
size: "icon",
|
|
45
50
|
className: "shrink-0 text-status-error-text",
|
|
46
|
-
onClick: () =>
|
|
51
|
+
onClick: () => x(f),
|
|
47
52
|
"aria-label": `Remove item ${f + 1}`,
|
|
48
53
|
title: `Remove item ${f + 1}`,
|
|
49
54
|
children: /* @__PURE__ */ c(e, {
|
|
@@ -64,7 +69,7 @@ function d({ item: d, index: f, products: p, productsLoading: m, onUpdate: h, on
|
|
|
64
69
|
/* @__PURE__ */ c(o, {
|
|
65
70
|
id: `item-product-${d.id}`,
|
|
66
71
|
value: d.productId,
|
|
67
|
-
onChange:
|
|
72
|
+
onChange: O,
|
|
68
73
|
options: p,
|
|
69
74
|
loading: m,
|
|
70
75
|
getId: (e) => e.id,
|
|
@@ -81,16 +86,20 @@ function d({ item: d, index: f, products: p, productsLoading: m, onUpdate: h, on
|
|
|
81
86
|
]
|
|
82
87
|
})
|
|
83
88
|
] }),
|
|
84
|
-
selectedOption:
|
|
85
|
-
selectedLoading:
|
|
89
|
+
selectedOption: S,
|
|
90
|
+
selectedLoading: C,
|
|
86
91
|
placeholder: "Pick from your product catalog",
|
|
87
92
|
emptyText: "No products found.",
|
|
88
|
-
noneLabel: "Enter details manually"
|
|
93
|
+
noneLabel: "Enter details manually",
|
|
94
|
+
hasMore: g,
|
|
95
|
+
totalCount: _,
|
|
96
|
+
onLoadMore: v,
|
|
97
|
+
loadingMore: h
|
|
89
98
|
}),
|
|
90
|
-
d.productId && !
|
|
99
|
+
d.productId && !E && /* @__PURE__ */ c("p", {
|
|
91
100
|
className: "mt-2 text-xs text-text-secondary",
|
|
92
101
|
role: "status",
|
|
93
|
-
children: u(
|
|
102
|
+
children: u(T, w)
|
|
94
103
|
})
|
|
95
104
|
]
|
|
96
105
|
}),
|
|
@@ -99,68 +108,98 @@ function d({ item: d, index: f, products: p, productsLoading: m, onUpdate: h, on
|
|
|
99
108
|
children: [
|
|
100
109
|
/* @__PURE__ */ l("div", {
|
|
101
110
|
className: "space-y-2 lg:col-span-4",
|
|
102
|
-
children: [
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
+
children: [
|
|
112
|
+
/* @__PURE__ */ c(a, {
|
|
113
|
+
htmlFor: `item-name-${d.id}`,
|
|
114
|
+
children: "Item name"
|
|
115
|
+
}),
|
|
116
|
+
/* @__PURE__ */ c(i, {
|
|
117
|
+
id: `item-name-${d.id}`,
|
|
118
|
+
value: d.name,
|
|
119
|
+
onChange: (e) => b(f, "name", e.target.value),
|
|
120
|
+
placeholder: "Product name",
|
|
121
|
+
"aria-invalid": !!y.name,
|
|
122
|
+
"aria-describedby": y.name ? `item-name-${d.id}-error` : void 0
|
|
123
|
+
}),
|
|
124
|
+
A("name")
|
|
125
|
+
]
|
|
111
126
|
}),
|
|
112
127
|
/* @__PURE__ */ l("div", {
|
|
113
128
|
className: "space-y-2 lg:col-span-3",
|
|
114
|
-
children: [
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
129
|
+
children: [
|
|
130
|
+
/* @__PURE__ */ c(a, {
|
|
131
|
+
htmlFor: `item-sku-${d.id}`,
|
|
132
|
+
children: "SKU"
|
|
133
|
+
}),
|
|
134
|
+
/* @__PURE__ */ c(i, {
|
|
135
|
+
id: `item-sku-${d.id}`,
|
|
136
|
+
value: d.sku,
|
|
137
|
+
onChange: (e) => b(f, "sku", e.target.value),
|
|
138
|
+
placeholder: "SKU-001",
|
|
139
|
+
"aria-invalid": !!y.sku,
|
|
140
|
+
"aria-describedby": y.sku ? `item-sku-${d.id}-error` : void 0
|
|
141
|
+
}),
|
|
142
|
+
A("sku")
|
|
143
|
+
]
|
|
123
144
|
}),
|
|
124
145
|
/* @__PURE__ */ l("div", {
|
|
125
146
|
className: "space-y-2 lg:col-span-2",
|
|
126
|
-
children: [
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
147
|
+
children: [
|
|
148
|
+
/* @__PURE__ */ c(a, {
|
|
149
|
+
htmlFor: `item-quantity-${d.id}`,
|
|
150
|
+
children: "Quantity"
|
|
151
|
+
}),
|
|
152
|
+
/* @__PURE__ */ c(i, {
|
|
153
|
+
id: `item-quantity-${d.id}`,
|
|
154
|
+
type: "number",
|
|
155
|
+
min: "1",
|
|
156
|
+
value: d.quantity,
|
|
157
|
+
onChange: (e) => b(f, "quantity", parseInt(e.target.value, 10) || 1),
|
|
158
|
+
"aria-invalid": !!y.quantity,
|
|
159
|
+
"aria-describedby": y.quantity ? `item-quantity-${d.id}-error` : void 0
|
|
160
|
+
}),
|
|
161
|
+
A("quantity")
|
|
162
|
+
]
|
|
136
163
|
}),
|
|
137
164
|
/* @__PURE__ */ l("div", {
|
|
138
165
|
className: "space-y-2 lg:col-span-2",
|
|
139
|
-
children: [
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
166
|
+
children: [
|
|
167
|
+
/* @__PURE__ */ c(a, {
|
|
168
|
+
htmlFor: `item-weight-${d.id}`,
|
|
169
|
+
children: "Weight (kg)"
|
|
170
|
+
}),
|
|
171
|
+
/* @__PURE__ */ c(i, {
|
|
172
|
+
id: `item-weight-${d.id}`,
|
|
173
|
+
type: "number",
|
|
174
|
+
min: "0",
|
|
175
|
+
step: "0.1",
|
|
176
|
+
value: d.weight,
|
|
177
|
+
onChange: (e) => b(f, "weight", parseFloat(e.target.value) || 0),
|
|
178
|
+
"aria-invalid": !!y.weight,
|
|
179
|
+
"aria-describedby": y.weight ? `item-weight-${d.id}-error` : void 0
|
|
180
|
+
}),
|
|
181
|
+
A("weight")
|
|
182
|
+
]
|
|
150
183
|
}),
|
|
151
184
|
/* @__PURE__ */ l("div", {
|
|
152
185
|
className: "space-y-2 lg:col-span-1",
|
|
153
|
-
children: [
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
186
|
+
children: [
|
|
187
|
+
/* @__PURE__ */ c(a, {
|
|
188
|
+
htmlFor: `item-value-${d.id}`,
|
|
189
|
+
children: "Value ($)"
|
|
190
|
+
}),
|
|
191
|
+
/* @__PURE__ */ c(i, {
|
|
192
|
+
id: `item-value-${d.id}`,
|
|
193
|
+
type: "number",
|
|
194
|
+
min: "0",
|
|
195
|
+
step: "0.01",
|
|
196
|
+
value: d.value,
|
|
197
|
+
onChange: (e) => b(f, "value", parseFloat(e.target.value) || 0),
|
|
198
|
+
"aria-invalid": !!y.value,
|
|
199
|
+
"aria-describedby": y.value ? `item-value-${d.id}-error` : void 0
|
|
200
|
+
}),
|
|
201
|
+
A("value")
|
|
202
|
+
]
|
|
164
203
|
})
|
|
165
204
|
]
|
|
166
205
|
}),
|
|
@@ -171,7 +210,7 @@ function d({ item: d, index: f, products: p, productsLoading: m, onUpdate: h, on
|
|
|
171
210
|
className: "px-1 text-xs font-medium text-text-secondary",
|
|
172
211
|
children: [
|
|
173
212
|
"Dimensions (",
|
|
174
|
-
|
|
213
|
+
D.unit,
|
|
175
214
|
")"
|
|
176
215
|
]
|
|
177
216
|
}),
|
|
@@ -183,17 +222,23 @@ function d({ item: d, index: f, products: p, productsLoading: m, onUpdate: h, on
|
|
|
183
222
|
"height"
|
|
184
223
|
].map((e) => /* @__PURE__ */ l("div", {
|
|
185
224
|
className: "space-y-2",
|
|
186
|
-
children: [
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
225
|
+
children: [
|
|
226
|
+
/* @__PURE__ */ c(a, {
|
|
227
|
+
htmlFor: `item-${e}-${d.id}`,
|
|
228
|
+
children: e.charAt(0).toUpperCase() + e.slice(1)
|
|
229
|
+
}),
|
|
230
|
+
/* @__PURE__ */ c(i, {
|
|
231
|
+
id: `item-${e}-${d.id}`,
|
|
232
|
+
type: "number",
|
|
233
|
+
min: "0",
|
|
234
|
+
step: "0.1",
|
|
235
|
+
value: D[e],
|
|
236
|
+
onChange: (t) => k(e, t.target.value),
|
|
237
|
+
"aria-invalid": !!y[e],
|
|
238
|
+
"aria-describedby": y[e] ? `item-${e}-${d.id}-error` : void 0
|
|
239
|
+
}),
|
|
240
|
+
A(e)
|
|
241
|
+
]
|
|
197
242
|
}, e))
|
|
198
243
|
}),
|
|
199
244
|
/* @__PURE__ */ c("p", {
|