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