@burdenoff/microfe-movethewheels 2026.830.5 → 2026.918.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/components/AssignmentSuggestions.js +135 -0
- package/dist/components/FleetAlertsPanel.js +114 -0
- package/dist/components/VehicleServiceCard.js +176 -0
- package/dist/hooks/useFleet.js +4 -3
- package/dist/hooks/useFleetIntelligence.js +91 -0
- package/dist/movethewheels/components/AssignmentSuggestions.d.ts +17 -0
- package/dist/movethewheels/components/FleetAlertsPanel.d.ts +14 -0
- package/dist/movethewheels/components/VehicleServiceCard.d.ts +10 -0
- package/dist/movethewheels/hooks/useFleetIntelligence.d.ts +64 -0
- package/dist/movethewheels/types/index.d.ts +2 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/sparkles.js +26 -0
- package/dist/pages/FleetPage.js +156 -146
- package/dist/pages/RouteDetailsPage.js +202 -184
- package/dist/pages/VehicleDetailsPage.js +149 -131
- package/dist/utils/graphqlClient.js +14 -5
- package/package.json +1 -1
- package/src/movethewheels/components/AssignmentSuggestions.tsx +234 -0
- package/src/movethewheels/components/FleetAlertsPanel.tsx +148 -0
- package/src/movethewheels/components/VehicleServiceCard.tsx +220 -0
- package/src/movethewheels/hooks/useFleet.ts +12 -2
- package/src/movethewheels/hooks/useFleetIntelligence.ts +226 -0
- package/src/movethewheels/pages/FleetPage.tsx +21 -0
- package/src/movethewheels/pages/RouteDetailsPage.tsx +33 -1
- package/src/movethewheels/pages/VehicleDetailsPage.tsx +27 -0
- package/src/movethewheels/types/index.ts +2 -0
- package/src/movethewheels/utils/graphqlClient.ts +20 -1
|
@@ -14,14 +14,18 @@ import { Avatar as m, AvatarFallback as h, Button as g, Card as _, CardContent a
|
|
|
14
14
|
import { ErrorState as k, LoadingState as A, PageLayout as j } from "../components/PageLayout.js";
|
|
15
15
|
import { StatusBadge as M, VehicleTypeBadge as N } from "../components/StatusBadge.js";
|
|
16
16
|
import { FormError as P } from "../components/FormError.js";
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
17
|
+
import { Notice as F, useNotice as I } from "../components/Notice.js";
|
|
18
|
+
import { formatDate as L, getInitials as R } from "../utils/formatters.js";
|
|
19
|
+
import { DocumentsCard as z } from "../components/DocumentsCard.js";
|
|
20
|
+
import { useRecordVehicleService as B } from "../hooks/useFleetIntelligence.js";
|
|
21
|
+
import { VehicleServiceCard as V } from "../components/VehicleServiceCard.js";
|
|
22
|
+
import { useEffect as H, useState as U } from "react";
|
|
23
|
+
import { useLocation as W, useParams as ee } from "react-router";
|
|
24
|
+
import { jsx as G, jsxs as K } from "react/jsx-runtime";
|
|
25
|
+
import { useI18n as te } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
26
|
+
import { EmphasisPanel as q, NextSteps as ne, PagePurpose as J } from "@burdenoff/fe-libs/ui";
|
|
23
27
|
//#region src/movethewheels/pages/VehicleDetailsPage.tsx
|
|
24
|
-
var
|
|
28
|
+
var Y = [
|
|
25
29
|
{
|
|
26
30
|
value: "TRUCK",
|
|
27
31
|
label: "Truck"
|
|
@@ -55,15 +59,15 @@ var q = [
|
|
|
55
59
|
label: "Drone"
|
|
56
60
|
}
|
|
57
61
|
];
|
|
58
|
-
function
|
|
59
|
-
let { basePath: n, navigate: r } = u(), { createVehicle: i, updateVehicle: o } = d(), { vehicle: c } = f(t), p = !!t, [m, h] =
|
|
62
|
+
function X({ editId: t }) {
|
|
63
|
+
let { basePath: n, navigate: r } = u(), { createVehicle: i, updateVehicle: o } = d(), { vehicle: c } = f(t), p = !!t, [m, h] = U({
|
|
60
64
|
vehicleNumber: "",
|
|
61
65
|
type: "VAN",
|
|
62
66
|
make: "",
|
|
63
67
|
model: "",
|
|
64
68
|
licensePlate: ""
|
|
65
|
-
}), [_, v] =
|
|
66
|
-
|
|
69
|
+
}), [_, v] = U(!1), [y, b] = U(null);
|
|
70
|
+
H(() => {
|
|
67
71
|
t && c && h({
|
|
68
72
|
vehicleNumber: c.vehicleNumber ?? "",
|
|
69
73
|
type: c.type ? c.type.toUpperCase() : "VAN",
|
|
@@ -102,49 +106,49 @@ function J({ editId: t }) {
|
|
|
102
106
|
console.error("Failed to create vehicle:", e), b(e instanceof Error ? e.message : "Failed to create vehicle. Please try again."), v(!1);
|
|
103
107
|
}
|
|
104
108
|
};
|
|
105
|
-
return /* @__PURE__ */
|
|
109
|
+
return /* @__PURE__ */ K(j, {
|
|
106
110
|
title: p ? "Edit Vehicle" : "Add Vehicle",
|
|
107
111
|
subtitle: "Register a new vehicle in your fleet",
|
|
108
|
-
icon: /* @__PURE__ */
|
|
109
|
-
headerActions: /* @__PURE__ */
|
|
112
|
+
icon: /* @__PURE__ */ G(s, { size: 24 }),
|
|
113
|
+
headerActions: /* @__PURE__ */ K("div", {
|
|
110
114
|
className: "flex gap-2",
|
|
111
|
-
children: [/* @__PURE__ */
|
|
115
|
+
children: [/* @__PURE__ */ K(g, {
|
|
112
116
|
variant: "outline",
|
|
113
117
|
onClick: C,
|
|
114
118
|
disabled: _,
|
|
115
|
-
children: [/* @__PURE__ */
|
|
116
|
-
}), /* @__PURE__ */
|
|
119
|
+
children: [/* @__PURE__ */ G(e, { size: 16 }), " Cancel"]
|
|
120
|
+
}), /* @__PURE__ */ K(g, {
|
|
117
121
|
onClick: k,
|
|
118
122
|
disabled: _,
|
|
119
123
|
children: [
|
|
120
|
-
/* @__PURE__ */
|
|
124
|
+
/* @__PURE__ */ G(a, { size: 16 }),
|
|
121
125
|
" ",
|
|
122
126
|
p ? _ ? "Saving..." : "Save Changes" : _ ? "Saving..." : "Add Vehicle"
|
|
123
127
|
]
|
|
124
128
|
})]
|
|
125
129
|
}),
|
|
126
|
-
children: [/* @__PURE__ */
|
|
127
|
-
icon: /* @__PURE__ */
|
|
130
|
+
children: [/* @__PURE__ */ G(J, {
|
|
131
|
+
icon: /* @__PURE__ */ G(s, { size: 18 }),
|
|
128
132
|
children: "Add a vehicle so it can be assigned to deliveries and routes. Give it a fleet number and type to start — make, model and plate help identify it on the road."
|
|
129
|
-
}), /* @__PURE__ */
|
|
133
|
+
}), /* @__PURE__ */ K("form", {
|
|
130
134
|
onSubmit: k,
|
|
131
135
|
className: "max-w-2xl space-y-6",
|
|
132
|
-
children: [/* @__PURE__ */
|
|
136
|
+
children: [/* @__PURE__ */ G(P, { message: y }), /* @__PURE__ */ K(q, { children: [/* @__PURE__ */ G("h2", {
|
|
133
137
|
className: "text-base font-semibold text-text-primary mb-4",
|
|
134
138
|
children: "Vehicle Details"
|
|
135
|
-
}), /* @__PURE__ */
|
|
139
|
+
}), /* @__PURE__ */ K("div", {
|
|
136
140
|
className: "space-y-4",
|
|
137
|
-
children: [/* @__PURE__ */
|
|
141
|
+
children: [/* @__PURE__ */ K("div", {
|
|
138
142
|
className: "grid grid-cols-1 md:grid-cols-2 gap-4",
|
|
139
|
-
children: [/* @__PURE__ */
|
|
143
|
+
children: [/* @__PURE__ */ K("div", {
|
|
140
144
|
className: "space-y-2",
|
|
141
|
-
children: [/* @__PURE__ */
|
|
145
|
+
children: [/* @__PURE__ */ K(S, {
|
|
142
146
|
htmlFor: "vehicleNumber",
|
|
143
|
-
children: ["Vehicle Number ", /* @__PURE__ */
|
|
147
|
+
children: ["Vehicle Number ", /* @__PURE__ */ G("span", {
|
|
144
148
|
className: "text-status-error-text",
|
|
145
149
|
children: "*"
|
|
146
150
|
})]
|
|
147
|
-
}), /* @__PURE__ */
|
|
151
|
+
}), /* @__PURE__ */ G(x, {
|
|
148
152
|
id: "vehicleNumber",
|
|
149
153
|
value: m.vehicleNumber,
|
|
150
154
|
onChange: (e) => h((t) => ({
|
|
@@ -154,38 +158,38 @@ function J({ editId: t }) {
|
|
|
154
158
|
placeholder: "MTW-001",
|
|
155
159
|
required: !0
|
|
156
160
|
})]
|
|
157
|
-
}), /* @__PURE__ */
|
|
161
|
+
}), /* @__PURE__ */ K("div", {
|
|
158
162
|
className: "space-y-2",
|
|
159
|
-
children: [/* @__PURE__ */
|
|
163
|
+
children: [/* @__PURE__ */ K(S, {
|
|
160
164
|
htmlFor: "type",
|
|
161
|
-
children: ["Type ", /* @__PURE__ */
|
|
165
|
+
children: ["Type ", /* @__PURE__ */ G("span", {
|
|
162
166
|
className: "text-status-error-text",
|
|
163
167
|
children: "*"
|
|
164
168
|
})]
|
|
165
|
-
}), /* @__PURE__ */
|
|
169
|
+
}), /* @__PURE__ */ K(w, {
|
|
166
170
|
value: m.type,
|
|
167
171
|
onValueChange: (e) => h((t) => ({
|
|
168
172
|
...t,
|
|
169
173
|
type: e
|
|
170
174
|
})),
|
|
171
|
-
children: [/* @__PURE__ */
|
|
175
|
+
children: [/* @__PURE__ */ G(D, {
|
|
172
176
|
id: "type",
|
|
173
|
-
children: /* @__PURE__ */
|
|
174
|
-
}), /* @__PURE__ */
|
|
177
|
+
children: /* @__PURE__ */ G(O, {})
|
|
178
|
+
}), /* @__PURE__ */ G(T, { children: Y.map((e) => /* @__PURE__ */ G(E, {
|
|
175
179
|
value: e.value,
|
|
176
180
|
children: e.label
|
|
177
181
|
}, e.value)) })]
|
|
178
182
|
})]
|
|
179
183
|
})]
|
|
180
|
-
}), /* @__PURE__ */
|
|
184
|
+
}), /* @__PURE__ */ K("div", {
|
|
181
185
|
className: "grid grid-cols-1 md:grid-cols-3 gap-4",
|
|
182
186
|
children: [
|
|
183
|
-
/* @__PURE__ */
|
|
187
|
+
/* @__PURE__ */ K("div", {
|
|
184
188
|
className: "space-y-2",
|
|
185
|
-
children: [/* @__PURE__ */
|
|
189
|
+
children: [/* @__PURE__ */ G(S, {
|
|
186
190
|
htmlFor: "make",
|
|
187
191
|
children: "Make"
|
|
188
|
-
}), /* @__PURE__ */
|
|
192
|
+
}), /* @__PURE__ */ G(x, {
|
|
189
193
|
id: "make",
|
|
190
194
|
value: m.make,
|
|
191
195
|
onChange: (e) => h((t) => ({
|
|
@@ -195,12 +199,12 @@ function J({ editId: t }) {
|
|
|
195
199
|
placeholder: "Ford"
|
|
196
200
|
})]
|
|
197
201
|
}),
|
|
198
|
-
/* @__PURE__ */
|
|
202
|
+
/* @__PURE__ */ K("div", {
|
|
199
203
|
className: "space-y-2",
|
|
200
|
-
children: [/* @__PURE__ */
|
|
204
|
+
children: [/* @__PURE__ */ G(S, {
|
|
201
205
|
htmlFor: "model",
|
|
202
206
|
children: "Model"
|
|
203
|
-
}), /* @__PURE__ */
|
|
207
|
+
}), /* @__PURE__ */ G(x, {
|
|
204
208
|
id: "model",
|
|
205
209
|
value: m.model,
|
|
206
210
|
onChange: (e) => h((t) => ({
|
|
@@ -210,12 +214,12 @@ function J({ editId: t }) {
|
|
|
210
214
|
placeholder: "Transit"
|
|
211
215
|
})]
|
|
212
216
|
}),
|
|
213
|
-
/* @__PURE__ */
|
|
217
|
+
/* @__PURE__ */ K("div", {
|
|
214
218
|
className: "space-y-2",
|
|
215
|
-
children: [/* @__PURE__ */
|
|
219
|
+
children: [/* @__PURE__ */ G(S, {
|
|
216
220
|
htmlFor: "licensePlate",
|
|
217
221
|
children: "License Plate"
|
|
218
|
-
}), /* @__PURE__ */
|
|
222
|
+
}), /* @__PURE__ */ G(x, {
|
|
219
223
|
id: "licensePlate",
|
|
220
224
|
value: m.licensePlate,
|
|
221
225
|
onChange: (e) => h((t) => ({
|
|
@@ -231,231 +235,238 @@ function J({ editId: t }) {
|
|
|
231
235
|
})]
|
|
232
236
|
});
|
|
233
237
|
}
|
|
234
|
-
function
|
|
235
|
-
let { vehicleId: a } =
|
|
236
|
-
|
|
238
|
+
function Z() {
|
|
239
|
+
let { vehicleId: a } = ee(), { basePath: d, navigate: x } = u(), { vehicle: S, isLoading: w, error: T, refetch: E } = f(a), D = B(), { message: O, notify: P } = I(), { t: H } = te(), U = (e, t) => {
|
|
240
|
+
let n = H(e);
|
|
241
|
+
return n === e ? t : n;
|
|
242
|
+
}, Y = W().pathname.endsWith("/edit"), { drivers: Z, isLoading: re, error: Q } = p(Y ? void 0 : a), ie = () => x?.(l(d, "fleet/vehicles")), $ = (e) => x?.(l(d, e));
|
|
243
|
+
return a ? Y ? /* @__PURE__ */ G(X, { editId: a }) : w ? /* @__PURE__ */ G(A, { message: "Loading vehicle details..." }) : T || !S ? /* @__PURE__ */ G(k, {
|
|
237
244
|
title: "Vehicle not found",
|
|
238
245
|
onRetry: E
|
|
239
|
-
}) : /* @__PURE__ */
|
|
246
|
+
}) : /* @__PURE__ */ K(j, {
|
|
240
247
|
title: S.vehicleNumber,
|
|
241
248
|
subtitle: `${S.make} ${S.model} (${S.year})`,
|
|
242
|
-
icon: /* @__PURE__ */
|
|
243
|
-
headerActions: /* @__PURE__ */
|
|
249
|
+
icon: /* @__PURE__ */ G(s, { size: 24 }),
|
|
250
|
+
headerActions: /* @__PURE__ */ K("div", {
|
|
244
251
|
className: "flex gap-2",
|
|
245
|
-
children: [/* @__PURE__ */
|
|
252
|
+
children: [/* @__PURE__ */ K(g, {
|
|
246
253
|
variant: "outline",
|
|
247
|
-
onClick:
|
|
248
|
-
children: [/* @__PURE__ */
|
|
249
|
-
}), /* @__PURE__ */
|
|
254
|
+
onClick: ie,
|
|
255
|
+
children: [/* @__PURE__ */ G(e, { size: 16 }), " Back"]
|
|
256
|
+
}), /* @__PURE__ */ K(g, {
|
|
250
257
|
onClick: () => x?.(l(d, "fleet/vehicles/" + a + "/edit")),
|
|
251
|
-
children: [/* @__PURE__ */
|
|
258
|
+
children: [/* @__PURE__ */ G(o, { size: 16 }), " Edit"]
|
|
252
259
|
})]
|
|
253
260
|
}),
|
|
254
|
-
headerContent: /* @__PURE__ */
|
|
261
|
+
headerContent: /* @__PURE__ */ K("div", {
|
|
255
262
|
className: "flex gap-2",
|
|
256
|
-
children: [/* @__PURE__ */
|
|
263
|
+
children: [/* @__PURE__ */ G(M, {
|
|
257
264
|
status: S.status,
|
|
258
265
|
type: "vehicle"
|
|
259
|
-
}), /* @__PURE__ */
|
|
266
|
+
}), /* @__PURE__ */ G(N, { type: S.type })]
|
|
260
267
|
}),
|
|
261
268
|
children: [
|
|
262
|
-
/* @__PURE__ */
|
|
263
|
-
icon: /* @__PURE__ */
|
|
269
|
+
/* @__PURE__ */ G(J, {
|
|
270
|
+
icon: /* @__PURE__ */ G(s, { size: 18 }),
|
|
264
271
|
children: "The full record for this vehicle — specs, capacity, fuel and mileage, who is driving it and where it is right now. Use it to confirm a vehicle is fuelled, crewed and the right size before dispatching it on a delivery."
|
|
265
272
|
}),
|
|
266
|
-
/* @__PURE__ */
|
|
273
|
+
/* @__PURE__ */ G(ne, {
|
|
267
274
|
storageKey: "movethewheels-vehicle-details",
|
|
268
275
|
steps: [{
|
|
269
276
|
id: "assign",
|
|
270
277
|
label: "Assign to a delivery",
|
|
271
278
|
description: "Put this vehicle on an order that fits its capacity.",
|
|
272
|
-
icon: /* @__PURE__ */
|
|
273
|
-
onClick: () =>
|
|
279
|
+
icon: /* @__PURE__ */ G(r, { size: 16 }),
|
|
280
|
+
onClick: () => $("orders")
|
|
274
281
|
}, {
|
|
275
282
|
id: "driver",
|
|
276
|
-
label:
|
|
283
|
+
label: Z.length > 0 ? "Review the assigned driver" : "Assign a driver",
|
|
277
284
|
description: "A vehicle needs a driver before it can be dispatched.",
|
|
278
|
-
icon: /* @__PURE__ */
|
|
279
|
-
done:
|
|
280
|
-
onClick: () =>
|
|
285
|
+
icon: /* @__PURE__ */ G(c, { size: 16 }),
|
|
286
|
+
done: Z.length > 0,
|
|
287
|
+
onClick: () => Z[0] ? $(`fleet/drivers/${Z[0].id}`) : $("fleet/drivers")
|
|
281
288
|
}]
|
|
282
289
|
}),
|
|
283
|
-
/* @__PURE__ */
|
|
290
|
+
O && /* @__PURE__ */ G("div", {
|
|
291
|
+
className: "mb-2",
|
|
292
|
+
children: /* @__PURE__ */ G(F, { message: O })
|
|
293
|
+
}),
|
|
294
|
+
/* @__PURE__ */ K("div", {
|
|
284
295
|
className: "grid grid-cols-1 lg:grid-cols-3 gap-6",
|
|
285
|
-
children: [/* @__PURE__ */
|
|
296
|
+
children: [/* @__PURE__ */ K("div", {
|
|
286
297
|
className: "lg:col-span-2 space-y-6",
|
|
287
298
|
children: [
|
|
288
|
-
/* @__PURE__ */
|
|
299
|
+
/* @__PURE__ */ K(q, { children: [/* @__PURE__ */ G("h2", {
|
|
289
300
|
className: "text-base font-semibold text-text-primary mb-4",
|
|
290
301
|
children: "Vehicle Information"
|
|
291
|
-
}), /* @__PURE__ */
|
|
302
|
+
}), /* @__PURE__ */ K("div", {
|
|
292
303
|
className: "grid grid-cols-2 md:grid-cols-3 gap-6",
|
|
293
304
|
children: [
|
|
294
|
-
/* @__PURE__ */
|
|
305
|
+
/* @__PURE__ */ K("div", { children: [/* @__PURE__ */ G("p", {
|
|
295
306
|
className: "text-sm text-text-secondary",
|
|
296
307
|
children: "Type"
|
|
297
|
-
}), /* @__PURE__ */
|
|
308
|
+
}), /* @__PURE__ */ G("p", {
|
|
298
309
|
className: "font-medium capitalize",
|
|
299
310
|
children: S.type
|
|
300
311
|
})] }),
|
|
301
|
-
/* @__PURE__ */
|
|
312
|
+
/* @__PURE__ */ K("div", { children: [/* @__PURE__ */ G("p", {
|
|
302
313
|
className: "text-sm text-text-secondary",
|
|
303
314
|
children: "Make"
|
|
304
|
-
}), /* @__PURE__ */
|
|
315
|
+
}), /* @__PURE__ */ G("p", {
|
|
305
316
|
className: "font-medium",
|
|
306
317
|
children: S.make || "—"
|
|
307
318
|
})] }),
|
|
308
|
-
/* @__PURE__ */
|
|
319
|
+
/* @__PURE__ */ K("div", { children: [/* @__PURE__ */ G("p", {
|
|
309
320
|
className: "text-sm text-text-secondary",
|
|
310
321
|
children: "Model"
|
|
311
|
-
}), /* @__PURE__ */
|
|
322
|
+
}), /* @__PURE__ */ G("p", {
|
|
312
323
|
className: "font-medium",
|
|
313
324
|
children: S.model || "—"
|
|
314
325
|
})] }),
|
|
315
|
-
/* @__PURE__ */
|
|
326
|
+
/* @__PURE__ */ K("div", { children: [/* @__PURE__ */ G("p", {
|
|
316
327
|
className: "text-sm text-text-secondary",
|
|
317
328
|
children: "Year"
|
|
318
|
-
}), /* @__PURE__ */
|
|
329
|
+
}), /* @__PURE__ */ G("p", {
|
|
319
330
|
className: "font-medium",
|
|
320
331
|
children: S.year
|
|
321
332
|
})] }),
|
|
322
|
-
/* @__PURE__ */
|
|
333
|
+
/* @__PURE__ */ K("div", { children: [/* @__PURE__ */ G("p", {
|
|
323
334
|
className: "text-sm text-text-secondary",
|
|
324
335
|
children: "License Plate"
|
|
325
|
-
}), /* @__PURE__ */
|
|
336
|
+
}), /* @__PURE__ */ G("p", {
|
|
326
337
|
className: "font-medium",
|
|
327
338
|
children: S.licensePlate || "—"
|
|
328
339
|
})] }),
|
|
329
|
-
/* @__PURE__ */
|
|
340
|
+
/* @__PURE__ */ K("div", { children: [/* @__PURE__ */ G("p", {
|
|
330
341
|
className: "text-sm text-text-secondary",
|
|
331
342
|
children: "Ownership"
|
|
332
|
-
}), /* @__PURE__ */
|
|
343
|
+
}), /* @__PURE__ */ G("p", {
|
|
333
344
|
className: "font-medium capitalize",
|
|
334
345
|
children: S.ownershipType || "—"
|
|
335
346
|
})] })
|
|
336
347
|
]
|
|
337
348
|
})] }),
|
|
338
|
-
/* @__PURE__ */
|
|
349
|
+
/* @__PURE__ */ K(_, { children: [/* @__PURE__ */ G(y, { children: /* @__PURE__ */ G(b, { children: "Capacity" }) }), /* @__PURE__ */ G(v, { children: /* @__PURE__ */ K("div", {
|
|
339
350
|
className: "grid grid-cols-1 sm:grid-cols-3 gap-6",
|
|
340
351
|
children: [
|
|
341
|
-
/* @__PURE__ */
|
|
352
|
+
/* @__PURE__ */ K("div", { children: [/* @__PURE__ */ G("p", {
|
|
342
353
|
className: "text-sm text-text-secondary",
|
|
343
354
|
children: "Weight"
|
|
344
|
-
}), /* @__PURE__ */
|
|
355
|
+
}), /* @__PURE__ */ K("p", {
|
|
345
356
|
className: "text-2xl font-bold",
|
|
346
|
-
children: [S.capacity.weight, /* @__PURE__ */
|
|
357
|
+
children: [S.capacity.weight, /* @__PURE__ */ G("span", {
|
|
347
358
|
className: "text-sm font-normal",
|
|
348
359
|
children: " kg"
|
|
349
360
|
})]
|
|
350
361
|
})] }),
|
|
351
|
-
/* @__PURE__ */
|
|
362
|
+
/* @__PURE__ */ K("div", { children: [/* @__PURE__ */ G("p", {
|
|
352
363
|
className: "text-sm text-text-secondary",
|
|
353
364
|
children: "Volume"
|
|
354
|
-
}), /* @__PURE__ */
|
|
365
|
+
}), /* @__PURE__ */ K("p", {
|
|
355
366
|
className: "text-2xl font-bold",
|
|
356
|
-
children: [S.capacity.volume, /* @__PURE__ */
|
|
367
|
+
children: [S.capacity.volume, /* @__PURE__ */ G("span", {
|
|
357
368
|
className: "text-sm font-normal",
|
|
358
369
|
children: " m³"
|
|
359
370
|
})]
|
|
360
371
|
})] }),
|
|
361
|
-
S.capacity.pallets && /* @__PURE__ */
|
|
372
|
+
S.capacity.pallets && /* @__PURE__ */ K("div", { children: [/* @__PURE__ */ G("p", {
|
|
362
373
|
className: "text-sm text-text-secondary",
|
|
363
374
|
children: "Pallets"
|
|
364
|
-
}), /* @__PURE__ */
|
|
375
|
+
}), /* @__PURE__ */ G("p", {
|
|
365
376
|
className: "text-2xl font-bold",
|
|
366
377
|
children: S.capacity.pallets
|
|
367
378
|
})] })
|
|
368
379
|
]
|
|
369
380
|
}) })] }),
|
|
370
|
-
/* @__PURE__ */
|
|
381
|
+
/* @__PURE__ */ G(z, {
|
|
371
382
|
entityType: "vehicle",
|
|
372
383
|
entityId: S.id
|
|
373
384
|
})
|
|
374
385
|
]
|
|
375
|
-
}), /* @__PURE__ */
|
|
386
|
+
}), /* @__PURE__ */ K("div", {
|
|
376
387
|
className: "space-y-6",
|
|
377
388
|
children: [
|
|
378
|
-
/* @__PURE__ */
|
|
389
|
+
/* @__PURE__ */ K(_, { children: [/* @__PURE__ */ G(y, { children: /* @__PURE__ */ K(b, {
|
|
379
390
|
className: "flex items-center gap-2",
|
|
380
|
-
children: [/* @__PURE__ */
|
|
381
|
-
}) }), /* @__PURE__ */
|
|
391
|
+
children: [/* @__PURE__ */ G(t, { size: 18 }), " Fuel & Mileage"]
|
|
392
|
+
}) }), /* @__PURE__ */ K(v, {
|
|
382
393
|
className: "space-y-4",
|
|
383
|
-
children: [S.fuelLevel !== void 0 && /* @__PURE__ */
|
|
394
|
+
children: [S.fuelLevel !== void 0 && /* @__PURE__ */ K("div", { children: [/* @__PURE__ */ K("div", {
|
|
384
395
|
className: "flex justify-between text-sm mb-2",
|
|
385
|
-
children: [/* @__PURE__ */
|
|
386
|
-
}), /* @__PURE__ */
|
|
396
|
+
children: [/* @__PURE__ */ G("span", { children: "Fuel Level" }), /* @__PURE__ */ K("span", { children: [S.fuelLevel, "%"] })]
|
|
397
|
+
}), /* @__PURE__ */ G(C, { value: S.fuelLevel })] }), S.mileage !== void 0 && /* @__PURE__ */ K("div", { children: [/* @__PURE__ */ G("p", {
|
|
387
398
|
className: "text-sm text-text-secondary",
|
|
388
399
|
children: "Total Mileage"
|
|
389
|
-
}), /* @__PURE__ */
|
|
400
|
+
}), /* @__PURE__ */ K("p", {
|
|
390
401
|
className: "text-2xl font-bold",
|
|
391
402
|
children: [
|
|
392
403
|
S.mileage.toLocaleString(),
|
|
393
404
|
" ",
|
|
394
|
-
/* @__PURE__ */
|
|
405
|
+
/* @__PURE__ */ G("span", {
|
|
395
406
|
className: "text-sm font-normal",
|
|
396
407
|
children: "miles"
|
|
397
408
|
})
|
|
398
409
|
]
|
|
399
410
|
})] })]
|
|
400
411
|
})] }),
|
|
401
|
-
/* @__PURE__ */
|
|
412
|
+
/* @__PURE__ */ K(_, { children: [/* @__PURE__ */ G(y, { children: /* @__PURE__ */ K(b, {
|
|
402
413
|
className: "flex items-center gap-2",
|
|
403
|
-
children: [/* @__PURE__ */
|
|
404
|
-
}) }), /* @__PURE__ */
|
|
414
|
+
children: [/* @__PURE__ */ G(c, { size: 18 }), " Assigned Driver"]
|
|
415
|
+
}) }), /* @__PURE__ */ G(v, {
|
|
405
416
|
className: "space-y-4",
|
|
406
|
-
children:
|
|
417
|
+
children: re ? /* @__PURE__ */ G("p", {
|
|
407
418
|
className: "text-sm text-text-secondary",
|
|
408
419
|
children: "Loading assignment…"
|
|
409
|
-
}) :
|
|
420
|
+
}) : Q ? /* @__PURE__ */ G("p", {
|
|
410
421
|
className: "text-sm text-status-error-text",
|
|
411
|
-
children:
|
|
412
|
-
}) :
|
|
422
|
+
children: Q.message
|
|
423
|
+
}) : Z.length === 0 ? /* @__PURE__ */ K("div", {
|
|
413
424
|
className: "space-y-3",
|
|
414
|
-
children: [/* @__PURE__ */
|
|
425
|
+
children: [/* @__PURE__ */ G("p", {
|
|
415
426
|
className: "text-sm text-text-secondary",
|
|
416
427
|
children: "No driver is assigned to this vehicle yet."
|
|
417
|
-
}), /* @__PURE__ */
|
|
428
|
+
}), /* @__PURE__ */ G(g, {
|
|
418
429
|
variant: "outline",
|
|
419
430
|
size: "sm",
|
|
420
|
-
onClick: () =>
|
|
431
|
+
onClick: () => $("fleet/drivers"),
|
|
421
432
|
children: "Assign from the roster"
|
|
422
433
|
})]
|
|
423
|
-
}) :
|
|
434
|
+
}) : Z.map((e) => /* @__PURE__ */ K("div", {
|
|
424
435
|
role: "button",
|
|
425
436
|
tabIndex: 0,
|
|
426
437
|
className: "flex w-full items-start gap-3 rounded-lg p-2 text-left hover:bg-bg-sunken/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-action-primary-bg",
|
|
427
|
-
onClick: () =>
|
|
438
|
+
onClick: () => $(`fleet/drivers/${e.id}`),
|
|
428
439
|
onKeyDown: (t) => {
|
|
429
|
-
(t.key === "Enter" || t.key === " ") && (t.preventDefault(),
|
|
440
|
+
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), $(`fleet/drivers/${e.id}`));
|
|
430
441
|
},
|
|
431
|
-
children: [/* @__PURE__ */
|
|
442
|
+
children: [/* @__PURE__ */ G(m, { children: /* @__PURE__ */ G(h, { children: R(e.fullName) }) }), /* @__PURE__ */ K("div", {
|
|
432
443
|
className: "min-w-0 space-y-1",
|
|
433
444
|
children: [
|
|
434
|
-
/* @__PURE__ */
|
|
445
|
+
/* @__PURE__ */ G("p", {
|
|
435
446
|
className: "font-medium",
|
|
436
447
|
children: e.fullName
|
|
437
448
|
}),
|
|
438
|
-
/* @__PURE__ */
|
|
449
|
+
/* @__PURE__ */ G("p", {
|
|
439
450
|
className: "text-xs text-text-secondary",
|
|
440
451
|
children: e.employeeId
|
|
441
452
|
}),
|
|
442
|
-
/* @__PURE__ */
|
|
453
|
+
/* @__PURE__ */ G(M, {
|
|
443
454
|
status: e.status,
|
|
444
455
|
type: "driver",
|
|
445
456
|
size: "sm"
|
|
446
457
|
}),
|
|
447
|
-
e.email && /* @__PURE__ */
|
|
458
|
+
e.email && /* @__PURE__ */ K("p", {
|
|
448
459
|
className: "flex items-center gap-1.5 truncate text-sm text-text-secondary",
|
|
449
460
|
children: [
|
|
450
|
-
/* @__PURE__ */
|
|
461
|
+
/* @__PURE__ */ G(n, { size: 13 }),
|
|
451
462
|
" ",
|
|
452
463
|
e.email
|
|
453
464
|
]
|
|
454
465
|
}),
|
|
455
|
-
e.phone && /* @__PURE__ */
|
|
466
|
+
e.phone && /* @__PURE__ */ K("p", {
|
|
456
467
|
className: "flex items-center gap-1.5 text-sm text-text-secondary",
|
|
457
468
|
children: [
|
|
458
|
-
/* @__PURE__ */
|
|
469
|
+
/* @__PURE__ */ G(i, { size: 13 }),
|
|
459
470
|
" ",
|
|
460
471
|
e.phone
|
|
461
472
|
]
|
|
@@ -464,21 +475,28 @@ function Y() {
|
|
|
464
475
|
})]
|
|
465
476
|
}, e.id))
|
|
466
477
|
})] }),
|
|
467
|
-
|
|
478
|
+
/* @__PURE__ */ G(V, {
|
|
479
|
+
vehicle: S,
|
|
480
|
+
t: U,
|
|
481
|
+
onRecord: async (e) => {
|
|
482
|
+
await D(S.id, e), P(U("movethewheels.vehicles.service.saved", "Service recorded.")), E();
|
|
483
|
+
}
|
|
484
|
+
}),
|
|
485
|
+
S.currentLocation && /* @__PURE__ */ K(_, { children: [/* @__PURE__ */ G(y, { children: /* @__PURE__ */ K(b, {
|
|
468
486
|
className: "flex items-center gap-2",
|
|
469
|
-
children: [/* @__PURE__ */
|
|
470
|
-
}) }), /* @__PURE__ */
|
|
487
|
+
children: [/* @__PURE__ */ G(r, { size: 18 }), " Current Location"]
|
|
488
|
+
}) }), /* @__PURE__ */ K(v, { children: [/* @__PURE__ */ G("p", {
|
|
471
489
|
className: "text-sm",
|
|
472
490
|
children: S.currentLocation.address || "Location updating..."
|
|
473
|
-
}), /* @__PURE__ */
|
|
491
|
+
}), /* @__PURE__ */ K("p", {
|
|
474
492
|
className: "text-xs text-text-secondary mt-1",
|
|
475
|
-
children: ["Updated ",
|
|
493
|
+
children: ["Updated ", L(S.currentLocation.timestamp || /* @__PURE__ */ new Date(), "relative")]
|
|
476
494
|
})] })] })
|
|
477
495
|
]
|
|
478
496
|
})]
|
|
479
497
|
})
|
|
480
498
|
]
|
|
481
|
-
}) : /* @__PURE__ */
|
|
499
|
+
}) : /* @__PURE__ */ G(X, {});
|
|
482
500
|
}
|
|
483
501
|
//#endregion
|
|
484
|
-
export {
|
|
502
|
+
export { Z as default };
|
|
@@ -37,17 +37,25 @@ async function f(t, n, r) {
|
|
|
37
37
|
});
|
|
38
38
|
await u();
|
|
39
39
|
try {
|
|
40
|
-
return await
|
|
40
|
+
return await m(i, a, o);
|
|
41
41
|
} finally {
|
|
42
42
|
d();
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
async function p(e
|
|
45
|
+
async function p(e) {
|
|
46
|
+
try {
|
|
47
|
+
let t = ((await e.json()).errors ?? []).map((e) => e.message).filter((e) => typeof e == "string" && e.length > 0);
|
|
48
|
+
return t.length > 0 ? t.join("; ") : null;
|
|
49
|
+
} catch {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
async function m(e, s, c) {
|
|
46
54
|
let l = /* @__PURE__ */ Error("GraphQL request failed");
|
|
47
55
|
for (let u = 0; u <= t; u += 1) {
|
|
48
56
|
let d = u < t;
|
|
49
57
|
u > 0 && await o(Math.min(250 * 2 ** (u - 1), 2e3) + Math.floor(Math.random() * 150));
|
|
50
|
-
let f = new AbortController(),
|
|
58
|
+
let f = new AbortController(), m = setTimeout(() => f.abort(), n);
|
|
51
59
|
try {
|
|
52
60
|
let t = await fetch(e, {
|
|
53
61
|
method: "POST",
|
|
@@ -56,7 +64,8 @@ async function p(e, s, c) {
|
|
|
56
64
|
signal: f.signal
|
|
57
65
|
});
|
|
58
66
|
if (!t.ok) {
|
|
59
|
-
|
|
67
|
+
let e = i(t.status) ? null : await p(t);
|
|
68
|
+
if (l = Error(e ?? `GraphQL request failed with status ${t.status}`), d && i(t.status)) continue;
|
|
60
69
|
throw l;
|
|
61
70
|
}
|
|
62
71
|
let n = await t.json();
|
|
@@ -75,7 +84,7 @@ async function p(e, s, c) {
|
|
|
75
84
|
if (l = !t && e instanceof Error ? e : Error(i), d && (t || r(i) || e instanceof TypeError)) continue;
|
|
76
85
|
throw l;
|
|
77
86
|
} finally {
|
|
78
|
-
clearTimeout(
|
|
87
|
+
clearTimeout(m);
|
|
79
88
|
}
|
|
80
89
|
}
|
|
81
90
|
throw l;
|
package/package.json
CHANGED