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