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