@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
@@ -6,516 +6,797 @@ import { MapPin as i } from "../node_modules/lucide-react/dist/esm/icons/map-pin
6
6
  import { Save as a } from "../node_modules/lucide-react/dist/esm/icons/save.js";
7
7
  import { SquarePen as o } from "../node_modules/lucide-react/dist/esm/icons/square-pen.js";
8
8
  import { Star as s } from "../node_modules/lucide-react/dist/esm/icons/star.js";
9
- import { Users as c } from "../node_modules/lucide-react/dist/esm/icons/users.js";
10
- import { joinPath as l } from "../utils/navigation.js";
11
- import { useMoveTheWheels as u } from "../providers/MoveTheWheelsProvider.js";
12
- import { useDriver as d, useFleet as f } from "../hooks/useFleet.js";
13
- import { Badge as p, Button as m, Card as h, CardContent as g, CardHeader as _, CardTitle as v, Input as y, Label as b, Progress as x } from "../components/ui.js";
14
- import { ErrorState as S, LoadingState as C, PageLayout as w } from "../components/PageLayout.js";
15
- import { StatusBadge as T } from "../components/StatusBadge.js";
16
- import { FormError as E } from "../components/FormError.js";
17
- import { formatCurrency as D, formatDate as O } from "../utils/formatters.js";
18
- import { DocumentsCard as k } from "../components/DocumentsCard.js";
19
- import { useEffect as A, useState as j } from "react";
20
- import { useLocation as M, useParams as N } from "react-router";
21
- import { jsx as P, jsxs as F } from "react/jsx-runtime";
22
- import { EmphasisPanel as I, NextSteps as L, PagePurpose as R } from "@burdenoff/fe-libs/ui";
9
+ import { StickyNote as ee } from "../node_modules/lucide-react/dist/esm/icons/sticky-note.js";
10
+ import { Truck as c } from "../node_modules/lucide-react/dist/esm/icons/truck.js";
11
+ import { UserX as l } from "../node_modules/lucide-react/dist/esm/icons/user-x.js";
12
+ import { Users as u } from "../node_modules/lucide-react/dist/esm/icons/users.js";
13
+ import { joinPath as d } from "../utils/navigation.js";
14
+ import { useMoveTheWheels as f } from "../providers/MoveTheWheelsProvider.js";
15
+ import { toApiDriverStatus as p, useDriver as m, useFleet as h, useVehicle as g, useVehicles as _ } from "../hooks/useFleet.js";
16
+ import { Button as v, Card as y, CardContent as b, CardHeader as x, CardTitle as S, Input as C, Label as w, Select as T, SelectContent as E, SelectItem as D, SelectTrigger as O, SelectValue as k, Textarea as A } from "../components/ui.js";
17
+ import { ErrorState as j, LoadingState as te, PageLayout as M } from "../components/PageLayout.js";
18
+ import { DRIVER_STATUS_LABELS as N } from "../constants/index.js";
19
+ import { StatusBadge as P } from "../components/StatusBadge.js";
20
+ import { FormError as F } from "../components/FormError.js";
21
+ import { formatCurrency as I, formatDate as L } from "../utils/formatters.js";
22
+ import { DocumentsCard as R } from "../components/DocumentsCard.js";
23
+ import { useDebouncedValue as ne } from "../hooks/useDebouncedValue.js";
24
+ import { EntityCombobox as re } from "../components/EntityCombobox.js";
25
+ import { useEffect as ie, useState as z } from "react";
26
+ import { useLocation as B, useParams as V } from "react-router";
27
+ import { Fragment as H, jsx as U, jsxs as W } from "react/jsx-runtime";
28
+ import { EmphasisPanel as ae, NextSteps as G, PagePurpose as K, ResponsiveDialog as oe, ResponsiveDialogContent as se, ResponsiveDialogDescription as ce, ResponsiveDialogFooter as le, ResponsiveDialogHeader as ue, ResponsiveDialogTitle as de } from "@burdenoff/fe-libs/ui";
23
29
  //#region src/movethewheels/pages/DriverDetailsPage.tsx
24
- function z({ editId: t }) {
25
- let { basePath: n, navigate: r } = u(), { createDriver: i, updateDriver: o } = f(), { driver: s } = d(t), p = !!t, [h, g] = j({
26
- employeeId: "",
27
- firstName: "",
28
- lastName: "",
29
- email: "",
30
- phone: "",
31
- licenseNumber: ""
32
- }), [_, v] = j(!1), [x, S] = j(null);
33
- A(() => {
34
- if (!t || !s) return;
35
- let [e, ...n] = s.fullName.trim().split(/\s+/);
36
- g({
37
- employeeId: s.employeeId || "",
30
+ var fe = Object.entries(N).map(([e, t]) => ({
31
+ value: e,
32
+ label: t
33
+ })), q = (e) => e ? e.toISOString().slice(0, 10) : "", pe = (e) => e ? `${e}T12:00:00.000Z` : void 0, me = {
34
+ employeeId: "",
35
+ firstName: "",
36
+ lastName: "",
37
+ email: "",
38
+ phone: "",
39
+ licenseNumber: "",
40
+ licenseClass: "",
41
+ licenseExpiry: "",
42
+ status: "available",
43
+ vehicleId: "",
44
+ rating: "",
45
+ notes: "",
46
+ hireDate: "",
47
+ baseSalary: "",
48
+ bonusYtd: "",
49
+ payCurrency: "",
50
+ onLeaveUntil: ""
51
+ };
52
+ function J({ editId: t }) {
53
+ let { basePath: r, navigate: i } = f(), { createDriver: o, updateDriver: s } = h(), { driver: j, refetch: te } = m(t), N = !!t, [P, I] = z(me), [R, B] = z(!1), [V, G] = z(null), [J, Y] = z(!1), [X, he] = z(""), [Z, ge] = z(!1), [_e, Q] = z(null), [ve, ye] = z(""), { vehicles: be, isLoading: xe } = _({
54
+ limit: 20,
55
+ search: ne(ve) || void 0
56
+ }), { vehicle: Se, isLoading: Ce } = g(P.vehicleId || void 0);
57
+ ie(() => {
58
+ if (!t || !j) return;
59
+ let [e, ...n] = j.fullName.trim().split(/\s+/);
60
+ I({
61
+ employeeId: j.employeeId || "",
38
62
  firstName: e || "",
39
63
  lastName: n.join(" "),
40
- email: s.email || "",
41
- phone: s.phone || "",
42
- licenseNumber: s.licenseNumber || ""
64
+ email: j.email || "",
65
+ phone: j.phone || "",
66
+ licenseNumber: j.licenseNumber || "",
67
+ licenseClass: j.licenseType || "",
68
+ licenseExpiry: q(j.licenseExpiry),
69
+ status: j.status,
70
+ vehicleId: j.assignedVehicle || "",
71
+ rating: j.rating ? String(j.rating) : "",
72
+ notes: j.notes || "",
73
+ hireDate: q(j.hireDate),
74
+ baseSalary: j.baseSalary === void 0 ? "" : String(j.baseSalary),
75
+ bonusYtd: j.bonusYtd === void 0 ? "" : String(j.bonusYtd),
76
+ payCurrency: j.payCurrency || "",
77
+ onLeaveUntil: q(j.onLeaveUntil)
43
78
  });
44
- }, [t, s]);
45
- let C = () => r?.(l(n, "fleet/drivers")), T = async (e) => {
46
- if (e.preventDefault(), !h.employeeId.trim() || !h.firstName.trim() || !h.lastName.trim()) {
47
- S("Employee ID, first name and last name are required.");
79
+ }, [t, j]);
80
+ let we = () => i?.(d(r, "fleet/drivers")), $ = () => ({
81
+ employeeId: P.employeeId.trim(),
82
+ firstName: P.firstName.trim(),
83
+ lastName: P.lastName.trim(),
84
+ email: P.email.trim() || void 0,
85
+ phone: P.phone.trim() || void 0,
86
+ licenseNumber: P.licenseNumber.trim() || void 0,
87
+ licenseClass: P.licenseClass.trim() || void 0,
88
+ licenseExpiry: pe(P.licenseExpiry),
89
+ status: p(P.status),
90
+ vehicleId: P.vehicleId || void 0,
91
+ rating: P.rating ? Number(P.rating) : void 0,
92
+ notes: P.notes.trim() || void 0,
93
+ hireDate: pe(P.hireDate),
94
+ baseSalary: P.baseSalary ? Number(P.baseSalary) : void 0,
95
+ bonusYtd: P.bonusYtd ? Number(P.bonusYtd) : void 0,
96
+ payCurrency: P.payCurrency.trim() || void 0
97
+ }), Te = async (e) => {
98
+ if (e.preventDefault(), !P.employeeId.trim() || !P.firstName.trim() || !P.lastName.trim()) {
99
+ G("Employee ID, first name and last name are required.");
48
100
  return;
49
101
  }
50
- v(!0), S(null);
102
+ if (!P.phone.trim()) {
103
+ G("Phone is required so this driver can be reached.");
104
+ return;
105
+ }
106
+ B(!0), G(null);
51
107
  try {
52
108
  if (t) {
53
- let e = await o(t, {
54
- employeeId: h.employeeId.trim(),
55
- firstName: h.firstName.trim(),
56
- lastName: h.lastName.trim(),
57
- email: h.email.trim() || void 0,
58
- phone: h.phone.trim() || void 0,
59
- licenseNumber: h.licenseNumber.trim() || void 0
60
- });
61
- r?.(l(n, `fleet/drivers/${e.id}`));
109
+ let e = await s(t, $());
110
+ i?.(d(r, `fleet/drivers/${e.id}`));
62
111
  } else {
63
- let e = await i({
64
- employeeId: h.employeeId.trim(),
65
- firstName: h.firstName.trim(),
66
- lastName: h.lastName.trim(),
67
- email: h.email.trim() || void 0,
68
- phone: h.phone.trim() || void 0,
69
- licenseNumber: h.licenseNumber.trim() || void 0
70
- });
71
- r?.(l(n, `fleet/drivers/${e.id}`));
112
+ let e = await o($());
113
+ i?.(d(r, `fleet/drivers/${e.id}`));
72
114
  }
73
115
  } catch (e) {
74
- console.error("Failed to save driver:", e), S(e instanceof Error ? e.message : "Failed to save driver. Please try again."), v(!1);
116
+ console.error("Failed to save driver:", e), G(e instanceof Error ? e.message : "Failed to save driver. Please try again."), B(!1);
117
+ }
118
+ }, Ee = async () => {
119
+ if (!t || !X.trim()) {
120
+ Q("A reason is required to dismiss a driver.");
121
+ return;
75
122
  }
76
- };
77
- return /* @__PURE__ */ F(w, {
78
- title: p ? "Edit Driver" : "Add Driver",
123
+ ge(!0), Q(null);
124
+ try {
125
+ await s(t, {
126
+ ...$(),
127
+ terminatedAt: (/* @__PURE__ */ new Date()).toISOString(),
128
+ terminationReason: X.trim()
129
+ }), Y(!1), await te(), i?.(d(r, `fleet/drivers/${t}`));
130
+ } catch (e) {
131
+ Q(e instanceof Error ? e.message : "Failed to dismiss driver.");
132
+ } finally {
133
+ ge(!1);
134
+ }
135
+ }, De = N && !!j?.terminatedAt;
136
+ return /* @__PURE__ */ W(M, {
137
+ title: N ? "Edit Driver" : "Add Driver",
79
138
  subtitle: "Add a driver to your workforce",
80
- icon: /* @__PURE__ */ P(c, { size: 24 }),
81
- headerActions: /* @__PURE__ */ F("div", {
139
+ icon: /* @__PURE__ */ U(u, { size: 24 }),
140
+ headerActions: /* @__PURE__ */ W("div", {
82
141
  className: "flex gap-2",
83
- children: [/* @__PURE__ */ F(m, {
142
+ children: [/* @__PURE__ */ W(v, {
84
143
  variant: "outline",
85
- onClick: C,
86
- disabled: _,
87
- children: [/* @__PURE__ */ P(e, { size: 16 }), " Cancel"]
88
- }), /* @__PURE__ */ F(m, {
89
- onClick: T,
90
- disabled: _,
144
+ onClick: we,
145
+ disabled: R,
146
+ children: [/* @__PURE__ */ U(e, { size: 16 }), " Cancel"]
147
+ }), /* @__PURE__ */ W(v, {
148
+ onClick: Te,
149
+ disabled: R,
91
150
  children: [
92
- /* @__PURE__ */ P(a, { size: 16 }),
151
+ /* @__PURE__ */ U(a, { size: 16 }),
93
152
  " ",
94
- p ? _ ? "Saving..." : "Save Changes" : _ ? "Saving..." : "Add Driver"
153
+ N ? R ? "Saving..." : "Save Changes" : R ? "Saving..." : "Add Driver"
95
154
  ]
96
155
  })]
97
156
  }),
98
- children: [/* @__PURE__ */ P(R, {
99
- icon: /* @__PURE__ */ P(c, { size: 18 }),
100
- children: "Add a driver so they can be assigned to orders and routes. An employee ID and name get them on the roster — add contact details and license number to keep the record complete."
101
- }), /* @__PURE__ */ F("form", {
102
- onSubmit: T,
103
- className: "max-w-2xl space-y-6",
104
- children: [/* @__PURE__ */ P(E, { message: x }), /* @__PURE__ */ F(I, { children: [/* @__PURE__ */ P("h2", {
105
- className: "text-base font-semibold text-text-primary mb-4",
106
- children: "Driver Details"
107
- }), /* @__PURE__ */ F("div", {
108
- className: "space-y-4",
109
- children: [/* @__PURE__ */ F("div", {
110
- className: "grid grid-cols-1 md:grid-cols-3 gap-4",
157
+ children: [
158
+ /* @__PURE__ */ U(K, {
159
+ icon: /* @__PURE__ */ U(u, { size: 18 }),
160
+ children: "Add a driver so they can be assigned to orders and routes. An employee ID, name and phone get them on the roster — add licensing, a vehicle and HR details to keep the record complete."
161
+ }),
162
+ De && j?.terminatedAt && /* @__PURE__ */ W("div", {
163
+ className: "rounded-card border border-status-error-border bg-status-error-bg-subtle p-4 text-sm text-status-error-text",
164
+ children: [/* @__PURE__ */ W("p", {
165
+ className: "font-medium",
111
166
  children: [
112
- /* @__PURE__ */ F("div", {
113
- className: "space-y-2",
114
- children: [/* @__PURE__ */ F(b, {
115
- htmlFor: "employeeId",
116
- children: ["Employee ID ", /* @__PURE__ */ P("span", {
117
- className: "text-status-error-text",
118
- children: "*"
167
+ "This driver was dismissed on ",
168
+ L(j.terminatedAt, "full"),
169
+ "."
170
+ ]
171
+ }), j.terminationReason && /* @__PURE__ */ W("p", {
172
+ className: "mt-1",
173
+ children: ["Reason: ", j.terminationReason]
174
+ })]
175
+ }),
176
+ /* @__PURE__ */ W("form", {
177
+ onSubmit: Te,
178
+ className: "max-w-3xl space-y-6",
179
+ children: [
180
+ /* @__PURE__ */ U(F, { message: V }),
181
+ /* @__PURE__ */ W(ae, { children: [/* @__PURE__ */ U("h2", {
182
+ className: "text-base font-semibold text-text-primary mb-4",
183
+ children: "Driver Details"
184
+ }), /* @__PURE__ */ W("div", {
185
+ className: "space-y-4",
186
+ children: [
187
+ /* @__PURE__ */ W("div", {
188
+ className: "grid grid-cols-1 md:grid-cols-3 gap-4",
189
+ children: [
190
+ /* @__PURE__ */ W("div", {
191
+ className: "space-y-2",
192
+ children: [/* @__PURE__ */ W(w, {
193
+ htmlFor: "employeeId",
194
+ children: ["Employee ID ", /* @__PURE__ */ U("span", {
195
+ className: "text-status-error-text",
196
+ children: "*"
197
+ })]
198
+ }), /* @__PURE__ */ U(C, {
199
+ id: "employeeId",
200
+ value: P.employeeId,
201
+ onChange: (e) => I((t) => ({
202
+ ...t,
203
+ employeeId: e.target.value
204
+ })),
205
+ placeholder: "EMP-001",
206
+ required: !0
207
+ })]
208
+ }),
209
+ /* @__PURE__ */ W("div", {
210
+ className: "space-y-2",
211
+ children: [/* @__PURE__ */ W(w, {
212
+ htmlFor: "firstName",
213
+ children: ["First Name ", /* @__PURE__ */ U("span", {
214
+ className: "text-status-error-text",
215
+ children: "*"
216
+ })]
217
+ }), /* @__PURE__ */ U(C, {
218
+ id: "firstName",
219
+ value: P.firstName,
220
+ onChange: (e) => I((t) => ({
221
+ ...t,
222
+ firstName: e.target.value
223
+ })),
224
+ placeholder: "Jane",
225
+ required: !0
226
+ })]
227
+ }),
228
+ /* @__PURE__ */ W("div", {
229
+ className: "space-y-2",
230
+ children: [/* @__PURE__ */ W(w, {
231
+ htmlFor: "lastName",
232
+ children: ["Last Name ", /* @__PURE__ */ U("span", {
233
+ className: "text-status-error-text",
234
+ children: "*"
235
+ })]
236
+ }), /* @__PURE__ */ U(C, {
237
+ id: "lastName",
238
+ value: P.lastName,
239
+ onChange: (e) => I((t) => ({
240
+ ...t,
241
+ lastName: e.target.value
242
+ })),
243
+ placeholder: "Doe",
244
+ required: !0
245
+ })]
246
+ })
247
+ ]
248
+ }),
249
+ /* @__PURE__ */ W("div", {
250
+ className: "grid grid-cols-1 md:grid-cols-3 gap-4",
251
+ children: [
252
+ /* @__PURE__ */ W("div", {
253
+ className: "space-y-2",
254
+ children: [/* @__PURE__ */ U(w, {
255
+ htmlFor: "email",
256
+ children: "Email"
257
+ }), /* @__PURE__ */ U(C, {
258
+ id: "email",
259
+ type: "email",
260
+ value: P.email,
261
+ onChange: (e) => I((t) => ({
262
+ ...t,
263
+ email: e.target.value
264
+ })),
265
+ placeholder: "jane.doe@example.com"
266
+ })]
267
+ }),
268
+ /* @__PURE__ */ W("div", {
269
+ className: "space-y-2",
270
+ children: [/* @__PURE__ */ W(w, {
271
+ htmlFor: "phone",
272
+ children: ["Phone ", /* @__PURE__ */ U("span", {
273
+ className: "text-status-error-text",
274
+ children: "*"
275
+ })]
276
+ }), /* @__PURE__ */ U(C, {
277
+ id: "phone",
278
+ value: P.phone,
279
+ onChange: (e) => I((t) => ({
280
+ ...t,
281
+ phone: e.target.value
282
+ })),
283
+ placeholder: "+1-555-0100",
284
+ required: !0
285
+ })]
286
+ }),
287
+ /* @__PURE__ */ W("div", {
288
+ className: "space-y-2",
289
+ children: [/* @__PURE__ */ U(w, {
290
+ htmlFor: "status",
291
+ children: "Status"
292
+ }), /* @__PURE__ */ W(T, {
293
+ value: P.status,
294
+ onValueChange: (e) => I((t) => ({
295
+ ...t,
296
+ status: e
297
+ })),
298
+ children: [/* @__PURE__ */ U(O, {
299
+ id: "status",
300
+ children: /* @__PURE__ */ U(k, {})
301
+ }), /* @__PURE__ */ U(E, { children: fe.map((e) => /* @__PURE__ */ U(D, {
302
+ value: e.value,
303
+ children: e.label
304
+ }, e.value)) })]
305
+ })]
306
+ })
307
+ ]
308
+ }),
309
+ /* @__PURE__ */ W("div", {
310
+ className: "grid grid-cols-1 md:grid-cols-3 gap-4",
311
+ children: [
312
+ /* @__PURE__ */ W("div", {
313
+ className: "space-y-2",
314
+ children: [/* @__PURE__ */ U(w, {
315
+ htmlFor: "licenseNumber",
316
+ children: "License Number"
317
+ }), /* @__PURE__ */ U(C, {
318
+ id: "licenseNumber",
319
+ value: P.licenseNumber,
320
+ onChange: (e) => I((t) => ({
321
+ ...t,
322
+ licenseNumber: e.target.value
323
+ })),
324
+ placeholder: "D1234567"
325
+ })]
326
+ }),
327
+ /* @__PURE__ */ W("div", {
328
+ className: "space-y-2",
329
+ children: [/* @__PURE__ */ U(w, {
330
+ htmlFor: "licenseClass",
331
+ children: "License Class"
332
+ }), /* @__PURE__ */ U(C, {
333
+ id: "licenseClass",
334
+ value: P.licenseClass,
335
+ onChange: (e) => I((t) => ({
336
+ ...t,
337
+ licenseClass: e.target.value
338
+ })),
339
+ placeholder: "Class A"
340
+ })]
341
+ }),
342
+ /* @__PURE__ */ W("div", {
343
+ className: "space-y-2",
344
+ children: [/* @__PURE__ */ U(w, {
345
+ htmlFor: "licenseExpiry",
346
+ children: "License Expiry"
347
+ }), /* @__PURE__ */ U(C, {
348
+ id: "licenseExpiry",
349
+ type: "date",
350
+ value: P.licenseExpiry,
351
+ onChange: (e) => I((t) => ({
352
+ ...t,
353
+ licenseExpiry: e.target.value
354
+ }))
355
+ })]
356
+ })
357
+ ]
358
+ }),
359
+ /* @__PURE__ */ W("div", {
360
+ className: "grid grid-cols-1 md:grid-cols-2 gap-4",
361
+ children: [/* @__PURE__ */ W("div", {
362
+ className: "space-y-2",
363
+ children: [/* @__PURE__ */ U(w, {
364
+ htmlFor: "vehicleSearch",
365
+ children: "Search vehicles"
366
+ }), /* @__PURE__ */ U(C, {
367
+ id: "vehicleSearch",
368
+ value: ve,
369
+ onChange: (e) => ye(e.target.value),
370
+ placeholder: "Vehicle number or type"
371
+ })]
372
+ }), /* @__PURE__ */ W("div", {
373
+ className: "space-y-2",
374
+ children: [/* @__PURE__ */ U(w, {
375
+ htmlFor: "vehicle",
376
+ children: "Assigned Vehicle"
377
+ }), /* @__PURE__ */ U(re, {
378
+ id: "vehicle",
379
+ value: P.vehicleId,
380
+ onChange: (e) => I((t) => ({
381
+ ...t,
382
+ vehicleId: e
383
+ })),
384
+ options: be,
385
+ loading: xe,
386
+ getId: (e) => e.id,
387
+ getLabel: (e) => `${e.vehicleNumber} (${e.type})`,
388
+ renderOption: (e) => /* @__PURE__ */ W(H, { children: [
389
+ /* @__PURE__ */ U(c, {
390
+ size: 14,
391
+ className: "mr-2 inline text-text-secondary"
392
+ }),
393
+ e.vehicleNumber,
394
+ " (",
395
+ e.type,
396
+ ")"
397
+ ] }),
398
+ selectedOption: Se,
399
+ selectedLoading: Ce,
400
+ placeholder: "Unassigned",
401
+ emptyText: "No vehicles match that search."
402
+ })]
119
403
  })]
120
- }), /* @__PURE__ */ P(y, {
121
- id: "employeeId",
122
- value: h.employeeId,
123
- onChange: (e) => g((t) => ({
124
- ...t,
125
- employeeId: e.target.value
126
- })),
127
- placeholder: "EMP-001",
128
- required: !0
129
- })]
130
- }),
131
- /* @__PURE__ */ F("div", {
132
- className: "space-y-2",
133
- children: [/* @__PURE__ */ F(b, {
134
- htmlFor: "firstName",
135
- children: ["First Name ", /* @__PURE__ */ P("span", {
136
- className: "text-status-error-text",
137
- children: "*"
404
+ }),
405
+ /* @__PURE__ */ W("div", {
406
+ className: "grid grid-cols-1 md:grid-cols-3 gap-4",
407
+ children: [
408
+ /* @__PURE__ */ W("div", {
409
+ className: "space-y-2",
410
+ children: [/* @__PURE__ */ U(w, {
411
+ htmlFor: "rating",
412
+ children: "Rating (0–5)"
413
+ }), /* @__PURE__ */ U(C, {
414
+ id: "rating",
415
+ type: "number",
416
+ min: 0,
417
+ max: 5,
418
+ step: .1,
419
+ value: P.rating,
420
+ onChange: (e) => I((t) => ({
421
+ ...t,
422
+ rating: e.target.value
423
+ })),
424
+ placeholder: "4.8"
425
+ })]
426
+ }),
427
+ /* @__PURE__ */ W("div", {
428
+ className: "space-y-2",
429
+ children: [/* @__PURE__ */ U(w, {
430
+ htmlFor: "hireDate",
431
+ children: "Hire Date"
432
+ }), /* @__PURE__ */ U(C, {
433
+ id: "hireDate",
434
+ type: "date",
435
+ value: P.hireDate,
436
+ onChange: (e) => I((t) => ({
437
+ ...t,
438
+ hireDate: e.target.value
439
+ }))
440
+ })]
441
+ }),
442
+ /* @__PURE__ */ W("div", {
443
+ className: "space-y-2",
444
+ children: [/* @__PURE__ */ U(w, {
445
+ htmlFor: "onLeaveUntil",
446
+ children: "On Leave Until"
447
+ }), /* @__PURE__ */ U(C, {
448
+ id: "onLeaveUntil",
449
+ type: "date",
450
+ value: P.onLeaveUntil,
451
+ onChange: (e) => I((t) => ({
452
+ ...t,
453
+ onLeaveUntil: e.target.value
454
+ }))
455
+ })]
456
+ })
457
+ ]
458
+ })
459
+ ]
460
+ })] }),
461
+ /* @__PURE__ */ W(y, { children: [/* @__PURE__ */ U(x, { children: /* @__PURE__ */ W(S, {
462
+ className: "flex items-center gap-2",
463
+ children: [/* @__PURE__ */ U(n, { size: 18 }), " Compensation"]
464
+ }) }), /* @__PURE__ */ U(b, { children: /* @__PURE__ */ W("div", {
465
+ className: "grid grid-cols-1 md:grid-cols-3 gap-4",
466
+ children: [
467
+ /* @__PURE__ */ W("div", {
468
+ className: "space-y-2",
469
+ children: [/* @__PURE__ */ U(w, {
470
+ htmlFor: "baseSalary",
471
+ children: "Base Salary (annual)"
472
+ }), /* @__PURE__ */ U(C, {
473
+ id: "baseSalary",
474
+ type: "number",
475
+ min: 0,
476
+ step: .01,
477
+ value: P.baseSalary,
478
+ onChange: (e) => I((t) => ({
479
+ ...t,
480
+ baseSalary: e.target.value
481
+ })),
482
+ placeholder: "55000"
483
+ })]
484
+ }),
485
+ /* @__PURE__ */ W("div", {
486
+ className: "space-y-2",
487
+ children: [/* @__PURE__ */ U(w, {
488
+ htmlFor: "bonusYtd",
489
+ children: "Bonus (YTD)"
490
+ }), /* @__PURE__ */ U(C, {
491
+ id: "bonusYtd",
492
+ type: "number",
493
+ min: 0,
494
+ step: .01,
495
+ value: P.bonusYtd,
496
+ onChange: (e) => I((t) => ({
497
+ ...t,
498
+ bonusYtd: e.target.value
499
+ })),
500
+ placeholder: "1200"
501
+ })]
502
+ }),
503
+ /* @__PURE__ */ W("div", {
504
+ className: "space-y-2",
505
+ children: [/* @__PURE__ */ U(w, {
506
+ htmlFor: "payCurrency",
507
+ children: "Currency"
508
+ }), /* @__PURE__ */ U(C, {
509
+ id: "payCurrency",
510
+ value: P.payCurrency,
511
+ onChange: (e) => I((t) => ({
512
+ ...t,
513
+ payCurrency: e.target.value
514
+ })),
515
+ placeholder: "USD",
516
+ maxLength: 10
138
517
  })]
139
- }), /* @__PURE__ */ P(y, {
140
- id: "firstName",
141
- value: h.firstName,
142
- onChange: (e) => g((t) => ({
143
- ...t,
144
- firstName: e.target.value
145
- })),
146
- placeholder: "Jane",
147
- required: !0
148
- })]
149
- }),
150
- /* @__PURE__ */ F("div", {
151
- className: "space-y-2",
152
- children: [/* @__PURE__ */ F(b, {
153
- htmlFor: "lastName",
154
- children: ["Last Name ", /* @__PURE__ */ P("span", {
518
+ })
519
+ ]
520
+ }) })] }),
521
+ /* @__PURE__ */ W(y, { children: [/* @__PURE__ */ U(x, { children: /* @__PURE__ */ W(S, {
522
+ className: "flex items-center gap-2",
523
+ children: [/* @__PURE__ */ U(ee, { size: 18 }), " HR Notes"]
524
+ }) }), /* @__PURE__ */ U(b, { children: /* @__PURE__ */ U(A, {
525
+ value: P.notes,
526
+ onChange: (e) => I((t) => ({
527
+ ...t,
528
+ notes: e.target.value
529
+ })),
530
+ placeholder: "Performance notes, disciplinary history, anything worth tracking for this driver...",
531
+ rows: 4
532
+ }) })] }),
533
+ N && !De && /* @__PURE__ */ W(y, {
534
+ className: "border-status-error-border",
535
+ children: [/* @__PURE__ */ U(x, { children: /* @__PURE__ */ W(S, {
536
+ className: "flex items-center gap-2 text-status-error-text",
537
+ children: [/* @__PURE__ */ U(l, { size: 18 }), " Dismiss Driver"]
538
+ }) }), /* @__PURE__ */ W(b, { children: [/* @__PURE__ */ U("p", {
539
+ className: "mb-3 text-sm text-text-secondary",
540
+ children: "Dismissing a driver marks them as no longer employed. Their delivery and route history stays visible; they can no longer be assigned new work. This cannot be undone from here."
541
+ }), /* @__PURE__ */ W(v, {
542
+ type: "button",
543
+ variant: "outline",
544
+ className: "border-status-error-border text-status-error-text hover:bg-status-error-bg-subtle",
545
+ onClick: () => Y(!0),
546
+ children: [/* @__PURE__ */ U(l, { size: 16 }), " Dismiss this driver"]
547
+ })] })]
548
+ })
549
+ ]
550
+ }),
551
+ /* @__PURE__ */ U(oe, {
552
+ open: J,
553
+ onOpenChange: Y,
554
+ children: /* @__PURE__ */ W(se, { children: [
555
+ /* @__PURE__ */ W(ue, { children: [/* @__PURE__ */ U(de, { children: "Dismiss this driver?" }), /* @__PURE__ */ U(ce, { children: "This records the driver as dismissed and requires a reason. It cannot be undone from here." })] }),
556
+ /* @__PURE__ */ W("div", {
557
+ className: "space-y-2 px-1",
558
+ children: [
559
+ /* @__PURE__ */ W(w, {
560
+ htmlFor: "dismissReason",
561
+ children: ["Reason ", /* @__PURE__ */ U("span", {
155
562
  className: "text-status-error-text",
156
563
  children: "*"
157
564
  })]
158
- }), /* @__PURE__ */ P(y, {
159
- id: "lastName",
160
- value: h.lastName,
161
- onChange: (e) => g((t) => ({
162
- ...t,
163
- lastName: e.target.value
164
- })),
165
- placeholder: "Doe",
166
- required: !0
167
- })]
168
- })
169
- ]
170
- }), /* @__PURE__ */ F("div", {
171
- className: "grid grid-cols-1 md:grid-cols-3 gap-4",
172
- children: [
173
- /* @__PURE__ */ F("div", {
174
- className: "space-y-2",
175
- children: [/* @__PURE__ */ P(b, {
176
- htmlFor: "email",
177
- children: "Email"
178
- }), /* @__PURE__ */ P(y, {
179
- id: "email",
180
- type: "email",
181
- value: h.email,
182
- onChange: (e) => g((t) => ({
183
- ...t,
184
- email: e.target.value
185
- })),
186
- placeholder: "jane.doe@example.com"
187
- })]
188
- }),
189
- /* @__PURE__ */ F("div", {
190
- className: "space-y-2",
191
- children: [/* @__PURE__ */ P(b, {
192
- htmlFor: "phone",
193
- children: "Phone"
194
- }), /* @__PURE__ */ P(y, {
195
- id: "phone",
196
- value: h.phone,
197
- onChange: (e) => g((t) => ({
198
- ...t,
199
- phone: e.target.value
200
- })),
201
- placeholder: "+1-555-0100"
202
- })]
203
- }),
204
- /* @__PURE__ */ F("div", {
205
- className: "space-y-2",
206
- children: [/* @__PURE__ */ P(b, {
207
- htmlFor: "licenseNumber",
208
- children: "License Number"
209
- }), /* @__PURE__ */ P(y, {
210
- id: "licenseNumber",
211
- value: h.licenseNumber,
212
- onChange: (e) => g((t) => ({
213
- ...t,
214
- licenseNumber: e.target.value
215
- })),
216
- placeholder: "D1234567"
217
- })]
218
- })
219
- ]
220
- })]
221
- })] })]
222
- })]
565
+ }),
566
+ /* @__PURE__ */ U(A, {
567
+ id: "dismissReason",
568
+ value: X,
569
+ onChange: (e) => he(e.target.value),
570
+ placeholder: "e.g. Repeated policy violations, voluntary resignation, performance...",
571
+ rows: 3
572
+ }),
573
+ /* @__PURE__ */ U(F, { message: _e })
574
+ ]
575
+ }),
576
+ /* @__PURE__ */ W(le, { children: [/* @__PURE__ */ U(v, {
577
+ variant: "outline",
578
+ onClick: () => Y(!1),
579
+ disabled: Z,
580
+ children: "Cancel"
581
+ }), /* @__PURE__ */ U(v, {
582
+ className: "bg-status-error-text text-text-inverse hover:opacity-90",
583
+ onClick: Ee,
584
+ disabled: Z,
585
+ children: Z ? "Dismissing..." : "Confirm dismissal"
586
+ })] })
587
+ ] })
588
+ })
589
+ ]
223
590
  });
224
591
  }
225
- function B() {
226
- let { driverId: a } = N(), f = M().pathname.endsWith("/edit"), { basePath: y, navigate: b } = u(), { driver: E, isLoading: A, error: j, refetch: B } = d(a), V = () => b?.(l(y, "fleet/drivers")), H = (e) => b?.(l(y, e));
227
- return a ? f ? /* @__PURE__ */ P(z, { editId: a }) : A ? /* @__PURE__ */ P(C, { message: "Loading driver details..." }) : j || !E ? /* @__PURE__ */ P(S, {
592
+ function Y() {
593
+ let { driverId: a } = V(), l = B().pathname.endsWith("/edit"), { basePath: p, navigate: h } = f(), { driver: _, isLoading: C, error: w, refetch: T } = m(a), { vehicle: E } = g(_?.assignedVehicle), D = () => h?.(d(p, "fleet/drivers")), O = (e) => h?.(d(p, e));
594
+ if (!a) return /* @__PURE__ */ U(J, {});
595
+ if (l) return /* @__PURE__ */ U(J, { editId: a });
596
+ if (C) return /* @__PURE__ */ U(te, { message: "Loading driver details..." });
597
+ if (w || !_) return /* @__PURE__ */ U(j, {
228
598
  title: "Driver not found",
229
- onRetry: B
230
- }) : /* @__PURE__ */ F(w, {
231
- title: E.fullName,
232
- subtitle: `Employee ID: ${E.employeeId}`,
233
- icon: /* @__PURE__ */ P(c, { size: 24 }),
234
- headerActions: /* @__PURE__ */ F("div", {
599
+ onRetry: T
600
+ });
601
+ let k = !!_.terminatedAt, A = _.onLeaveUntil && _.onLeaveUntil.getTime() > (/* @__PURE__ */ new Date()).getTime() ? _.onLeaveUntil : void 0, N = _.baseSalary !== void 0 || _.bonusYtd !== void 0;
602
+ return /* @__PURE__ */ W(M, {
603
+ title: _.fullName,
604
+ subtitle: `Employee ID: ${_.employeeId}`,
605
+ icon: /* @__PURE__ */ U(u, { size: 24 }),
606
+ headerActions: /* @__PURE__ */ W("div", {
235
607
  className: "flex gap-2",
236
- children: [/* @__PURE__ */ F(m, {
608
+ children: [/* @__PURE__ */ W(v, {
237
609
  variant: "outline",
238
- onClick: V,
239
- children: [/* @__PURE__ */ P(e, { size: 16 }), " Back"]
240
- }), /* @__PURE__ */ F(m, {
241
- onClick: () => b?.(l(y, "fleet/drivers/" + a + "/edit")),
242
- children: [/* @__PURE__ */ P(o, { size: 16 }), " Edit"]
610
+ onClick: D,
611
+ children: [/* @__PURE__ */ U(e, { size: 16 }), " Back"]
612
+ }), /* @__PURE__ */ W(v, {
613
+ onClick: () => h?.(d(p, "fleet/drivers/" + a + "/edit")),
614
+ children: [/* @__PURE__ */ U(o, { size: 16 }), " Edit"]
243
615
  })]
244
616
  }),
245
- headerContent: /* @__PURE__ */ F("div", {
246
- className: "flex items-center gap-4",
247
- children: [/* @__PURE__ */ P(T, {
248
- status: E.status,
249
- type: "driver"
250
- }), /* @__PURE__ */ F("div", {
251
- className: "flex items-center gap-1",
252
- children: [
253
- /* @__PURE__ */ P(s, {
617
+ headerContent: /* @__PURE__ */ W("div", {
618
+ className: "flex flex-wrap items-center gap-4",
619
+ children: [
620
+ /* @__PURE__ */ U(P, {
621
+ status: _.status,
622
+ type: "driver"
623
+ }),
624
+ k && /* @__PURE__ */ U(P, {
625
+ status: "dismissed",
626
+ label: "Dismissed",
627
+ customColors: {
628
+ bg: "bg-status-error-bg-subtle",
629
+ text: "text-status-error-text"
630
+ }
631
+ }),
632
+ A && !k && /* @__PURE__ */ U(P, {
633
+ status: "on_leave",
634
+ label: `On leave until ${L(A, "short")}`,
635
+ customColors: {
636
+ bg: "bg-status-warning-bg-subtle",
637
+ text: "text-status-warning-text"
638
+ }
639
+ }),
640
+ _.rating > 0 && /* @__PURE__ */ W("div", {
641
+ className: "flex items-center gap-1",
642
+ children: [/* @__PURE__ */ U(s, {
254
643
  size: 16,
255
644
  className: "text-status-warning-text fill-current"
256
- }),
257
- /* @__PURE__ */ P("span", {
645
+ }), /* @__PURE__ */ U("span", {
258
646
  className: "font-medium",
259
- children: E.ratings.overall.toFixed(1)
260
- }),
261
- /* @__PURE__ */ F("span", {
262
- className: "text-text-secondary",
263
- children: [
264
- "(",
265
- E.ratings.totalRatings,
266
- " ratings)"
267
- ]
268
- })
269
- ]
270
- })]
647
+ children: _.rating.toFixed(1)
648
+ })]
649
+ })
650
+ ]
271
651
  }),
272
652
  children: [
273
- /* @__PURE__ */ P(R, {
274
- icon: /* @__PURE__ */ P(c, { size: 18 }),
275
- children: "A driver's full profile — performance ratings, working hours, documents, earnings and live location. Use it to confirm someone is road-ready and compliant before assigning them an order or route."
653
+ /* @__PURE__ */ U(K, {
654
+ icon: /* @__PURE__ */ U(u, { size: 18 }),
655
+ children: "A driver's full profile — licensing, assigned vehicle, documents and HR record. Use it to confirm someone is road-ready and compliant before assigning them an order or route."
276
656
  }),
277
- /* @__PURE__ */ P(L, {
657
+ /* @__PURE__ */ U(G, {
278
658
  storageKey: "movethewheels-driver-details",
279
659
  steps: [
280
660
  {
281
661
  id: "assign",
282
662
  label: "Assign to an order",
283
663
  description: "Hand a pending delivery to this driver.",
284
- icon: /* @__PURE__ */ P(i, { size: 16 }),
285
- onClick: () => H("orders")
664
+ icon: /* @__PURE__ */ U(i, { size: 16 }),
665
+ onClick: () => O("orders")
286
666
  },
287
667
  {
288
668
  id: "routes",
289
669
  label: "Plan their route",
290
670
  description: "Batch nearby drop-offs into an optimized itinerary.",
291
- icon: /* @__PURE__ */ P(t, { size: 16 }),
292
- onClick: () => H("routes")
671
+ icon: /* @__PURE__ */ U(t, { size: 16 }),
672
+ onClick: () => O("routes")
293
673
  },
294
674
  {
295
675
  id: "edit",
296
676
  label: "Update driver record",
297
- description: "Refresh documents, shift or compliance details.",
298
- icon: /* @__PURE__ */ P(o, { size: 16 }),
677
+ description: "Refresh documents, license or HR details.",
678
+ icon: /* @__PURE__ */ U(o, { size: 16 }),
299
679
  onClick: () => {}
300
680
  }
301
681
  ]
302
682
  }),
303
- /* @__PURE__ */ F("div", {
683
+ k && /* @__PURE__ */ W("div", {
684
+ className: "rounded-card border border-status-error-border bg-status-error-bg-subtle p-4 text-sm text-status-error-text",
685
+ children: [/* @__PURE__ */ W("p", {
686
+ className: "font-medium",
687
+ children: ["Dismissed ", _.terminatedAt && L(_.terminatedAt, "full")]
688
+ }), _.terminationReason && /* @__PURE__ */ W("p", {
689
+ className: "mt-1",
690
+ children: ["Reason: ", _.terminationReason]
691
+ })]
692
+ }),
693
+ /* @__PURE__ */ W("div", {
304
694
  className: "grid grid-cols-1 lg:grid-cols-3 gap-6",
305
- children: [/* @__PURE__ */ F("div", {
695
+ children: [/* @__PURE__ */ W("div", {
306
696
  className: "lg:col-span-2 space-y-6",
307
697
  children: [
308
- /* @__PURE__ */ F(I, { children: [/* @__PURE__ */ F("h2", {
309
- className: "flex items-center gap-2 text-base font-semibold text-text-primary mb-4",
310
- children: [/* @__PURE__ */ P(s, { size: 18 }), " Ratings"]
311
- }), /* @__PURE__ */ P("div", {
312
- className: "grid grid-cols-2 md:grid-cols-3 gap-4",
313
- children: [
314
- {
315
- label: "Punctuality",
316
- value: E.ratings.punctuality
317
- },
318
- {
319
- label: "Communication",
320
- value: E.ratings.communication
321
- },
322
- {
323
- label: "Handling",
324
- value: E.ratings.carefulHandling
325
- },
326
- {
327
- label: "Professionalism",
328
- value: E.ratings.professionalism
329
- },
330
- {
331
- label: "On-Time Delivery",
332
- value: E.ratings.onTimeDelivery
333
- }
334
- ].map((e) => /* @__PURE__ */ F("div", { children: [/* @__PURE__ */ P("p", {
335
- className: "text-sm text-text-secondary",
336
- children: e.label
337
- }), /* @__PURE__ */ F("div", {
338
- className: "flex items-center gap-2 mt-1",
339
- children: [/* @__PURE__ */ P(x, {
340
- value: e.value * 20,
341
- className: "flex-1 h-2"
342
- }), /* @__PURE__ */ P("span", {
343
- className: "text-sm font-medium",
344
- children: e.value.toFixed(1)
345
- })]
346
- })] }, e.label))
347
- })] }),
348
- /* @__PURE__ */ F(h, { children: [/* @__PURE__ */ P(_, { children: /* @__PURE__ */ F(v, {
349
- className: "flex items-center gap-2",
350
- children: [/* @__PURE__ */ P(t, { size: 18 }), " Working Hours"]
351
- }) }), /* @__PURE__ */ P(g, { children: /* @__PURE__ */ F("div", {
352
- className: "grid grid-cols-2 md:grid-cols-4 gap-4",
353
- children: [
354
- /* @__PURE__ */ F("div", { children: [/* @__PURE__ */ P("p", {
355
- className: "text-sm text-text-secondary",
356
- children: "Shift"
357
- }), /* @__PURE__ */ F("p", {
358
- className: "font-medium",
359
- children: [
360
- E.workingHours.startTime,
361
- " - ",
362
- E.workingHours.endTime
363
- ]
364
- })] }),
365
- /* @__PURE__ */ F("div", { children: [/* @__PURE__ */ P("p", {
366
- className: "text-sm text-text-secondary",
367
- children: "Working Days"
368
- }), /* @__PURE__ */ F("p", {
369
- className: "font-medium",
370
- children: [E.workingHours.workingDays.length, " days/week"]
371
- })] }),
372
- /* @__PURE__ */ F("div", { children: [/* @__PURE__ */ P("p", {
373
- className: "text-sm text-text-secondary",
374
- children: "Hours Today"
375
- }), /* @__PURE__ */ F("p", {
376
- className: "font-medium",
377
- children: [
378
- E.workingHours.currentHoursToday,
379
- "h / ",
380
- E.workingHours.maxHoursPerDay,
381
- "h"
382
- ]
383
- })] }),
384
- /* @__PURE__ */ F("div", { children: [/* @__PURE__ */ P("p", {
385
- className: "text-sm text-text-secondary",
386
- children: "Hours This Week"
387
- }), /* @__PURE__ */ F("p", {
388
- className: "font-medium",
389
- children: [
390
- E.workingHours.currentHoursThisWeek,
391
- "h /",
392
- " ",
393
- E.workingHours.maxHoursPerWeek,
394
- "h"
395
- ]
396
- })] })
397
- ]
398
- }) })] }),
399
- /* @__PURE__ */ F(h, { children: [/* @__PURE__ */ P(_, { children: /* @__PURE__ */ F(v, {
698
+ /* @__PURE__ */ W(y, { children: [/* @__PURE__ */ U(x, { children: /* @__PURE__ */ W(S, {
400
699
  className: "flex items-center gap-2",
401
- children: [/* @__PURE__ */ P(r, { size: 18 }), " License"]
402
- }) }), /* @__PURE__ */ P(g, { children: /* @__PURE__ */ P("div", {
700
+ children: [/* @__PURE__ */ U(r, { size: 18 }), " License"]
701
+ }) }), /* @__PURE__ */ U(b, { children: /* @__PURE__ */ U("div", {
403
702
  className: "flex items-center justify-between p-3 border rounded-lg",
404
- children: /* @__PURE__ */ F("div", { children: [
405
- /* @__PURE__ */ P("p", {
703
+ children: /* @__PURE__ */ W("div", { children: [
704
+ /* @__PURE__ */ U("p", {
406
705
  className: "font-medium",
407
706
  children: "Driver's License"
408
707
  }),
409
- /* @__PURE__ */ F("p", {
708
+ /* @__PURE__ */ W("p", {
410
709
  className: "text-sm text-text-secondary",
411
- children: [E.licenseNumber || "—", E.licenseType ? ` - ${E.licenseType}` : ""]
710
+ children: [_.licenseNumber || "—", _.licenseType ? ` - ${_.licenseType}` : ""]
412
711
  }),
413
- /* @__PURE__ */ F("p", {
712
+ /* @__PURE__ */ W("p", {
414
713
  className: "text-sm text-text-secondary",
415
- children: ["Expires: ", O(E.licenseExpiry)]
714
+ children: ["Expires: ", L(_.licenseExpiry)]
416
715
  })
417
716
  ] })
418
717
  }) })] }),
419
- /* @__PURE__ */ P(k, {
718
+ _.notes && /* @__PURE__ */ W(y, { children: [/* @__PURE__ */ U(x, { children: /* @__PURE__ */ W(S, {
719
+ className: "flex items-center gap-2",
720
+ children: [/* @__PURE__ */ U(ee, { size: 18 }), " HR Notes"]
721
+ }) }), /* @__PURE__ */ U(b, { children: /* @__PURE__ */ U("p", {
722
+ className: "text-sm whitespace-pre-wrap",
723
+ children: _.notes
724
+ }) })] }),
725
+ /* @__PURE__ */ U(R, {
420
726
  entityType: "driver",
421
- entityId: E.id
727
+ entityId: _.id
422
728
  })
423
729
  ]
424
- }), /* @__PURE__ */ F("div", {
730
+ }), /* @__PURE__ */ W("div", {
425
731
  className: "space-y-6",
426
732
  children: [
427
- /* @__PURE__ */ F(h, { children: [/* @__PURE__ */ P(_, { children: /* @__PURE__ */ P(v, { children: "Statistics" }) }), /* @__PURE__ */ F(g, {
428
- className: "space-y-4",
733
+ /* @__PURE__ */ W(y, { children: [/* @__PURE__ */ U(x, { children: /* @__PURE__ */ W(S, {
734
+ className: "flex items-center gap-2",
735
+ children: [/* @__PURE__ */ U(c, { size: 18 }), " Assigned Vehicle"]
736
+ }) }), /* @__PURE__ */ U(b, { children: _.assignedVehicle ? E ? /* @__PURE__ */ W("button", {
737
+ type: "button",
738
+ className: "text-sm font-medium text-primary hover:underline",
739
+ onClick: () => O(`fleet/vehicles/${E.id}`),
429
740
  children: [
430
- /* @__PURE__ */ F("div", { children: [/* @__PURE__ */ P("p", {
431
- className: "text-sm text-text-secondary",
432
- children: "Total Deliveries"
433
- }), /* @__PURE__ */ P("p", {
434
- className: "text-2xl font-bold",
435
- children: E.completedOrders.toLocaleString()
436
- })] }),
437
- /* @__PURE__ */ F("div", { children: [/* @__PURE__ */ P("p", {
438
- className: "text-sm text-text-secondary",
439
- children: "Today's Deliveries"
440
- }), /* @__PURE__ */ P("p", {
441
- className: "text-2xl font-bold",
442
- children: E.todayOrders
443
- })] }),
444
- /* @__PURE__ */ F("div", { children: [/* @__PURE__ */ P("p", {
445
- className: "text-sm text-text-secondary",
446
- children: "Join Date"
447
- }), /* @__PURE__ */ P("p", {
448
- className: "font-medium",
449
- children: O(E.joinDate)
450
- })] })
741
+ E.vehicleNumber,
742
+ " (",
743
+ E.type,
744
+ ")"
451
745
  ]
746
+ }) : /* @__PURE__ */ U("p", {
747
+ className: "text-sm text-text-secondary",
748
+ children: "Loading…"
749
+ }) : /* @__PURE__ */ U("p", {
750
+ className: "text-sm text-text-secondary",
751
+ children: "No vehicle assigned"
752
+ }) })] }),
753
+ /* @__PURE__ */ W(y, { children: [/* @__PURE__ */ U(x, { children: /* @__PURE__ */ U(S, { children: "Record" }) }), /* @__PURE__ */ U(b, {
754
+ className: "space-y-4",
755
+ children: /* @__PURE__ */ W("div", { children: [/* @__PURE__ */ U("p", {
756
+ className: "text-sm text-text-secondary",
757
+ children: "Hire Date"
758
+ }), /* @__PURE__ */ U("p", {
759
+ className: "font-medium",
760
+ children: _.hireDate ? L(_.hireDate) : "Not recorded"
761
+ })] })
452
762
  })] }),
453
- /* @__PURE__ */ F(h, { children: [/* @__PURE__ */ P(_, { children: /* @__PURE__ */ F(v, {
763
+ /* @__PURE__ */ W(y, { children: [/* @__PURE__ */ U(x, { children: /* @__PURE__ */ W(S, {
454
764
  className: "flex items-center gap-2",
455
- children: [/* @__PURE__ */ P(n, { size: 18 }), " Earnings"]
456
- }) }), /* @__PURE__ */ F(g, {
765
+ children: [/* @__PURE__ */ U(n, { size: 18 }), " Compensation"]
766
+ }) }), /* @__PURE__ */ U(b, {
457
767
  className: "space-y-3",
458
- children: [
459
- /* @__PURE__ */ F("div", { children: [/* @__PURE__ */ P("p", {
460
- className: "text-sm text-text-secondary",
461
- children: "Total Earnings"
462
- }), /* @__PURE__ */ P("p", {
463
- className: "text-2xl font-bold",
464
- children: D(E.earnings.totalEarnings)
465
- })] }),
466
- /* @__PURE__ */ F("div", {
467
- className: "grid grid-cols-1 sm:grid-cols-2 gap-3",
468
- children: [/* @__PURE__ */ F("div", { children: [/* @__PURE__ */ P("p", {
469
- className: "text-sm text-text-secondary",
470
- children: "This Week"
471
- }), /* @__PURE__ */ P("p", {
472
- className: "font-medium",
473
- children: D(E.earnings.weeklyEarnings)
474
- })] }), /* @__PURE__ */ F("div", { children: [/* @__PURE__ */ P("p", {
475
- className: "text-sm text-text-secondary",
476
- children: "This Month"
477
- }), /* @__PURE__ */ P("p", {
478
- className: "font-medium",
479
- children: D(E.earnings.monthlyEarnings)
480
- })] })]
481
- }),
482
- /* @__PURE__ */ F("div", { children: [/* @__PURE__ */ P("p", {
483
- className: "text-sm text-text-secondary",
484
- children: "Base Salary"
485
- }), /* @__PURE__ */ F("p", {
486
- className: "font-medium",
487
- children: [D(E.baseSalary), "/year"]
488
- })] })
489
- ]
768
+ children: N ? /* @__PURE__ */ W(H, { children: [_.baseSalary !== void 0 && /* @__PURE__ */ W("div", { children: [/* @__PURE__ */ U("p", {
769
+ className: "text-sm text-text-secondary",
770
+ children: "Base Salary"
771
+ }), /* @__PURE__ */ W("p", {
772
+ className: "font-medium",
773
+ children: [I(_.baseSalary, _.payCurrency || void 0), "/year"]
774
+ })] }), _.bonusYtd !== void 0 && /* @__PURE__ */ W("div", { children: [/* @__PURE__ */ U("p", {
775
+ className: "text-sm text-text-secondary",
776
+ children: "Bonus (YTD)"
777
+ }), /* @__PURE__ */ U("p", {
778
+ className: "font-medium",
779
+ children: I(_.bonusYtd, _.payCurrency || void 0)
780
+ })] })] }) : /* @__PURE__ */ U("p", {
781
+ className: "text-sm text-text-secondary",
782
+ children: "Not recorded"
783
+ })
490
784
  })] }),
491
- E.currentLocation && /* @__PURE__ */ F(h, { children: [/* @__PURE__ */ P(_, { children: /* @__PURE__ */ F(v, {
785
+ _.currentLocation && /* @__PURE__ */ W(y, { children: [/* @__PURE__ */ U(x, { children: /* @__PURE__ */ W(S, {
492
786
  className: "flex items-center gap-2",
493
- children: [/* @__PURE__ */ P(i, { size: 18 }), " Current Location"]
494
- }) }), /* @__PURE__ */ F(g, { children: [/* @__PURE__ */ P("p", {
787
+ children: [/* @__PURE__ */ U(i, { size: 18 }), " Current Location"]
788
+ }) }), /* @__PURE__ */ W(b, { children: [/* @__PURE__ */ U("p", {
495
789
  className: "text-sm",
496
- children: E.currentLocation.address || "Location updating..."
497
- }), /* @__PURE__ */ F("p", {
790
+ children: _.currentLocation.address || "Location updating..."
791
+ }), /* @__PURE__ */ W("p", {
498
792
  className: "text-xs text-text-secondary mt-1",
499
- children: ["Updated ", O(E.currentLocation.timestamp || /* @__PURE__ */ new Date(), "relative")]
500
- })] })] }),
501
- /* @__PURE__ */ F(h, { children: [/* @__PURE__ */ P(_, { children: /* @__PURE__ */ P(v, { children: "Compliance Status" }) }), /* @__PURE__ */ P(g, {
502
- className: "space-y-2",
503
- children: Object.entries(E.compliance).filter(([e]) => e !== "lastUpdate").map(([e, t]) => /* @__PURE__ */ F("div", {
504
- className: "flex items-center justify-between",
505
- children: [/* @__PURE__ */ P("span", {
506
- className: "text-sm capitalize",
507
- children: e.replace(/([A-Z])/g, " $1")
508
- }), /* @__PURE__ */ P(p, {
509
- variant: t ? "default" : "destructive",
510
- children: t ? "Compliant" : "Non-compliant"
511
- })]
512
- }, e))
513
- })] })
793
+ children: ["Updated ", L(_.currentLocation.timestamp || /* @__PURE__ */ new Date(), "relative")]
794
+ })] })] })
514
795
  ]
515
796
  })]
516
797
  })
517
798
  ]
518
- }) : /* @__PURE__ */ P(z, {});
799
+ });
519
800
  }
520
801
  //#endregion
521
- export { B as default };
802
+ export { Y as default };