@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.
@@ -4,40 +4,40 @@ import { ArrowUp as n } from "../node_modules/lucide-react/dist/esm/icons/arrow-
4
4
  import { CircleCheckBig as r } from "../node_modules/lucide-react/dist/esm/icons/circle-check-big.js";
5
5
  import { Clock as i } from "../node_modules/lucide-react/dist/esm/icons/clock.js";
6
6
  import { Fuel as a } from "../node_modules/lucide-react/dist/esm/icons/fuel.js";
7
- import { MapPin as ee } from "../node_modules/lucide-react/dist/esm/icons/map-pin.js";
8
- import { Navigation as o } from "../node_modules/lucide-react/dist/esm/icons/navigation.js";
9
- import { Plus as s } from "../node_modules/lucide-react/dist/esm/icons/plus.js";
10
- import { Save as c } from "../node_modules/lucide-react/dist/esm/icons/save.js";
11
- import { SquarePen as l } from "../node_modules/lucide-react/dist/esm/icons/square-pen.js";
12
- import { Trash2 as u } from "../node_modules/lucide-react/dist/esm/icons/trash-2.js";
13
- import { Zap as d } from "../node_modules/lucide-react/dist/esm/icons/zap.js";
14
- import { joinPath as f } from "../utils/navigation.js";
15
- import { useMoveTheWheels as p } from "../providers/MoveTheWheelsProvider.js";
16
- import { useDriver as m, useFleet as h, useVehicle as g } from "../hooks/useFleet.js";
17
- import { useRoute as _, useRoutes as te } from "../hooks/useRoutes.js";
18
- import { Badge as v, Button as y, Card as b, CardContent as x, CardHeader as S, CardTitle as C, Input as w, Label as T, Select as E, SelectContent as D, SelectItem as O, SelectTrigger as k, SelectValue as A } from "../components/ui.js";
19
- import { ErrorState as ne, LoadingState as re, PageLayout as ie } from "../components/PageLayout.js";
20
- import { RouteMap as ae } from "../components/maps/RouteMap.js";
7
+ import { MapPin as o } from "../node_modules/lucide-react/dist/esm/icons/map-pin.js";
8
+ import { Navigation as s } from "../node_modules/lucide-react/dist/esm/icons/navigation.js";
9
+ import { Plus as c } from "../node_modules/lucide-react/dist/esm/icons/plus.js";
10
+ import { Save as l } from "../node_modules/lucide-react/dist/esm/icons/save.js";
11
+ import { SquarePen as u } from "../node_modules/lucide-react/dist/esm/icons/square-pen.js";
12
+ import { Trash2 as d } from "../node_modules/lucide-react/dist/esm/icons/trash-2.js";
13
+ import { Zap as f } from "../node_modules/lucide-react/dist/esm/icons/zap.js";
14
+ import { joinPath as p } from "../utils/navigation.js";
15
+ import { useMoveTheWheels as ee } from "../providers/MoveTheWheelsProvider.js";
16
+ import { useRoute as m, useRoutes as te } from "../hooks/useRoutes.js";
17
+ import { useDriver as ne, useFleet as h, useVehicle as g } from "../hooks/useFleet.js";
18
+ import { Badge as _, Button as v, Card as y, CardContent as b, CardHeader as x, CardTitle as S, Input as C, Label as w, Select as T, SelectContent as E, SelectItem as D, SelectTrigger as O, SelectValue as k } from "../components/ui.js";
19
+ import { ErrorState as re, LoadingState as A, PageLayout as ie } from "../components/PageLayout.js";
20
+ import { RouteMap as j } from "../components/maps/RouteMap.js";
21
21
  import "../components/maps/index.js";
22
- import { ROUTE_STATUS_COLORS as j } from "../constants/index.js";
23
- import { StatusBadge as M } from "../components/StatusBadge.js";
24
- import { FormError as oe } from "../components/FormError.js";
25
- import { Notice as N, useNotice as P } from "../components/Notice.js";
26
- import { formatAddress as F, formatCurrency as I, formatDate as L } from "../utils/formatters.js";
27
- import { useDebouncedValue as R } from "../hooks/useDebouncedValue.js";
28
- import { firstRealLatLng as z } from "../utils/mapMarkers.js";
29
- import { useAssignmentSuggestions as B } from "../hooks/useFleetIntelligence.js";
30
- import { AssignmentSuggestions as V } from "../components/AssignmentSuggestions.js";
31
- import { useEffect as H, useState as U } from "react";
32
- import { useLocation as W, useParams as G } from "react-router";
33
- import { jsx as K, jsxs as q } from "react/jsx-runtime";
34
- import { useI18n as se } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
35
- import { EmphasisPanel as ce, NextSteps as le, PagePurpose as ue } from "@burdenoff/fe-libs/ui";
22
+ import { ROUTE_STATUS_COLORS as M } from "../constants/index.js";
23
+ import { StatusBadge as N } from "../components/StatusBadge.js";
24
+ import { FormError as ae } from "../components/FormError.js";
25
+ import { Notice as oe, useNotice as P } from "../components/Notice.js";
26
+ import { formatAddress as F, formatCurrency as se, formatDate as I } from "../utils/formatters.js";
27
+ import { useDebouncedValue as L } from "../hooks/useDebouncedValue.js";
28
+ import { firstRealLatLng as ce } from "../utils/mapMarkers.js";
29
+ import { useAssignmentSuggestions as le } from "../hooks/useFleetIntelligence.js";
30
+ import { AssignmentSuggestions as R } from "../components/AssignmentSuggestions.js";
31
+ import { useEffect as z, useState as B } from "react";
32
+ import { useLocation as V, useParams as H } from "react-router";
33
+ import { jsx as U, jsxs as W } from "react/jsx-runtime";
34
+ import { useI18n as G } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
35
+ import { EmphasisPanel as K, NextSteps as ue, PagePurpose as de } from "@burdenoff/fe-libs/ui";
36
36
  //#region src/movethewheels/pages/RouteDetailsPage.tsx
37
- function J(e, t) {
37
+ function q(e, t) {
38
38
  return !t || e.some((e) => e.id === t.id) ? e : [t, ...e];
39
39
  }
40
- var Y = [
40
+ var J = [
41
41
  {
42
42
  value: "planned",
43
43
  label: "Planned"
@@ -55,11 +55,8 @@ var Y = [
55
55
  label: "Cancelled"
56
56
  }
57
57
  ];
58
- function X({ editId: r }) {
59
- let { basePath: i, navigate: a } = p(), { createRoute: ee, updateRoute: l } = te(), { route: d } = _(r), [v, ne] = U(""), { vehicles: re, drivers: ae } = h({
60
- limit: 20,
61
- filters: { search: R(v) || void 0 }
62
- }), j = !!r, [M, N] = U({
58
+ function Y({ editId: r }) {
59
+ let { basePath: i, navigate: a } = ee(), { createRoute: o, updateRoute: u } = te(), { route: f } = m(r), [_, re] = B(""), A = L(_), j = !!r, [M, N] = B({
63
60
  name: "",
64
61
  status: "planned",
65
62
  vehicleId: "",
@@ -68,14 +65,26 @@ function X({ editId: r }) {
68
65
  address: "",
69
66
  type: "delivery"
70
67
  }]
71
- }), { vehicle: P } = g(M.vehicleId || void 0), { driver: I } = m(M.driverId || void 0), L = J(re, P), z = J(ae, I), [B, V] = U(!1), [W, G] = U(null);
72
- H(() => {
73
- !r || !d || N({
74
- name: d.name || "",
75
- status: d.status,
76
- vehicleId: d.vehicleId || "",
77
- driverId: d.driverId || "",
78
- stops: d.stops.length > 0 ? d.stops.map((e) => ({
68
+ }), { vehicles: oe } = h({
69
+ limit: 20,
70
+ filters: {
71
+ search: A || void 0,
72
+ driverId: M.driverId || void 0
73
+ }
74
+ }), { drivers: P } = h({
75
+ limit: 20,
76
+ filters: {
77
+ search: A || void 0,
78
+ vehicleId: M.vehicleId || void 0
79
+ }
80
+ }), { vehicle: se } = g(M.vehicleId || void 0), { driver: I } = ne(M.driverId || void 0), ce = q(oe, se), le = q(P, I), [R, V] = B(!1), [H, G] = B(null);
81
+ z(() => {
82
+ !r || !f || N({
83
+ name: f.name || "",
84
+ status: f.status,
85
+ vehicleId: f.vehicleId || "",
86
+ driverId: f.driverId || "",
87
+ stops: f.stops.length > 0 ? f.stops.map((e) => ({
79
88
  address: F(e.address) || e.address.street || "",
80
89
  type: e.type
81
90
  })) : [{
@@ -83,8 +92,8 @@ function X({ editId: r }) {
83
92
  type: "delivery"
84
93
  }]
85
94
  });
86
- }, [r, d]);
87
- let se = () => a?.(f(i, "routes")), le = () => N((e) => ({
95
+ }, [r, f]);
96
+ let ue = () => a?.(p(i, "routes")), Y = () => N((e) => ({
88
97
  ...e,
89
98
  stops: [...e.stops, {
90
99
  address: "",
@@ -136,74 +145,74 @@ function X({ editId: r }) {
136
145
  status: "pending"
137
146
  }));
138
147
  if (j) {
139
- let t = await l(r, {
148
+ let t = await u(r, {
140
149
  name: M.name.trim(),
141
150
  status: M.status,
142
151
  vehicleId: M.vehicleId || void 0,
143
152
  driverId: M.driverId || void 0,
144
153
  stops: e
145
154
  });
146
- a?.(f(i, `routes/${t.id}`));
155
+ a?.(p(i, `routes/${t.id}`));
147
156
  return;
148
157
  }
149
- let n = await ee({
158
+ let n = await o({
150
159
  name: M.name.trim(),
151
160
  status: M.status,
152
161
  vehicleId: M.vehicleId || void 0,
153
162
  driverId: M.driverId || void 0,
154
163
  stops: e
155
164
  });
156
- a?.(f(i, `routes/${n.id}`));
165
+ a?.(p(i, `routes/${n.id}`));
157
166
  } catch (e) {
158
167
  console.error("Failed to create route:", e), G(e instanceof Error ? e.message : "Failed to create route. Please try again."), V(!1);
159
168
  }
160
169
  };
161
- return /* @__PURE__ */ q(ie, {
170
+ return /* @__PURE__ */ W(ie, {
162
171
  title: j ? "Edit Route" : "Create Route",
163
172
  subtitle: "Plan a new delivery route",
164
- icon: /* @__PURE__ */ K(o, { size: 24 }),
165
- headerActions: /* @__PURE__ */ q("div", {
173
+ icon: /* @__PURE__ */ U(s, { size: 24 }),
174
+ headerActions: /* @__PURE__ */ W("div", {
166
175
  className: "flex gap-2",
167
- children: [/* @__PURE__ */ q(y, {
176
+ children: [/* @__PURE__ */ W(v, {
168
177
  variant: "outline",
169
- onClick: se,
170
- disabled: B,
171
- children: [/* @__PURE__ */ K(t, { size: 16 }), " Cancel"]
172
- }), /* @__PURE__ */ q(y, {
178
+ onClick: ue,
179
+ disabled: R,
180
+ children: [/* @__PURE__ */ U(t, { size: 16 }), " Cancel"]
181
+ }), /* @__PURE__ */ W(v, {
173
182
  onClick: $,
174
- disabled: B,
183
+ disabled: R,
175
184
  children: [
176
- /* @__PURE__ */ K(c, { size: 16 }),
185
+ /* @__PURE__ */ U(l, { size: 16 }),
177
186
  " ",
178
- j ? B ? "Saving..." : "Save Changes" : B ? "Saving..." : "Create Route"
187
+ j ? R ? "Saving..." : "Save Changes" : R ? "Saving..." : "Create Route"
179
188
  ]
180
189
  })]
181
190
  }),
182
- children: [/* @__PURE__ */ K(ue, {
183
- icon: /* @__PURE__ */ K(o, { size: 18 }),
191
+ children: [/* @__PURE__ */ U(de, {
192
+ icon: /* @__PURE__ */ U(s, { size: 18 }),
184
193
  children: "Plan a new delivery route — name it, list the stops to visit, and optionally assign a vehicle and driver. Once created you can optimize it to sequence the stops into the shortest run."
185
- }), /* @__PURE__ */ q("form", {
194
+ }), /* @__PURE__ */ W("form", {
186
195
  onSubmit: $,
187
196
  className: "max-w-3xl space-y-6",
188
197
  children: [
189
- /* @__PURE__ */ K(oe, { message: W }),
190
- /* @__PURE__ */ q(ce, { children: [/* @__PURE__ */ K("h2", {
198
+ /* @__PURE__ */ U(ae, { message: H }),
199
+ /* @__PURE__ */ W(K, { children: [/* @__PURE__ */ U("h2", {
191
200
  className: "text-base font-semibold text-text-primary mb-4",
192
201
  children: "Route Details"
193
- }), /* @__PURE__ */ q("div", {
202
+ }), /* @__PURE__ */ W("div", {
194
203
  className: "space-y-4",
195
204
  children: [
196
- /* @__PURE__ */ q("div", {
205
+ /* @__PURE__ */ W("div", {
197
206
  className: "grid grid-cols-1 md:grid-cols-2 gap-4",
198
- children: [/* @__PURE__ */ q("div", {
207
+ children: [/* @__PURE__ */ W("div", {
199
208
  className: "space-y-2",
200
- children: [/* @__PURE__ */ q(T, {
209
+ children: [/* @__PURE__ */ W(w, {
201
210
  htmlFor: "name",
202
- children: ["Route Name ", /* @__PURE__ */ K("span", {
211
+ children: ["Route Name ", /* @__PURE__ */ U("span", {
203
212
  className: "text-status-error-text",
204
213
  children: "*"
205
214
  })]
206
- }), /* @__PURE__ */ K(w, {
215
+ }), /* @__PURE__ */ U(C, {
207
216
  id: "name",
208
217
  value: M.name,
209
218
  onChange: (e) => N((t) => ({
@@ -213,56 +222,56 @@ function X({ editId: r }) {
213
222
  placeholder: "Downtown morning run",
214
223
  required: !0
215
224
  })]
216
- }), /* @__PURE__ */ q("div", {
225
+ }), /* @__PURE__ */ W("div", {
217
226
  className: "space-y-2",
218
- children: [/* @__PURE__ */ K(T, {
227
+ children: [/* @__PURE__ */ U(w, {
219
228
  htmlFor: "status",
220
229
  children: "Status"
221
- }), /* @__PURE__ */ q(E, {
230
+ }), /* @__PURE__ */ W(T, {
222
231
  value: M.status,
223
232
  onValueChange: (e) => N((t) => ({
224
233
  ...t,
225
234
  status: e
226
235
  })),
227
- children: [/* @__PURE__ */ K(k, {
236
+ children: [/* @__PURE__ */ U(O, {
228
237
  id: "status",
229
- children: /* @__PURE__ */ K(A, {})
230
- }), /* @__PURE__ */ K(D, { children: Y.map((e) => /* @__PURE__ */ K(O, {
238
+ children: /* @__PURE__ */ U(k, {})
239
+ }), /* @__PURE__ */ U(E, { children: J.map((e) => /* @__PURE__ */ U(D, {
231
240
  value: e.value,
232
241
  children: e.label
233
242
  }, e.value)) })]
234
243
  })]
235
244
  })]
236
245
  }),
237
- /* @__PURE__ */ q("div", {
246
+ /* @__PURE__ */ W("div", {
238
247
  className: "space-y-2",
239
- children: [/* @__PURE__ */ K(T, {
248
+ children: [/* @__PURE__ */ U(w, {
240
249
  htmlFor: "fleet-search",
241
250
  children: "Search fleet"
242
- }), /* @__PURE__ */ K(w, {
251
+ }), /* @__PURE__ */ U(C, {
243
252
  id: "fleet-search",
244
- value: v,
245
- onChange: (e) => ne(e.target.value),
253
+ value: _,
254
+ onChange: (e) => re(e.target.value),
246
255
  placeholder: "Vehicle number, driver name or ID"
247
256
  })]
248
257
  }),
249
- /* @__PURE__ */ q("div", {
258
+ /* @__PURE__ */ W("div", {
250
259
  className: "grid grid-cols-1 md:grid-cols-2 gap-4",
251
- children: [/* @__PURE__ */ q("div", {
260
+ children: [/* @__PURE__ */ W("div", {
252
261
  className: "space-y-2",
253
- children: [/* @__PURE__ */ K(T, {
262
+ children: [/* @__PURE__ */ U(w, {
254
263
  htmlFor: "vehicle",
255
264
  children: "Vehicle (optional)"
256
- }), /* @__PURE__ */ q(E, {
265
+ }), /* @__PURE__ */ W(T, {
257
266
  value: M.vehicleId,
258
267
  onValueChange: (e) => N((t) => ({
259
268
  ...t,
260
269
  vehicleId: e
261
270
  })),
262
- children: [/* @__PURE__ */ K(k, {
271
+ children: [/* @__PURE__ */ U(O, {
263
272
  id: "vehicle",
264
- children: /* @__PURE__ */ K(A, { placeholder: "Assign later" })
265
- }), /* @__PURE__ */ K(D, { children: L.map((e) => /* @__PURE__ */ q(O, {
273
+ children: /* @__PURE__ */ U(k, { placeholder: "Assign later" })
274
+ }), /* @__PURE__ */ U(E, { children: ce.map((e) => /* @__PURE__ */ W(D, {
266
275
  value: e.id,
267
276
  children: [
268
277
  e.vehicleNumber,
@@ -272,21 +281,21 @@ function X({ editId: r }) {
272
281
  ]
273
282
  }, e.id)) })]
274
283
  })]
275
- }), /* @__PURE__ */ q("div", {
284
+ }), /* @__PURE__ */ W("div", {
276
285
  className: "space-y-2",
277
- children: [/* @__PURE__ */ K(T, {
286
+ children: [/* @__PURE__ */ U(w, {
278
287
  htmlFor: "driver",
279
288
  children: "Driver (optional)"
280
- }), /* @__PURE__ */ q(E, {
289
+ }), /* @__PURE__ */ W(T, {
281
290
  value: M.driverId,
282
291
  onValueChange: (e) => N((t) => ({
283
292
  ...t,
284
293
  driverId: e
285
294
  })),
286
- children: [/* @__PURE__ */ K(k, {
295
+ children: [/* @__PURE__ */ U(O, {
287
296
  id: "driver",
288
- children: /* @__PURE__ */ K(A, { placeholder: "Assign later" })
289
- }), /* @__PURE__ */ K(D, { children: z.map((e) => /* @__PURE__ */ q(O, {
297
+ children: /* @__PURE__ */ U(k, { placeholder: "Assign later" })
298
+ }), /* @__PURE__ */ U(E, { children: le.map((e) => /* @__PURE__ */ W(D, {
290
299
  value: e.id,
291
300
  children: [
292
301
  e.fullName,
@@ -300,81 +309,81 @@ function X({ editId: r }) {
300
309
  })
301
310
  ]
302
311
  })] }),
303
- /* @__PURE__ */ q(b, { children: [/* @__PURE__ */ q(S, {
312
+ /* @__PURE__ */ W(y, { children: [/* @__PURE__ */ W(x, {
304
313
  className: "flex flex-row items-center justify-between",
305
- children: [/* @__PURE__ */ q(C, { children: ["Stops ", /* @__PURE__ */ K("span", {
314
+ children: [/* @__PURE__ */ W(S, { children: ["Stops ", /* @__PURE__ */ U("span", {
306
315
  className: "text-status-error-text",
307
316
  children: "*"
308
- })] }), /* @__PURE__ */ q(y, {
317
+ })] }), /* @__PURE__ */ W(v, {
309
318
  type: "button",
310
319
  variant: "outline",
311
320
  size: "sm",
312
- onClick: le,
313
- children: [/* @__PURE__ */ K(s, { size: 16 }), " Add Stop"]
321
+ onClick: Y,
322
+ children: [/* @__PURE__ */ U(c, { size: 16 }), " Add Stop"]
314
323
  })]
315
- }), /* @__PURE__ */ K(x, {
324
+ }), /* @__PURE__ */ U(b, {
316
325
  className: "space-y-4",
317
- children: M.stops.map((t, r) => /* @__PURE__ */ q("div", {
326
+ children: M.stops.map((t, r) => /* @__PURE__ */ W("div", {
318
327
  className: "grid grid-cols-1 md:grid-cols-12 gap-3 items-end",
319
328
  children: [
320
- /* @__PURE__ */ q("div", {
329
+ /* @__PURE__ */ W("div", {
321
330
  className: "md:col-span-7 space-y-2",
322
- children: [/* @__PURE__ */ q(T, {
331
+ children: [/* @__PURE__ */ W(w, {
323
332
  htmlFor: `stop-address-${r}`,
324
333
  children: [
325
334
  "Stop ",
326
335
  r + 1,
327
336
  " address"
328
337
  ]
329
- }), /* @__PURE__ */ K(w, {
338
+ }), /* @__PURE__ */ U(C, {
330
339
  id: `stop-address-${r}`,
331
340
  value: t.address,
332
341
  onChange: (e) => Z(r, "address", e.target.value),
333
342
  placeholder: "123 Main St, San Francisco, CA"
334
343
  })]
335
344
  }),
336
- /* @__PURE__ */ q("div", {
345
+ /* @__PURE__ */ W("div", {
337
346
  className: "md:col-span-4 space-y-2",
338
- children: [/* @__PURE__ */ K(T, {
347
+ children: [/* @__PURE__ */ U(w, {
339
348
  htmlFor: `stop-type-${r}`,
340
349
  children: "Type"
341
- }), /* @__PURE__ */ q(E, {
350
+ }), /* @__PURE__ */ W(T, {
342
351
  value: t.type,
343
352
  onValueChange: (e) => Z(r, "type", e),
344
- children: [/* @__PURE__ */ K(k, {
353
+ children: [/* @__PURE__ */ U(O, {
345
354
  id: `stop-type-${r}`,
346
- children: /* @__PURE__ */ K(A, {})
347
- }), /* @__PURE__ */ q(D, { children: [/* @__PURE__ */ K(O, {
355
+ children: /* @__PURE__ */ U(k, {})
356
+ }), /* @__PURE__ */ W(E, { children: [/* @__PURE__ */ U(D, {
348
357
  value: "pickup",
349
358
  children: "Pickup"
350
- }), /* @__PURE__ */ K(O, {
359
+ }), /* @__PURE__ */ U(D, {
351
360
  value: "delivery",
352
361
  children: "Delivery"
353
362
  })] })]
354
363
  })]
355
364
  }),
356
- /* @__PURE__ */ q("div", {
365
+ /* @__PURE__ */ W("div", {
357
366
  className: "md:col-span-1 flex justify-end gap-1",
358
367
  children: [
359
- /* @__PURE__ */ K(y, {
368
+ /* @__PURE__ */ U(v, {
360
369
  type: "button",
361
370
  variant: "ghost",
362
371
  size: "icon",
363
372
  onClick: () => Q(r, -1),
364
373
  disabled: r === 0,
365
374
  "aria-label": `Move stop ${r + 1} up`,
366
- children: /* @__PURE__ */ K(n, { size: 16 })
375
+ children: /* @__PURE__ */ U(n, { size: 16 })
367
376
  }),
368
- /* @__PURE__ */ K(y, {
377
+ /* @__PURE__ */ U(v, {
369
378
  type: "button",
370
379
  variant: "ghost",
371
380
  size: "icon",
372
381
  onClick: () => Q(r, 1),
373
382
  disabled: r === M.stops.length - 1,
374
383
  "aria-label": `Move stop ${r + 1} down`,
375
- children: /* @__PURE__ */ K(e, { size: 16 })
384
+ children: /* @__PURE__ */ U(e, { size: 16 })
376
385
  }),
377
- /* @__PURE__ */ K(y, {
386
+ /* @__PURE__ */ U(v, {
378
387
  type: "button",
379
388
  variant: "ghost",
380
389
  size: "icon",
@@ -382,7 +391,7 @@ function X({ editId: r }) {
382
391
  onClick: () => X(r),
383
392
  disabled: M.stops.length === 1,
384
393
  "aria-label": `Remove stop ${r + 1}`,
385
- children: /* @__PURE__ */ K(u, { size: 16 })
394
+ children: /* @__PURE__ */ U(d, { size: 16 })
386
395
  })
387
396
  ]
388
397
  })
@@ -393,33 +402,33 @@ function X({ editId: r }) {
393
402
  })]
394
403
  });
395
404
  }
396
- function Z() {
397
- let { routeId: e } = G(), n = W().pathname.endsWith("/edit"), { basePath: s, navigate: c } = p(), { route: u, isLoading: m, error: h, refetch: g } = _(e), { optimizeRoute: w, updateRoute: T } = te(), E = B(e), { t: D } = se(), O = (e, t) => {
398
- let n = D(e);
405
+ function X() {
406
+ let { routeId: e } = H(), n = V().pathname.endsWith("/edit"), { basePath: c, navigate: l } = ee(), { route: d, isLoading: ne, error: h, refetch: g } = m(e), { optimizeRoute: C, updateRoute: w } = te(), T = le(e), { t: E } = G(), D = (e, t) => {
407
+ let n = E(e);
399
408
  return n === e ? t : n;
400
- }, { message: k, notify: A } = P(), [R, H] = U(null), [J, Y] = U(!1), Z = () => c?.(f(s, "routes")), Q = (e) => c?.(f(s, e)), $ = async () => {
409
+ }, { message: O, notify: k } = P(), [L, z] = B(null), [q, J] = B(!1), X = () => l?.(p(c, "routes")), Z = (e) => l?.(p(c, e)), Q = async () => {
401
410
  if (e) {
402
- Y(!0), H(null);
411
+ J(!0), z(null);
403
412
  try {
404
- await w(e), A("Route optimized — stops resequenced for the shortest run."), g();
413
+ await C(e), k("Route optimized — stops resequenced for the shortest run."), g();
405
414
  } catch (e) {
406
- H(e instanceof Error ? e.message : "Failed to optimize route.");
415
+ z(e instanceof Error ? e.message : "Failed to optimize route.");
407
416
  } finally {
408
- Y(!1);
417
+ J(!1);
409
418
  }
410
419
  }
411
- }, de = async (t) => {
412
- e && (await T(e, t), A(O("movethewheels.routes.suggest.done", "Assignment saved.")), g(), E.refetch());
420
+ }, $ = async (t) => {
421
+ e && (await w(e, t), k(D("movethewheels.routes.suggest.done", "Assignment saved.")), g(), T.refetch());
413
422
  };
414
- if (!e) return /* @__PURE__ */ K(X, {});
415
- if (n) return /* @__PURE__ */ K(X, { editId: e });
416
- if (m) return /* @__PURE__ */ K(re, { message: "Loading route details..." });
417
- if (h || !u) return /* @__PURE__ */ K(ne, {
423
+ if (!e) return /* @__PURE__ */ U(Y, {});
424
+ if (n) return /* @__PURE__ */ U(Y, { editId: e });
425
+ if (ne) return /* @__PURE__ */ U(A, { message: "Loading route details..." });
426
+ if (h || !d) return /* @__PURE__ */ U(re, {
418
427
  title: "Route not found",
419
428
  onRetry: g
420
429
  });
421
- let fe = u.stops.map((e) => {
422
- let t = z(e.address);
430
+ let fe = d.stops.map((e) => {
431
+ let t = ce(e.address);
423
432
  return t ? {
424
433
  lat: t.lat,
425
434
  lng: t.lng,
@@ -427,152 +436,152 @@ function Z() {
427
436
  label: F(e.address) || `Order #${e.orderId || e.sequence}`
428
437
  } : null;
429
438
  }).filter((e) => e !== null);
430
- return /* @__PURE__ */ q(ie, {
431
- title: u.name,
432
- subtitle: `${u.stops.length} stops - ${u.distance.toFixed(1)} km`,
433
- icon: /* @__PURE__ */ K(o, { size: 24 }),
434
- headerActions: /* @__PURE__ */ q("div", {
439
+ return /* @__PURE__ */ W(ie, {
440
+ title: d.name,
441
+ subtitle: `${d.stops.length} stops - ${d.distance.toFixed(1)} km`,
442
+ icon: /* @__PURE__ */ U(s, { size: 24 }),
443
+ headerActions: /* @__PURE__ */ W("div", {
435
444
  className: "flex gap-2",
436
445
  children: [
437
- /* @__PURE__ */ q(y, {
446
+ /* @__PURE__ */ W(v, {
438
447
  variant: "outline",
439
- onClick: Z,
440
- children: [/* @__PURE__ */ K(t, { size: 16 }), " Back"]
448
+ onClick: X,
449
+ children: [/* @__PURE__ */ U(t, { size: 16 }), " Back"]
441
450
  }),
442
- !u.optimized && /* @__PURE__ */ q(y, {
451
+ !d.optimized && /* @__PURE__ */ W(v, {
443
452
  variant: "outline",
444
- onClick: $,
445
- disabled: J,
453
+ onClick: Q,
454
+ disabled: q,
446
455
  children: [
447
- /* @__PURE__ */ K(d, { size: 16 }),
456
+ /* @__PURE__ */ U(f, { size: 16 }),
448
457
  " ",
449
- J ? "Optimizing…" : "Optimize"
458
+ q ? "Optimizing…" : "Optimize"
450
459
  ]
451
460
  }),
452
- /* @__PURE__ */ q(y, {
453
- onClick: () => c?.(f(s, `routes/${e}/edit`)),
454
- children: [/* @__PURE__ */ K(l, { size: 16 }), " Edit"]
461
+ /* @__PURE__ */ W(v, {
462
+ onClick: () => l?.(p(c, `routes/${e}/edit`)),
463
+ children: [/* @__PURE__ */ U(u, { size: 16 }), " Edit"]
455
464
  })
456
465
  ]
457
466
  }),
458
- headerContent: /* @__PURE__ */ q("div", {
467
+ headerContent: /* @__PURE__ */ W("div", {
459
468
  className: "flex gap-2",
460
- children: [/* @__PURE__ */ K(M, {
461
- status: u.status,
462
- customColors: j[u.status]
463
- }), /* @__PURE__ */ K(v, {
464
- variant: u.optimized ? "default" : "secondary",
465
- children: u.optimized ? "Optimized" : "Not Optimized"
469
+ children: [/* @__PURE__ */ U(N, {
470
+ status: d.status,
471
+ customColors: M[d.status]
472
+ }), /* @__PURE__ */ U(_, {
473
+ variant: d.optimized ? "default" : "secondary",
474
+ children: d.optimized ? "Optimized" : "Not Optimized"
466
475
  })]
467
476
  }),
468
477
  children: [
469
- /* @__PURE__ */ K(ue, {
470
- icon: /* @__PURE__ */ K(o, { size: 18 }),
478
+ /* @__PURE__ */ U(de, {
479
+ icon: /* @__PURE__ */ U(s, { size: 18 }),
471
480
  children: "A single optimized driving plan that chains together this route's stops. Review the sequence, distance and timing here, re-optimize if traffic or stops change, then hand the itinerary to a driver."
472
481
  }),
473
- /* @__PURE__ */ K(le, {
482
+ /* @__PURE__ */ U(ue, {
474
483
  storageKey: "movethewheels-route-details",
475
484
  steps: [
476
- ...u.optimized ? [] : [{
485
+ ...d.optimized ? [] : [{
477
486
  id: "optimize",
478
487
  label: "Optimize this route",
479
488
  description: "Reorder stops to cut distance and driving time.",
480
- icon: /* @__PURE__ */ K(d, { size: 16 }),
481
- onClick: $
489
+ icon: /* @__PURE__ */ U(f, { size: 16 }),
490
+ onClick: Q
482
491
  }],
483
492
  {
484
493
  id: "edit",
485
494
  label: "Adjust stops",
486
495
  description: "Add, remove or reorder the delivery stops.",
487
- icon: /* @__PURE__ */ K(l, { size: 16 }),
496
+ icon: /* @__PURE__ */ U(u, { size: 16 }),
488
497
  onClick: () => {}
489
498
  },
490
499
  {
491
500
  id: "orders",
492
501
  label: "Review the orders on this route",
493
502
  description: "Check the deliveries bundled into this run.",
494
- icon: /* @__PURE__ */ K(ee, { size: 16 }),
495
- onClick: () => Q("orders")
503
+ icon: /* @__PURE__ */ U(o, { size: 16 }),
504
+ onClick: () => Z("orders")
496
505
  }
497
506
  ]
498
507
  }),
499
- R && /* @__PURE__ */ K("div", {
508
+ L && /* @__PURE__ */ U("div", {
500
509
  className: "mb-2",
501
- children: /* @__PURE__ */ K(oe, { message: R })
510
+ children: /* @__PURE__ */ U(ae, { message: L })
502
511
  }),
503
- k && /* @__PURE__ */ K("div", {
512
+ O && /* @__PURE__ */ U("div", {
504
513
  className: "mb-2",
505
- children: /* @__PURE__ */ K(N, { message: k })
514
+ children: /* @__PURE__ */ U(oe, { message: O })
506
515
  }),
507
- /* @__PURE__ */ q("div", {
516
+ /* @__PURE__ */ W("div", {
508
517
  className: "grid grid-cols-1 lg:grid-cols-3 gap-6",
509
- children: [/* @__PURE__ */ q("div", {
518
+ children: [/* @__PURE__ */ W("div", {
510
519
  className: "lg:col-span-2 space-y-6",
511
- children: [/* @__PURE__ */ q(b, { children: [/* @__PURE__ */ K(S, { children: /* @__PURE__ */ K(C, { children: "Route Map" }) }), /* @__PURE__ */ K(x, { children: fe.length > 0 ? /* @__PURE__ */ K(ae, {
520
+ children: [/* @__PURE__ */ W(y, { children: [/* @__PURE__ */ U(x, { children: /* @__PURE__ */ U(S, { children: "Route Map" }) }), /* @__PURE__ */ U(b, { children: fe.length > 0 ? /* @__PURE__ */ U(j, {
512
521
  className: "overflow-hidden rounded-lg border border-border-seam",
513
522
  height: 360,
514
523
  stops: fe
515
- }) : /* @__PURE__ */ q("div", {
524
+ }) : /* @__PURE__ */ W("div", {
516
525
  className: "rounded-lg border border-border-seam bg-bg-sunken/40 p-4",
517
- children: [/* @__PURE__ */ K("p", {
526
+ children: [/* @__PURE__ */ U("p", {
518
527
  className: "mb-3 text-sm text-text-secondary",
519
528
  children: "These stops don't have map coordinates yet — showing the planned sequence instead."
520
- }), /* @__PURE__ */ K("ol", {
529
+ }), /* @__PURE__ */ U("ol", {
521
530
  className: "space-y-2",
522
- children: u.stops.map((e) => /* @__PURE__ */ q("li", {
531
+ children: d.stops.map((e) => /* @__PURE__ */ W("li", {
523
532
  className: "flex items-start gap-3",
524
- children: [/* @__PURE__ */ K("span", {
533
+ children: [/* @__PURE__ */ U("span", {
525
534
  className: "flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-action-primary-bg/10 text-xs font-semibold text-primary",
526
535
  children: e.sequence
527
- }), /* @__PURE__ */ K("span", {
536
+ }), /* @__PURE__ */ U("span", {
528
537
  className: "text-sm",
529
538
  children: F(e.address) || `Order #${e.orderId || e.sequence}`
530
539
  })]
531
540
  }, e.id))
532
541
  })]
533
- }) })] }), /* @__PURE__ */ q(b, { children: [/* @__PURE__ */ K(S, { children: /* @__PURE__ */ q(C, { children: [
542
+ }) })] }), /* @__PURE__ */ W(y, { children: [/* @__PURE__ */ U(x, { children: /* @__PURE__ */ W(S, { children: [
534
543
  "Stops (",
535
- u.stops.length,
544
+ d.stops.length,
536
545
  ")"
537
- ] }) }), /* @__PURE__ */ K(x, { children: /* @__PURE__ */ K("div", {
546
+ ] }) }), /* @__PURE__ */ U(b, { children: /* @__PURE__ */ U("div", {
538
547
  className: "space-y-4",
539
- children: u.stops.map((e, t) => /* @__PURE__ */ q("div", {
548
+ children: d.stops.map((e, t) => /* @__PURE__ */ W("div", {
540
549
  className: "flex gap-4",
541
- children: [/* @__PURE__ */ q("div", {
550
+ children: [/* @__PURE__ */ W("div", {
542
551
  className: "relative",
543
- children: [/* @__PURE__ */ K("div", {
552
+ children: [/* @__PURE__ */ U("div", {
544
553
  className: `w-8 h-8 rounded-full flex items-center justify-center ${e.status === "completed" ? "bg-status-success-text text-text-inverse" : "bg-bg-sunken"}`,
545
- children: e.status === "completed" ? /* @__PURE__ */ K(r, { size: 16 }) : e.sequence
546
- }), t < u.stops.length - 1 && /* @__PURE__ */ K("div", { className: "absolute top-8 left-4 w-px h-12 bg-border" })]
547
- }), /* @__PURE__ */ K("div", {
554
+ children: e.status === "completed" ? /* @__PURE__ */ U(r, { size: 16 }) : e.sequence
555
+ }), t < d.stops.length - 1 && /* @__PURE__ */ U("div", { className: "absolute top-8 left-4 w-px h-12 bg-border" })]
556
+ }), /* @__PURE__ */ U("div", {
548
557
  className: "flex-1 pb-4",
549
- children: /* @__PURE__ */ q("div", {
558
+ children: /* @__PURE__ */ W("div", {
550
559
  className: "flex items-center justify-between",
551
- children: [/* @__PURE__ */ q("div", { children: [/* @__PURE__ */ q("div", {
560
+ children: [/* @__PURE__ */ W("div", { children: [/* @__PURE__ */ W("div", {
552
561
  className: "flex items-center gap-2",
553
- children: [/* @__PURE__ */ K(v, {
562
+ children: [/* @__PURE__ */ U(_, {
554
563
  variant: e.type === "pickup" ? "secondary" : "default",
555
564
  className: "capitalize",
556
565
  children: e.type
557
- }), /* @__PURE__ */ q("span", {
566
+ }), /* @__PURE__ */ W("span", {
558
567
  className: "font-medium",
559
568
  children: ["Order #", e.orderId]
560
569
  })]
561
- }), /* @__PURE__ */ K("p", {
570
+ }), /* @__PURE__ */ U("p", {
562
571
  className: "text-sm text-text-secondary mt-1",
563
572
  children: F(e.address)
564
- })] }), /* @__PURE__ */ q("div", {
573
+ })] }), /* @__PURE__ */ W("div", {
565
574
  className: "text-right",
566
575
  children: [
567
- /* @__PURE__ */ q("p", {
576
+ /* @__PURE__ */ W("p", {
568
577
  className: "text-sm",
569
- children: ["Scheduled: ", L(e.scheduledTime, "time")]
578
+ children: ["Scheduled: ", I(e.scheduledTime, "time")]
570
579
  }),
571
- e.actualTime && /* @__PURE__ */ q("p", {
580
+ e.actualTime && /* @__PURE__ */ W("p", {
572
581
  className: "text-sm text-status-success-text",
573
- children: ["Actual: ", L(e.actualTime, "time")]
582
+ children: ["Actual: ", I(e.actualTime, "time")]
574
583
  }),
575
- /* @__PURE__ */ q("p", {
584
+ /* @__PURE__ */ W("p", {
576
585
  className: "text-xs text-text-secondary",
577
586
  children: [e.duration, " min stop"]
578
587
  })
@@ -582,91 +591,91 @@ function Z() {
582
591
  })]
583
592
  }, e.id))
584
593
  }) })] })]
585
- }), /* @__PURE__ */ q("div", {
594
+ }), /* @__PURE__ */ W("div", {
586
595
  className: "space-y-6",
587
596
  children: [
588
- (u.status === "planned" || u.status === "in_progress") && /* @__PURE__ */ K(V, {
589
- suggestions: E.data,
590
- isLoading: E.isLoading,
591
- error: E.error,
592
- onRetry: E.refetch,
593
- assignedVehicleId: u.vehicleId || void 0,
594
- assignedDriverId: u.driverId || void 0,
595
- onAssign: de,
596
- t: O
597
+ (d.status === "planned" || d.status === "in_progress") && /* @__PURE__ */ U(R, {
598
+ suggestions: T.data,
599
+ isLoading: T.isLoading,
600
+ error: T.error,
601
+ onRetry: T.refetch,
602
+ assignedVehicleId: d.vehicleId || void 0,
603
+ assignedDriverId: d.driverId || void 0,
604
+ onAssign: $,
605
+ t: D
597
606
  }),
598
- /* @__PURE__ */ q(ce, {
607
+ /* @__PURE__ */ W(K, {
599
608
  className: "space-y-4",
600
609
  children: [
601
- /* @__PURE__ */ K("h2", {
610
+ /* @__PURE__ */ U("h2", {
602
611
  className: "text-base font-semibold text-text-primary",
603
612
  children: "Route Info"
604
613
  }),
605
- /* @__PURE__ */ q("div", { children: [/* @__PURE__ */ K("p", {
614
+ /* @__PURE__ */ W("div", { children: [/* @__PURE__ */ U("p", {
606
615
  className: "text-sm text-text-secondary",
607
616
  children: "Total Distance"
608
- }), /* @__PURE__ */ q("p", {
617
+ }), /* @__PURE__ */ W("p", {
609
618
  className: "text-2xl font-bold",
610
- children: [u.distance.toFixed(1), /* @__PURE__ */ K("span", {
619
+ children: [d.distance.toFixed(1), /* @__PURE__ */ U("span", {
611
620
  className: "text-sm font-normal",
612
621
  children: " km"
613
622
  })]
614
623
  })] }),
615
- /* @__PURE__ */ q("div", { children: [/* @__PURE__ */ K("p", {
624
+ /* @__PURE__ */ W("div", { children: [/* @__PURE__ */ U("p", {
616
625
  className: "text-sm text-text-secondary",
617
626
  children: "Est. Duration"
618
- }), /* @__PURE__ */ q("p", {
627
+ }), /* @__PURE__ */ W("p", {
619
628
  className: "text-2xl font-bold",
620
- children: [u.estimatedDuration, /* @__PURE__ */ K("span", {
629
+ children: [d.estimatedDuration, /* @__PURE__ */ U("span", {
621
630
  className: "text-sm font-normal",
622
631
  children: " min"
623
632
  })]
624
633
  })] }),
625
- u.fuelCost !== void 0 && /* @__PURE__ */ q("div", { children: [/* @__PURE__ */ q("p", {
634
+ d.fuelCost !== void 0 && /* @__PURE__ */ W("div", { children: [/* @__PURE__ */ W("p", {
626
635
  className: "text-sm text-text-secondary flex items-center gap-1",
627
- children: [/* @__PURE__ */ K(a, { size: 14 }), " Est. Fuel Cost"]
628
- }), /* @__PURE__ */ K("p", {
636
+ children: [/* @__PURE__ */ U(a, { size: 14 }), " Est. Fuel Cost"]
637
+ }), /* @__PURE__ */ U("p", {
629
638
  className: "text-2xl font-bold",
630
- children: I(u.fuelCost)
639
+ children: se(d.fuelCost)
631
640
  })] }),
632
- u.actualDuration && /* @__PURE__ */ q("div", { children: [/* @__PURE__ */ K("p", {
641
+ d.actualDuration && /* @__PURE__ */ W("div", { children: [/* @__PURE__ */ U("p", {
633
642
  className: "text-sm text-text-secondary",
634
643
  children: "Actual Duration"
635
- }), /* @__PURE__ */ q("p", {
644
+ }), /* @__PURE__ */ W("p", {
636
645
  className: "text-2xl font-bold",
637
- children: [u.actualDuration, /* @__PURE__ */ K("span", {
646
+ children: [d.actualDuration, /* @__PURE__ */ U("span", {
638
647
  className: "text-sm font-normal",
639
648
  children: " min"
640
649
  })]
641
650
  })] })
642
651
  ]
643
652
  }),
644
- /* @__PURE__ */ q(b, { children: [/* @__PURE__ */ K(S, { children: /* @__PURE__ */ q(C, {
653
+ /* @__PURE__ */ W(y, { children: [/* @__PURE__ */ U(x, { children: /* @__PURE__ */ W(S, {
645
654
  className: "flex items-center gap-2",
646
- children: [/* @__PURE__ */ K(i, { size: 18 }), " Timeline"]
647
- }) }), /* @__PURE__ */ q(x, {
655
+ children: [/* @__PURE__ */ U(i, { size: 18 }), " Timeline"]
656
+ }) }), /* @__PURE__ */ W(b, {
648
657
  className: "space-y-3",
649
658
  children: [
650
- u.startTime && /* @__PURE__ */ q("div", { children: [/* @__PURE__ */ K("p", {
659
+ d.startTime && /* @__PURE__ */ W("div", { children: [/* @__PURE__ */ U("p", {
651
660
  className: "text-sm text-text-secondary",
652
661
  children: "Started"
653
- }), /* @__PURE__ */ K("p", { children: L(u.startTime, "full") })] }),
654
- u.endTime && /* @__PURE__ */ q("div", { children: [/* @__PURE__ */ K("p", {
662
+ }), /* @__PURE__ */ U("p", { children: I(d.startTime, "full") })] }),
663
+ d.endTime && /* @__PURE__ */ W("div", { children: [/* @__PURE__ */ U("p", {
655
664
  className: "text-sm text-text-secondary",
656
665
  children: "Completed"
657
- }), /* @__PURE__ */ K("p", { children: L(u.endTime, "full") })] }),
658
- /* @__PURE__ */ q("div", { children: [/* @__PURE__ */ K("p", {
666
+ }), /* @__PURE__ */ U("p", { children: I(d.endTime, "full") })] }),
667
+ /* @__PURE__ */ W("div", { children: [/* @__PURE__ */ U("p", {
659
668
  className: "text-sm text-text-secondary",
660
669
  children: "Created"
661
- }), /* @__PURE__ */ K("p", { children: L(u.createdAt, "full") })] })
670
+ }), /* @__PURE__ */ U("p", { children: I(d.createdAt, "full") })] })
662
671
  ]
663
672
  })] }),
664
- u.trafficConditions.length > 0 && /* @__PURE__ */ q(b, { children: [/* @__PURE__ */ K(S, { children: /* @__PURE__ */ K(C, { children: "Traffic Conditions" }) }), /* @__PURE__ */ K(x, { children: u.trafficConditions.map((e, t) => /* @__PURE__ */ q("div", {
673
+ d.trafficConditions.length > 0 && /* @__PURE__ */ W(y, { children: [/* @__PURE__ */ U(x, { children: /* @__PURE__ */ U(S, { children: "Traffic Conditions" }) }), /* @__PURE__ */ U(b, { children: d.trafficConditions.map((e, t) => /* @__PURE__ */ W("div", {
665
674
  className: `p-2 rounded mb-2 ${e.condition === "severe" ? "bg-status-error-bg-subtle" : (e.condition, "bg-status-warning-bg-subtle")}`,
666
- children: [/* @__PURE__ */ q("p", {
675
+ children: [/* @__PURE__ */ W("p", {
667
676
  className: "text-sm font-medium capitalize",
668
677
  children: [e.condition, " traffic"]
669
- }), /* @__PURE__ */ q("p", {
678
+ }), /* @__PURE__ */ W("p", {
670
679
  className: "text-xs text-text-secondary",
671
680
  children: [
672
681
  e.location,
@@ -683,4 +692,4 @@ function Z() {
683
692
  });
684
693
  }
685
694
  //#endregion
686
- export { Z as default };
695
+ export { X as default };