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