@burdenoff/microfe-movethewheels 2026.924.2 → 2026.925.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.
Files changed (47) hide show
  1. package/dist/components/OrderItemRow.js +195 -109
  2. package/dist/components/StatusBadge.js +31 -31
  3. package/dist/constants/index.js +11 -3
  4. package/dist/generated/wspace-operations.d.ts +7 -0
  5. package/dist/hooks/useFleet.js +85 -76
  6. package/dist/hooks/useOrders.js +8 -4
  7. package/dist/hooks/useTracking.js +127 -66
  8. package/dist/movethewheels/components/OrderItemRow.d.ts +1 -2
  9. package/dist/movethewheels/components/StatusBadge.d.ts +3 -1
  10. package/dist/movethewheels/constants/index.d.ts +1 -0
  11. package/dist/movethewheels/hooks/useFleet.d.ts +41 -1
  12. package/dist/movethewheels/hooks/useOrders.d.ts +1 -0
  13. package/dist/movethewheels/hooks/useTracking.d.ts +2 -2
  14. package/dist/movethewheels/types/index.d.ts +17 -39
  15. package/dist/node_modules/lucide-react/dist/esm/icons/sticky-note.js +11 -0
  16. package/dist/node_modules/lucide-react/dist/esm/icons/user-x.js +30 -0
  17. package/dist/pages/CreateOrderPage.js +597 -420
  18. package/dist/pages/DriverDetailsPage.js +702 -421
  19. package/dist/pages/DriversPage.js +106 -117
  20. package/dist/pages/FleetPage.js +4 -10
  21. package/dist/pages/OrderDetailsPage.js +290 -262
  22. package/dist/pages/OrdersListPage.js +4 -0
  23. package/dist/pages/RouteDetailsPage.js +264 -252
  24. package/dist/pages/TrackingPage.js +205 -195
  25. package/dist/pages/VehicleDetailsPage.js +403 -243
  26. package/dist/utils/mapMarkers.js +2 -1
  27. package/package.json +1 -1
  28. package/src/generated/wspace-operations.ts +10 -3
  29. package/src/movethewheels/components/OrderItemRow.tsx +162 -99
  30. package/src/movethewheels/components/StatusBadge.tsx +11 -2
  31. package/src/movethewheels/constants/index.ts +13 -0
  32. package/src/movethewheels/hooks/useFleet.ts +163 -44
  33. package/src/movethewheels/hooks/useOrders.ts +17 -3
  34. package/src/movethewheels/hooks/useTracking.ts +208 -27
  35. package/src/movethewheels/pages/CreateOrderPage.tsx +372 -263
  36. package/src/movethewheels/pages/DriverDetailsPage.tsx +516 -156
  37. package/src/movethewheels/pages/DriversPage.tsx +28 -11
  38. package/src/movethewheels/pages/FleetPage.tsx +7 -10
  39. package/src/movethewheels/pages/OrderDetailsPage.tsx +67 -30
  40. package/src/movethewheels/pages/OrdersListPage.tsx +1 -0
  41. package/src/movethewheels/pages/RouteDetailsPage.tsx +15 -7
  42. package/src/movethewheels/pages/TrackingPage.tsx +44 -14
  43. package/src/movethewheels/pages/VehicleDetailsPage.tsx +137 -15
  44. package/src/movethewheels/types/index.ts +17 -38
  45. package/src/movethewheels/utils/mapMarkers.ts +1 -0
  46. package/src/operations/wspace/movethewheels/queries/dashboard.graphql +5 -0
  47. package/src/operations/wspace/movethewheels/queries/logistics.graphql +2 -2
@@ -9,23 +9,23 @@ import { Truck as s } from "../node_modules/lucide-react/dist/esm/icons/truck.js
9
9
  import { UserRound as c } from "../node_modules/lucide-react/dist/esm/icons/user-round.js";
10
10
  import { joinPath as l } from "../utils/navigation.js";
11
11
  import { useMoveTheWheels as u } from "../providers/MoveTheWheelsProvider.js";
12
- import { useFleet as d, useVehicle as f, useVehicleDrivers as p } from "../hooks/useFleet.js";
13
- import { Avatar as m, AvatarFallback as h, Button as g, Card as _, CardContent as v, CardHeader as y, CardTitle as b, Input as x, Label as S, Progress as C, Select as w, SelectContent as T, SelectItem as E, SelectTrigger as D, SelectValue as O } from "../components/ui.js";
14
- import { ErrorState as k, LoadingState as A, PageLayout as j } from "../components/PageLayout.js";
15
- import { StatusBadge as M, VehicleTypeBadge as N } from "../components/StatusBadge.js";
16
- import { FormError as P } from "../components/FormError.js";
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";
12
+ import { toApiVehicleStatus as d, useFleet as f, useVehicle as p, useVehicleDrivers as m } from "../hooks/useFleet.js";
13
+ import { Avatar as h, AvatarFallback as g, Button as _, Card as v, CardContent as y, CardHeader as b, CardTitle as x, Input as S, Label as C, Progress as w, Select as T, SelectContent as E, SelectItem as D, SelectTrigger as O, SelectValue as k } from "../components/ui.js";
14
+ import { ErrorState as A, LoadingState as j, PageLayout as M } from "../components/PageLayout.js";
15
+ import { StatusBadge as N, VehicleTypeBadge as P } from "../components/StatusBadge.js";
16
+ import { FormError as F } from "../components/FormError.js";
17
+ import { Notice as I, useNotice as L } from "../components/Notice.js";
18
+ import { formatDate as R, getInitials as z } from "../utils/formatters.js";
19
+ import { DocumentsCard as B } from "../components/DocumentsCard.js";
20
+ import { useRecordVehicleService as V } from "../hooks/useFleetIntelligence.js";
21
+ import { VehicleServiceCard as ee } from "../components/VehicleServiceCard.js";
22
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
+ import { useLocation as te, useParams as ne } from "react-router";
24
+ import { jsx as W, jsxs as G } from "react/jsx-runtime";
25
+ import { useI18n as re } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
26
+ import { EmphasisPanel as K, NextSteps as ie, PagePurpose as q } from "@burdenoff/fe-libs/ui";
27
27
  //#region src/movethewheels/pages/VehicleDetailsPage.tsx
28
- var Y = [
28
+ var J = [
29
29
  {
30
30
  value: "TRUCK",
31
31
  label: "Truck"
@@ -58,380 +58,540 @@ var Y = [
58
58
  value: "DRONE",
59
59
  label: "Drone"
60
60
  }
61
+ ], Y = [
62
+ {
63
+ value: "available",
64
+ label: "Available"
65
+ },
66
+ {
67
+ value: "assigned",
68
+ label: "In Transit"
69
+ },
70
+ {
71
+ value: "maintenance",
72
+ label: "Maintenance"
73
+ },
74
+ {
75
+ value: "out_of_service",
76
+ label: "Out of Service"
77
+ }
78
+ ], X = [
79
+ {
80
+ value: "owned",
81
+ label: "Owned"
82
+ },
83
+ {
84
+ value: "leased",
85
+ label: "Leased"
86
+ },
87
+ {
88
+ value: "rented",
89
+ label: "Rented"
90
+ }
61
91
  ];
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({
92
+ function Z({ editId: t }) {
93
+ let { basePath: n, navigate: r } = u(), { createVehicle: i, updateVehicle: o } = f(), { vehicle: c } = p(t), m = !!t, [h, g] = U({
64
94
  vehicleNumber: "",
65
95
  type: "VAN",
66
96
  make: "",
67
97
  model: "",
68
- licensePlate: ""
69
- }), [_, v] = U(!1), [y, b] = U(null);
98
+ licensePlate: "",
99
+ ownershipType: "",
100
+ year: "",
101
+ status: "available",
102
+ fuelType: "",
103
+ fuelEfficiencyLPer100Km: ""
104
+ }), [v, y] = U(!1), [b, x] = U(null);
70
105
  H(() => {
71
- t && c && h({
106
+ t && c && g({
72
107
  vehicleNumber: c.vehicleNumber ?? "",
73
108
  type: c.type ? c.type.toUpperCase() : "VAN",
74
109
  make: c.make ?? "",
75
110
  model: c.model ?? "",
76
- licensePlate: c.licensePlate ?? ""
111
+ licensePlate: c.licensePlate ?? "",
112
+ ownershipType: c.ownershipType ?? "",
113
+ year: c.year ? String(c.year) : "",
114
+ status: c.status,
115
+ fuelType: c.fuelType ?? "",
116
+ fuelEfficiencyLPer100Km: c.fuelEfficiencyLPer100Km === void 0 ? "" : String(c.fuelEfficiencyLPer100Km)
77
117
  });
78
118
  }, [t, c]);
79
- let C = () => r?.(l(n, "fleet/vehicles")), k = async (e) => {
80
- if (e.preventDefault(), !m.vehicleNumber.trim()) {
81
- b("Vehicle number is required.");
119
+ let w = () => r?.(l(n, "fleet/vehicles")), A = async (e) => {
120
+ if (e.preventDefault(), !h.vehicleNumber.trim()) {
121
+ x("Vehicle number is required.");
82
122
  return;
83
123
  }
84
- v(!0), b(null);
124
+ y(!0), x(null);
85
125
  try {
126
+ let e = {
127
+ vehicleNumber: h.vehicleNumber.trim(),
128
+ type: h.type,
129
+ make: h.make.trim() || void 0,
130
+ model: h.model.trim() || void 0,
131
+ licensePlate: h.licensePlate.trim() || void 0,
132
+ ownershipType: h.ownershipType || void 0,
133
+ year: h.year ? Number(h.year) : void 0,
134
+ status: d(h.status),
135
+ fuelType: h.fuelType || void 0,
136
+ fuelEfficiencyLPer100Km: h.fuelEfficiencyLPer100Km ? Number(h.fuelEfficiencyLPer100Km) : void 0
137
+ };
86
138
  if (t) {
87
- let e = await o(t, {
88
- vehicleNumber: m.vehicleNumber.trim(),
89
- type: m.type,
90
- make: m.make.trim() || void 0,
91
- model: m.model.trim() || void 0,
92
- licensePlate: m.licensePlate.trim() || void 0
93
- });
94
- r?.(l(n, `fleet/vehicles/${e.id}`));
139
+ let i = await o(t, e);
140
+ r?.(l(n, `fleet/vehicles/${i.id}`));
95
141
  } else {
96
- let e = await i({
97
- vehicleNumber: m.vehicleNumber.trim(),
98
- type: m.type,
99
- make: m.make.trim() || void 0,
100
- model: m.model.trim() || void 0,
101
- licensePlate: m.licensePlate.trim() || void 0
102
- });
103
- r?.(l(n, `fleet/vehicles/${e.id}`));
142
+ let t = await i(e);
143
+ r?.(l(n, `fleet/vehicles/${t.id}`));
104
144
  }
105
145
  } catch (e) {
106
- console.error("Failed to create vehicle:", e), b(e instanceof Error ? e.message : "Failed to create vehicle. Please try again."), v(!1);
146
+ console.error("Failed to create vehicle:", e), x(e instanceof Error ? e.message : "Failed to create vehicle. Please try again."), y(!1);
107
147
  }
108
148
  };
109
- return /* @__PURE__ */ K(j, {
110
- title: p ? "Edit Vehicle" : "Add Vehicle",
149
+ return /* @__PURE__ */ G(M, {
150
+ title: m ? "Edit Vehicle" : "Add Vehicle",
111
151
  subtitle: "Register a new vehicle in your fleet",
112
- icon: /* @__PURE__ */ G(s, { size: 24 }),
113
- headerActions: /* @__PURE__ */ K("div", {
152
+ icon: /* @__PURE__ */ W(s, { size: 24 }),
153
+ headerActions: /* @__PURE__ */ G("div", {
114
154
  className: "flex gap-2",
115
- children: [/* @__PURE__ */ K(g, {
155
+ children: [/* @__PURE__ */ G(_, {
116
156
  variant: "outline",
117
- onClick: C,
118
- disabled: _,
119
- children: [/* @__PURE__ */ G(e, { size: 16 }), " Cancel"]
120
- }), /* @__PURE__ */ K(g, {
121
- onClick: k,
122
- disabled: _,
157
+ onClick: w,
158
+ disabled: v,
159
+ children: [/* @__PURE__ */ W(e, { size: 16 }), " Cancel"]
160
+ }), /* @__PURE__ */ G(_, {
161
+ onClick: A,
162
+ disabled: v,
123
163
  children: [
124
- /* @__PURE__ */ G(a, { size: 16 }),
164
+ /* @__PURE__ */ W(a, { size: 16 }),
125
165
  " ",
126
- p ? _ ? "Saving..." : "Save Changes" : _ ? "Saving..." : "Add Vehicle"
166
+ m ? v ? "Saving..." : "Save Changes" : v ? "Saving..." : "Add Vehicle"
127
167
  ]
128
168
  })]
129
169
  }),
130
- children: [/* @__PURE__ */ G(J, {
131
- icon: /* @__PURE__ */ G(s, { size: 18 }),
170
+ children: [/* @__PURE__ */ W(q, {
171
+ icon: /* @__PURE__ */ W(s, { size: 18 }),
132
172
  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."
133
- }), /* @__PURE__ */ K("form", {
134
- onSubmit: k,
173
+ }), /* @__PURE__ */ G("form", {
174
+ onSubmit: A,
135
175
  className: "max-w-2xl space-y-6",
136
- children: [/* @__PURE__ */ G(P, { message: y }), /* @__PURE__ */ K(q, { children: [/* @__PURE__ */ G("h2", {
176
+ children: [/* @__PURE__ */ W(F, { message: b }), /* @__PURE__ */ G(K, { children: [/* @__PURE__ */ W("h2", {
137
177
  className: "text-base font-semibold text-text-primary mb-4",
138
178
  children: "Vehicle Details"
139
- }), /* @__PURE__ */ K("div", {
179
+ }), /* @__PURE__ */ G("div", {
140
180
  className: "space-y-4",
141
- children: [/* @__PURE__ */ K("div", {
142
- className: "grid grid-cols-1 md:grid-cols-2 gap-4",
143
- children: [/* @__PURE__ */ K("div", {
144
- className: "space-y-2",
145
- children: [/* @__PURE__ */ K(S, {
146
- htmlFor: "vehicleNumber",
147
- children: ["Vehicle Number ", /* @__PURE__ */ G("span", {
148
- className: "text-status-error-text",
149
- children: "*"
150
- })]
151
- }), /* @__PURE__ */ G(x, {
152
- id: "vehicleNumber",
153
- value: m.vehicleNumber,
154
- onChange: (e) => h((t) => ({
155
- ...t,
156
- vehicleNumber: e.target.value
157
- })),
158
- placeholder: "MTW-001",
159
- required: !0
160
- })]
161
- }), /* @__PURE__ */ K("div", {
162
- className: "space-y-2",
163
- children: [/* @__PURE__ */ K(S, {
164
- htmlFor: "type",
165
- children: ["Type ", /* @__PURE__ */ G("span", {
166
- className: "text-status-error-text",
167
- children: "*"
181
+ children: [
182
+ /* @__PURE__ */ G("div", {
183
+ className: "grid grid-cols-1 md:grid-cols-2 gap-4",
184
+ children: [/* @__PURE__ */ G("div", {
185
+ className: "space-y-2",
186
+ children: [/* @__PURE__ */ G(C, {
187
+ htmlFor: "vehicleNumber",
188
+ children: ["Vehicle Number ", /* @__PURE__ */ W("span", {
189
+ className: "text-status-error-text",
190
+ children: "*"
191
+ })]
192
+ }), /* @__PURE__ */ W(S, {
193
+ id: "vehicleNumber",
194
+ value: h.vehicleNumber,
195
+ onChange: (e) => g((t) => ({
196
+ ...t,
197
+ vehicleNumber: e.target.value
198
+ })),
199
+ placeholder: "MTW-001",
200
+ required: !0
168
201
  })]
169
- }), /* @__PURE__ */ K(w, {
170
- value: m.type,
171
- onValueChange: (e) => h((t) => ({
172
- ...t,
173
- type: e
174
- })),
175
- children: [/* @__PURE__ */ G(D, {
176
- id: "type",
177
- children: /* @__PURE__ */ G(O, {})
178
- }), /* @__PURE__ */ G(T, { children: Y.map((e) => /* @__PURE__ */ G(E, {
179
- value: e.value,
180
- children: e.label
181
- }, e.value)) })]
182
- })]
183
- })]
184
- }), /* @__PURE__ */ K("div", {
185
- className: "grid grid-cols-1 md:grid-cols-3 gap-4",
186
- children: [
187
- /* @__PURE__ */ K("div", {
202
+ }), /* @__PURE__ */ G("div", {
188
203
  className: "space-y-2",
189
- children: [/* @__PURE__ */ G(S, {
190
- htmlFor: "make",
191
- children: "Make"
192
- }), /* @__PURE__ */ G(x, {
193
- id: "make",
194
- value: m.make,
195
- onChange: (e) => h((t) => ({
204
+ children: [/* @__PURE__ */ G(C, {
205
+ htmlFor: "type",
206
+ children: ["Type ", /* @__PURE__ */ W("span", {
207
+ className: "text-status-error-text",
208
+ children: "*"
209
+ })]
210
+ }), /* @__PURE__ */ G(T, {
211
+ value: h.type,
212
+ onValueChange: (e) => g((t) => ({
196
213
  ...t,
197
- make: e.target.value
214
+ type: e
198
215
  })),
199
- placeholder: "Ford"
216
+ children: [/* @__PURE__ */ W(O, {
217
+ id: "type",
218
+ children: /* @__PURE__ */ W(k, {})
219
+ }), /* @__PURE__ */ W(E, { children: J.map((e) => /* @__PURE__ */ W(D, {
220
+ value: e.value,
221
+ children: e.label
222
+ }, e.value)) })]
200
223
  })]
201
- }),
202
- /* @__PURE__ */ K("div", {
224
+ })]
225
+ }),
226
+ /* @__PURE__ */ G("div", {
227
+ className: "grid grid-cols-1 md:grid-cols-3 gap-4",
228
+ children: [
229
+ /* @__PURE__ */ G("div", {
230
+ className: "space-y-2",
231
+ children: [/* @__PURE__ */ W(C, {
232
+ htmlFor: "make",
233
+ children: "Make"
234
+ }), /* @__PURE__ */ W(S, {
235
+ id: "make",
236
+ value: h.make,
237
+ onChange: (e) => g((t) => ({
238
+ ...t,
239
+ make: e.target.value
240
+ })),
241
+ placeholder: "Ford"
242
+ })]
243
+ }),
244
+ /* @__PURE__ */ G("div", {
245
+ className: "space-y-2",
246
+ children: [/* @__PURE__ */ W(C, {
247
+ htmlFor: "model",
248
+ children: "Model"
249
+ }), /* @__PURE__ */ W(S, {
250
+ id: "model",
251
+ value: h.model,
252
+ onChange: (e) => g((t) => ({
253
+ ...t,
254
+ model: e.target.value
255
+ })),
256
+ placeholder: "Transit"
257
+ })]
258
+ }),
259
+ /* @__PURE__ */ G("div", {
260
+ className: "space-y-2",
261
+ children: [/* @__PURE__ */ W(C, {
262
+ htmlFor: "licensePlate",
263
+ children: "License Plate"
264
+ }), /* @__PURE__ */ W(S, {
265
+ id: "licensePlate",
266
+ value: h.licensePlate,
267
+ onChange: (e) => g((t) => ({
268
+ ...t,
269
+ licensePlate: e.target.value
270
+ })),
271
+ placeholder: "ABC-1234"
272
+ })]
273
+ })
274
+ ]
275
+ }),
276
+ /* @__PURE__ */ G("div", {
277
+ className: "grid grid-cols-1 md:grid-cols-3 gap-4",
278
+ children: [
279
+ /* @__PURE__ */ G("div", {
280
+ className: "space-y-2",
281
+ children: [/* @__PURE__ */ W(C, {
282
+ htmlFor: "ownershipType",
283
+ children: "Ownership"
284
+ }), /* @__PURE__ */ G(T, {
285
+ value: h.ownershipType || void 0,
286
+ onValueChange: (e) => g((t) => ({
287
+ ...t,
288
+ ownershipType: e
289
+ })),
290
+ children: [/* @__PURE__ */ W(O, {
291
+ id: "ownershipType",
292
+ children: /* @__PURE__ */ W(k, { placeholder: "Select ownership" })
293
+ }), /* @__PURE__ */ W(E, { children: X.map((e) => /* @__PURE__ */ W(D, {
294
+ value: e.value,
295
+ children: e.label
296
+ }, e.value)) })]
297
+ })]
298
+ }),
299
+ /* @__PURE__ */ G("div", {
300
+ className: "space-y-2",
301
+ children: [/* @__PURE__ */ W(C, {
302
+ htmlFor: "year",
303
+ children: "Year"
304
+ }), /* @__PURE__ */ W(S, {
305
+ id: "year",
306
+ type: "number",
307
+ min: 1980,
308
+ max: (/* @__PURE__ */ new Date()).getFullYear() + 1,
309
+ value: h.year,
310
+ onChange: (e) => g((t) => ({
311
+ ...t,
312
+ year: e.target.value
313
+ })),
314
+ placeholder: String((/* @__PURE__ */ new Date()).getFullYear())
315
+ })]
316
+ }),
317
+ /* @__PURE__ */ G("div", {
318
+ className: "space-y-2",
319
+ children: [/* @__PURE__ */ W(C, {
320
+ htmlFor: "vehicleStatus",
321
+ children: "Status"
322
+ }), /* @__PURE__ */ G(T, {
323
+ value: h.status,
324
+ onValueChange: (e) => g((t) => ({
325
+ ...t,
326
+ status: e
327
+ })),
328
+ children: [/* @__PURE__ */ W(O, {
329
+ id: "vehicleStatus",
330
+ children: /* @__PURE__ */ W(k, {})
331
+ }), /* @__PURE__ */ W(E, { children: Y.map((e) => /* @__PURE__ */ W(D, {
332
+ value: e.value,
333
+ children: e.label
334
+ }, e.value)) })]
335
+ })]
336
+ })
337
+ ]
338
+ }),
339
+ /* @__PURE__ */ G("div", {
340
+ className: "grid grid-cols-1 md:grid-cols-2 gap-4",
341
+ children: [/* @__PURE__ */ G("div", {
203
342
  className: "space-y-2",
204
- children: [/* @__PURE__ */ G(S, {
205
- htmlFor: "model",
206
- children: "Model"
207
- }), /* @__PURE__ */ G(x, {
208
- id: "model",
209
- value: m.model,
210
- onChange: (e) => h((t) => ({
343
+ children: [/* @__PURE__ */ W(C, {
344
+ htmlFor: "fuelType",
345
+ children: "Fuel Type"
346
+ }), /* @__PURE__ */ W(S, {
347
+ id: "fuelType",
348
+ value: h.fuelType,
349
+ onChange: (e) => g((t) => ({
211
350
  ...t,
212
- model: e.target.value
351
+ fuelType: e.target.value
213
352
  })),
214
- placeholder: "Transit"
353
+ placeholder: "Diesel"
215
354
  })]
216
- }),
217
- /* @__PURE__ */ K("div", {
355
+ }), /* @__PURE__ */ G("div", {
218
356
  className: "space-y-2",
219
- children: [/* @__PURE__ */ G(S, {
220
- htmlFor: "licensePlate",
221
- children: "License Plate"
222
- }), /* @__PURE__ */ G(x, {
223
- id: "licensePlate",
224
- value: m.licensePlate,
225
- onChange: (e) => h((t) => ({
357
+ children: [/* @__PURE__ */ W(C, {
358
+ htmlFor: "fuelEfficiency",
359
+ children: "Fuel Efficiency (L/100km)"
360
+ }), /* @__PURE__ */ W(S, {
361
+ id: "fuelEfficiency",
362
+ type: "number",
363
+ min: 0,
364
+ step: .1,
365
+ value: h.fuelEfficiencyLPer100Km,
366
+ onChange: (e) => g((t) => ({
226
367
  ...t,
227
- licensePlate: e.target.value
368
+ fuelEfficiencyLPer100Km: e.target.value
228
369
  })),
229
- placeholder: "ABC-1234"
370
+ placeholder: "12.5"
230
371
  })]
231
- })
232
- ]
233
- })]
372
+ })]
373
+ })
374
+ ]
234
375
  })] })]
235
376
  })]
236
377
  });
237
378
  }
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);
379
+ function Q() {
380
+ let { vehicleId: a } = ne(), { basePath: d, navigate: f } = u(), { vehicle: S, isLoading: C, error: T, refetch: E } = p(a), D = V(), { message: O, notify: k } = L(), { t: F } = re(), H = (e, t) => {
381
+ let n = F(e);
241
382
  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, {
383
+ }, U = te().pathname.endsWith("/edit"), { drivers: J, isLoading: Y, error: X } = m(U ? void 0 : a), Q = () => f?.(l(d, "fleet/vehicles")), $ = (e) => f?.(l(d, e));
384
+ return a ? U ? /* @__PURE__ */ W(Z, { editId: a }) : C ? /* @__PURE__ */ W(j, { message: "Loading vehicle details..." }) : T || !S ? /* @__PURE__ */ W(A, {
244
385
  title: "Vehicle not found",
245
386
  onRetry: E
246
- }) : /* @__PURE__ */ K(j, {
387
+ }) : /* @__PURE__ */ G(M, {
247
388
  title: S.vehicleNumber,
248
389
  subtitle: `${S.make} ${S.model} (${S.year})`,
249
- icon: /* @__PURE__ */ G(s, { size: 24 }),
250
- headerActions: /* @__PURE__ */ K("div", {
390
+ icon: /* @__PURE__ */ W(s, { size: 24 }),
391
+ headerActions: /* @__PURE__ */ G("div", {
251
392
  className: "flex gap-2",
252
- children: [/* @__PURE__ */ K(g, {
393
+ children: [/* @__PURE__ */ G(_, {
253
394
  variant: "outline",
254
- onClick: ie,
255
- children: [/* @__PURE__ */ G(e, { size: 16 }), " Back"]
256
- }), /* @__PURE__ */ K(g, {
257
- onClick: () => x?.(l(d, "fleet/vehicles/" + a + "/edit")),
258
- children: [/* @__PURE__ */ G(o, { size: 16 }), " Edit"]
395
+ onClick: Q,
396
+ children: [/* @__PURE__ */ W(e, { size: 16 }), " Back"]
397
+ }), /* @__PURE__ */ G(_, {
398
+ onClick: () => f?.(l(d, "fleet/vehicles/" + a + "/edit")),
399
+ children: [/* @__PURE__ */ W(o, { size: 16 }), " Edit"]
259
400
  })]
260
401
  }),
261
- headerContent: /* @__PURE__ */ K("div", {
402
+ headerContent: /* @__PURE__ */ G("div", {
262
403
  className: "flex gap-2",
263
- children: [/* @__PURE__ */ G(M, {
404
+ children: [/* @__PURE__ */ W(N, {
264
405
  status: S.status,
265
406
  type: "vehicle"
266
- }), /* @__PURE__ */ G(N, { type: S.type })]
407
+ }), /* @__PURE__ */ W(P, { type: S.type })]
267
408
  }),
268
409
  children: [
269
- /* @__PURE__ */ G(J, {
270
- icon: /* @__PURE__ */ G(s, { size: 18 }),
410
+ /* @__PURE__ */ W(q, {
411
+ icon: /* @__PURE__ */ W(s, { size: 18 }),
271
412
  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."
272
413
  }),
273
- /* @__PURE__ */ G(ne, {
414
+ /* @__PURE__ */ W(ie, {
274
415
  storageKey: "movethewheels-vehicle-details",
275
416
  steps: [{
276
417
  id: "assign",
277
418
  label: "Assign to a delivery",
278
419
  description: "Put this vehicle on an order that fits its capacity.",
279
- icon: /* @__PURE__ */ G(r, { size: 16 }),
420
+ icon: /* @__PURE__ */ W(r, { size: 16 }),
280
421
  onClick: () => $("orders")
281
422
  }, {
282
423
  id: "driver",
283
- label: Z.length > 0 ? "Review the assigned driver" : "Assign a driver",
424
+ label: J.length > 0 ? "Review the assigned driver" : "Assign a driver",
284
425
  description: "A vehicle needs a driver before it can be dispatched.",
285
- icon: /* @__PURE__ */ G(c, { size: 16 }),
286
- done: Z.length > 0,
287
- onClick: () => Z[0] ? $(`fleet/drivers/${Z[0].id}`) : $("fleet/drivers")
426
+ icon: /* @__PURE__ */ W(c, { size: 16 }),
427
+ done: J.length > 0,
428
+ onClick: () => J[0] ? $(`fleet/drivers/${J[0].id}`) : $("fleet/drivers")
288
429
  }]
289
430
  }),
290
- O && /* @__PURE__ */ G("div", {
431
+ O && /* @__PURE__ */ W("div", {
291
432
  className: "mb-2",
292
- children: /* @__PURE__ */ G(F, { message: O })
433
+ children: /* @__PURE__ */ W(I, { message: O })
293
434
  }),
294
- /* @__PURE__ */ K("div", {
435
+ /* @__PURE__ */ G("div", {
295
436
  className: "grid grid-cols-1 lg:grid-cols-3 gap-6",
296
- children: [/* @__PURE__ */ K("div", {
437
+ children: [/* @__PURE__ */ G("div", {
297
438
  className: "lg:col-span-2 space-y-6",
298
439
  children: [
299
- /* @__PURE__ */ K(q, { children: [/* @__PURE__ */ G("h2", {
440
+ /* @__PURE__ */ G(K, { children: [/* @__PURE__ */ W("h2", {
300
441
  className: "text-base font-semibold text-text-primary mb-4",
301
442
  children: "Vehicle Information"
302
- }), /* @__PURE__ */ K("div", {
443
+ }), /* @__PURE__ */ G("div", {
303
444
  className: "grid grid-cols-2 md:grid-cols-3 gap-6",
304
445
  children: [
305
- /* @__PURE__ */ K("div", { children: [/* @__PURE__ */ G("p", {
446
+ /* @__PURE__ */ G("div", { children: [/* @__PURE__ */ W("p", {
306
447
  className: "text-sm text-text-secondary",
307
448
  children: "Type"
308
- }), /* @__PURE__ */ G("p", {
449
+ }), /* @__PURE__ */ W("p", {
309
450
  className: "font-medium capitalize",
310
451
  children: S.type
311
452
  })] }),
312
- /* @__PURE__ */ K("div", { children: [/* @__PURE__ */ G("p", {
453
+ /* @__PURE__ */ G("div", { children: [/* @__PURE__ */ W("p", {
313
454
  className: "text-sm text-text-secondary",
314
455
  children: "Make"
315
- }), /* @__PURE__ */ G("p", {
456
+ }), /* @__PURE__ */ W("p", {
316
457
  className: "font-medium",
317
458
  children: S.make || "—"
318
459
  })] }),
319
- /* @__PURE__ */ K("div", { children: [/* @__PURE__ */ G("p", {
460
+ /* @__PURE__ */ G("div", { children: [/* @__PURE__ */ W("p", {
320
461
  className: "text-sm text-text-secondary",
321
462
  children: "Model"
322
- }), /* @__PURE__ */ G("p", {
463
+ }), /* @__PURE__ */ W("p", {
323
464
  className: "font-medium",
324
465
  children: S.model || "—"
325
466
  })] }),
326
- /* @__PURE__ */ K("div", { children: [/* @__PURE__ */ G("p", {
467
+ /* @__PURE__ */ G("div", { children: [/* @__PURE__ */ W("p", {
327
468
  className: "text-sm text-text-secondary",
328
469
  children: "Year"
329
- }), /* @__PURE__ */ G("p", {
470
+ }), /* @__PURE__ */ W("p", {
330
471
  className: "font-medium",
331
472
  children: S.year
332
473
  })] }),
333
- /* @__PURE__ */ K("div", { children: [/* @__PURE__ */ G("p", {
474
+ /* @__PURE__ */ G("div", { children: [/* @__PURE__ */ W("p", {
334
475
  className: "text-sm text-text-secondary",
335
476
  children: "License Plate"
336
- }), /* @__PURE__ */ G("p", {
477
+ }), /* @__PURE__ */ W("p", {
337
478
  className: "font-medium",
338
479
  children: S.licensePlate || "—"
339
480
  })] }),
340
- /* @__PURE__ */ K("div", { children: [/* @__PURE__ */ G("p", {
481
+ /* @__PURE__ */ G("div", { children: [/* @__PURE__ */ W("p", {
341
482
  className: "text-sm text-text-secondary",
342
483
  children: "Ownership"
343
- }), /* @__PURE__ */ G("p", {
484
+ }), /* @__PURE__ */ W("p", {
344
485
  className: "font-medium capitalize",
345
486
  children: S.ownershipType || "—"
346
487
  })] })
347
488
  ]
348
489
  })] }),
349
- /* @__PURE__ */ K(_, { children: [/* @__PURE__ */ G(y, { children: /* @__PURE__ */ G(b, { children: "Capacity" }) }), /* @__PURE__ */ G(v, { children: /* @__PURE__ */ K("div", {
490
+ /* @__PURE__ */ G(v, { children: [/* @__PURE__ */ W(b, { children: /* @__PURE__ */ W(x, { children: "Capacity" }) }), /* @__PURE__ */ W(y, { children: /* @__PURE__ */ G("div", {
350
491
  className: "grid grid-cols-1 sm:grid-cols-3 gap-6",
351
492
  children: [
352
- /* @__PURE__ */ K("div", { children: [/* @__PURE__ */ G("p", {
493
+ /* @__PURE__ */ G("div", { children: [/* @__PURE__ */ W("p", {
353
494
  className: "text-sm text-text-secondary",
354
495
  children: "Weight"
355
- }), /* @__PURE__ */ K("p", {
496
+ }), /* @__PURE__ */ G("p", {
356
497
  className: "text-2xl font-bold",
357
- children: [S.capacity.weight, /* @__PURE__ */ G("span", {
498
+ children: [S.capacity.weight, /* @__PURE__ */ W("span", {
358
499
  className: "text-sm font-normal",
359
500
  children: " kg"
360
501
  })]
361
502
  })] }),
362
- /* @__PURE__ */ K("div", { children: [/* @__PURE__ */ G("p", {
503
+ /* @__PURE__ */ G("div", { children: [/* @__PURE__ */ W("p", {
363
504
  className: "text-sm text-text-secondary",
364
505
  children: "Volume"
365
- }), /* @__PURE__ */ K("p", {
506
+ }), /* @__PURE__ */ G("p", {
366
507
  className: "text-2xl font-bold",
367
- children: [S.capacity.volume, /* @__PURE__ */ G("span", {
508
+ children: [S.capacity.volume, /* @__PURE__ */ W("span", {
368
509
  className: "text-sm font-normal",
369
510
  children: " m³"
370
511
  })]
371
512
  })] }),
372
- S.capacity.pallets && /* @__PURE__ */ K("div", { children: [/* @__PURE__ */ G("p", {
513
+ S.capacity.pallets && /* @__PURE__ */ G("div", { children: [/* @__PURE__ */ W("p", {
373
514
  className: "text-sm text-text-secondary",
374
515
  children: "Pallets"
375
- }), /* @__PURE__ */ G("p", {
516
+ }), /* @__PURE__ */ W("p", {
376
517
  className: "text-2xl font-bold",
377
518
  children: S.capacity.pallets
378
519
  })] })
379
520
  ]
380
521
  }) })] }),
381
- /* @__PURE__ */ G(z, {
522
+ /* @__PURE__ */ W(B, {
382
523
  entityType: "vehicle",
383
524
  entityId: S.id
384
525
  })
385
526
  ]
386
- }), /* @__PURE__ */ K("div", {
527
+ }), /* @__PURE__ */ G("div", {
387
528
  className: "space-y-6",
388
529
  children: [
389
- /* @__PURE__ */ K(_, { children: [/* @__PURE__ */ G(y, { children: /* @__PURE__ */ K(b, {
530
+ /* @__PURE__ */ G(v, { children: [/* @__PURE__ */ W(b, { children: /* @__PURE__ */ G(x, {
390
531
  className: "flex items-center gap-2",
391
- children: [/* @__PURE__ */ G(t, { size: 18 }), " Fuel & Mileage"]
392
- }) }), /* @__PURE__ */ K(v, {
532
+ children: [/* @__PURE__ */ W(t, { size: 18 }), " Fuel & Mileage"]
533
+ }) }), /* @__PURE__ */ G(y, {
393
534
  className: "space-y-4",
394
- children: [S.fuelLevel !== void 0 && /* @__PURE__ */ K("div", { children: [/* @__PURE__ */ K("div", {
395
- className: "flex justify-between text-sm mb-2",
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", {
398
- className: "text-sm text-text-secondary",
399
- children: "Total Mileage"
400
- }), /* @__PURE__ */ K("p", {
401
- className: "text-2xl font-bold",
402
- children: [
403
- S.mileage.toLocaleString(),
404
- " ",
405
- /* @__PURE__ */ G("span", {
406
- className: "text-sm font-normal",
407
- children: "miles"
408
- })
409
- ]
410
- })] })]
535
+ children: [
536
+ S.fuelLevel !== void 0 && /* @__PURE__ */ G("div", { children: [/* @__PURE__ */ G("div", {
537
+ className: "flex justify-between text-sm mb-2",
538
+ children: [/* @__PURE__ */ W("span", { children: "Fuel Level" }), /* @__PURE__ */ G("span", { children: [S.fuelLevel, "%"] })]
539
+ }), /* @__PURE__ */ W(w, { value: S.fuelLevel })] }),
540
+ S.mileage !== void 0 && /* @__PURE__ */ G("div", { children: [/* @__PURE__ */ W("p", {
541
+ className: "text-sm text-text-secondary",
542
+ children: "Total Mileage"
543
+ }), /* @__PURE__ */ G("p", {
544
+ className: "text-2xl font-bold",
545
+ children: [
546
+ S.mileage.toLocaleString(),
547
+ " ",
548
+ /* @__PURE__ */ W("span", {
549
+ className: "text-sm font-normal",
550
+ children: "miles"
551
+ })
552
+ ]
553
+ })] }),
554
+ (S.fuelType || S.fuelEfficiencyLPer100Km !== void 0) && /* @__PURE__ */ G("div", {
555
+ className: "grid grid-cols-2 gap-4",
556
+ children: [S.fuelType && /* @__PURE__ */ G("div", { children: [/* @__PURE__ */ W("p", {
557
+ className: "text-sm text-text-secondary",
558
+ children: "Fuel Type"
559
+ }), /* @__PURE__ */ W("p", {
560
+ className: "font-medium",
561
+ children: S.fuelType
562
+ })] }), S.fuelEfficiencyLPer100Km !== void 0 && /* @__PURE__ */ G("div", { children: [/* @__PURE__ */ W("p", {
563
+ className: "text-sm text-text-secondary",
564
+ children: "Efficiency"
565
+ }), /* @__PURE__ */ G("p", {
566
+ className: "font-medium",
567
+ children: [S.fuelEfficiencyLPer100Km, " L/100km"]
568
+ })] })]
569
+ })
570
+ ]
411
571
  })] }),
412
- /* @__PURE__ */ K(_, { children: [/* @__PURE__ */ G(y, { children: /* @__PURE__ */ K(b, {
572
+ /* @__PURE__ */ G(v, { children: [/* @__PURE__ */ W(b, { children: /* @__PURE__ */ G(x, {
413
573
  className: "flex items-center gap-2",
414
- children: [/* @__PURE__ */ G(c, { size: 18 }), " Assigned Driver"]
415
- }) }), /* @__PURE__ */ G(v, {
574
+ children: [/* @__PURE__ */ W(c, { size: 18 }), " Assigned Driver"]
575
+ }) }), /* @__PURE__ */ W(y, {
416
576
  className: "space-y-4",
417
- children: re ? /* @__PURE__ */ G("p", {
577
+ children: Y ? /* @__PURE__ */ W("p", {
418
578
  className: "text-sm text-text-secondary",
419
579
  children: "Loading assignment…"
420
- }) : Q ? /* @__PURE__ */ G("p", {
580
+ }) : X ? /* @__PURE__ */ W("p", {
421
581
  className: "text-sm text-status-error-text",
422
- children: Q.message
423
- }) : Z.length === 0 ? /* @__PURE__ */ K("div", {
582
+ children: X.message
583
+ }) : J.length === 0 ? /* @__PURE__ */ G("div", {
424
584
  className: "space-y-3",
425
- children: [/* @__PURE__ */ G("p", {
585
+ children: [/* @__PURE__ */ W("p", {
426
586
  className: "text-sm text-text-secondary",
427
587
  children: "No driver is assigned to this vehicle yet."
428
- }), /* @__PURE__ */ G(g, {
588
+ }), /* @__PURE__ */ W(_, {
429
589
  variant: "outline",
430
590
  size: "sm",
431
591
  onClick: () => $("fleet/drivers"),
432
592
  children: "Assign from the roster"
433
593
  })]
434
- }) : Z.map((e) => /* @__PURE__ */ K("div", {
594
+ }) : J.map((e) => /* @__PURE__ */ G("div", {
435
595
  role: "button",
436
596
  tabIndex: 0,
437
597
  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",
@@ -439,34 +599,34 @@ function Z() {
439
599
  onKeyDown: (t) => {
440
600
  (t.key === "Enter" || t.key === " ") && (t.preventDefault(), $(`fleet/drivers/${e.id}`));
441
601
  },
442
- children: [/* @__PURE__ */ G(m, { children: /* @__PURE__ */ G(h, { children: R(e.fullName) }) }), /* @__PURE__ */ K("div", {
602
+ children: [/* @__PURE__ */ W(h, { children: /* @__PURE__ */ W(g, { children: z(e.fullName) }) }), /* @__PURE__ */ G("div", {
443
603
  className: "min-w-0 space-y-1",
444
604
  children: [
445
- /* @__PURE__ */ G("p", {
605
+ /* @__PURE__ */ W("p", {
446
606
  className: "font-medium",
447
607
  children: e.fullName
448
608
  }),
449
- /* @__PURE__ */ G("p", {
609
+ /* @__PURE__ */ W("p", {
450
610
  className: "text-xs text-text-secondary",
451
611
  children: e.employeeId
452
612
  }),
453
- /* @__PURE__ */ G(M, {
613
+ /* @__PURE__ */ W(N, {
454
614
  status: e.status,
455
615
  type: "driver",
456
616
  size: "sm"
457
617
  }),
458
- e.email && /* @__PURE__ */ K("p", {
618
+ e.email && /* @__PURE__ */ G("p", {
459
619
  className: "flex items-center gap-1.5 truncate text-sm text-text-secondary",
460
620
  children: [
461
- /* @__PURE__ */ G(n, { size: 13 }),
621
+ /* @__PURE__ */ W(n, { size: 13 }),
462
622
  " ",
463
623
  e.email
464
624
  ]
465
625
  }),
466
- e.phone && /* @__PURE__ */ K("p", {
626
+ e.phone && /* @__PURE__ */ G("p", {
467
627
  className: "flex items-center gap-1.5 text-sm text-text-secondary",
468
628
  children: [
469
- /* @__PURE__ */ G(i, { size: 13 }),
629
+ /* @__PURE__ */ W(i, { size: 13 }),
470
630
  " ",
471
631
  e.phone
472
632
  ]
@@ -475,28 +635,28 @@ function Z() {
475
635
  })]
476
636
  }, e.id))
477
637
  })] }),
478
- /* @__PURE__ */ G(V, {
638
+ /* @__PURE__ */ W(ee, {
479
639
  vehicle: S,
480
- t: U,
640
+ t: H,
481
641
  onRecord: async (e) => {
482
- await D(S.id, e), P(U("movethewheels.vehicles.service.saved", "Service recorded.")), E();
642
+ await D(S.id, e), k(H("movethewheels.vehicles.service.saved", "Service recorded.")), E();
483
643
  }
484
644
  }),
485
- S.currentLocation && /* @__PURE__ */ K(_, { children: [/* @__PURE__ */ G(y, { children: /* @__PURE__ */ K(b, {
645
+ S.currentLocation && /* @__PURE__ */ G(v, { children: [/* @__PURE__ */ W(b, { children: /* @__PURE__ */ G(x, {
486
646
  className: "flex items-center gap-2",
487
- children: [/* @__PURE__ */ G(r, { size: 18 }), " Current Location"]
488
- }) }), /* @__PURE__ */ K(v, { children: [/* @__PURE__ */ G("p", {
647
+ children: [/* @__PURE__ */ W(r, { size: 18 }), " Current Location"]
648
+ }) }), /* @__PURE__ */ G(y, { children: [/* @__PURE__ */ W("p", {
489
649
  className: "text-sm",
490
650
  children: S.currentLocation.address || "Location updating..."
491
- }), /* @__PURE__ */ K("p", {
651
+ }), /* @__PURE__ */ G("p", {
492
652
  className: "text-xs text-text-secondary mt-1",
493
- children: ["Updated ", L(S.currentLocation.timestamp || /* @__PURE__ */ new Date(), "relative")]
653
+ children: ["Updated ", R(S.currentLocation.timestamp || /* @__PURE__ */ new Date(), "relative")]
494
654
  })] })] })
495
655
  ]
496
656
  })]
497
657
  })
498
658
  ]
499
- }) : /* @__PURE__ */ G(X, {});
659
+ }) : /* @__PURE__ */ W(Z, {});
500
660
  }
501
661
  //#endregion
502
- export { Z as default };
662
+ export { Q as default };