@burdenoff/microfe-movethewheels 2026.1108.2 → 2026.1108.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/dist/components/DocumentsCard.js +183 -55
  2. package/dist/generated/tracking-quality-operations.d.ts +328 -1
  3. package/dist/generated/wspace-types.d.ts +1479 -10
  4. package/dist/hooks/useCarrierIntegrations.js +30 -29
  5. package/dist/hooks/useDocumentExtractions.js +100 -0
  6. package/dist/movethewheels/hooks/useCarrierIntegrations.d.ts +9 -3
  7. package/dist/movethewheels/hooks/useDocumentExtractions.d.ts +49 -0
  8. package/dist/movethewheels/hooks/useEntityDocuments.d.ts +5 -5
  9. package/dist/movethewheels/utils/carrierIntegrations.d.ts +90 -9
  10. package/dist/node_modules/lucide-react/dist/esm/icons/cloud-download.js +18 -0
  11. package/dist/node_modules/lucide-react/dist/esm/icons/file-search.js +24 -0
  12. package/dist/pages/IntegrationsPage.js +551 -329
  13. package/dist/pages/MultiModalShipmentPage.js +125 -121
  14. package/dist/pages/RouteDetailsPage.js +212 -207
  15. package/dist/utils/carrierIntegrations.js +127 -30
  16. package/package.json +1 -1
  17. package/src/generated/tracking-quality-operations.ts +373 -0
  18. package/src/generated/wspace-types.ts +1672 -10
  19. package/src/movethewheels/components/DocumentsCard.tsx +174 -29
  20. package/src/movethewheels/hooks/useCarrierIntegrations.ts +19 -2
  21. package/src/movethewheels/hooks/useDocumentExtractions.ts +246 -0
  22. package/src/movethewheels/hooks/useEntityDocuments.ts +5 -5
  23. package/src/movethewheels/pages/IntegrationsPage.tsx +292 -36
  24. package/src/movethewheels/pages/MultiModalShipmentPage.tsx +2 -0
  25. package/src/movethewheels/pages/RouteDetailsPage.tsx +2 -0
  26. package/src/movethewheels/utils/carrierIntegrations.ts +252 -10
@@ -21,21 +21,22 @@ import { ErrorState as j, LoadingState as M, PageLayout as se } from "../compone
21
21
  import { RouteMap as N } from "../components/maps/RouteMap.js";
22
22
  import "../components/maps/index.js";
23
23
  import { ROUTE_STATUS_COLORS as P } from "../constants/index.js";
24
- import { StatusBadge as ce } from "../components/StatusBadge.js";
25
- import { FormError as F } from "../components/FormError.js";
26
- import { Notice as I, useNotice as le } from "../components/Notice.js";
24
+ import { StatusBadge as F } from "../components/StatusBadge.js";
25
+ import { FormError as I } from "../components/FormError.js";
26
+ import { Notice as ce, useNotice as le } from "../components/Notice.js";
27
+ import { DocumentsCard as ue } from "../components/DocumentsCard.js";
27
28
  import { EntityCombobox as L } from "../components/EntityCombobox.js";
28
- import { firstRealLatLng as ue } from "../utils/mapMarkers.js";
29
- import { useRefetchOnLeaveEdit as de } from "../hooks/useRefetchOnLeaveEdit.js";
30
- import { useAssignmentSuggestions as fe } from "../hooks/useFleetIntelligence.js";
31
- import { AssignmentSuggestions as pe } from "../components/AssignmentSuggestions.js";
32
- import { useEffect as R, useState as z } from "react";
29
+ import { firstRealLatLng as de } from "../utils/mapMarkers.js";
30
+ import { useRefetchOnLeaveEdit as fe } from "../hooks/useRefetchOnLeaveEdit.js";
31
+ import { useAssignmentSuggestions as pe } from "../hooks/useFleetIntelligence.js";
32
+ import { AssignmentSuggestions as R } from "../components/AssignmentSuggestions.js";
33
+ import { useEffect as z, useState as B } from "react";
33
34
  import { useLocation as me, useParams as he } from "react-router";
34
- import { Fragment as B, jsx as V, jsxs as H } from "react/jsx-runtime";
35
- import { useI18n as ge } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
36
- import { EmphasisPanel as U, NextSteps as _e, PagePurpose as ve, ResponsiveDialog as ye, ResponsiveDialogContent as be, ResponsiveDialogDescription as xe, ResponsiveDialogFooter as Se, ResponsiveDialogHeader as W, ResponsiveDialogTitle as G } from "@burdenoff/fe-libs/ui";
35
+ import { Fragment as V, jsx as H, jsxs as U } from "react/jsx-runtime";
36
+ import { useI18n as W } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
37
+ import { EmphasisPanel as ge, NextSteps as _e, PagePurpose as ve, ResponsiveDialog as ye, ResponsiveDialogContent as be, ResponsiveDialogDescription as xe, ResponsiveDialogFooter as G, ResponsiveDialogHeader as K, ResponsiveDialogTitle as Se } from "@burdenoff/fe-libs/ui";
37
38
  //#region src/movethewheels/pages/RouteDetailsPage.tsx
38
- var K = [
39
+ var q = [
39
40
  {
40
41
  value: "planned",
41
42
  label: "Planned"
@@ -53,8 +54,8 @@ var K = [
53
54
  label: "Cancelled"
54
55
  }
55
56
  ];
56
- function q({ editId: r }) {
57
- let { basePath: i, navigate: a } = te(), { createRoute: ee, updateRoute: l } = ie(), { route: d } = re(r), [ne, m] = z(""), [h, v] = z(""), j = !!r, [M, N] = z({
57
+ function J({ editId: r }) {
58
+ let { basePath: i, navigate: a } = te(), { createRoute: ee, updateRoute: l } = ie(), { route: d } = re(r), [ne, m] = B(""), [h, v] = B(""), j = !!r, [M, N] = B({
58
59
  name: "",
59
60
  status: "planned",
60
61
  vehicleId: "",
@@ -63,14 +64,14 @@ function q({ editId: r }) {
63
64
  address: "",
64
65
  type: "delivery"
65
66
  }]
66
- }), { vehicles: P, isLoading: ce, hasMore: I, totalVehicles: le, loadMore: ue, isLoadingMore: de } = _({
67
+ }), { vehicles: P, isLoading: F, hasMore: ce, totalVehicles: le, loadMore: ue, isLoadingMore: de } = _({
67
68
  limit: 20,
68
69
  search: ne || void 0
69
- }), { drivers: fe, isLoading: pe, hasMore: me, totalDrivers: he, loadMore: ge, isLoadingMore: _e } = ae({
70
+ }), { drivers: fe, isLoading: pe, hasMore: R, totalDrivers: me, loadMore: he, isLoadingMore: W } = ae({
70
71
  limit: 20,
71
72
  search: h || void 0
72
- }), { vehicle: ye, isLoading: be } = oe(M.vehicleId || void 0), { driver: xe, isLoading: Se } = g(M.driverId || void 0), [W, G] = z(!1), [q, J] = z(null);
73
- R(() => {
73
+ }), { vehicle: _e, isLoading: ye } = oe(M.vehicleId || void 0), { driver: be, isLoading: xe } = g(M.driverId || void 0), [G, K] = B(!1), [Se, J] = B(null);
74
+ z(() => {
74
75
  !r || !d || N({
75
76
  name: d.name || "",
76
77
  status: d.status,
@@ -85,7 +86,7 @@ function q({ editId: r }) {
85
86
  }]
86
87
  });
87
88
  }, [r, d]);
88
- let Ce = () => a?.(f(i, "routes")), Y = () => N((e) => ({
89
+ let Y = () => a?.(f(i, "routes")), Ce = () => N((e) => ({
89
90
  ...e,
90
91
  stops: [...e.stops, {
91
92
  address: "",
@@ -118,7 +119,7 @@ function q({ editId: r }) {
118
119
  J("Add at least one stop with an address.");
119
120
  return;
120
121
  }
121
- G(!0), J(null);
122
+ K(!0), J(null);
122
123
  try {
123
124
  let e = t.map((e, t) => ({
124
125
  id: `stop-${t + 1}`,
@@ -154,54 +155,54 @@ function q({ editId: r }) {
154
155
  });
155
156
  a?.(f(i, `routes/${n.id}`));
156
157
  } catch (e) {
157
- console.error("Failed to create route:", e), J(e instanceof Error ? e.message : "Failed to create route. Please try again."), G(!1);
158
+ console.error("Failed to create route:", e), J(e instanceof Error ? e.message : "Failed to create route. Please try again."), K(!1);
158
159
  }
159
160
  };
160
- return /* @__PURE__ */ H(se, {
161
+ return /* @__PURE__ */ U(se, {
161
162
  title: j ? "Edit Route" : "Create Route",
162
163
  subtitle: "Plan a new delivery route",
163
- icon: /* @__PURE__ */ V(o, { size: 24 }),
164
- headerActions: /* @__PURE__ */ H("div", {
164
+ icon: /* @__PURE__ */ H(o, { size: 24 }),
165
+ headerActions: /* @__PURE__ */ U("div", {
165
166
  className: "flex gap-2",
166
- children: [/* @__PURE__ */ H(y, {
167
+ children: [/* @__PURE__ */ U(y, {
167
168
  variant: "outline",
168
- onClick: Ce,
169
- disabled: W,
170
- children: [/* @__PURE__ */ V(t, { size: 16 }), " Cancel"]
171
- }), /* @__PURE__ */ H(y, {
169
+ onClick: Y,
170
+ disabled: G,
171
+ children: [/* @__PURE__ */ H(t, { size: 16 }), " Cancel"]
172
+ }), /* @__PURE__ */ U(y, {
172
173
  onClick: $,
173
- disabled: W,
174
+ disabled: G,
174
175
  children: [
175
- /* @__PURE__ */ V(c, { size: 16 }),
176
+ /* @__PURE__ */ H(c, { size: 16 }),
176
177
  " ",
177
- j ? W ? "Saving..." : "Save Changes" : W ? "Saving..." : "Create Route"
178
+ j ? G ? "Saving..." : "Save Changes" : G ? "Saving..." : "Create Route"
178
179
  ]
179
180
  })]
180
181
  }),
181
- children: [/* @__PURE__ */ V(ve, {
182
- icon: /* @__PURE__ */ V(o, { size: 18 }),
182
+ children: [/* @__PURE__ */ H(ve, {
183
+ icon: /* @__PURE__ */ H(o, { size: 18 }),
183
184
  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. Optimizing also marks the route In Progress."
184
- }), /* @__PURE__ */ H("form", {
185
+ }), /* @__PURE__ */ U("form", {
185
186
  onSubmit: $,
186
187
  className: "max-w-3xl space-y-6",
187
188
  children: [
188
- /* @__PURE__ */ V(F, { message: q }),
189
- /* @__PURE__ */ H(U, { children: [/* @__PURE__ */ V("h2", {
189
+ /* @__PURE__ */ H(I, { message: Se }),
190
+ /* @__PURE__ */ U(ge, { children: [/* @__PURE__ */ H("h2", {
190
191
  className: "text-base font-semibold text-text-primary mb-4",
191
192
  children: "Route Details"
192
- }), /* @__PURE__ */ H("div", {
193
+ }), /* @__PURE__ */ U("div", {
193
194
  className: "space-y-4",
194
- children: [/* @__PURE__ */ H("div", {
195
+ children: [/* @__PURE__ */ U("div", {
195
196
  className: "grid grid-cols-1 md:grid-cols-2 gap-4",
196
- children: [/* @__PURE__ */ H("div", {
197
+ children: [/* @__PURE__ */ U("div", {
197
198
  className: "space-y-2",
198
- children: [/* @__PURE__ */ H(T, {
199
+ children: [/* @__PURE__ */ U(T, {
199
200
  htmlFor: "name",
200
- children: ["Route Name ", /* @__PURE__ */ V("span", {
201
+ children: ["Route Name ", /* @__PURE__ */ H("span", {
201
202
  className: "text-status-error-text",
202
203
  children: "*"
203
204
  })]
204
- }), /* @__PURE__ */ V(w, {
205
+ }), /* @__PURE__ */ H(w, {
205
206
  id: "name",
206
207
  value: M.name,
207
208
  onChange: (e) => N((t) => ({
@@ -211,34 +212,34 @@ function q({ editId: r }) {
211
212
  placeholder: "Downtown morning run",
212
213
  required: !0
213
214
  })]
214
- }), /* @__PURE__ */ H("div", {
215
+ }), /* @__PURE__ */ U("div", {
215
216
  className: "space-y-2",
216
- children: [/* @__PURE__ */ V(T, {
217
+ children: [/* @__PURE__ */ H(T, {
217
218
  htmlFor: "status",
218
219
  children: "Status"
219
- }), /* @__PURE__ */ H(E, {
220
+ }), /* @__PURE__ */ U(E, {
220
221
  value: M.status,
221
222
  onValueChange: (e) => N((t) => ({
222
223
  ...t,
223
224
  status: e
224
225
  })),
225
- children: [/* @__PURE__ */ V(k, {
226
+ children: [/* @__PURE__ */ H(k, {
226
227
  id: "status",
227
- children: /* @__PURE__ */ V(A, {})
228
- }), /* @__PURE__ */ V(D, { children: K.map((e) => /* @__PURE__ */ V(O, {
228
+ children: /* @__PURE__ */ H(A, {})
229
+ }), /* @__PURE__ */ H(D, { children: q.map((e) => /* @__PURE__ */ H(O, {
229
230
  value: e.value,
230
231
  children: e.label
231
232
  }, e.value)) })]
232
233
  })]
233
234
  })]
234
- }), /* @__PURE__ */ H("div", {
235
+ }), /* @__PURE__ */ U("div", {
235
236
  className: "grid grid-cols-1 md:grid-cols-2 gap-4",
236
- children: [/* @__PURE__ */ H("div", {
237
+ children: [/* @__PURE__ */ U("div", {
237
238
  className: "space-y-2",
238
- children: [/* @__PURE__ */ V(T, {
239
+ children: [/* @__PURE__ */ H(T, {
239
240
  htmlFor: "vehicle",
240
241
  children: "Vehicle (optional)"
241
- }), /* @__PURE__ */ V(L, {
242
+ }), /* @__PURE__ */ H(L, {
242
243
  id: "vehicle",
243
244
  value: M.vehicleId,
244
245
  onChange: (e) => N((t) => ({
@@ -246,32 +247,32 @@ function q({ editId: r }) {
246
247
  vehicleId: e
247
248
  })),
248
249
  options: P,
249
- loading: ce,
250
+ loading: F,
250
251
  getId: (e) => e.id,
251
252
  getLabel: (e) => `${e.vehicleNumber} (${e.type})`,
252
- renderOption: (e) => /* @__PURE__ */ H(B, { children: [
253
+ renderOption: (e) => /* @__PURE__ */ U(V, { children: [
253
254
  e.vehicleNumber,
254
255
  " (",
255
256
  e.type,
256
257
  ")"
257
258
  ] }),
258
- selectedOption: ye,
259
- selectedLoading: be,
259
+ selectedOption: _e,
260
+ selectedLoading: ye,
260
261
  onSearchChange: m,
261
262
  searchPlaceholder: "Search vehicle number or type…",
262
- hasMore: I,
263
+ hasMore: ce,
263
264
  totalCount: le,
264
265
  onLoadMore: ue,
265
266
  loadingMore: de,
266
267
  placeholder: "Assign later",
267
268
  emptyText: "No available vehicles."
268
269
  })]
269
- }), /* @__PURE__ */ H("div", {
270
+ }), /* @__PURE__ */ U("div", {
270
271
  className: "space-y-2",
271
- children: [/* @__PURE__ */ V(T, {
272
+ children: [/* @__PURE__ */ H(T, {
272
273
  htmlFor: "driver",
273
274
  children: "Driver (optional)"
274
- }), /* @__PURE__ */ V(L, {
275
+ }), /* @__PURE__ */ H(L, {
275
276
  id: "driver",
276
277
  value: M.driverId,
277
278
  onChange: (e) => N((t) => ({
@@ -282,101 +283,101 @@ function q({ editId: r }) {
282
283
  loading: pe,
283
284
  getId: (e) => e.id,
284
285
  getLabel: (e) => `${e.fullName} (${e.employeeId})`,
285
- renderOption: (e) => /* @__PURE__ */ H(B, { children: [
286
+ renderOption: (e) => /* @__PURE__ */ U(V, { children: [
286
287
  e.fullName,
287
288
  " (",
288
289
  e.employeeId,
289
290
  ")"
290
291
  ] }),
291
- selectedOption: xe,
292
- selectedLoading: Se,
292
+ selectedOption: be,
293
+ selectedLoading: xe,
293
294
  onSearchChange: v,
294
295
  searchPlaceholder: "Search driver name or employee ID…",
295
- hasMore: me,
296
- totalCount: he,
297
- onLoadMore: ge,
298
- loadingMore: _e,
296
+ hasMore: R,
297
+ totalCount: me,
298
+ onLoadMore: he,
299
+ loadingMore: W,
299
300
  placeholder: "Assign later",
300
301
  emptyText: "No available drivers."
301
302
  })]
302
303
  })]
303
304
  })]
304
305
  })] }),
305
- /* @__PURE__ */ H(b, { children: [/* @__PURE__ */ H(S, {
306
+ /* @__PURE__ */ U(b, { children: [/* @__PURE__ */ U(S, {
306
307
  className: "flex flex-row items-center justify-between",
307
- children: [/* @__PURE__ */ H(C, { children: ["Stops ", /* @__PURE__ */ V("span", {
308
+ children: [/* @__PURE__ */ U(C, { children: ["Stops ", /* @__PURE__ */ H("span", {
308
309
  className: "text-status-error-text",
309
310
  children: "*"
310
- })] }), /* @__PURE__ */ H(y, {
311
+ })] }), /* @__PURE__ */ U(y, {
311
312
  type: "button",
312
313
  variant: "outline",
313
314
  size: "sm",
314
- onClick: Y,
315
- children: [/* @__PURE__ */ V(s, { size: 16 }), " Add Stop"]
315
+ onClick: Ce,
316
+ children: [/* @__PURE__ */ H(s, { size: 16 }), " Add Stop"]
316
317
  })]
317
- }), /* @__PURE__ */ V(x, {
318
+ }), /* @__PURE__ */ H(x, {
318
319
  className: "space-y-4",
319
- children: M.stops.map((t, r) => /* @__PURE__ */ H("div", {
320
+ children: M.stops.map((t, r) => /* @__PURE__ */ U("div", {
320
321
  className: "grid grid-cols-1 md:grid-cols-12 gap-3 items-end",
321
322
  children: [
322
- /* @__PURE__ */ H("div", {
323
+ /* @__PURE__ */ U("div", {
323
324
  className: "md:col-span-7 space-y-2",
324
- children: [/* @__PURE__ */ H(T, {
325
+ children: [/* @__PURE__ */ U(T, {
325
326
  htmlFor: `stop-address-${r}`,
326
327
  children: [
327
328
  "Stop ",
328
329
  r + 1,
329
330
  " address"
330
331
  ]
331
- }), /* @__PURE__ */ V(w, {
332
+ }), /* @__PURE__ */ H(w, {
332
333
  id: `stop-address-${r}`,
333
334
  value: t.address,
334
335
  onChange: (e) => Z(r, "address", e.target.value),
335
336
  placeholder: "123 Main St, San Francisco, CA"
336
337
  })]
337
338
  }),
338
- /* @__PURE__ */ H("div", {
339
+ /* @__PURE__ */ U("div", {
339
340
  className: "md:col-span-4 space-y-2",
340
- children: [/* @__PURE__ */ V(T, {
341
+ children: [/* @__PURE__ */ H(T, {
341
342
  htmlFor: `stop-type-${r}`,
342
343
  children: "Type"
343
- }), /* @__PURE__ */ H(E, {
344
+ }), /* @__PURE__ */ U(E, {
344
345
  value: t.type,
345
346
  onValueChange: (e) => Z(r, "type", e),
346
- children: [/* @__PURE__ */ V(k, {
347
+ children: [/* @__PURE__ */ H(k, {
347
348
  id: `stop-type-${r}`,
348
- children: /* @__PURE__ */ V(A, {})
349
- }), /* @__PURE__ */ H(D, { children: [/* @__PURE__ */ V(O, {
349
+ children: /* @__PURE__ */ H(A, {})
350
+ }), /* @__PURE__ */ U(D, { children: [/* @__PURE__ */ H(O, {
350
351
  value: "pickup",
351
352
  children: "Pickup"
352
- }), /* @__PURE__ */ V(O, {
353
+ }), /* @__PURE__ */ H(O, {
353
354
  value: "delivery",
354
355
  children: "Delivery"
355
356
  })] })]
356
357
  })]
357
358
  }),
358
- /* @__PURE__ */ H("div", {
359
+ /* @__PURE__ */ U("div", {
359
360
  className: "md:col-span-1 flex justify-end gap-1",
360
361
  children: [
361
- /* @__PURE__ */ V(y, {
362
+ /* @__PURE__ */ H(y, {
362
363
  type: "button",
363
364
  variant: "ghost",
364
365
  size: "icon",
365
366
  onClick: () => Q(r, -1),
366
367
  disabled: r === 0,
367
368
  "aria-label": `Move stop ${r + 1} up`,
368
- children: /* @__PURE__ */ V(n, { size: 16 })
369
+ children: /* @__PURE__ */ H(n, { size: 16 })
369
370
  }),
370
- /* @__PURE__ */ V(y, {
371
+ /* @__PURE__ */ H(y, {
371
372
  type: "button",
372
373
  variant: "ghost",
373
374
  size: "icon",
374
375
  onClick: () => Q(r, 1),
375
376
  disabled: r === M.stops.length - 1,
376
377
  "aria-label": `Move stop ${r + 1} down`,
377
- children: /* @__PURE__ */ V(e, { size: 16 })
378
+ children: /* @__PURE__ */ H(e, { size: 16 })
378
379
  }),
379
- /* @__PURE__ */ V(y, {
380
+ /* @__PURE__ */ H(y, {
380
381
  type: "button",
381
382
  variant: "ghost",
382
383
  size: "icon",
@@ -384,7 +385,7 @@ function q({ editId: r }) {
384
385
  onClick: () => X(r),
385
386
  disabled: M.stops.length === 1,
386
387
  "aria-label": `Remove stop ${r + 1}`,
387
- children: /* @__PURE__ */ V(u, { size: 16 })
388
+ children: /* @__PURE__ */ H(u, { size: 16 })
388
389
  })
389
390
  ]
390
391
  })
@@ -395,44 +396,44 @@ function q({ editId: r }) {
395
396
  })]
396
397
  });
397
398
  }
398
- function J() {
399
+ function Y() {
399
400
  let { routeId: e } = he(), n = me().pathname.endsWith("/edit"), { basePath: s, navigate: c } = te(), { route: g, isLoading: ae, error: oe, refetch: _ } = re(e);
400
- de(n, _);
401
- let { optimizeRoute: w, updateRoute: T, deleteRoute: E } = ie(), D = fe(e), { t: O } = ge(), k = (e, t) => {
401
+ fe(n, _);
402
+ let { optimizeRoute: w, updateRoute: T, deleteRoute: E } = ie(), D = pe(e), { t: O } = W(), k = (e, t) => {
402
403
  let n = O(e);
403
404
  return n === e ? t : n;
404
- }, { message: A, notify: L } = le(), [R, B] = z(null), [K, J] = z(!1), [Ce, Y] = z(!1), [X, Z] = z(!1), [Q, $] = z(null), we = () => c?.(f(s, "routes")), Te = (e) => c?.(f(s, e)), Ee = async () => {
405
+ }, { message: A, notify: L } = le(), [z, V] = B(null), [q, Y] = B(!1), [Ce, X] = B(!1), [Z, Q] = B(!1), [$, we] = B(null), Te = () => c?.(f(s, "routes")), Ee = (e) => c?.(f(s, e)), De = async () => {
405
406
  if (e) {
406
- Z(!0), $(null);
407
+ Q(!0), we(null);
407
408
  try {
408
- await E(e), Y(!1), we();
409
+ await E(e), X(!1), Te();
409
410
  } catch (e) {
410
- $(e instanceof Error ? e.message : "Failed to delete route."), Z(!1);
411
+ we(e instanceof Error ? e.message : "Failed to delete route."), Q(!1);
411
412
  }
412
413
  }
413
- }, De = async () => {
414
+ }, Oe = async () => {
414
415
  if (e) {
415
- J(!0), B(null);
416
+ Y(!0), V(null);
416
417
  try {
417
418
  await w(e), L("Route optimized — stops resequenced for the shortest run."), _();
418
419
  } catch (e) {
419
- B(e instanceof Error ? e.message : "Failed to optimize route.");
420
+ V(e instanceof Error ? e.message : "Failed to optimize route.");
420
421
  } finally {
421
- J(!1);
422
+ Y(!1);
422
423
  }
423
424
  }
424
- }, Oe = async (t) => {
425
+ }, ke = async (t) => {
425
426
  e && (await T(e, t), L(k("movethewheels.routes.suggest.done", "Assignment saved.")), _(), D.refetch());
426
427
  };
427
- if (!e) return /* @__PURE__ */ V(q, {});
428
- if (n) return /* @__PURE__ */ V(q, { editId: e });
429
- if (ae) return /* @__PURE__ */ V(M, { message: "Loading route details..." });
430
- if (oe || !g) return /* @__PURE__ */ V(j, {
428
+ if (!e) return /* @__PURE__ */ H(J, {});
429
+ if (n) return /* @__PURE__ */ H(J, { editId: e });
430
+ if (ae) return /* @__PURE__ */ H(M, { message: "Loading route details..." });
431
+ if (oe || !g) return /* @__PURE__ */ H(j, {
431
432
  title: "Route not found",
432
433
  onRetry: _
433
434
  });
434
- let ke = g.stops.map((e) => {
435
- let t = ue(e.address);
435
+ let Ae = g.stops.map((e) => {
436
+ let t = de(e.address);
436
437
  return t ? {
437
438
  lat: t.lat,
438
439
  lng: t.lng,
@@ -440,152 +441,152 @@ function J() {
440
441
  label: p(e.address) || `Order #${e.orderId || e.sequence}`
441
442
  } : null;
442
443
  }).filter((e) => e !== null);
443
- return /* @__PURE__ */ H(se, {
444
+ return /* @__PURE__ */ U(se, {
444
445
  title: g.name,
445
446
  subtitle: `${g.stops.length} stops - ${h(g.distance)}`,
446
- icon: /* @__PURE__ */ V(o, { size: 24 }),
447
- headerActions: /* @__PURE__ */ H("div", {
447
+ icon: /* @__PURE__ */ H(o, { size: 24 }),
448
+ headerActions: /* @__PURE__ */ U("div", {
448
449
  className: "flex gap-2",
449
450
  children: [
450
- /* @__PURE__ */ H(y, {
451
+ /* @__PURE__ */ U(y, {
451
452
  variant: "outline",
452
- onClick: we,
453
- children: [/* @__PURE__ */ V(t, { size: 16 }), " Back"]
453
+ onClick: Te,
454
+ children: [/* @__PURE__ */ H(t, { size: 16 }), " Back"]
454
455
  }),
455
- !g.optimized && /* @__PURE__ */ H(y, {
456
+ !g.optimized && /* @__PURE__ */ U(y, {
456
457
  variant: "outline",
457
- onClick: De,
458
- disabled: K,
458
+ onClick: Oe,
459
+ disabled: q,
459
460
  children: [
460
- /* @__PURE__ */ V(d, { size: 16 }),
461
+ /* @__PURE__ */ H(d, { size: 16 }),
461
462
  " ",
462
- K ? "Optimizing…" : "Optimize & start"
463
+ q ? "Optimizing…" : "Optimize & start"
463
464
  ]
464
465
  }),
465
- /* @__PURE__ */ H(y, {
466
+ /* @__PURE__ */ U(y, {
466
467
  onClick: () => c?.(f(s, `routes/${e}/edit`)),
467
- children: [/* @__PURE__ */ V(l, { size: 16 }), " Edit"]
468
+ children: [/* @__PURE__ */ H(l, { size: 16 }), " Edit"]
468
469
  })
469
470
  ]
470
471
  }),
471
- headerContent: /* @__PURE__ */ H("div", {
472
+ headerContent: /* @__PURE__ */ U("div", {
472
473
  className: "flex gap-2",
473
- children: [/* @__PURE__ */ V(ce, {
474
+ children: [/* @__PURE__ */ H(F, {
474
475
  status: g.status,
475
476
  customColors: P[g.status]
476
- }), /* @__PURE__ */ V(v, {
477
+ }), /* @__PURE__ */ H(v, {
477
478
  variant: g.optimized === !0 ? "default" : "secondary",
478
479
  children: g.optimized === void 0 ? "Optimization unknown" : g.optimized ? "Optimized" : "Not Optimized"
479
480
  })]
480
481
  }),
481
482
  children: [
482
- /* @__PURE__ */ V(ve, {
483
- icon: /* @__PURE__ */ V(o, { size: 18 }),
483
+ /* @__PURE__ */ H(ve, {
484
+ icon: /* @__PURE__ */ H(o, { size: 18 }),
484
485
  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."
485
486
  }),
486
- /* @__PURE__ */ V(_e, {
487
+ /* @__PURE__ */ H(_e, {
487
488
  storageKey: "movethewheels-route-details",
488
489
  steps: [
489
490
  ...g.optimized ? [] : [{
490
491
  id: "optimize",
491
492
  label: "Optimize & start this route",
492
493
  description: "Reorder stops to cut distance and driving time, then mark the route In Progress.",
493
- icon: /* @__PURE__ */ V(d, { size: 16 }),
494
- onClick: De
494
+ icon: /* @__PURE__ */ H(d, { size: 16 }),
495
+ onClick: Oe
495
496
  }],
496
497
  {
497
498
  id: "edit",
498
499
  label: "Adjust stops",
499
500
  description: "Add, remove or reorder the delivery stops.",
500
- icon: /* @__PURE__ */ V(l, { size: 16 }),
501
+ icon: /* @__PURE__ */ H(l, { size: 16 }),
501
502
  onClick: () => {}
502
503
  },
503
504
  {
504
505
  id: "orders",
505
506
  label: "Review the orders on this route",
506
507
  description: "Check the deliveries bundled into this run.",
507
- icon: /* @__PURE__ */ V(ee, { size: 16 }),
508
- onClick: () => Te("orders")
508
+ icon: /* @__PURE__ */ H(ee, { size: 16 }),
509
+ onClick: () => Ee("orders")
509
510
  }
510
511
  ]
511
512
  }),
512
- R && /* @__PURE__ */ V("div", {
513
+ z && /* @__PURE__ */ H("div", {
513
514
  className: "mb-2",
514
- children: /* @__PURE__ */ V(F, { message: R })
515
+ children: /* @__PURE__ */ H(I, { message: z })
515
516
  }),
516
- A && /* @__PURE__ */ V("div", {
517
+ A && /* @__PURE__ */ H("div", {
517
518
  className: "mb-2",
518
- children: /* @__PURE__ */ V(I, { message: A })
519
+ children: /* @__PURE__ */ H(ce, { message: A })
519
520
  }),
520
- /* @__PURE__ */ H("div", {
521
+ /* @__PURE__ */ U("div", {
521
522
  className: "grid grid-cols-1 lg:grid-cols-3 gap-6",
522
- children: [/* @__PURE__ */ H("div", {
523
+ children: [/* @__PURE__ */ U("div", {
523
524
  className: "lg:col-span-2 space-y-6",
524
- children: [/* @__PURE__ */ H(b, { children: [/* @__PURE__ */ V(S, { children: /* @__PURE__ */ V(C, { children: "Route Map" }) }), /* @__PURE__ */ V(x, { children: ke.length > 0 ? /* @__PURE__ */ V(N, {
525
+ children: [/* @__PURE__ */ U(b, { children: [/* @__PURE__ */ H(S, { children: /* @__PURE__ */ H(C, { children: "Route Map" }) }), /* @__PURE__ */ H(x, { children: Ae.length > 0 ? /* @__PURE__ */ H(N, {
525
526
  className: "overflow-hidden rounded-lg border border-border-seam",
526
527
  height: 360,
527
- stops: ke
528
- }) : /* @__PURE__ */ H("div", {
528
+ stops: Ae
529
+ }) : /* @__PURE__ */ U("div", {
529
530
  className: "rounded-lg border border-border-seam bg-bg-sunken/40 p-4",
530
- children: [/* @__PURE__ */ V("p", {
531
+ children: [/* @__PURE__ */ H("p", {
531
532
  className: "mb-3 text-sm text-text-secondary",
532
533
  children: "These stops don't have map coordinates yet — showing the planned sequence instead."
533
- }), /* @__PURE__ */ V("ol", {
534
+ }), /* @__PURE__ */ H("ol", {
534
535
  className: "space-y-2",
535
- children: g.stops.map((e) => /* @__PURE__ */ H("li", {
536
+ children: g.stops.map((e) => /* @__PURE__ */ U("li", {
536
537
  className: "flex items-start gap-3",
537
- children: [/* @__PURE__ */ V("span", {
538
+ children: [/* @__PURE__ */ H("span", {
538
539
  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",
539
540
  children: e.sequence
540
- }), /* @__PURE__ */ V("span", {
541
+ }), /* @__PURE__ */ H("span", {
541
542
  className: "text-sm",
542
543
  children: p(e.address) || `Order #${e.orderId || e.sequence}`
543
544
  })]
544
545
  }, e.id))
545
546
  })]
546
- }) })] }), /* @__PURE__ */ H(b, { children: [/* @__PURE__ */ V(S, { children: /* @__PURE__ */ H(C, { children: [
547
+ }) })] }), /* @__PURE__ */ U(b, { children: [/* @__PURE__ */ H(S, { children: /* @__PURE__ */ U(C, { children: [
547
548
  "Stops (",
548
549
  g.stops.length,
549
550
  ")"
550
- ] }) }), /* @__PURE__ */ V(x, { children: /* @__PURE__ */ V("div", {
551
+ ] }) }), /* @__PURE__ */ H(x, { children: /* @__PURE__ */ H("div", {
551
552
  className: "space-y-4",
552
- children: g.stops.map((e, t) => /* @__PURE__ */ H("div", {
553
+ children: g.stops.map((e, t) => /* @__PURE__ */ U("div", {
553
554
  className: "flex gap-4",
554
- children: [/* @__PURE__ */ H("div", {
555
+ children: [/* @__PURE__ */ U("div", {
555
556
  className: "relative",
556
- children: [/* @__PURE__ */ V("div", {
557
+ children: [/* @__PURE__ */ H("div", {
557
558
  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"}`,
558
- children: e.status === "completed" ? /* @__PURE__ */ V(r, { size: 16 }) : e.sequence
559
- }), t < g.stops.length - 1 && /* @__PURE__ */ V("div", { className: "absolute top-8 left-4 w-px h-12 bg-border" })]
560
- }), /* @__PURE__ */ V("div", {
559
+ children: e.status === "completed" ? /* @__PURE__ */ H(r, { size: 16 }) : e.sequence
560
+ }), t < g.stops.length - 1 && /* @__PURE__ */ H("div", { className: "absolute top-8 left-4 w-px h-12 bg-border" })]
561
+ }), /* @__PURE__ */ H("div", {
561
562
  className: "flex-1 pb-4",
562
- children: /* @__PURE__ */ H("div", {
563
+ children: /* @__PURE__ */ U("div", {
563
564
  className: "flex items-center justify-between",
564
- children: [/* @__PURE__ */ H("div", { children: [/* @__PURE__ */ H("div", {
565
+ children: [/* @__PURE__ */ U("div", { children: [/* @__PURE__ */ U("div", {
565
566
  className: "flex items-center gap-2",
566
- children: [/* @__PURE__ */ V(v, {
567
+ children: [/* @__PURE__ */ H(v, {
567
568
  variant: e.type === "pickup" ? "secondary" : "default",
568
569
  className: "capitalize",
569
570
  children: e.type
570
- }), /* @__PURE__ */ H("span", {
571
+ }), /* @__PURE__ */ U("span", {
571
572
  className: "font-medium",
572
573
  children: ["Order #", e.orderId]
573
574
  })]
574
- }), /* @__PURE__ */ V("p", {
575
+ }), /* @__PURE__ */ H("p", {
575
576
  className: "text-sm text-text-secondary mt-1",
576
577
  children: p(e.address)
577
- })] }), /* @__PURE__ */ H("div", {
578
+ })] }), /* @__PURE__ */ U("div", {
578
579
  className: "text-right",
579
580
  children: [
580
- /* @__PURE__ */ V("p", {
581
+ /* @__PURE__ */ H("p", {
581
582
  className: "text-sm",
582
583
  children: e.scheduledTime ? `Scheduled: ${m(e.scheduledTime, "time")}` : "Scheduled: Not provided"
583
584
  }),
584
- e.actualTime && /* @__PURE__ */ H("p", {
585
+ e.actualTime && /* @__PURE__ */ U("p", {
585
586
  className: "text-sm text-status-success-text",
586
587
  children: ["Actual: ", m(e.actualTime, "time")]
587
588
  }),
588
- /* @__PURE__ */ V("p", {
589
+ /* @__PURE__ */ H("p", {
589
590
  className: "text-xs text-text-secondary",
590
591
  children: e.duration === void 0 ? "Duration not provided" : `${e.duration} min stop`
591
592
  })
@@ -595,113 +596,117 @@ function J() {
595
596
  })]
596
597
  }, e.id))
597
598
  }) })] })]
598
- }), /* @__PURE__ */ H("div", {
599
+ }), /* @__PURE__ */ U("div", {
599
600
  className: "space-y-6",
600
601
  children: [
601
- (g.status === "planned" || g.status === "in_progress") && /* @__PURE__ */ V(pe, {
602
+ /* @__PURE__ */ H(ue, {
603
+ entityType: "route",
604
+ entityId: g.id
605
+ }),
606
+ (g.status === "planned" || g.status === "in_progress") && /* @__PURE__ */ H(R, {
602
607
  suggestions: D.data,
603
608
  isLoading: D.isLoading,
604
609
  error: D.error,
605
610
  onRetry: D.refetch,
606
611
  assignedVehicleId: g.vehicleId || void 0,
607
612
  assignedDriverId: g.driverId || void 0,
608
- onAssign: Oe,
613
+ onAssign: ke,
609
614
  t: k
610
615
  }),
611
- /* @__PURE__ */ H(U, {
616
+ /* @__PURE__ */ U(ge, {
612
617
  className: "space-y-4",
613
618
  children: [
614
- /* @__PURE__ */ V("h2", {
619
+ /* @__PURE__ */ H("h2", {
615
620
  className: "text-base font-semibold text-text-primary",
616
621
  children: "Route Info"
617
622
  }),
618
- /* @__PURE__ */ H("div", { children: [/* @__PURE__ */ V("p", {
623
+ /* @__PURE__ */ U("div", { children: [/* @__PURE__ */ H("p", {
619
624
  className: "text-sm text-text-secondary",
620
625
  children: "Total Distance"
621
- }), /* @__PURE__ */ V("p", {
626
+ }), /* @__PURE__ */ H("p", {
622
627
  className: "text-2xl font-bold",
623
628
  children: h(g.distance)
624
629
  })] }),
625
- /* @__PURE__ */ H("div", { children: [/* @__PURE__ */ V("p", {
630
+ /* @__PURE__ */ U("div", { children: [/* @__PURE__ */ H("p", {
626
631
  className: "text-sm text-text-secondary",
627
632
  children: "Est. Duration"
628
- }), /* @__PURE__ */ H("p", {
633
+ }), /* @__PURE__ */ U("p", {
629
634
  className: "text-2xl font-bold",
630
- children: [g.estimatedDuration, /* @__PURE__ */ V("span", {
635
+ children: [g.estimatedDuration, /* @__PURE__ */ H("span", {
631
636
  className: "text-sm font-normal",
632
637
  children: " min"
633
638
  })]
634
639
  })] }),
635
- g.fuelCost !== void 0 && /* @__PURE__ */ H("div", { children: [/* @__PURE__ */ H("p", {
640
+ g.fuelCost !== void 0 && /* @__PURE__ */ U("div", { children: [/* @__PURE__ */ U("p", {
636
641
  className: "text-sm text-text-secondary flex items-center gap-1",
637
- children: [/* @__PURE__ */ V(a, { size: 14 }), " Est. Fuel Cost"]
638
- }), /* @__PURE__ */ V("p", {
642
+ children: [/* @__PURE__ */ H(a, { size: 14 }), " Est. Fuel Cost"]
643
+ }), /* @__PURE__ */ H("p", {
639
644
  className: "text-2xl font-bold",
640
645
  children: ne(g.fuelCost)
641
646
  })] }),
642
- g.actualDuration && /* @__PURE__ */ H("div", { children: [/* @__PURE__ */ V("p", {
647
+ g.actualDuration && /* @__PURE__ */ U("div", { children: [/* @__PURE__ */ H("p", {
643
648
  className: "text-sm text-text-secondary",
644
649
  children: "Actual Duration"
645
- }), /* @__PURE__ */ H("p", {
650
+ }), /* @__PURE__ */ U("p", {
646
651
  className: "text-2xl font-bold",
647
- children: [g.actualDuration, /* @__PURE__ */ V("span", {
652
+ children: [g.actualDuration, /* @__PURE__ */ H("span", {
648
653
  className: "text-sm font-normal",
649
654
  children: " min"
650
655
  })]
651
656
  })] })
652
657
  ]
653
658
  }),
654
- /* @__PURE__ */ H(b, { children: [/* @__PURE__ */ V(S, { children: /* @__PURE__ */ H(C, {
659
+ /* @__PURE__ */ U(b, { children: [/* @__PURE__ */ H(S, { children: /* @__PURE__ */ U(C, {
655
660
  className: "flex items-center gap-2",
656
- children: [/* @__PURE__ */ V(i, { size: 18 }), " Timeline"]
657
- }) }), /* @__PURE__ */ V(x, {
661
+ children: [/* @__PURE__ */ H(i, { size: 18 }), " Timeline"]
662
+ }) }), /* @__PURE__ */ H(x, {
658
663
  className: "space-y-3",
659
- children: /* @__PURE__ */ H("div", { children: [/* @__PURE__ */ V("p", {
664
+ children: /* @__PURE__ */ U("div", { children: [/* @__PURE__ */ H("p", {
660
665
  className: "text-sm text-text-secondary",
661
666
  children: "Created"
662
- }), /* @__PURE__ */ V("p", { children: m(g.createdAt, "full") })] })
667
+ }), /* @__PURE__ */ H("p", { children: m(g.createdAt, "full") })] })
663
668
  })] }),
664
- /* @__PURE__ */ H(b, {
669
+ /* @__PURE__ */ U(b, {
665
670
  className: "border-status-error-border",
666
- children: [/* @__PURE__ */ V(S, { children: /* @__PURE__ */ H(C, {
671
+ children: [/* @__PURE__ */ H(S, { children: /* @__PURE__ */ U(C, {
667
672
  className: "flex items-center gap-2 text-status-error-text",
668
- children: [/* @__PURE__ */ V(u, { size: 18 }), " Delete Route"]
669
- }) }), /* @__PURE__ */ H(x, { children: [/* @__PURE__ */ V("p", {
673
+ children: [/* @__PURE__ */ H(u, { size: 18 }), " Delete Route"]
674
+ }) }), /* @__PURE__ */ U(x, { children: [/* @__PURE__ */ H("p", {
670
675
  className: "mb-3 text-sm text-text-secondary",
671
676
  children: "Removes this route. It can no longer be dispatched. This cannot be undone from here."
672
- }), /* @__PURE__ */ H(y, {
677
+ }), /* @__PURE__ */ U(y, {
673
678
  variant: "outline",
674
679
  className: "border-status-error-border text-status-error-text hover:bg-status-error-bg-subtle",
675
- onClick: () => Y(!0),
676
- children: [/* @__PURE__ */ V(u, { size: 16 }), " Delete this route"]
680
+ onClick: () => X(!0),
681
+ children: [/* @__PURE__ */ H(u, { size: 16 }), " Delete this route"]
677
682
  })] })]
678
683
  })
679
684
  ]
680
685
  })]
681
686
  }),
682
- /* @__PURE__ */ V(ye, {
687
+ /* @__PURE__ */ H(ye, {
683
688
  open: Ce,
684
- onOpenChange: Y,
685
- children: /* @__PURE__ */ H(be, { children: [
686
- /* @__PURE__ */ H(W, { children: [/* @__PURE__ */ V(G, { children: "Delete this route?" }), /* @__PURE__ */ H(xe, { children: [
689
+ onOpenChange: X,
690
+ children: /* @__PURE__ */ U(be, { children: [
691
+ /* @__PURE__ */ U(K, { children: [/* @__PURE__ */ H(Se, { children: "Delete this route?" }), /* @__PURE__ */ U(xe, { children: [
687
692
  "This removes ",
688
693
  g.name,
689
694
  " and cannot be undone from here."
690
695
  ] })] }),
691
- /* @__PURE__ */ V("div", {
696
+ /* @__PURE__ */ H("div", {
692
697
  className: "px-1",
693
- children: /* @__PURE__ */ V(F, { message: Q })
698
+ children: /* @__PURE__ */ H(I, { message: $ })
694
699
  }),
695
- /* @__PURE__ */ H(Se, { children: [/* @__PURE__ */ V(y, {
700
+ /* @__PURE__ */ U(G, { children: [/* @__PURE__ */ H(y, {
696
701
  variant: "outline",
697
- onClick: () => Y(!1),
698
- disabled: X,
702
+ onClick: () => X(!1),
703
+ disabled: Z,
699
704
  children: "Cancel"
700
- }), /* @__PURE__ */ V(y, {
705
+ }), /* @__PURE__ */ H(y, {
701
706
  className: "bg-status-error-text text-text-inverse hover:opacity-90",
702
- onClick: Ee,
703
- disabled: X,
704
- children: X ? "Deleting..." : "Delete route"
707
+ onClick: De,
708
+ disabled: Z,
709
+ children: Z ? "Deleting..." : "Delete route"
705
710
  })] })
706
711
  ] })
707
712
  })
@@ -709,4 +714,4 @@ function J() {
709
714
  });
710
715
  }
711
716
  //#endregion
712
- export { J as default };
717
+ export { Y as default };