@burdenoff/microfe-movethewheels 2026.1114.1 → 2026.1123.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/MoveTheWheelsRoot.js +149 -133
- package/dist/MoveTheWheelsRoutes.js +157 -139
- package/dist/components/EntityConversationsCard.js +145 -0
- package/dist/components/maps/MapCanvas.js +4 -3
- package/dist/events/rybbit.js +87 -0
- package/dist/generated/tracking-quality-operations.d.ts +342 -0
- package/dist/hooks/useEntityComments.js +111 -0
- package/dist/hooks/useFleet.js +394 -311
- package/dist/hooks/useInventory.js +378 -313
- package/dist/hooks/useMultiModalShipments.js +58 -53
- package/dist/hooks/useOrders.js +178 -158
- package/dist/hooks/useRoutes.js +146 -130
- package/dist/index.js +35 -34
- package/dist/movethewheels/components/EntityConversationsCard.d.ts +8 -0
- package/dist/movethewheels/events/rybbit.d.ts +27 -0
- package/dist/movethewheels/hooks/useEntityComments.d.ts +26 -0
- package/dist/movethewheels/hooks/useFleet.d.ts +73 -1
- package/dist/movethewheels/hooks/useInventory.d.ts +19 -0
- package/dist/movethewheels/index.d.ts +1 -0
- package/dist/movethewheels/pages/DocumentsLibraryPage.d.ts +1 -0
- package/dist/movethewheels/pages/NotificationsCenterPage.d.ts +1 -0
- package/dist/movethewheels/types/index.d.ts +95 -2
- package/dist/node_modules/lucide-react/dist/esm/icons/check-check.js +10 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/layers.js +17 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/message-square.js +7 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/send.js +10 -0
- package/dist/pages/DocumentsLibraryPage.js +235 -0
- package/dist/pages/DriverDetailsPage.js +625 -351
- package/dist/pages/NotificationsCenterPage.js +310 -0
- package/dist/pages/OrderDetailsPage.js +48 -42
- package/dist/pages/RouteDetailsPage.js +257 -251
- package/dist/pages/TrackingPage.js +202 -196
- package/dist/pages/VehicleDetailsPage.js +616 -314
- package/dist/pages/WarehouseDetailsPage.js +539 -253
- package/dist/stories/ControlTowerWidgets.stories.d.ts +10 -0
- package/dist/stories/DataTable.stories.d.ts +15 -0
- package/dist/stories/FleetCards.stories.d.ts +9 -0
- package/dist/stories/OrderForms.stories.d.ts +8 -0
- package/dist/stories/RouteMap.stories.d.ts +7 -0
- package/dist/stories/ShipmentTimeline.stories.d.ts +6 -0
- package/package.json +3 -2
- package/src/generated/tracking-quality-operations.ts +407 -0
- package/src/movethewheels/MoveTheWheelsRoot.tsx +16 -0
- package/src/movethewheels/MoveTheWheelsRoutes.tsx +17 -2
- package/src/movethewheels/components/EntityConversationsCard.tsx +143 -0
- package/src/movethewheels/components/maps/MapCanvas.tsx +3 -3
- package/src/movethewheels/events/__tests__/rybbit.test.ts +98 -0
- package/src/movethewheels/events/rybbit.ts +191 -0
- package/src/movethewheels/hooks/useEntityComments.ts +258 -0
- package/src/movethewheels/hooks/useFleet.ts +300 -5
- package/src/movethewheels/hooks/useInventory.ts +231 -3
- package/src/movethewheels/hooks/useMultiModalShipments.ts +8 -1
- package/src/movethewheels/hooks/useOrders.ts +19 -3
- package/src/movethewheels/hooks/useRoutes.ts +14 -2
- package/src/movethewheels/index.ts +1 -0
- package/src/movethewheels/pages/DocumentsLibraryPage.tsx +229 -0
- package/src/movethewheels/pages/DriverDetailsPage.tsx +250 -1
- package/src/movethewheels/pages/NotificationsCenterPage.tsx +331 -0
- package/src/movethewheels/pages/OrderDetailsPage.tsx +8 -0
- package/src/movethewheels/pages/RouteDetailsPage.tsx +6 -0
- package/src/movethewheels/pages/TrackingPage.tsx +8 -0
- package/src/movethewheels/pages/VehicleDetailsPage.tsx +255 -1
- package/src/movethewheels/pages/WarehouseDetailsPage.tsx +266 -2
- package/src/movethewheels/types/index.ts +103 -2
- package/src/stories/ControlTowerWidgets.stories.tsx +150 -0
- package/src/stories/DataTable.stories.tsx +94 -0
- package/src/stories/FleetCards.stories.tsx +77 -0
- package/src/stories/OrderForms.stories.tsx +84 -0
- package/src/stories/RouteMap.stories.tsx +43 -0
- package/src/stories/ShipmentTimeline.stories.tsx +128 -0
|
@@ -20,23 +20,24 @@ import { EntityCombobox as E } from "../components/EntityCombobox.js";
|
|
|
20
20
|
import { useRoute as ae, useRoutes as oe } from "../hooks/useRoutes.js";
|
|
21
21
|
import { RouteMap as D } from "../components/maps/RouteMap.js";
|
|
22
22
|
import { DocumentsCard as O } from "../components/DocumentsCard.js";
|
|
23
|
-
import {
|
|
23
|
+
import { EntityConversationsCard as se } from "../components/EntityConversationsCard.js";
|
|
24
|
+
import { useDriver as k, useDrivers as ce, useVehicle as A, useVehicles as le } from "../hooks/useFleet.js";
|
|
24
25
|
import { useAssignmentSuggestions as ue } from "../hooks/useFleetIntelligence.js";
|
|
25
26
|
import { useRefetchOnLeaveEdit as de } from "../hooks/useRefetchOnLeaveEdit.js";
|
|
26
27
|
import { AssignmentSuggestions as fe } from "../components/AssignmentSuggestions.js";
|
|
27
28
|
import { useMoveTheWheels as pe } from "../providers/MoveTheWheelsProvider.js";
|
|
28
|
-
import { formatAddress as
|
|
29
|
-
import { joinPath as
|
|
29
|
+
import { formatAddress as j, formatCurrency as me, formatDate as M, formatDistance as N, formatDuration as P } from "../utils/formatters.js";
|
|
30
|
+
import { joinPath as F } from "../utils/navigation.js";
|
|
30
31
|
import { ROUTE_STATUS_COLORS as he } from "../constants/index.js";
|
|
31
|
-
import { FormError as
|
|
32
|
-
import { Notice as
|
|
33
|
-
import { useEffect as
|
|
32
|
+
import { FormError as I } from "../components/FormError.js";
|
|
33
|
+
import { Notice as L, useNotice as R } from "../components/Notice.js";
|
|
34
|
+
import { useEffect as ge, useState as z } from "react";
|
|
34
35
|
import { useLocation as _e, useParams as ve } from "react-router";
|
|
35
|
-
import { Fragment as
|
|
36
|
+
import { Fragment as B, jsx as V, jsxs as H } from "react/jsx-runtime";
|
|
36
37
|
import { useI18n as ye } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
37
|
-
import { EmphasisPanel as be, NextSteps as xe, PagePurpose as Se, ResponsiveDialog as
|
|
38
|
+
import { EmphasisPanel as be, NextSteps as xe, PagePurpose as Se, ResponsiveDialog as U, ResponsiveDialogContent as W, ResponsiveDialogDescription as G, ResponsiveDialogFooter as Ce, ResponsiveDialogHeader as K, ResponsiveDialogTitle as we } from "@burdenoff/fe-libs/ui";
|
|
38
39
|
// src/movethewheels/pages/RouteDetailsPage.tsx
|
|
39
|
-
var
|
|
40
|
+
var q = [
|
|
40
41
|
{
|
|
41
42
|
value: "planned",
|
|
42
43
|
label: "Planned"
|
|
@@ -54,8 +55,8 @@ var K = [
|
|
|
54
55
|
label: "Cancelled"
|
|
55
56
|
}
|
|
56
57
|
];
|
|
57
|
-
function
|
|
58
|
-
let { basePath: r, navigate: i } = pe(), { createRoute: a, updateRoute: ee } = oe(), { route: d } = ae(n), [te, ne] =
|
|
58
|
+
function J({ editId: n }) {
|
|
59
|
+
let { basePath: r, navigate: i } = pe(), { createRoute: a, updateRoute: ee } = oe(), { route: d } = ae(n), [te, ne] = z(""), [ie, f] = z(""), T = !!n, [D, O] = z({
|
|
59
60
|
name: "",
|
|
60
61
|
status: "planned",
|
|
61
62
|
vehicleId: "",
|
|
@@ -64,21 +65,21 @@ function q({ editId: n }) {
|
|
|
64
65
|
address: "",
|
|
65
66
|
type: "delivery"
|
|
66
67
|
}]
|
|
67
|
-
}), { vehicles:
|
|
68
|
+
}), { vehicles: se, isLoading: ue, hasMore: de, totalVehicles: fe, loadMore: me, isLoadingMore: M } = le({
|
|
68
69
|
limit: 20,
|
|
69
70
|
search: te || void 0
|
|
70
|
-
}), { drivers: N, isLoading:
|
|
71
|
+
}), { drivers: N, isLoading: P, hasMore: he, totalDrivers: L, loadMore: R, isLoadingMore: _e } = ce({
|
|
71
72
|
limit: 20,
|
|
72
73
|
search: ie || void 0
|
|
73
|
-
}), { vehicle:
|
|
74
|
-
|
|
74
|
+
}), { vehicle: ve, isLoading: ye } = A(D.vehicleId || void 0), { driver: xe, isLoading: U } = k(D.driverId || void 0), [W, G] = z(!1), [Ce, K] = z(null);
|
|
75
|
+
ge(() => {
|
|
75
76
|
n && d && O({
|
|
76
77
|
name: d.name || "",
|
|
77
78
|
status: d.status,
|
|
78
79
|
vehicleId: d.vehicleId || "",
|
|
79
80
|
driverId: d.driverId || "",
|
|
80
81
|
stops: d.stops.length > 0 ? d.stops.map((e) => ({
|
|
81
|
-
address:
|
|
82
|
+
address: j(e.address) || e.address.street || "",
|
|
82
83
|
type: e.type
|
|
83
84
|
})) : [{
|
|
84
85
|
address: "",
|
|
@@ -86,13 +87,13 @@ function q({ editId: n }) {
|
|
|
86
87
|
}]
|
|
87
88
|
});
|
|
88
89
|
}, [n, d]);
|
|
89
|
-
let
|
|
90
|
+
let we = () => i?.(F(r, "routes")), J = () => O((e) => ({
|
|
90
91
|
...e,
|
|
91
92
|
stops: [...e.stops, {
|
|
92
93
|
address: "",
|
|
93
94
|
type: "delivery"
|
|
94
95
|
}]
|
|
95
|
-
})),
|
|
96
|
+
})), Te = (e) => O((t) => ({
|
|
96
97
|
...t,
|
|
97
98
|
stops: t.stops.filter((t, n) => n !== e)
|
|
98
99
|
})), Y = (e, t, n) => O((r) => ({
|
|
@@ -111,13 +112,13 @@ function q({ editId: n }) {
|
|
|
111
112
|
};
|
|
112
113
|
}), Z = async (e) => {
|
|
113
114
|
if (e.preventDefault(), !D.name.trim()) {
|
|
114
|
-
|
|
115
|
+
K("Route name is required.");
|
|
115
116
|
return;
|
|
116
117
|
}
|
|
117
118
|
let t = D.stops.filter((e) => e.address.trim());
|
|
118
|
-
if (t.length === 0)
|
|
119
|
+
if (t.length === 0) K("Add at least one stop with an address.");
|
|
119
120
|
else {
|
|
120
|
-
|
|
121
|
+
G(!0), K(null);
|
|
121
122
|
try {
|
|
122
123
|
let e = t.map((e, t) => ({
|
|
123
124
|
id: `stop-${t + 1}`,
|
|
@@ -141,7 +142,7 @@ function q({ editId: n }) {
|
|
|
141
142
|
driverId: D.driverId || null,
|
|
142
143
|
stops: e
|
|
143
144
|
});
|
|
144
|
-
i?.(
|
|
145
|
+
i?.(F(r, `routes/${t.id}`));
|
|
145
146
|
return;
|
|
146
147
|
}
|
|
147
148
|
let o = await a({
|
|
@@ -151,57 +152,57 @@ function q({ editId: n }) {
|
|
|
151
152
|
driverId: D.driverId || void 0,
|
|
152
153
|
stops: e
|
|
153
154
|
});
|
|
154
|
-
i?.(
|
|
155
|
+
i?.(F(r, `routes/${o.id}`));
|
|
155
156
|
} catch (e) {
|
|
156
|
-
console.error("Failed to create route:", e),
|
|
157
|
+
console.error("Failed to create route:", e), K(e instanceof Error ? e.message : "Failed to create route. Please try again."), G(!1);
|
|
157
158
|
}
|
|
158
159
|
}
|
|
159
160
|
};
|
|
160
|
-
return /* @__PURE__ */
|
|
161
|
+
return /* @__PURE__ */ H(re, {
|
|
161
162
|
title: T ? "Edit Route" : "Create Route",
|
|
162
163
|
subtitle: "Plan a new delivery route",
|
|
163
|
-
icon: /* @__PURE__ */
|
|
164
|
-
headerActions: /* @__PURE__ */
|
|
164
|
+
icon: /* @__PURE__ */ V(e, { size: 24 }),
|
|
165
|
+
headerActions: /* @__PURE__ */ H("div", {
|
|
165
166
|
className: "flex gap-2",
|
|
166
|
-
children: [/* @__PURE__ */
|
|
167
|
+
children: [/* @__PURE__ */ H(p, {
|
|
167
168
|
variant: "outline",
|
|
168
|
-
onClick:
|
|
169
|
-
disabled:
|
|
170
|
-
children: [/* @__PURE__ */
|
|
171
|
-
}), /* @__PURE__ */
|
|
169
|
+
onClick: we,
|
|
170
|
+
disabled: W,
|
|
171
|
+
children: [/* @__PURE__ */ V(t, { size: 16 }), " Cancel"]
|
|
172
|
+
}), /* @__PURE__ */ H(p, {
|
|
172
173
|
onClick: Z,
|
|
173
|
-
disabled:
|
|
174
|
+
disabled: W,
|
|
174
175
|
children: [
|
|
175
|
-
/* @__PURE__ */
|
|
176
|
+
/* @__PURE__ */ V(c, { size: 16 }),
|
|
176
177
|
" ",
|
|
177
|
-
T ?
|
|
178
|
+
T ? W ? "Saving..." : "Save Changes" : W ? "Saving..." : "Create Route"
|
|
178
179
|
]
|
|
179
180
|
})]
|
|
180
181
|
}),
|
|
181
|
-
children: [/* @__PURE__ */
|
|
182
|
-
icon: /* @__PURE__ */
|
|
182
|
+
children: [/* @__PURE__ */ V(Se, {
|
|
183
|
+
icon: /* @__PURE__ */ V(e, { 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__ */
|
|
185
|
+
}), /* @__PURE__ */ H("form", {
|
|
185
186
|
onSubmit: Z,
|
|
186
187
|
className: "max-w-3xl space-y-6",
|
|
187
188
|
children: [
|
|
188
|
-
/* @__PURE__ */
|
|
189
|
-
/* @__PURE__ */
|
|
189
|
+
/* @__PURE__ */ V(I, { message: Ce }),
|
|
190
|
+
/* @__PURE__ */ H(be, { children: [/* @__PURE__ */ V("h2", {
|
|
190
191
|
className: "text-base font-semibold text-text-primary mb-4",
|
|
191
192
|
children: "Route Details"
|
|
192
|
-
}), /* @__PURE__ */
|
|
193
|
+
}), /* @__PURE__ */ H("div", {
|
|
193
194
|
className: "space-y-4",
|
|
194
|
-
children: [/* @__PURE__ */
|
|
195
|
+
children: [/* @__PURE__ */ H("div", {
|
|
195
196
|
className: "grid grid-cols-1 md:grid-cols-2 gap-4",
|
|
196
|
-
children: [/* @__PURE__ */
|
|
197
|
+
children: [/* @__PURE__ */ H("div", {
|
|
197
198
|
className: "space-y-2",
|
|
198
|
-
children: [/* @__PURE__ */
|
|
199
|
+
children: [/* @__PURE__ */ H(y, {
|
|
199
200
|
htmlFor: "name",
|
|
200
|
-
children: ["Route Name ", /* @__PURE__ */
|
|
201
|
+
children: ["Route Name ", /* @__PURE__ */ V("span", {
|
|
201
202
|
className: "text-status-error-text",
|
|
202
203
|
children: "*"
|
|
203
204
|
})]
|
|
204
|
-
}), /* @__PURE__ */
|
|
205
|
+
}), /* @__PURE__ */ V(v, {
|
|
205
206
|
id: "name",
|
|
206
207
|
value: D.name,
|
|
207
208
|
onChange: (e) => O((t) => ({
|
|
@@ -211,67 +212,67 @@ function q({ editId: n }) {
|
|
|
211
212
|
placeholder: "Downtown morning run",
|
|
212
213
|
required: !0
|
|
213
214
|
})]
|
|
214
|
-
}), /* @__PURE__ */
|
|
215
|
+
}), /* @__PURE__ */ H("div", {
|
|
215
216
|
className: "space-y-2",
|
|
216
|
-
children: [/* @__PURE__ */
|
|
217
|
+
children: [/* @__PURE__ */ V(y, {
|
|
217
218
|
htmlFor: "status",
|
|
218
219
|
children: "Status"
|
|
219
|
-
}), /* @__PURE__ */
|
|
220
|
+
}), /* @__PURE__ */ H(b, {
|
|
220
221
|
value: D.status,
|
|
221
222
|
onValueChange: (e) => O((t) => ({
|
|
222
223
|
...t,
|
|
223
224
|
status: e
|
|
224
225
|
})),
|
|
225
|
-
children: [/* @__PURE__ */
|
|
226
|
+
children: [/* @__PURE__ */ V(C, {
|
|
226
227
|
id: "status",
|
|
227
|
-
children: /* @__PURE__ */
|
|
228
|
-
}), /* @__PURE__ */
|
|
228
|
+
children: /* @__PURE__ */ V(w, {})
|
|
229
|
+
}), /* @__PURE__ */ V(x, { children: q.map((e) => /* @__PURE__ */ V(S, {
|
|
229
230
|
value: e.value,
|
|
230
231
|
children: e.label
|
|
231
232
|
}, e.value)) })]
|
|
232
233
|
})]
|
|
233
234
|
})]
|
|
234
|
-
}), /* @__PURE__ */
|
|
235
|
+
}), /* @__PURE__ */ H("div", {
|
|
235
236
|
className: "grid grid-cols-1 md:grid-cols-2 gap-4",
|
|
236
|
-
children: [/* @__PURE__ */
|
|
237
|
+
children: [/* @__PURE__ */ H("div", {
|
|
237
238
|
className: "space-y-2",
|
|
238
|
-
children: [/* @__PURE__ */
|
|
239
|
+
children: [/* @__PURE__ */ V(y, {
|
|
239
240
|
htmlFor: "vehicle",
|
|
240
241
|
children: "Vehicle (optional)"
|
|
241
|
-
}), /* @__PURE__ */
|
|
242
|
+
}), /* @__PURE__ */ V(E, {
|
|
242
243
|
id: "vehicle",
|
|
243
244
|
value: D.vehicleId,
|
|
244
245
|
onChange: (e) => O((t) => ({
|
|
245
246
|
...t,
|
|
246
247
|
vehicleId: e
|
|
247
248
|
})),
|
|
248
|
-
options:
|
|
249
|
-
loading:
|
|
249
|
+
options: se,
|
|
250
|
+
loading: ue,
|
|
250
251
|
getId: (e) => e.id,
|
|
251
252
|
getLabel: (e) => `${e.vehicleNumber} (${e.type})`,
|
|
252
|
-
renderOption: (e) => /* @__PURE__ */
|
|
253
|
+
renderOption: (e) => /* @__PURE__ */ H(B, { children: [
|
|
253
254
|
e.vehicleNumber,
|
|
254
255
|
" (",
|
|
255
256
|
e.type,
|
|
256
257
|
")"
|
|
257
258
|
] }),
|
|
258
|
-
selectedOption:
|
|
259
|
-
selectedLoading:
|
|
259
|
+
selectedOption: ve,
|
|
260
|
+
selectedLoading: ye,
|
|
260
261
|
onSearchChange: ne,
|
|
261
262
|
searchPlaceholder: "Search vehicle number or type…",
|
|
262
|
-
hasMore:
|
|
263
|
-
totalCount:
|
|
264
|
-
onLoadMore:
|
|
263
|
+
hasMore: de,
|
|
264
|
+
totalCount: fe,
|
|
265
|
+
onLoadMore: me,
|
|
265
266
|
loadingMore: M,
|
|
266
267
|
placeholder: "Assign later",
|
|
267
268
|
emptyText: "No available vehicles."
|
|
268
269
|
})]
|
|
269
|
-
}), /* @__PURE__ */
|
|
270
|
+
}), /* @__PURE__ */ H("div", {
|
|
270
271
|
className: "space-y-2",
|
|
271
|
-
children: [/* @__PURE__ */
|
|
272
|
+
children: [/* @__PURE__ */ V(y, {
|
|
272
273
|
htmlFor: "driver",
|
|
273
274
|
children: "Driver (optional)"
|
|
274
|
-
}), /* @__PURE__ */
|
|
275
|
+
}), /* @__PURE__ */ V(E, {
|
|
275
276
|
id: "driver",
|
|
276
277
|
value: D.driverId,
|
|
277
278
|
onChange: (e) => O((t) => ({
|
|
@@ -279,112 +280,112 @@ function q({ editId: n }) {
|
|
|
279
280
|
driverId: e
|
|
280
281
|
})),
|
|
281
282
|
options: N,
|
|
282
|
-
loading:
|
|
283
|
+
loading: P,
|
|
283
284
|
getId: (e) => e.id,
|
|
284
285
|
getLabel: (e) => `${e.fullName} (${e.employeeId})`,
|
|
285
|
-
renderOption: (e) => /* @__PURE__ */
|
|
286
|
+
renderOption: (e) => /* @__PURE__ */ H(B, { children: [
|
|
286
287
|
e.fullName,
|
|
287
288
|
" (",
|
|
288
289
|
e.employeeId,
|
|
289
290
|
")"
|
|
290
291
|
] }),
|
|
291
|
-
selectedOption:
|
|
292
|
-
selectedLoading:
|
|
292
|
+
selectedOption: xe,
|
|
293
|
+
selectedLoading: U,
|
|
293
294
|
onSearchChange: f,
|
|
294
295
|
searchPlaceholder: "Search driver name or employee ID…",
|
|
295
|
-
hasMore:
|
|
296
|
-
totalCount:
|
|
297
|
-
onLoadMore:
|
|
298
|
-
loadingMore:
|
|
296
|
+
hasMore: he,
|
|
297
|
+
totalCount: L,
|
|
298
|
+
onLoadMore: R,
|
|
299
|
+
loadingMore: _e,
|
|
299
300
|
placeholder: "Assign later",
|
|
300
301
|
emptyText: "No available drivers."
|
|
301
302
|
})]
|
|
302
303
|
})]
|
|
303
304
|
})]
|
|
304
305
|
})] }),
|
|
305
|
-
/* @__PURE__ */
|
|
306
|
+
/* @__PURE__ */ H(m, { children: [/* @__PURE__ */ H(g, {
|
|
306
307
|
className: "flex flex-row items-center justify-between",
|
|
307
|
-
children: [/* @__PURE__ */
|
|
308
|
+
children: [/* @__PURE__ */ H(_, { children: ["Stops ", /* @__PURE__ */ V("span", {
|
|
308
309
|
className: "text-status-error-text",
|
|
309
310
|
children: "*"
|
|
310
|
-
})] }), /* @__PURE__ */
|
|
311
|
+
})] }), /* @__PURE__ */ H(p, {
|
|
311
312
|
type: "button",
|
|
312
313
|
variant: "outline",
|
|
313
314
|
size: "sm",
|
|
314
|
-
onClick:
|
|
315
|
-
children: [/* @__PURE__ */
|
|
315
|
+
onClick: J,
|
|
316
|
+
children: [/* @__PURE__ */ V(o, { size: 16 }), " Add Stop"]
|
|
316
317
|
})]
|
|
317
|
-
}), /* @__PURE__ */
|
|
318
|
+
}), /* @__PURE__ */ V(h, {
|
|
318
319
|
className: "space-y-4",
|
|
319
|
-
children: D.stops.map((e, t) => /* @__PURE__ */
|
|
320
|
+
children: D.stops.map((e, t) => /* @__PURE__ */ H("div", {
|
|
320
321
|
className: "grid grid-cols-1 md:grid-cols-12 gap-3 items-end",
|
|
321
322
|
children: [
|
|
322
|
-
/* @__PURE__ */
|
|
323
|
+
/* @__PURE__ */ H("div", {
|
|
323
324
|
className: "md:col-span-7 space-y-2",
|
|
324
|
-
children: [/* @__PURE__ */
|
|
325
|
+
children: [/* @__PURE__ */ H(y, {
|
|
325
326
|
htmlFor: `stop-address-${t}`,
|
|
326
327
|
children: [
|
|
327
328
|
"Stop ",
|
|
328
329
|
t + 1,
|
|
329
330
|
" address"
|
|
330
331
|
]
|
|
331
|
-
}), /* @__PURE__ */
|
|
332
|
+
}), /* @__PURE__ */ V(v, {
|
|
332
333
|
id: `stop-address-${t}`,
|
|
333
334
|
value: e.address,
|
|
334
335
|
onChange: (e) => Y(t, "address", e.target.value),
|
|
335
336
|
placeholder: "123 Main St, San Francisco, CA"
|
|
336
337
|
})]
|
|
337
338
|
}),
|
|
338
|
-
/* @__PURE__ */
|
|
339
|
+
/* @__PURE__ */ H("div", {
|
|
339
340
|
className: "md:col-span-4 space-y-2",
|
|
340
|
-
children: [/* @__PURE__ */
|
|
341
|
+
children: [/* @__PURE__ */ V(y, {
|
|
341
342
|
htmlFor: `stop-type-${t}`,
|
|
342
343
|
children: "Type"
|
|
343
|
-
}), /* @__PURE__ */
|
|
344
|
+
}), /* @__PURE__ */ H(b, {
|
|
344
345
|
value: e.type,
|
|
345
346
|
onValueChange: (e) => Y(t, "type", e),
|
|
346
|
-
children: [/* @__PURE__ */
|
|
347
|
+
children: [/* @__PURE__ */ V(C, {
|
|
347
348
|
id: `stop-type-${t}`,
|
|
348
|
-
children: /* @__PURE__ */
|
|
349
|
-
}), /* @__PURE__ */
|
|
349
|
+
children: /* @__PURE__ */ V(w, {})
|
|
350
|
+
}), /* @__PURE__ */ H(x, { children: [/* @__PURE__ */ V(S, {
|
|
350
351
|
value: "pickup",
|
|
351
352
|
children: "Pickup"
|
|
352
|
-
}), /* @__PURE__ */
|
|
353
|
+
}), /* @__PURE__ */ V(S, {
|
|
353
354
|
value: "delivery",
|
|
354
355
|
children: "Delivery"
|
|
355
356
|
})] })]
|
|
356
357
|
})]
|
|
357
358
|
}),
|
|
358
|
-
/* @__PURE__ */
|
|
359
|
+
/* @__PURE__ */ H("div", {
|
|
359
360
|
className: "md:col-span-1 flex justify-end gap-1",
|
|
360
361
|
children: [
|
|
361
|
-
/* @__PURE__ */
|
|
362
|
+
/* @__PURE__ */ V(p, {
|
|
362
363
|
type: "button",
|
|
363
364
|
variant: "ghost",
|
|
364
365
|
size: "icon",
|
|
365
366
|
onClick: () => X(t, -1),
|
|
366
367
|
disabled: t === 0,
|
|
367
368
|
"aria-label": `Move stop ${t + 1} up`,
|
|
368
|
-
children: /* @__PURE__ */
|
|
369
|
+
children: /* @__PURE__ */ V(l, { size: 16 })
|
|
369
370
|
}),
|
|
370
|
-
/* @__PURE__ */
|
|
371
|
+
/* @__PURE__ */ V(p, {
|
|
371
372
|
type: "button",
|
|
372
373
|
variant: "ghost",
|
|
373
374
|
size: "icon",
|
|
374
375
|
onClick: () => X(t, 1),
|
|
375
376
|
disabled: t === D.stops.length - 1,
|
|
376
377
|
"aria-label": `Move stop ${t + 1} down`,
|
|
377
|
-
children: /* @__PURE__ */
|
|
378
|
+
children: /* @__PURE__ */ V(u, { size: 16 })
|
|
378
379
|
}),
|
|
379
|
-
/* @__PURE__ */
|
|
380
|
+
/* @__PURE__ */ V(p, {
|
|
380
381
|
type: "button",
|
|
381
382
|
variant: "ghost",
|
|
382
383
|
size: "icon",
|
|
383
384
|
className: "text-status-error-text",
|
|
384
|
-
onClick: () =>
|
|
385
|
+
onClick: () => Te(t),
|
|
385
386
|
disabled: D.stops.length === 1,
|
|
386
387
|
"aria-label": `Remove stop ${t + 1}`,
|
|
387
|
-
children: /* @__PURE__ */
|
|
388
|
+
children: /* @__PURE__ */ V(s, { size: 16 })
|
|
388
389
|
})
|
|
389
390
|
]
|
|
390
391
|
})
|
|
@@ -400,36 +401,36 @@ function Te({ summary: e }) {
|
|
|
400
401
|
dateStyle: "medium",
|
|
401
402
|
timeStyle: "short"
|
|
402
403
|
});
|
|
403
|
-
return /* @__PURE__ */
|
|
404
|
+
return /* @__PURE__ */ H(m, {
|
|
404
405
|
className: "mb-6",
|
|
405
|
-
children: [/* @__PURE__ */
|
|
406
|
+
children: [/* @__PURE__ */ V(g, { children: /* @__PURE__ */ H(_, {
|
|
406
407
|
className: "flex items-center gap-2",
|
|
407
408
|
children: [
|
|
408
|
-
/* @__PURE__ */
|
|
409
|
+
/* @__PURE__ */ V(a, { size: 16 }),
|
|
409
410
|
"Last optimization",
|
|
410
|
-
/* @__PURE__ */
|
|
411
|
+
/* @__PURE__ */ V(f, {
|
|
411
412
|
variant: e.feasible ? "default" : "secondary",
|
|
412
413
|
children: e.feasible ? "Feasible" : `${e.violations.length} warning(s)`
|
|
413
414
|
})
|
|
414
415
|
]
|
|
415
|
-
}) }), /* @__PURE__ */
|
|
416
|
+
}) }), /* @__PURE__ */ H(h, {
|
|
416
417
|
className: "space-y-2 text-sm",
|
|
417
|
-
children: [/* @__PURE__ */
|
|
418
|
+
children: [/* @__PURE__ */ H("div", {
|
|
418
419
|
className: "flex flex-wrap gap-x-6 gap-y-1",
|
|
419
420
|
children: [
|
|
420
|
-
/* @__PURE__ */
|
|
421
|
-
/* @__PURE__ */
|
|
422
|
-
e.distanceAfterKm != null && /* @__PURE__ */
|
|
423
|
-
e.distanceSavedKm != null && e.distanceSavedKm > 0 && /* @__PURE__ */
|
|
421
|
+
/* @__PURE__ */ H("span", { children: ["Strategy: ", /* @__PURE__ */ V("strong", { children: e.strategy })] }),
|
|
422
|
+
/* @__PURE__ */ H("span", { children: ["Run: ", /* @__PURE__ */ V("strong", { children: n })] }),
|
|
423
|
+
e.distanceAfterKm != null && /* @__PURE__ */ H("span", { children: ["Distance: ", /* @__PURE__ */ V("strong", { children: N(e.distanceAfterKm) })] }),
|
|
424
|
+
e.distanceSavedKm != null && e.distanceSavedKm > 0 && /* @__PURE__ */ H("span", { children: [
|
|
424
425
|
"Saved: ",
|
|
425
|
-
/* @__PURE__ */
|
|
426
|
+
/* @__PURE__ */ V("strong", { children: N(e.distanceSavedKm) }),
|
|
426
427
|
" vs recorded order"
|
|
427
428
|
] }),
|
|
428
|
-
e.durationAfterMinutes != null && /* @__PURE__ */
|
|
429
|
+
e.durationAfterMinutes != null && /* @__PURE__ */ H("span", { children: ["Drive time: ", /* @__PURE__ */ V("strong", { children: P(e.durationAfterMinutes) })] })
|
|
429
430
|
]
|
|
430
|
-
}), e.violations.length > 0 && /* @__PURE__ */
|
|
431
|
+
}), e.violations.length > 0 && /* @__PURE__ */ V("ul", {
|
|
431
432
|
className: "list-disc pl-5 space-y-1",
|
|
432
|
-
children: e.violations.map((e, t) => /* @__PURE__ */
|
|
433
|
+
children: e.violations.map((e, t) => /* @__PURE__ */ H("li", { children: [e.message, e.sequence != null && /* @__PURE__ */ H(f, {
|
|
433
434
|
variant: "outline",
|
|
434
435
|
className: "ml-2",
|
|
435
436
|
children: ["stop ", e.sequence]
|
|
@@ -438,224 +439,224 @@ function Te({ summary: e }) {
|
|
|
438
439
|
})]
|
|
439
440
|
});
|
|
440
441
|
}
|
|
441
|
-
function
|
|
442
|
+
function Y() {
|
|
442
443
|
let { routeId: o } = ve(), c = _e().pathname.endsWith("/edit"), { basePath: l, navigate: u } = pe(), { route: v, isLoading: y, error: E, refetch: k } = ae(o);
|
|
443
444
|
de(c, k);
|
|
444
|
-
let { optimizeRoute:
|
|
445
|
-
let n =
|
|
445
|
+
let { optimizeRoute: ce, updateRoute: A, deleteRoute: le } = oe(), P = ue(o), { t: ge } = ye(), q = (e, t) => {
|
|
446
|
+
let n = ge(e);
|
|
446
447
|
return n === e ? t : n;
|
|
447
|
-
}, { message:
|
|
448
|
+
}, { message: Y, notify: X } = R(), [Z, Ee] = z(null), [De, Oe] = z(!1), [ke, Ae] = z("AUTO"), [je, Q] = z(!1), [$, Me] = z(!1), [Ne, Pe] = z(null), Fe = () => u?.(F(l, "routes")), Ie = (e) => u?.(F(l, e)), Le = async () => {
|
|
448
449
|
if (o) {
|
|
449
|
-
|
|
450
|
+
Me(!0), Pe(null);
|
|
450
451
|
try {
|
|
451
|
-
await le(o), Q(!1),
|
|
452
|
+
await le(o), Q(!1), Fe();
|
|
452
453
|
} catch (e) {
|
|
453
|
-
|
|
454
|
+
Pe(e instanceof Error ? e.message : "Failed to delete route."), Me(!1);
|
|
454
455
|
}
|
|
455
456
|
}
|
|
456
|
-
},
|
|
457
|
+
}, Re = async () => {
|
|
457
458
|
if (o) {
|
|
458
|
-
|
|
459
|
+
Oe(!0), Ee(null);
|
|
459
460
|
try {
|
|
460
|
-
let e = (await
|
|
461
|
-
e && !e.feasible ?
|
|
461
|
+
let e = (await ce(o, ke)).lastOptimization;
|
|
462
|
+
e && !e.feasible ? X(`Route optimized with ${e.violations.length} constraint warning(s) — see the optimization panel below.`) : X("Route optimized — stops resequenced for the shortest feasible run."), k();
|
|
462
463
|
} catch (e) {
|
|
463
|
-
|
|
464
|
+
Ee(e instanceof Error ? e.message : "Failed to optimize route.");
|
|
464
465
|
} finally {
|
|
465
|
-
|
|
466
|
+
Oe(!1);
|
|
466
467
|
}
|
|
467
468
|
}
|
|
468
|
-
},
|
|
469
|
-
o && (await
|
|
469
|
+
}, ze = async (e) => {
|
|
470
|
+
o && (await A(o, e), X(q("movethewheels.routes.suggest.done", "Assignment saved.")), k(), P.refetch());
|
|
470
471
|
};
|
|
471
|
-
if (!o) return /* @__PURE__ */
|
|
472
|
-
if (c) return /* @__PURE__ */
|
|
473
|
-
if (y) return /* @__PURE__ */
|
|
474
|
-
if (E || !v) return /* @__PURE__ */
|
|
472
|
+
if (!o) return /* @__PURE__ */ V(J, {});
|
|
473
|
+
if (c) return /* @__PURE__ */ V(J, { editId: o });
|
|
474
|
+
if (y) return /* @__PURE__ */ V(ne, { message: "Loading route details..." });
|
|
475
|
+
if (E || !v) return /* @__PURE__ */ V(te, {
|
|
475
476
|
title: "Route not found",
|
|
476
477
|
onRetry: k
|
|
477
478
|
});
|
|
478
|
-
let
|
|
479
|
+
let Be = v.stops.map((e) => {
|
|
479
480
|
let t = T(e.address);
|
|
480
481
|
return t ? {
|
|
481
482
|
lat: t.lat,
|
|
482
483
|
lng: t.lng,
|
|
483
484
|
sequence: e.sequence,
|
|
484
|
-
label:
|
|
485
|
+
label: j(e.address) || `Order #${e.orderId || e.sequence}`
|
|
485
486
|
} : null;
|
|
486
487
|
}).filter((e) => e !== null);
|
|
487
|
-
return /* @__PURE__ */
|
|
488
|
+
return /* @__PURE__ */ H(re, {
|
|
488
489
|
title: v.name,
|
|
489
|
-
subtitle: `${v.stops.length} stops - ${
|
|
490
|
-
icon: /* @__PURE__ */
|
|
491
|
-
headerActions: /* @__PURE__ */
|
|
490
|
+
subtitle: `${v.stops.length} stops - ${N(v.distance)}`,
|
|
491
|
+
icon: /* @__PURE__ */ V(e, { size: 24 }),
|
|
492
|
+
headerActions: /* @__PURE__ */ H("div", {
|
|
492
493
|
className: "flex gap-2",
|
|
493
494
|
children: [
|
|
494
|
-
/* @__PURE__ */
|
|
495
|
+
/* @__PURE__ */ H(p, {
|
|
495
496
|
variant: "outline",
|
|
496
|
-
onClick:
|
|
497
|
-
children: [/* @__PURE__ */
|
|
497
|
+
onClick: Fe,
|
|
498
|
+
children: [/* @__PURE__ */ V(t, { size: 16 }), " Back"]
|
|
498
499
|
}),
|
|
499
|
-
(v.status === "planned" || v.status === "in_progress") && /* @__PURE__ */
|
|
500
|
-
value:
|
|
501
|
-
onValueChange: (e) =>
|
|
502
|
-
children: [/* @__PURE__ */
|
|
500
|
+
(v.status === "planned" || v.status === "in_progress") && /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ H(b, {
|
|
501
|
+
value: ke,
|
|
502
|
+
onValueChange: (e) => Ae(e),
|
|
503
|
+
children: [/* @__PURE__ */ V(C, {
|
|
503
504
|
className: "w-44",
|
|
504
505
|
"aria-label": "Optimization strategy",
|
|
505
|
-
children: /* @__PURE__ */
|
|
506
|
-
}), /* @__PURE__ */
|
|
507
|
-
/* @__PURE__ */
|
|
506
|
+
children: /* @__PURE__ */ V(w, {})
|
|
507
|
+
}), /* @__PURE__ */ H(x, { children: [
|
|
508
|
+
/* @__PURE__ */ V(S, {
|
|
508
509
|
value: "AUTO",
|
|
509
510
|
children: "Auto (windows + 2-opt)"
|
|
510
511
|
}),
|
|
511
|
-
/* @__PURE__ */
|
|
512
|
+
/* @__PURE__ */ V(S, {
|
|
512
513
|
value: "NEAREST_NEIGHBOUR",
|
|
513
514
|
children: "Nearest neighbour"
|
|
514
515
|
}),
|
|
515
|
-
/* @__PURE__ */
|
|
516
|
+
/* @__PURE__ */ V(S, {
|
|
516
517
|
value: "TIME_WINDOW",
|
|
517
518
|
children: "Time windows"
|
|
518
519
|
}),
|
|
519
|
-
/* @__PURE__ */
|
|
520
|
+
/* @__PURE__ */ V(S, {
|
|
520
521
|
value: "TWO_OPT",
|
|
521
522
|
children: "Shortest tour (2-opt)"
|
|
522
523
|
})
|
|
523
524
|
] })]
|
|
524
|
-
}), /* @__PURE__ */
|
|
525
|
+
}), /* @__PURE__ */ H(p, {
|
|
525
526
|
variant: "outline",
|
|
526
|
-
onClick:
|
|
527
|
-
disabled:
|
|
527
|
+
onClick: Re,
|
|
528
|
+
disabled: De,
|
|
528
529
|
children: [
|
|
529
|
-
/* @__PURE__ */
|
|
530
|
+
/* @__PURE__ */ V(a, { size: 16 }),
|
|
530
531
|
" ",
|
|
531
|
-
|
|
532
|
+
De ? "Optimizing…" : v.optimized ? "Re-optimize" : "Optimize & start"
|
|
532
533
|
]
|
|
533
534
|
})] }),
|
|
534
|
-
/* @__PURE__ */
|
|
535
|
-
onClick: () => u?.(
|
|
536
|
-
children: [/* @__PURE__ */
|
|
535
|
+
/* @__PURE__ */ H(p, {
|
|
536
|
+
onClick: () => u?.(F(l, `routes/${o}/edit`)),
|
|
537
|
+
children: [/* @__PURE__ */ V(n, { size: 16 }), " Edit"]
|
|
537
538
|
})
|
|
538
539
|
]
|
|
539
540
|
}),
|
|
540
|
-
headerContent: /* @__PURE__ */
|
|
541
|
+
headerContent: /* @__PURE__ */ H("div", {
|
|
541
542
|
className: "flex gap-2",
|
|
542
|
-
children: [/* @__PURE__ */
|
|
543
|
+
children: [/* @__PURE__ */ V(ie, {
|
|
543
544
|
status: v.status,
|
|
544
545
|
customColors: he[v.status]
|
|
545
|
-
}), /* @__PURE__ */
|
|
546
|
+
}), /* @__PURE__ */ V(f, {
|
|
546
547
|
variant: v.optimized === !0 ? "default" : "secondary",
|
|
547
548
|
children: v.optimized === void 0 ? "Optimization unknown" : v.optimized ? "Optimized" : "Not Optimized"
|
|
548
549
|
})]
|
|
549
550
|
}),
|
|
550
551
|
children: [
|
|
551
|
-
/* @__PURE__ */
|
|
552
|
-
icon: /* @__PURE__ */
|
|
552
|
+
/* @__PURE__ */ V(Se, {
|
|
553
|
+
icon: /* @__PURE__ */ V(e, { size: 18 }),
|
|
553
554
|
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."
|
|
554
555
|
}),
|
|
555
|
-
/* @__PURE__ */
|
|
556
|
+
/* @__PURE__ */ V(xe, {
|
|
556
557
|
storageKey: "movethewheels-route-details",
|
|
557
558
|
steps: [
|
|
558
559
|
...v.status === "planned" || v.status === "in_progress" ? [{
|
|
559
560
|
id: "optimize",
|
|
560
561
|
label: v.optimized ? "Re-optimize this route" : "Optimize & start this route",
|
|
561
562
|
description: "Reorder stops to cut distance and driving time, then mark the route In Progress.",
|
|
562
|
-
icon: /* @__PURE__ */
|
|
563
|
-
onClick:
|
|
563
|
+
icon: /* @__PURE__ */ V(a, { size: 16 }),
|
|
564
|
+
onClick: Re
|
|
564
565
|
}] : [],
|
|
565
566
|
{
|
|
566
567
|
id: "edit",
|
|
567
568
|
label: "Adjust stops",
|
|
568
569
|
description: "Add, remove or reorder the delivery stops.",
|
|
569
|
-
icon: /* @__PURE__ */
|
|
570
|
+
icon: /* @__PURE__ */ V(n, { size: 16 }),
|
|
570
571
|
onClick: () => {}
|
|
571
572
|
},
|
|
572
573
|
{
|
|
573
574
|
id: "orders",
|
|
574
575
|
label: "Review the orders on this route",
|
|
575
576
|
description: "Check the deliveries bundled into this run.",
|
|
576
|
-
icon: /* @__PURE__ */
|
|
577
|
-
onClick: () =>
|
|
577
|
+
icon: /* @__PURE__ */ V(r, { size: 16 }),
|
|
578
|
+
onClick: () => Ie("orders")
|
|
578
579
|
}
|
|
579
580
|
]
|
|
580
581
|
}),
|
|
581
|
-
|
|
582
|
+
Z && /* @__PURE__ */ V("div", {
|
|
582
583
|
className: "mb-2",
|
|
583
|
-
children: /* @__PURE__ */
|
|
584
|
+
children: /* @__PURE__ */ V(I, { message: Z })
|
|
584
585
|
}),
|
|
585
|
-
|
|
586
|
+
Y && /* @__PURE__ */ V("div", {
|
|
586
587
|
className: "mb-2",
|
|
587
|
-
children: /* @__PURE__ */
|
|
588
|
+
children: /* @__PURE__ */ V(L, { message: Y })
|
|
588
589
|
}),
|
|
589
|
-
v.lastOptimization && /* @__PURE__ */
|
|
590
|
-
/* @__PURE__ */
|
|
590
|
+
v.lastOptimization && /* @__PURE__ */ V(Te, { summary: v.lastOptimization }),
|
|
591
|
+
/* @__PURE__ */ H("div", {
|
|
591
592
|
className: "grid grid-cols-1 lg:grid-cols-3 gap-6",
|
|
592
|
-
children: [/* @__PURE__ */
|
|
593
|
+
children: [/* @__PURE__ */ H("div", {
|
|
593
594
|
className: "lg:col-span-2 space-y-6",
|
|
594
|
-
children: [/* @__PURE__ */
|
|
595
|
+
children: [/* @__PURE__ */ H(m, { children: [/* @__PURE__ */ V(g, { children: /* @__PURE__ */ V(_, { children: "Route Map" }) }), /* @__PURE__ */ V(h, { children: Be.length > 0 ? /* @__PURE__ */ V(D, {
|
|
595
596
|
className: "overflow-hidden rounded-lg border border-border-seam",
|
|
596
597
|
height: 360,
|
|
597
|
-
stops:
|
|
598
|
-
}) : /* @__PURE__ */
|
|
598
|
+
stops: Be
|
|
599
|
+
}) : /* @__PURE__ */ H("div", {
|
|
599
600
|
className: "rounded-lg border border-border-seam bg-bg-sunken/40 p-4",
|
|
600
|
-
children: [/* @__PURE__ */
|
|
601
|
+
children: [/* @__PURE__ */ V("p", {
|
|
601
602
|
className: "mb-3 text-sm text-text-secondary",
|
|
602
603
|
children: "These stops don't have map coordinates yet — showing the planned sequence instead."
|
|
603
|
-
}), /* @__PURE__ */
|
|
604
|
+
}), /* @__PURE__ */ V("ol", {
|
|
604
605
|
className: "space-y-2",
|
|
605
|
-
children: v.stops.map((e) => /* @__PURE__ */
|
|
606
|
+
children: v.stops.map((e) => /* @__PURE__ */ H("li", {
|
|
606
607
|
className: "flex items-start gap-3",
|
|
607
|
-
children: [/* @__PURE__ */
|
|
608
|
+
children: [/* @__PURE__ */ V("span", {
|
|
608
609
|
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",
|
|
609
610
|
children: e.sequence
|
|
610
|
-
}), /* @__PURE__ */
|
|
611
|
+
}), /* @__PURE__ */ V("span", {
|
|
611
612
|
className: "text-sm",
|
|
612
|
-
children:
|
|
613
|
+
children: j(e.address) || `Order #${e.orderId || e.sequence}`
|
|
613
614
|
})]
|
|
614
615
|
}, e.id))
|
|
615
616
|
})]
|
|
616
|
-
}) })] }), /* @__PURE__ */
|
|
617
|
+
}) })] }), /* @__PURE__ */ H(m, { children: [/* @__PURE__ */ V(g, { children: /* @__PURE__ */ H(_, { children: [
|
|
617
618
|
"Stops (",
|
|
618
619
|
v.stops.length,
|
|
619
620
|
")"
|
|
620
|
-
] }) }), /* @__PURE__ */
|
|
621
|
+
] }) }), /* @__PURE__ */ V(h, { children: /* @__PURE__ */ V("div", {
|
|
621
622
|
className: "space-y-4",
|
|
622
|
-
children: v.stops.map((e, t) => /* @__PURE__ */
|
|
623
|
+
children: v.stops.map((e, t) => /* @__PURE__ */ H("div", {
|
|
623
624
|
className: "flex gap-4",
|
|
624
|
-
children: [/* @__PURE__ */
|
|
625
|
+
children: [/* @__PURE__ */ H("div", {
|
|
625
626
|
className: "relative",
|
|
626
|
-
children: [/* @__PURE__ */
|
|
627
|
+
children: [/* @__PURE__ */ V("div", {
|
|
627
628
|
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"}`,
|
|
628
|
-
children: e.status === "completed" ? /* @__PURE__ */
|
|
629
|
-
}), t < v.stops.length - 1 && /* @__PURE__ */
|
|
630
|
-
}), /* @__PURE__ */
|
|
629
|
+
children: e.status === "completed" ? /* @__PURE__ */ V(ee, { size: 16 }) : e.sequence
|
|
630
|
+
}), t < v.stops.length - 1 && /* @__PURE__ */ V("div", { className: "absolute top-8 left-4 w-px h-12 bg-border" })]
|
|
631
|
+
}), /* @__PURE__ */ V("div", {
|
|
631
632
|
className: "flex-1 pb-4",
|
|
632
|
-
children: /* @__PURE__ */
|
|
633
|
+
children: /* @__PURE__ */ H("div", {
|
|
633
634
|
className: "flex items-center justify-between",
|
|
634
|
-
children: [/* @__PURE__ */
|
|
635
|
+
children: [/* @__PURE__ */ H("div", { children: [/* @__PURE__ */ H("div", {
|
|
635
636
|
className: "flex items-center gap-2",
|
|
636
|
-
children: [/* @__PURE__ */
|
|
637
|
+
children: [/* @__PURE__ */ V(f, {
|
|
637
638
|
variant: e.type === "pickup" ? "secondary" : "default",
|
|
638
639
|
className: "capitalize",
|
|
639
640
|
children: e.type
|
|
640
|
-
}), /* @__PURE__ */
|
|
641
|
+
}), /* @__PURE__ */ H("span", {
|
|
641
642
|
className: "font-medium",
|
|
642
643
|
children: ["Order #", e.orderId]
|
|
643
644
|
})]
|
|
644
|
-
}), /* @__PURE__ */
|
|
645
|
+
}), /* @__PURE__ */ V("p", {
|
|
645
646
|
className: "text-sm text-text-secondary mt-1",
|
|
646
|
-
children:
|
|
647
|
-
})] }), /* @__PURE__ */
|
|
647
|
+
children: j(e.address)
|
|
648
|
+
})] }), /* @__PURE__ */ H("div", {
|
|
648
649
|
className: "text-right",
|
|
649
650
|
children: [
|
|
650
|
-
/* @__PURE__ */
|
|
651
|
+
/* @__PURE__ */ V("p", {
|
|
651
652
|
className: "text-sm",
|
|
652
|
-
children: e.scheduledTime ? `Scheduled: ${
|
|
653
|
+
children: e.scheduledTime ? `Scheduled: ${M(e.scheduledTime, "time")}` : "Scheduled: Not provided"
|
|
653
654
|
}),
|
|
654
|
-
e.actualTime && /* @__PURE__ */
|
|
655
|
+
e.actualTime && /* @__PURE__ */ H("p", {
|
|
655
656
|
className: "text-sm text-status-success-text",
|
|
656
|
-
children: ["Actual: ",
|
|
657
|
+
children: ["Actual: ", M(e.actualTime, "time")]
|
|
657
658
|
}),
|
|
658
|
-
/* @__PURE__ */
|
|
659
|
+
/* @__PURE__ */ V("p", {
|
|
659
660
|
className: "text-xs text-text-secondary",
|
|
660
661
|
children: e.duration === void 0 ? "Duration not provided" : `${e.duration} min stop`
|
|
661
662
|
})
|
|
@@ -665,115 +666,120 @@ function J() {
|
|
|
665
666
|
})]
|
|
666
667
|
}, e.id))
|
|
667
668
|
}) })] })]
|
|
668
|
-
}), /* @__PURE__ */
|
|
669
|
+
}), /* @__PURE__ */ H("div", {
|
|
669
670
|
className: "space-y-6",
|
|
670
671
|
children: [
|
|
671
|
-
/* @__PURE__ */
|
|
672
|
+
/* @__PURE__ */ V(O, {
|
|
672
673
|
entityType: "route",
|
|
673
674
|
entityId: v.id
|
|
674
675
|
}),
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
676
|
+
/* @__PURE__ */ V(se, {
|
|
677
|
+
entityType: "mtw_route",
|
|
678
|
+
entityId: v.id,
|
|
679
|
+
title: "Route conversation"
|
|
680
|
+
}),
|
|
681
|
+
(v.status === "planned" || v.status === "in_progress") && /* @__PURE__ */ V(fe, {
|
|
682
|
+
suggestions: P.data,
|
|
683
|
+
isLoading: P.isLoading,
|
|
684
|
+
error: P.error,
|
|
685
|
+
onRetry: P.refetch,
|
|
680
686
|
assignedVehicleId: v.vehicleId || void 0,
|
|
681
687
|
assignedDriverId: v.driverId || void 0,
|
|
682
|
-
onAssign:
|
|
683
|
-
t:
|
|
688
|
+
onAssign: ze,
|
|
689
|
+
t: q
|
|
684
690
|
}),
|
|
685
|
-
/* @__PURE__ */
|
|
691
|
+
/* @__PURE__ */ H(be, {
|
|
686
692
|
className: "space-y-4",
|
|
687
693
|
children: [
|
|
688
|
-
/* @__PURE__ */
|
|
694
|
+
/* @__PURE__ */ V("h2", {
|
|
689
695
|
className: "text-base font-semibold text-text-primary",
|
|
690
696
|
children: "Route Info"
|
|
691
697
|
}),
|
|
692
|
-
/* @__PURE__ */
|
|
698
|
+
/* @__PURE__ */ H("div", { children: [/* @__PURE__ */ V("p", {
|
|
693
699
|
className: "text-sm text-text-secondary",
|
|
694
700
|
children: "Total Distance"
|
|
695
|
-
}), /* @__PURE__ */
|
|
701
|
+
}), /* @__PURE__ */ V("p", {
|
|
696
702
|
className: "text-2xl font-bold",
|
|
697
|
-
children:
|
|
703
|
+
children: N(v.distance)
|
|
698
704
|
})] }),
|
|
699
|
-
/* @__PURE__ */
|
|
705
|
+
/* @__PURE__ */ H("div", { children: [/* @__PURE__ */ V("p", {
|
|
700
706
|
className: "text-sm text-text-secondary",
|
|
701
707
|
children: "Est. Duration"
|
|
702
|
-
}), /* @__PURE__ */
|
|
708
|
+
}), /* @__PURE__ */ H("p", {
|
|
703
709
|
className: "text-2xl font-bold",
|
|
704
|
-
children: [v.estimatedDuration, /* @__PURE__ */
|
|
710
|
+
children: [v.estimatedDuration, /* @__PURE__ */ V("span", {
|
|
705
711
|
className: "text-sm font-normal",
|
|
706
712
|
children: " min"
|
|
707
713
|
})]
|
|
708
714
|
})] }),
|
|
709
|
-
v.fuelCost !== void 0 && /* @__PURE__ */
|
|
715
|
+
v.fuelCost !== void 0 && /* @__PURE__ */ H("div", { children: [/* @__PURE__ */ H("p", {
|
|
710
716
|
className: "text-sm text-text-secondary flex items-center gap-1",
|
|
711
|
-
children: [/* @__PURE__ */
|
|
712
|
-
}), /* @__PURE__ */
|
|
717
|
+
children: [/* @__PURE__ */ V(d, { size: 14 }), " Est. Fuel Cost"]
|
|
718
|
+
}), /* @__PURE__ */ V("p", {
|
|
713
719
|
className: "text-2xl font-bold",
|
|
714
720
|
children: me(v.fuelCost)
|
|
715
721
|
})] }),
|
|
716
|
-
v.actualDuration && /* @__PURE__ */
|
|
722
|
+
v.actualDuration && /* @__PURE__ */ H("div", { children: [/* @__PURE__ */ V("p", {
|
|
717
723
|
className: "text-sm text-text-secondary",
|
|
718
724
|
children: "Actual Duration"
|
|
719
|
-
}), /* @__PURE__ */
|
|
725
|
+
}), /* @__PURE__ */ H("p", {
|
|
720
726
|
className: "text-2xl font-bold",
|
|
721
|
-
children: [v.actualDuration, /* @__PURE__ */
|
|
727
|
+
children: [v.actualDuration, /* @__PURE__ */ V("span", {
|
|
722
728
|
className: "text-sm font-normal",
|
|
723
729
|
children: " min"
|
|
724
730
|
})]
|
|
725
731
|
})] })
|
|
726
732
|
]
|
|
727
733
|
}),
|
|
728
|
-
/* @__PURE__ */
|
|
734
|
+
/* @__PURE__ */ H(m, { children: [/* @__PURE__ */ V(g, { children: /* @__PURE__ */ H(_, {
|
|
729
735
|
className: "flex items-center gap-2",
|
|
730
|
-
children: [/* @__PURE__ */
|
|
731
|
-
}) }), /* @__PURE__ */
|
|
736
|
+
children: [/* @__PURE__ */ V(i, { size: 18 }), " Timeline"]
|
|
737
|
+
}) }), /* @__PURE__ */ V(h, {
|
|
732
738
|
className: "space-y-3",
|
|
733
|
-
children: /* @__PURE__ */
|
|
739
|
+
children: /* @__PURE__ */ H("div", { children: [/* @__PURE__ */ V("p", {
|
|
734
740
|
className: "text-sm text-text-secondary",
|
|
735
741
|
children: "Created"
|
|
736
|
-
}), /* @__PURE__ */
|
|
742
|
+
}), /* @__PURE__ */ V("p", { children: M(v.createdAt, "full") })] })
|
|
737
743
|
})] }),
|
|
738
|
-
/* @__PURE__ */
|
|
744
|
+
/* @__PURE__ */ H(m, {
|
|
739
745
|
className: "border-status-error-border",
|
|
740
|
-
children: [/* @__PURE__ */
|
|
746
|
+
children: [/* @__PURE__ */ V(g, { children: /* @__PURE__ */ H(_, {
|
|
741
747
|
className: "flex items-center gap-2 text-status-error-text",
|
|
742
|
-
children: [/* @__PURE__ */
|
|
743
|
-
}) }), /* @__PURE__ */
|
|
748
|
+
children: [/* @__PURE__ */ V(s, { size: 18 }), " Delete Route"]
|
|
749
|
+
}) }), /* @__PURE__ */ H(h, { children: [/* @__PURE__ */ V("p", {
|
|
744
750
|
className: "mb-3 text-sm text-text-secondary",
|
|
745
751
|
children: "Removes this route. It can no longer be dispatched. This cannot be undone from here."
|
|
746
|
-
}), /* @__PURE__ */
|
|
752
|
+
}), /* @__PURE__ */ H(p, {
|
|
747
753
|
variant: "outline",
|
|
748
754
|
className: "border-status-error-border text-status-error-text hover:bg-status-error-bg-subtle",
|
|
749
755
|
onClick: () => Q(!0),
|
|
750
|
-
children: [/* @__PURE__ */
|
|
756
|
+
children: [/* @__PURE__ */ V(s, { size: 16 }), " Delete this route"]
|
|
751
757
|
})] })]
|
|
752
758
|
})
|
|
753
759
|
]
|
|
754
760
|
})]
|
|
755
761
|
}),
|
|
756
|
-
/* @__PURE__ */
|
|
757
|
-
open:
|
|
762
|
+
/* @__PURE__ */ V(U, {
|
|
763
|
+
open: je,
|
|
758
764
|
onOpenChange: Q,
|
|
759
|
-
children: /* @__PURE__ */
|
|
760
|
-
/* @__PURE__ */
|
|
765
|
+
children: /* @__PURE__ */ H(W, { children: [
|
|
766
|
+
/* @__PURE__ */ H(K, { children: [/* @__PURE__ */ V(we, { children: "Delete this route?" }), /* @__PURE__ */ H(G, { children: [
|
|
761
767
|
"This removes ",
|
|
762
768
|
v.name,
|
|
763
769
|
" and cannot be undone from here."
|
|
764
770
|
] })] }),
|
|
765
|
-
/* @__PURE__ */
|
|
771
|
+
/* @__PURE__ */ V("div", {
|
|
766
772
|
className: "px-1",
|
|
767
|
-
children: /* @__PURE__ */
|
|
773
|
+
children: /* @__PURE__ */ V(I, { message: Ne })
|
|
768
774
|
}),
|
|
769
|
-
/* @__PURE__ */
|
|
775
|
+
/* @__PURE__ */ H(Ce, { children: [/* @__PURE__ */ V(p, {
|
|
770
776
|
variant: "outline",
|
|
771
777
|
onClick: () => Q(!1),
|
|
772
778
|
disabled: $,
|
|
773
779
|
children: "Cancel"
|
|
774
|
-
}), /* @__PURE__ */
|
|
780
|
+
}), /* @__PURE__ */ V(p, {
|
|
775
781
|
className: "bg-status-error-text text-text-inverse hover:opacity-90",
|
|
776
|
-
onClick:
|
|
782
|
+
onClick: Le,
|
|
777
783
|
disabled: $,
|
|
778
784
|
children: $ ? "Deleting..." : "Delete route"
|
|
779
785
|
})] })
|
|
@@ -782,4 +788,4 @@ function J() {
|
|
|
782
788
|
]
|
|
783
789
|
});
|
|
784
790
|
}
|
|
785
|
-
export {
|
|
791
|
+
export { Y as default };
|