@burdenoff/microfe-movethewheels 2026.921.1 → 2026.923.1

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.
@@ -3,139 +3,167 @@ import { CalendarClock as t } from "../node_modules/lucide-react/dist/esm/icons/
3
3
  import { MapPin as n } from "../node_modules/lucide-react/dist/esm/icons/map-pin.js";
4
4
  import { Package as r } from "../node_modules/lucide-react/dist/esm/icons/package.js";
5
5
  import { Plus as i } from "../node_modules/lucide-react/dist/esm/icons/plus.js";
6
- import { Save as a } from "../node_modules/lucide-react/dist/esm/icons/save.js";
7
- import { Trash2 as ee } from "../node_modules/lucide-react/dist/esm/icons/trash-2.js";
8
- import { Users as o } from "../node_modules/lucide-react/dist/esm/icons/users.js";
9
- import { buildCustomerCreatePath as te, joinPath as s } from "../utils/navigation.js";
10
- import { useMoveTheWheels as c } from "../providers/MoveTheWheelsProvider.js";
11
- import { useOrder as l, useOrders as u } from "../hooks/useOrders.js";
12
- import { useCustomer as ne, useCustomers as re } from "../hooks/useCustomers.js";
13
- import { Button as d, Card as f, CardContent as p, CardHeader as m, CardTitle as h, Input as g, Label as _, Select as v, SelectContent as ie, SelectItem as y, SelectTrigger as ae, SelectValue as oe, Separator as se, Textarea as ce } from "../components/ui.js";
14
- import { EmptyState as le, PageLayout as ue } from "../components/PageLayout.js";
15
- import { FormError as de } from "../components/FormError.js";
16
- import { useDebouncedValue as fe } from "../hooks/useDebouncedValue.js";
17
- import { CustomerPicker as pe } from "../components/CustomerPicker.js";
6
+ import { Route as a } from "../node_modules/lucide-react/dist/esm/icons/route.js";
7
+ import { Save as ee } from "../node_modules/lucide-react/dist/esm/icons/save.js";
8
+ import { Trash2 as te } from "../node_modules/lucide-react/dist/esm/icons/trash-2.js";
9
+ import { Users as ne } from "../node_modules/lucide-react/dist/esm/icons/users.js";
10
+ import { buildCustomerCreatePath as re, joinPath as o } from "../utils/navigation.js";
11
+ import { useMoveTheWheels as ie } from "../providers/MoveTheWheelsProvider.js";
12
+ import { useRoutes as ae } from "../hooks/useRoutes.js";
13
+ import { useOrder as oe, useOrders as se } from "../hooks/useOrders.js";
14
+ import { useCustomer as ce, useCustomers as le } from "../hooks/useCustomers.js";
15
+ import { Button as s, Card as c, CardContent as l, CardHeader as u, CardTitle as d, Input as f, Label as p, Select as m, SelectContent as h, SelectItem as g, SelectTrigger as _, SelectValue as v, Separator as ue, Textarea as de } from "../components/ui.js";
16
+ import { EmptyState as fe, PageLayout as y } from "../components/PageLayout.js";
17
+ import { FormError as pe } from "../components/FormError.js";
18
+ import { useDebouncedValue as me } from "../hooks/useDebouncedValue.js";
19
+ import { CustomerPicker as he } from "../components/CustomerPicker.js";
18
20
  import { useEffect as b, useState as x } from "react";
19
- import { useParams as me, useSearchParams as he } from "react-router";
20
- import { jsx as S, jsxs as C } from "react/jsx-runtime";
21
- import { EmphasisPanel as ge, NextSteps as _e, PagePurpose as ve } from "@burdenoff/fe-libs/ui";
21
+ import { useParams as ge, useSearchParams as S } from "react-router";
22
+ import { jsx as C, jsxs as w } from "react/jsx-runtime";
23
+ import { EmphasisPanel as _e, NextSteps as ve, PagePurpose as ye } from "@burdenoff/fe-libs/ui";
22
24
  //#region src/movethewheels/pages/CreateOrderPage.tsx
23
- function w(e) {
25
+ function T(e) {
24
26
  if (!e || Number.isNaN(e.getTime())) return "";
25
27
  let t = (e) => String(e).padStart(2, "0");
26
28
  return `${e.getFullYear()}-${t(e.getMonth() + 1)}-${t(e.getDate())}T${t(e.getHours())}:${t(e.getMinutes())}`;
27
29
  }
28
- function T() {
29
- let { orderId: T } = me(), [ye] = he(), E = ye.get("customerId")?.trim() || void 0, { basePath: D, navigate: O } = c(), { order: k } = l(T), { createOrder: A, updateOrder: j } = u(), [M, N] = x(""), { customers: P, createCustomer: be, isLoading: F, error: I, refetch: xe } = re({
30
+ function E() {
31
+ let { orderId: E } = ge(), [be] = S(), D = be.get("customerId")?.trim() || void 0, { basePath: O, navigate: k } = ie(), { order: A } = oe(E), { createOrder: j, updateOrder: M } = se(), [N, xe] = x(""), { customers: P, createCustomer: Se, isLoading: F, error: I, refetch: Ce } = le({
30
32
  limit: 20,
31
- filters: { search: fe(M) || void 0 }
32
- }), { customer: L } = ne(E ?? k?.customerId), R = !!T && !!k, [z, B] = x(null), [V, H] = x({
33
- customerId: E || k?.customerId || "",
34
- priority: k?.priority || "normal",
33
+ filters: { search: me(N) || void 0 }
34
+ }), { customer: L } = ce(D ?? A?.customerId), { routes: R, isLoading: we, error: Te } = ae({
35
+ status: "planned",
36
+ limit: 20
37
+ }), z = !!E && !!A, [B, V] = x(null), [H, U] = x({
38
+ customerId: D || A?.customerId || "",
39
+ priority: A?.priority || "normal",
40
+ routeId: A?.routeId || "",
35
41
  pickupAddress: {
36
- street: k?.pickupAddress.street || "",
37
- city: k?.pickupAddress.city || "",
38
- state: k?.pickupAddress.state || "",
39
- postalCode: k?.pickupAddress.postalCode || "",
40
- country: k?.pickupAddress.country || "USA"
42
+ street: A?.pickupAddress.street || "",
43
+ city: A?.pickupAddress.city || "",
44
+ state: A?.pickupAddress.state || "",
45
+ postalCode: A?.pickupAddress.postalCode || "",
46
+ country: A?.pickupAddress.country || "USA"
41
47
  },
42
48
  deliveryAddress: {
43
- street: k?.deliveryAddress.street || "",
44
- city: k?.deliveryAddress.city || "",
45
- state: k?.deliveryAddress.state || "",
46
- postalCode: k?.deliveryAddress.postalCode || "",
47
- country: k?.deliveryAddress.country || "USA"
49
+ street: A?.deliveryAddress.street || "",
50
+ city: A?.deliveryAddress.city || "",
51
+ state: A?.deliveryAddress.state || "",
52
+ postalCode: A?.deliveryAddress.postalCode || "",
53
+ country: A?.deliveryAddress.country || "USA"
48
54
  },
49
- items: k?.items || [],
50
- scheduledDelivery: w(k?.scheduledDelivery),
51
- specialInstructions: k?.specialInstructions || ""
52
- }), [U, W] = x(!1), [Se, G] = x(null);
55
+ items: A?.items || [],
56
+ scheduledDelivery: T(A?.scheduledDelivery),
57
+ specialInstructions: A?.specialInstructions || ""
58
+ }), [W, G] = x(!1), [Ee, K] = x(null);
53
59
  b(() => {
54
- L && (B((e) => e?.id === L.id ? e : L), H((e) => e.customerId ? e : {
60
+ L && (V((e) => e?.id === L.id ? e : L), U((e) => e.customerId ? e : {
55
61
  ...e,
56
62
  customerId: L.id
57
63
  }));
58
64
  }, [L]), b(() => {
59
- k && H({
60
- customerId: k.customerId || "",
61
- priority: k.priority || "normal",
65
+ A && U({
66
+ customerId: A.customerId || "",
67
+ priority: A.priority || "normal",
68
+ routeId: A.routeId || "",
62
69
  pickupAddress: {
63
- street: k.pickupAddress.street || "",
64
- city: k.pickupAddress.city || "",
65
- state: k.pickupAddress.state || "",
66
- postalCode: k.pickupAddress.postalCode || "",
67
- country: k.pickupAddress.country || "USA"
70
+ street: A.pickupAddress.street || "",
71
+ city: A.pickupAddress.city || "",
72
+ state: A.pickupAddress.state || "",
73
+ postalCode: A.pickupAddress.postalCode || "",
74
+ country: A.pickupAddress.country || "USA"
68
75
  },
69
76
  deliveryAddress: {
70
- street: k.deliveryAddress.street || "",
71
- city: k.deliveryAddress.city || "",
72
- state: k.deliveryAddress.state || "",
73
- postalCode: k.deliveryAddress.postalCode || "",
74
- country: k.deliveryAddress.country || "USA"
77
+ street: A.deliveryAddress.street || "",
78
+ city: A.deliveryAddress.city || "",
79
+ state: A.deliveryAddress.state || "",
80
+ postalCode: A.deliveryAddress.postalCode || "",
81
+ country: A.deliveryAddress.country || "USA"
75
82
  },
76
- items: k.items || [],
77
- scheduledDelivery: w(k.scheduledDelivery),
78
- specialInstructions: k.specialInstructions || ""
83
+ items: A.items || [],
84
+ scheduledDelivery: T(A.scheduledDelivery),
85
+ specialInstructions: A.specialInstructions || ""
79
86
  });
80
- }, [k]);
81
- let K = () => {
82
- if (O) {
83
- if (!R && E) {
84
- O(s(D, `customers/${E}`));
87
+ }, [A]);
88
+ let q = () => {
89
+ if (k) {
90
+ if (!z && D) {
91
+ k(o(O, `customers/${D}`));
85
92
  return;
86
93
  }
87
- O(s(D, "orders"));
94
+ k(o(O, "orders"));
88
95
  }
89
- }, q = () => z ?? P.find((e) => e.id === V.customerId), J = () => !V.customerId || !q() ? I ? "Customers could not be loaded. Retry or create a customer before continuing." : "Select a customer for this order." : V.pickupAddress.street.trim() ? V.deliveryAddress.street.trim() ? V.items.length === 0 ? "Add at least one item to the order." : V.scheduledDelivery && Number.isNaN(Date.parse(V.scheduledDelivery)) ? "Enter a valid scheduled delivery date and time." : null : "Enter a delivery street address." : "Enter a pickup street address.", Y = async (e) => {
90
- e.preventDefault(), G(null);
91
- let t = J();
96
+ }, J = () => B ?? P.find((e) => e.id === H.customerId), De = () => !H.customerId || !J() ? I ? "Customers could not be loaded. Retry or create a customer before continuing." : "Select a customer for this order." : H.pickupAddress.street.trim() ? H.deliveryAddress.street.trim() ? H.items.length === 0 ? "Add at least one item to the order." : H.scheduledDelivery && Number.isNaN(Date.parse(H.scheduledDelivery)) ? "Enter a valid scheduled delivery date and time." : null : "Enter a delivery street address." : "Enter a pickup street address.", Y = async (e) => {
97
+ e.preventDefault(), K(null);
98
+ let t = De();
92
99
  if (t) {
93
- G(t);
100
+ K(t);
94
101
  return;
95
102
  }
96
- let n = q();
103
+ let n = J();
97
104
  if (!n) {
98
- G(I ? "Customers could not be loaded. Retry or create a customer before continuing." : "Select a customer for this order.");
105
+ K(I ? "Customers could not be loaded. Retry or create a customer before continuing." : "Select a customer for this order.");
99
106
  return;
100
107
  }
101
- W(!0);
108
+ G(!0);
102
109
  try {
103
110
  let e = {
104
- customerId: V.customerId,
111
+ customerId: H.customerId,
105
112
  customerInfo: {
106
113
  name: n.name,
107
114
  email: n.email,
108
115
  phone: n.phone,
109
116
  company: n.company
110
117
  },
111
- priority: V.priority,
112
- pickupAddress: V.pickupAddress,
113
- deliveryAddress: V.deliveryAddress,
114
- items: V.items,
115
- scheduledDelivery: V.scheduledDelivery ? new Date(V.scheduledDelivery) : null,
116
- specialInstructions: V.specialInstructions
118
+ priority: H.priority,
119
+ pickupAddress: H.pickupAddress,
120
+ deliveryAddress: H.deliveryAddress,
121
+ items: H.items,
122
+ scheduledDelivery: H.scheduledDelivery ? new Date(H.scheduledDelivery) : null,
123
+ routeId: H.routeId || void 0,
124
+ specialInstructions: H.specialInstructions
117
125
  };
118
- R && T ? (await j(T, e), O && O(s(D, `orders/${T}`))) : (await A(e), K());
126
+ z && E ? (await M(E, e), k && k(o(O, `orders/${E}`))) : (await j(e), q());
119
127
  } catch (e) {
120
- G(e instanceof Error ? e.message : R ? "Could not update the order. Please try again." : "Could not create the order. Please try again.");
128
+ K(e instanceof Error ? e.message : z ? "Could not update the order. Please try again." : "Could not create the order. Please try again.");
121
129
  } finally {
122
- W(!1);
130
+ G(!1);
123
131
  }
124
132
  }, X = (e, t) => {
125
- H((n) => ({
133
+ U((n) => ({
126
134
  ...n,
127
135
  [e]: t
128
136
  }));
129
137
  }, Z = (e, t, n) => {
130
- H((r) => ({
138
+ U((r) => ({
131
139
  ...r,
132
140
  [e]: {
133
141
  ...r[e],
134
142
  [t]: n
135
143
  }
136
144
  }));
145
+ }, Oe = (e) => {
146
+ if (e === "none") {
147
+ X("routeId", "");
148
+ return;
149
+ }
150
+ let t = R.find((t) => t.id === e);
151
+ if (!t) return;
152
+ let n = t.stops.find((e) => e.type === "pickup")?.address, r = [...t.stops].reverse().find((e) => e.type === "delivery")?.address, i = (e, t) => t ? {
153
+ street: e.street.trim() ? e.street : t.street,
154
+ city: e.city.trim() ? e.city : t.city,
155
+ state: e.state.trim() ? e.state : t.state,
156
+ postalCode: e.postalCode.trim() ? e.postalCode : t.postalCode,
157
+ country: e.country.trim() ? e.country : t.country
158
+ } : e;
159
+ U((e) => ({
160
+ ...e,
161
+ routeId: t.id,
162
+ pickupAddress: i(e.pickupAddress, n),
163
+ deliveryAddress: i(e.deliveryAddress, r)
164
+ }));
137
165
  }, Q = () => {
138
- H((e) => ({
166
+ U((e) => ({
139
167
  ...e,
140
168
  items: [...e.items, {
141
169
  id: `item-${Date.now()}`,
@@ -153,13 +181,13 @@ function T() {
153
181
  sku: ""
154
182
  }]
155
183
  }));
156
- }, Ce = (e) => {
157
- H((t) => ({
184
+ }, ke = (e) => {
185
+ U((t) => ({
158
186
  ...t,
159
187
  items: t.items.filter((t, n) => n !== e)
160
188
  }));
161
189
  }, $ = (e, t, n) => {
162
- H((r) => ({
190
+ U((r) => ({
163
191
  ...r,
164
192
  items: r.items.map((r, i) => i === e ? {
165
193
  ...r,
@@ -167,112 +195,112 @@ function T() {
167
195
  } : r)
168
196
  }));
169
197
  };
170
- return /* @__PURE__ */ C(ue, {
171
- title: R ? "Edit Order" : "Create Order",
172
- subtitle: R ? `Editing ${k?.orderNumber}` : "Create a new delivery order",
173
- icon: /* @__PURE__ */ S(r, { size: 24 }),
174
- headerActions: /* @__PURE__ */ C("div", {
198
+ return /* @__PURE__ */ w(y, {
199
+ title: z ? "Edit Order" : "Create Order",
200
+ subtitle: z ? `Editing ${A?.orderNumber}` : "Create a new delivery order",
201
+ icon: /* @__PURE__ */ C(r, { size: 24 }),
202
+ headerActions: /* @__PURE__ */ w("div", {
175
203
  className: "flex gap-2",
176
- children: [/* @__PURE__ */ C(d, {
204
+ children: [/* @__PURE__ */ w(s, {
177
205
  variant: "outline",
178
- onClick: K,
179
- children: [/* @__PURE__ */ S(e, { size: 16 }), "Cancel"]
180
- }), /* @__PURE__ */ C(d, {
206
+ onClick: q,
207
+ children: [/* @__PURE__ */ C(e, { size: 16 }), "Cancel"]
208
+ }), /* @__PURE__ */ w(s, {
181
209
  onClick: Y,
182
- disabled: U || F,
183
- children: [/* @__PURE__ */ S(a, { size: 16 }), U ? "Saving..." : R ? "Save Changes" : "Create Order"]
210
+ disabled: W || F,
211
+ children: [/* @__PURE__ */ C(ee, { size: 16 }), W ? "Saving..." : z ? "Save Changes" : "Create Order"]
184
212
  })]
185
213
  }),
186
214
  children: [
187
- /* @__PURE__ */ S(ve, {
188
- icon: /* @__PURE__ */ S(r, { size: 18 }),
189
- children: R ? "Update this delivery before it goes out — change the customer, addresses, items or handling notes, then save." : "Book a new delivery in a few steps: choose who it’s for, set pickup and drop-off addresses, list what’s being shipped, and add any handling notes. Once created it joins the orders pipeline ready to assign and track."
215
+ /* @__PURE__ */ C(ye, {
216
+ icon: /* @__PURE__ */ C(r, { size: 18 }),
217
+ children: z ? "Update this delivery before it goes out — change the customer, addresses, items or handling notes, then save." : "Book a new delivery in a few steps: choose who it’s for, set pickup and drop-off addresses, list what’s being shipped, and add any handling notes. Once created it joins the orders pipeline ready to assign and track."
190
218
  }),
191
- /* @__PURE__ */ S(_e, {
219
+ /* @__PURE__ */ C(ve, {
192
220
  storageKey: "movethewheels-create-order",
193
221
  steps: [
194
222
  {
195
223
  id: "customer",
196
224
  label: "Pick the customer first",
197
225
  description: "Their saved contact details auto-fill the order.",
198
- icon: /* @__PURE__ */ S(o, { size: 16 }),
199
- done: !!V.customerId,
226
+ icon: /* @__PURE__ */ C(ne, { size: 16 }),
227
+ done: !!H.customerId,
200
228
  onClick: () => document.getElementById("customer")?.focus()
201
229
  },
202
230
  {
203
231
  id: "addresses",
204
232
  label: "Set pickup & delivery addresses",
205
233
  description: "Where the shipment is collected and dropped off.",
206
- icon: /* @__PURE__ */ S(n, { size: 16 }),
207
- done: !!V.pickupAddress.street && !!V.deliveryAddress.street,
234
+ icon: /* @__PURE__ */ C(n, { size: 16 }),
235
+ done: !!H.pickupAddress.street && !!H.deliveryAddress.street,
208
236
  onClick: () => document.getElementById("pickupStreet")?.focus()
209
237
  },
210
238
  {
211
239
  id: "items",
212
240
  label: "Add the items to ship",
213
241
  description: "List each product with its quantity and value.",
214
- icon: /* @__PURE__ */ S(r, { size: 16 }),
215
- done: V.items.length > 0,
242
+ icon: /* @__PURE__ */ C(r, { size: 16 }),
243
+ done: H.items.length > 0,
216
244
  onClick: Q
217
245
  }
218
246
  ]
219
247
  }),
220
- /* @__PURE__ */ C("form", {
248
+ /* @__PURE__ */ w("form", {
221
249
  onSubmit: Y,
222
250
  className: "space-y-6",
223
251
  children: [
224
- /* @__PURE__ */ S(de, { message: Se }),
225
- /* @__PURE__ */ C(ge, { children: [/* @__PURE__ */ S("h2", {
252
+ /* @__PURE__ */ C(pe, { message: Ee }),
253
+ /* @__PURE__ */ w(_e, { children: [/* @__PURE__ */ C("h2", {
226
254
  className: "text-base font-semibold text-text-primary mb-4",
227
255
  children: "Order Details"
228
- }), /* @__PURE__ */ S("div", {
256
+ }), /* @__PURE__ */ C("div", {
229
257
  className: "space-y-4",
230
- children: /* @__PURE__ */ C("div", {
258
+ children: /* @__PURE__ */ w("div", {
231
259
  className: "grid grid-cols-1 md:grid-cols-2 gap-4",
232
- children: [/* @__PURE__ */ S(pe, {
260
+ children: [/* @__PURE__ */ C(he, {
233
261
  customers: P,
234
- value: V.customerId,
262
+ value: H.customerId,
235
263
  onValueChange: (e) => {
236
- e && (X("customerId", e), B(P.find((t) => t.id === e) ?? (z?.id === e ? z : null)), G(null));
264
+ e && (X("customerId", e), V(P.find((t) => t.id === e) ?? (B?.id === e ? B : null)), K(null));
237
265
  },
238
266
  onCreated: (e) => {
239
- B(e), X("customerId", e.id), G(null);
267
+ V(e), X("customerId", e.id), K(null);
240
268
  },
241
- createCustomer: be,
269
+ createCustomer: Se,
242
270
  isLoading: F,
243
271
  error: I,
244
- onRetry: xe,
272
+ onRetry: Ce,
245
273
  onOpenCustomers: () => {
246
- O && O(s(D, te(R && T ? `orders/${T}/edit` : "orders/new")));
274
+ k && k(o(O, re(z && E ? `orders/${E}/edit` : "orders/new")));
247
275
  },
248
- selectedCustomer: z,
249
- searchQuery: M,
250
- onSearchQueryChange: N
251
- }), /* @__PURE__ */ C("div", {
276
+ selectedCustomer: B,
277
+ searchQuery: N,
278
+ onSearchQueryChange: xe
279
+ }), /* @__PURE__ */ w("div", {
252
280
  className: "space-y-2",
253
- children: [/* @__PURE__ */ S(_, {
281
+ children: [/* @__PURE__ */ C(p, {
254
282
  htmlFor: "priority",
255
283
  children: "Priority"
256
- }), /* @__PURE__ */ C(v, {
257
- value: V.priority,
284
+ }), /* @__PURE__ */ w(m, {
285
+ value: H.priority,
258
286
  onValueChange: (e) => X("priority", e),
259
- children: [/* @__PURE__ */ S(ae, {
287
+ children: [/* @__PURE__ */ C(_, {
260
288
  id: "priority",
261
- children: /* @__PURE__ */ S(oe, {})
262
- }), /* @__PURE__ */ C(ie, { children: [
263
- /* @__PURE__ */ S(y, {
289
+ children: /* @__PURE__ */ C(v, {})
290
+ }), /* @__PURE__ */ w(h, { children: [
291
+ /* @__PURE__ */ C(g, {
264
292
  value: "low",
265
293
  children: "Low"
266
294
  }),
267
- /* @__PURE__ */ S(y, {
295
+ /* @__PURE__ */ C(g, {
268
296
  value: "normal",
269
297
  children: "Normal"
270
298
  }),
271
- /* @__PURE__ */ S(y, {
299
+ /* @__PURE__ */ C(g, {
272
300
  value: "high",
273
301
  children: "High"
274
302
  }),
275
- /* @__PURE__ */ S(y, {
303
+ /* @__PURE__ */ C(g, {
276
304
  value: "urgent",
277
305
  children: "Urgent"
278
306
  })
@@ -281,138 +309,166 @@ function T() {
281
309
  })]
282
310
  })
283
311
  })] }),
284
- /* @__PURE__ */ C("div", {
312
+ /* @__PURE__ */ w(c, { children: [/* @__PURE__ */ C(u, { children: /* @__PURE__ */ w(d, {
313
+ className: "flex items-center gap-2",
314
+ children: [/* @__PURE__ */ C(a, { size: 18 }), "Saved Route (Optional)"]
315
+ }) }), /* @__PURE__ */ w(l, {
316
+ className: "space-y-2",
317
+ children: [/* @__PURE__ */ w(m, {
318
+ value: H.routeId || "none",
319
+ onValueChange: Oe,
320
+ children: [/* @__PURE__ */ C(_, {
321
+ id: "saved-route",
322
+ children: /* @__PURE__ */ C(v, { placeholder: "Choose a saved route" })
323
+ }), /* @__PURE__ */ w(h, { children: [/* @__PURE__ */ C(g, {
324
+ value: "none",
325
+ children: "No saved route"
326
+ }), R.map((e) => /* @__PURE__ */ w(g, {
327
+ value: e.id,
328
+ children: [
329
+ e.name,
330
+ " · ",
331
+ e.stops.length,
332
+ " stops"
333
+ ]
334
+ }, e.id))] })]
335
+ }), /* @__PURE__ */ C("p", {
336
+ className: "text-xs text-text-secondary",
337
+ children: we ? "Loading planned routes…" : Te ? "Saved routes are unavailable; enter pickup and delivery addresses manually." : "A saved route fills any blank address fields. You can always edit both addresses below."
338
+ })]
339
+ })] }),
340
+ /* @__PURE__ */ w("div", {
285
341
  className: "grid grid-cols-1 md:grid-cols-2 gap-6",
286
- children: [/* @__PURE__ */ C(f, { children: [/* @__PURE__ */ S(m, { children: /* @__PURE__ */ S(h, { children: "Pickup Address" }) }), /* @__PURE__ */ C(p, {
342
+ children: [/* @__PURE__ */ w(c, { children: [/* @__PURE__ */ C(u, { children: /* @__PURE__ */ C(d, { children: "Pickup Address" }) }), /* @__PURE__ */ w(l, {
287
343
  className: "space-y-4",
288
344
  children: [
289
- /* @__PURE__ */ C("div", {
345
+ /* @__PURE__ */ w("div", {
290
346
  className: "space-y-2",
291
- children: [/* @__PURE__ */ S(_, {
347
+ children: [/* @__PURE__ */ C(p, {
292
348
  htmlFor: "pickupStreet",
293
349
  children: "Street Address"
294
- }), /* @__PURE__ */ S(g, {
350
+ }), /* @__PURE__ */ C(f, {
295
351
  id: "pickupStreet",
296
- value: V.pickupAddress.street,
352
+ value: H.pickupAddress.street,
297
353
  onChange: (e) => Z("pickupAddress", "street", e.target.value),
298
354
  placeholder: "123 Main St"
299
355
  })]
300
356
  }),
301
- /* @__PURE__ */ C("div", {
357
+ /* @__PURE__ */ w("div", {
302
358
  className: "grid grid-cols-1 sm:grid-cols-2 gap-4",
303
- children: [/* @__PURE__ */ C("div", {
359
+ children: [/* @__PURE__ */ w("div", {
304
360
  className: "space-y-2",
305
- children: [/* @__PURE__ */ S(_, {
361
+ children: [/* @__PURE__ */ C(p, {
306
362
  htmlFor: "pickupCity",
307
363
  children: "City"
308
- }), /* @__PURE__ */ S(g, {
364
+ }), /* @__PURE__ */ C(f, {
309
365
  id: "pickupCity",
310
- value: V.pickupAddress.city,
366
+ value: H.pickupAddress.city,
311
367
  onChange: (e) => Z("pickupAddress", "city", e.target.value),
312
368
  placeholder: "San Francisco"
313
369
  })]
314
- }), /* @__PURE__ */ C("div", {
370
+ }), /* @__PURE__ */ w("div", {
315
371
  className: "space-y-2",
316
- children: [/* @__PURE__ */ S(_, {
372
+ children: [/* @__PURE__ */ C(p, {
317
373
  htmlFor: "pickupState",
318
374
  children: "State"
319
- }), /* @__PURE__ */ S(g, {
375
+ }), /* @__PURE__ */ C(f, {
320
376
  id: "pickupState",
321
- value: V.pickupAddress.state,
377
+ value: H.pickupAddress.state,
322
378
  onChange: (e) => Z("pickupAddress", "state", e.target.value),
323
379
  placeholder: "CA"
324
380
  })]
325
381
  })]
326
382
  }),
327
- /* @__PURE__ */ C("div", {
383
+ /* @__PURE__ */ w("div", {
328
384
  className: "grid grid-cols-1 sm:grid-cols-2 gap-4",
329
- children: [/* @__PURE__ */ C("div", {
385
+ children: [/* @__PURE__ */ w("div", {
330
386
  className: "space-y-2",
331
- children: [/* @__PURE__ */ S(_, {
387
+ children: [/* @__PURE__ */ C(p, {
332
388
  htmlFor: "pickupPostal",
333
389
  children: "Postal Code"
334
- }), /* @__PURE__ */ S(g, {
390
+ }), /* @__PURE__ */ C(f, {
335
391
  id: "pickupPostal",
336
- value: V.pickupAddress.postalCode,
392
+ value: H.pickupAddress.postalCode,
337
393
  onChange: (e) => Z("pickupAddress", "postalCode", e.target.value),
338
394
  placeholder: "94103"
339
395
  })]
340
- }), /* @__PURE__ */ C("div", {
396
+ }), /* @__PURE__ */ w("div", {
341
397
  className: "space-y-2",
342
- children: [/* @__PURE__ */ S(_, {
398
+ children: [/* @__PURE__ */ C(p, {
343
399
  htmlFor: "pickupCountry",
344
400
  children: "Country"
345
- }), /* @__PURE__ */ S(g, {
401
+ }), /* @__PURE__ */ C(f, {
346
402
  id: "pickupCountry",
347
- value: V.pickupAddress.country,
403
+ value: H.pickupAddress.country,
348
404
  onChange: (e) => Z("pickupAddress", "country", e.target.value),
349
405
  placeholder: "USA"
350
406
  })]
351
407
  })]
352
408
  })
353
409
  ]
354
- })] }), /* @__PURE__ */ C(f, { children: [/* @__PURE__ */ S(m, { children: /* @__PURE__ */ S(h, { children: "Delivery Address" }) }), /* @__PURE__ */ C(p, {
410
+ })] }), /* @__PURE__ */ w(c, { children: [/* @__PURE__ */ C(u, { children: /* @__PURE__ */ C(d, { children: "Delivery Address" }) }), /* @__PURE__ */ w(l, {
355
411
  className: "space-y-4",
356
412
  children: [
357
- /* @__PURE__ */ C("div", {
413
+ /* @__PURE__ */ w("div", {
358
414
  className: "space-y-2",
359
- children: [/* @__PURE__ */ S(_, {
415
+ children: [/* @__PURE__ */ C(p, {
360
416
  htmlFor: "deliveryStreet",
361
417
  children: "Street Address"
362
- }), /* @__PURE__ */ S(g, {
418
+ }), /* @__PURE__ */ C(f, {
363
419
  id: "deliveryStreet",
364
- value: V.deliveryAddress.street,
420
+ value: H.deliveryAddress.street,
365
421
  onChange: (e) => Z("deliveryAddress", "street", e.target.value),
366
422
  placeholder: "456 Oak Ave"
367
423
  })]
368
424
  }),
369
- /* @__PURE__ */ C("div", {
425
+ /* @__PURE__ */ w("div", {
370
426
  className: "grid grid-cols-1 sm:grid-cols-2 gap-4",
371
- children: [/* @__PURE__ */ C("div", {
427
+ children: [/* @__PURE__ */ w("div", {
372
428
  className: "space-y-2",
373
- children: [/* @__PURE__ */ S(_, {
429
+ children: [/* @__PURE__ */ C(p, {
374
430
  htmlFor: "deliveryCity",
375
431
  children: "City"
376
- }), /* @__PURE__ */ S(g, {
432
+ }), /* @__PURE__ */ C(f, {
377
433
  id: "deliveryCity",
378
- value: V.deliveryAddress.city,
434
+ value: H.deliveryAddress.city,
379
435
  onChange: (e) => Z("deliveryAddress", "city", e.target.value),
380
436
  placeholder: "Los Angeles"
381
437
  })]
382
- }), /* @__PURE__ */ C("div", {
438
+ }), /* @__PURE__ */ w("div", {
383
439
  className: "space-y-2",
384
- children: [/* @__PURE__ */ S(_, {
440
+ children: [/* @__PURE__ */ C(p, {
385
441
  htmlFor: "deliveryState",
386
442
  children: "State"
387
- }), /* @__PURE__ */ S(g, {
443
+ }), /* @__PURE__ */ C(f, {
388
444
  id: "deliveryState",
389
- value: V.deliveryAddress.state,
445
+ value: H.deliveryAddress.state,
390
446
  onChange: (e) => Z("deliveryAddress", "state", e.target.value),
391
447
  placeholder: "CA"
392
448
  })]
393
449
  })]
394
450
  }),
395
- /* @__PURE__ */ C("div", {
451
+ /* @__PURE__ */ w("div", {
396
452
  className: "grid grid-cols-1 sm:grid-cols-2 gap-4",
397
- children: [/* @__PURE__ */ C("div", {
453
+ children: [/* @__PURE__ */ w("div", {
398
454
  className: "space-y-2",
399
- children: [/* @__PURE__ */ S(_, {
455
+ children: [/* @__PURE__ */ C(p, {
400
456
  htmlFor: "deliveryPostal",
401
457
  children: "Postal Code"
402
- }), /* @__PURE__ */ S(g, {
458
+ }), /* @__PURE__ */ C(f, {
403
459
  id: "deliveryPostal",
404
- value: V.deliveryAddress.postalCode,
460
+ value: H.deliveryAddress.postalCode,
405
461
  onChange: (e) => Z("deliveryAddress", "postalCode", e.target.value),
406
462
  placeholder: "90210"
407
463
  })]
408
- }), /* @__PURE__ */ C("div", {
464
+ }), /* @__PURE__ */ w("div", {
409
465
  className: "space-y-2",
410
- children: [/* @__PURE__ */ S(_, {
466
+ children: [/* @__PURE__ */ C(p, {
411
467
  htmlFor: "deliveryCountry",
412
468
  children: "Country"
413
- }), /* @__PURE__ */ S(g, {
469
+ }), /* @__PURE__ */ C(f, {
414
470
  id: "deliveryCountry",
415
- value: V.deliveryAddress.country,
471
+ value: H.deliveryAddress.country,
416
472
  onChange: (e) => Z("deliveryAddress", "country", e.target.value),
417
473
  placeholder: "USA"
418
474
  })]
@@ -421,61 +477,61 @@ function T() {
421
477
  ]
422
478
  })] })]
423
479
  }),
424
- /* @__PURE__ */ C(f, { children: [/* @__PURE__ */ C(m, {
480
+ /* @__PURE__ */ w(c, { children: [/* @__PURE__ */ w(u, {
425
481
  className: "flex flex-row items-center justify-between",
426
- children: [/* @__PURE__ */ S(h, { children: "Order Items" }), /* @__PURE__ */ C(d, {
482
+ children: [/* @__PURE__ */ C(d, { children: "Order Items" }), /* @__PURE__ */ w(s, {
427
483
  type: "button",
428
484
  variant: "outline",
429
485
  size: "sm",
430
486
  onClick: Q,
431
- children: [/* @__PURE__ */ S(i, { size: 16 }), "Add Item"]
487
+ children: [/* @__PURE__ */ C(i, { size: 16 }), "Add Item"]
432
488
  })]
433
- }), /* @__PURE__ */ S(p, { children: V.items.length === 0 ? /* @__PURE__ */ S(le, {
489
+ }), /* @__PURE__ */ C(l, { children: H.items.length === 0 ? /* @__PURE__ */ C(fe, {
434
490
  illustration: "empty-files",
435
491
  title: "No items added yet",
436
492
  description: "Add the products this order will ship — each with a name, SKU, quantity and value.",
437
- action: /* @__PURE__ */ C(d, {
493
+ action: /* @__PURE__ */ w(s, {
438
494
  type: "button",
439
495
  variant: "outline",
440
496
  onClick: Q,
441
- children: [/* @__PURE__ */ S(i, {
497
+ children: [/* @__PURE__ */ C(i, {
442
498
  size: 16,
443
499
  className: "mr-1.5"
444
500
  }), "Add your first item"]
445
501
  })
446
- }) : /* @__PURE__ */ S("div", {
502
+ }) : /* @__PURE__ */ C("div", {
447
503
  className: "space-y-4",
448
- children: V.items.map((e, t) => /* @__PURE__ */ C("div", { children: [t > 0 && /* @__PURE__ */ S(se, { className: "my-4" }), /* @__PURE__ */ C("div", {
504
+ children: H.items.map((e, t) => /* @__PURE__ */ w("div", { children: [t > 0 && /* @__PURE__ */ C(ue, { className: "my-4" }), /* @__PURE__ */ w("div", {
449
505
  className: "grid grid-cols-1 md:grid-cols-7 gap-4",
450
506
  children: [
451
- /* @__PURE__ */ C("div", {
507
+ /* @__PURE__ */ w("div", {
452
508
  className: "md:col-span-2 space-y-2",
453
- children: [/* @__PURE__ */ S(_, { children: "Item Name" }), /* @__PURE__ */ S(g, {
509
+ children: [/* @__PURE__ */ C(p, { children: "Item Name" }), /* @__PURE__ */ C(f, {
454
510
  value: e.name,
455
511
  onChange: (e) => $(t, "name", e.target.value),
456
512
  placeholder: "Product name"
457
513
  })]
458
514
  }),
459
- /* @__PURE__ */ C("div", {
515
+ /* @__PURE__ */ w("div", {
460
516
  className: "space-y-2",
461
- children: [/* @__PURE__ */ S(_, { children: "SKU" }), /* @__PURE__ */ S(g, {
517
+ children: [/* @__PURE__ */ C(p, { children: "SKU" }), /* @__PURE__ */ C(f, {
462
518
  value: e.sku,
463
519
  onChange: (e) => $(t, "sku", e.target.value),
464
520
  placeholder: "SKU-001"
465
521
  })]
466
522
  }),
467
- /* @__PURE__ */ C("div", {
523
+ /* @__PURE__ */ w("div", {
468
524
  className: "space-y-2",
469
- children: [/* @__PURE__ */ S(_, { children: "Quantity" }), /* @__PURE__ */ S(g, {
525
+ children: [/* @__PURE__ */ C(p, { children: "Quantity" }), /* @__PURE__ */ C(f, {
470
526
  type: "number",
471
527
  min: "1",
472
528
  value: e.quantity,
473
529
  onChange: (e) => $(t, "quantity", parseInt(e.target.value) || 1)
474
530
  })]
475
531
  }),
476
- /* @__PURE__ */ C("div", {
532
+ /* @__PURE__ */ w("div", {
477
533
  className: "space-y-2",
478
- children: [/* @__PURE__ */ S(_, { children: "Weight (kg)" }), /* @__PURE__ */ S(g, {
534
+ children: [/* @__PURE__ */ C(p, { children: "Weight (kg)" }), /* @__PURE__ */ C(f, {
479
535
  type: "number",
480
536
  min: "0",
481
537
  step: "0.1",
@@ -483,9 +539,9 @@ function T() {
483
539
  onChange: (e) => $(t, "weight", parseFloat(e.target.value) || 0)
484
540
  })]
485
541
  }),
486
- /* @__PURE__ */ C("div", {
542
+ /* @__PURE__ */ w("div", {
487
543
  className: "space-y-2",
488
- children: [/* @__PURE__ */ S(_, { children: "Value ($)" }), /* @__PURE__ */ S(g, {
544
+ children: [/* @__PURE__ */ C(p, { children: "Value ($)" }), /* @__PURE__ */ C(f, {
489
545
  type: "number",
490
546
  min: "0",
491
547
  step: "0.01",
@@ -493,52 +549,52 @@ function T() {
493
549
  onChange: (e) => $(t, "value", parseFloat(e.target.value) || 0)
494
550
  })]
495
551
  }),
496
- /* @__PURE__ */ S("div", {
552
+ /* @__PURE__ */ C("div", {
497
553
  className: "flex items-end",
498
- children: /* @__PURE__ */ S(d, {
554
+ children: /* @__PURE__ */ C(s, {
499
555
  type: "button",
500
556
  variant: "ghost",
501
557
  size: "icon",
502
558
  className: "text-status-error-text",
503
- onClick: () => Ce(t),
504
- children: /* @__PURE__ */ S(ee, { size: 16 })
559
+ onClick: () => ke(t),
560
+ children: /* @__PURE__ */ C(te, { size: 16 })
505
561
  })
506
562
  })
507
563
  ]
508
564
  })] }, e.id))
509
565
  }) })] }),
510
- /* @__PURE__ */ C(f, { children: [/* @__PURE__ */ S(m, { children: /* @__PURE__ */ S(h, { children: "Scheduling & Handling" }) }), /* @__PURE__ */ S(p, { children: /* @__PURE__ */ C("div", {
566
+ /* @__PURE__ */ w(c, { children: [/* @__PURE__ */ C(u, { children: /* @__PURE__ */ C(d, { children: "Scheduling & Handling" }) }), /* @__PURE__ */ C(l, { children: /* @__PURE__ */ w("div", {
511
567
  className: "grid grid-cols-1 md:grid-cols-3 gap-6",
512
- children: [/* @__PURE__ */ C("div", {
568
+ children: [/* @__PURE__ */ w("div", {
513
569
  className: "space-y-2",
514
570
  children: [
515
- /* @__PURE__ */ C(_, {
571
+ /* @__PURE__ */ w(p, {
516
572
  htmlFor: "scheduledDelivery",
517
573
  className: "flex items-center gap-1.5",
518
- children: [/* @__PURE__ */ S(t, {
574
+ children: [/* @__PURE__ */ C(t, {
519
575
  size: 14,
520
576
  className: "text-text-secondary"
521
577
  }), "Scheduled Delivery"]
522
578
  }),
523
- /* @__PURE__ */ S(g, {
579
+ /* @__PURE__ */ C(f, {
524
580
  id: "scheduledDelivery",
525
581
  type: "datetime-local",
526
- value: V.scheduledDelivery,
582
+ value: H.scheduledDelivery,
527
583
  onChange: (e) => X("scheduledDelivery", e.target.value)
528
584
  }),
529
- /* @__PURE__ */ S("p", {
585
+ /* @__PURE__ */ C("p", {
530
586
  className: "text-xs text-text-secondary",
531
587
  children: "The delivery window promised to the customer. Leave blank to dispatch as soon as a driver is free."
532
588
  })
533
589
  ]
534
- }), /* @__PURE__ */ C("div", {
590
+ }), /* @__PURE__ */ w("div", {
535
591
  className: "md:col-span-2 space-y-2",
536
- children: [/* @__PURE__ */ S(_, {
592
+ children: [/* @__PURE__ */ C(p, {
537
593
  htmlFor: "specialInstructions",
538
594
  children: "Special Instructions"
539
- }), /* @__PURE__ */ S(ce, {
595
+ }), /* @__PURE__ */ C(de, {
540
596
  id: "specialInstructions",
541
- value: V.specialInstructions,
597
+ value: H.specialInstructions,
542
598
  onChange: (e) => X("specialInstructions", e.target.value),
543
599
  placeholder: "Any special handling or delivery instructions...",
544
600
  rows: 4
@@ -551,4 +607,4 @@ function T() {
551
607
  });
552
608
  }
553
609
  //#endregion
554
- export { T as default };
610
+ export { E as default };