@burdenoff/microfe-movethewheels 2026.925.1 → 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.
@@ -1,182 +1,168 @@
1
1
  import { Coffee as e } from "../node_modules/lucide-react/dist/esm/icons/coffee.js";
2
2
  import { Download as t } from "../node_modules/lucide-react/dist/esm/icons/download.js";
3
3
  import { Filter as n } from "../node_modules/lucide-react/dist/esm/icons/filter.js";
4
- import { Plus as ee } from "../node_modules/lucide-react/dist/esm/icons/plus.js";
5
- import { RefreshCw as r } from "../node_modules/lucide-react/dist/esm/icons/refresh-cw.js";
4
+ import { Plus as r } from "../node_modules/lucide-react/dist/esm/icons/plus.js";
5
+ import { RefreshCw as ee } from "../node_modules/lucide-react/dist/esm/icons/refresh-cw.js";
6
6
  import { Star as i } from "../node_modules/lucide-react/dist/esm/icons/star.js";
7
- import { Truck as te } from "../node_modules/lucide-react/dist/esm/icons/truck.js";
8
- import { UserCheck as a } from "../node_modules/lucide-react/dist/esm/icons/user-check.js";
9
- import { UserMinus as o } from "../node_modules/lucide-react/dist/esm/icons/user-minus.js";
10
- import { Users as s } from "../node_modules/lucide-react/dist/esm/icons/users.js";
11
- import { joinPath as ne } from "../utils/navigation.js";
12
- import { useMoveTheWheels as re } from "../providers/MoveTheWheelsProvider.js";
13
- import { useDriverStatusCounts as c, useDrivers as l, useFleetStats as u, useVehicles as d } from "../hooks/useFleet.js";
14
- import { Avatar as f, AvatarFallback as p, Button as m, Card as h, CardContent as g, Select as _, SelectContent as v, SelectItem as y, SelectTrigger as b, SelectValue as x } from "../components/ui.js";
15
- import { PageLayout as S } from "../components/PageLayout.js";
16
- import { MetricCard as C, MetricGrid as ie } from "../components/MetricCard.js";
17
- import { StatusBadge as ae } from "../components/StatusBadge.js";
18
- import { DataTable as oe } from "../components/DataTable.js";
19
- import { formatDate as w } from "../utils/formatters.js";
20
- import { useDebouncedValue as se } from "../hooks/useDebouncedValue.js";
21
- import { useMemo as T, useState as E } from "react";
22
- import { jsx as D, jsxs as O } from "react/jsx-runtime";
23
- import { CTAOverflowMenu as k, PagePurpose as A } from "@burdenoff/fe-libs/ui";
7
+ import { Truck as a } from "../node_modules/lucide-react/dist/esm/icons/truck.js";
8
+ import { UserCheck as o } from "../node_modules/lucide-react/dist/esm/icons/user-check.js";
9
+ import { UserMinus as s } from "../node_modules/lucide-react/dist/esm/icons/user-minus.js";
10
+ import { Users as c } from "../node_modules/lucide-react/dist/esm/icons/users.js";
11
+ import { joinPath as l } from "../utils/navigation.js";
12
+ import { useMoveTheWheels as u } from "../providers/MoveTheWheelsProvider.js";
13
+ import { useDriverStatusCounts as d, useDrivers as f, useFleetStats as p, useVehicles as te } from "../hooks/useFleet.js";
14
+ import { Avatar as ne, AvatarFallback as re, Button as ie, Card as m, CardContent as h, Select as g, SelectContent as _, SelectItem as v, SelectTrigger as y, SelectValue as b } from "../components/ui.js";
15
+ import { PageLayout as ae } from "../components/PageLayout.js";
16
+ import { MetricCard as x, MetricGrid as S } from "../components/MetricCard.js";
17
+ import { DRIVER_STATUS_LABELS as C } from "../constants/index.js";
18
+ import { StatusBadge as w } from "../components/StatusBadge.js";
19
+ import { DataTable as T } from "../components/DataTable.js";
20
+ import { formatDate as E } from "../utils/formatters.js";
21
+ import { useDebouncedValue as oe } from "../hooks/useDebouncedValue.js";
22
+ import { useMemo as D, useState as O } from "react";
23
+ import { jsx as k, jsxs as A } from "react/jsx-runtime";
24
+ import { CTAOverflowMenu as j, PagePurpose as M } from "@burdenoff/fe-libs/ui";
24
25
  //#region src/movethewheels/pages/DriversPage.tsx
25
- var j = [
26
- {
27
- value: "all",
28
- label: "All statuses"
29
- },
30
- {
31
- value: "available",
32
- label: "Available"
33
- },
34
- {
35
- value: "busy",
36
- label: "On delivery"
37
- },
38
- {
39
- value: "on_break",
40
- label: "On break"
41
- },
42
- {
43
- value: "offline",
44
- label: "Off duty"
45
- }
46
- ];
47
- function M() {
48
- let { basePath: M, navigate: N } = re(), [P, F] = E(0), [I, L] = E(25), [R, z] = E(""), B = se(R), [V, H] = E("all"), [U, W] = E("all"), { drivers: G, totalDrivers: K, hasMore: ce, isLoading: le, error: ue, refetch: q } = l({
49
- limit: I,
50
- offset: P * I,
51
- search: B || void 0,
52
- status: V === "all" ? void 0 : V,
53
- licenseClass: U === "all" ? void 0 : U
54
- }), { stats: J } = u(), { counts: Y } = c(), { vehicles: X } = d({ limit: 100 }), de = T(() => new Map(X.map((e) => [e.id, e.vehicleNumber])), [X]), Z = J.totalDrivers, fe = T(() => Array.from(new Set(G.map((e) => e.licenseType).filter(Boolean))).sort((e, t) => e.localeCompare(t)), [G]), Q = V !== "all" || U !== "all" || R.length > 0, $ = (e) => N?.(ne(M, e));
55
- return /* @__PURE__ */ O(S, {
26
+ var N = [{
27
+ value: "all",
28
+ label: "All statuses"
29
+ }, ...Object.entries(C).map(([e, t]) => ({
30
+ value: e,
31
+ label: t
32
+ }))];
33
+ function P() {
34
+ let { basePath: C, navigate: P } = u(), [F, I] = O(0), [L, R] = O(25), [z, B] = O(""), V = oe(z), [H, U] = O("all"), [W, G] = O("all"), { drivers: K, totalDrivers: se, hasMore: ce, isLoading: le, error: ue, refetch: q } = f({
35
+ limit: L,
36
+ offset: F * L,
37
+ search: V || void 0,
38
+ status: H === "all" ? void 0 : H,
39
+ licenseClass: W === "all" ? void 0 : W
40
+ }), { stats: J } = p(), { counts: Y } = d(), { vehicles: X } = te({ ids: D(() => Array.from(new Set(K.map((e) => e.assignedVehicle).filter(Boolean))), [K]) }), de = D(() => new Map(X.map((e) => [e.id, e.vehicleNumber])), [X]), Z = J.totalDrivers, fe = D(() => Array.from(new Set(K.map((e) => e.licenseType).filter(Boolean))).sort((e, t) => e.localeCompare(t)), [K]), Q = H !== "all" || W !== "all" || z.length > 0, $ = (e) => P?.(l(C, e));
41
+ return /* @__PURE__ */ A(ae, {
56
42
  title: "Drivers",
57
43
  subtitle: `${Z} drivers`,
58
- icon: /* @__PURE__ */ D(s, { size: 24 }),
59
- headerActions: /* @__PURE__ */ D(k, {
44
+ icon: /* @__PURE__ */ k(c, { size: 24 }),
45
+ headerActions: /* @__PURE__ */ k(j, {
60
46
  primary: {
61
47
  label: "Add Driver",
62
- icon: /* @__PURE__ */ D(ee, { size: 16 }),
48
+ icon: /* @__PURE__ */ k(r, { size: 16 }),
63
49
  onSelect: () => $("fleet/drivers/new")
64
50
  },
65
51
  actions: [{
66
52
  label: "Refresh",
67
- icon: /* @__PURE__ */ D(r, { size: 16 }),
53
+ icon: /* @__PURE__ */ k(ee, { size: 16 }),
68
54
  onSelect: () => q()
69
55
  }, {
70
56
  label: "Export",
71
- icon: /* @__PURE__ */ D(t, { size: 16 }),
57
+ icon: /* @__PURE__ */ k(t, { size: 16 }),
72
58
  onSelect: () => $("import-export")
73
59
  }]
74
60
  }),
75
61
  children: [
76
- /* @__PURE__ */ D(A, {
77
- icon: /* @__PURE__ */ D(s, { size: 18 }),
62
+ /* @__PURE__ */ k(M, {
63
+ icon: /* @__PURE__ */ k(c, { size: 18 }),
78
64
  children: "Your delivery workforce. Track each driver's availability, rating, licence status, contact number and the vehicle they are on — open a driver to review their record before assigning them to an order or route."
79
65
  }),
80
- /* @__PURE__ */ O("div", { children: [/* @__PURE__ */ D("p", {
66
+ /* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k("p", {
81
67
  className: "mb-3 text-sm font-medium text-text-secondary",
82
68
  children: "Workforce at a glance"
83
- }), /* @__PURE__ */ O(ie, {
69
+ }), /* @__PURE__ */ A(S, {
84
70
  columns: 4,
85
71
  children: [
86
- /* @__PURE__ */ D(C, {
72
+ /* @__PURE__ */ k(x, {
87
73
  label: "On duty",
88
74
  value: J.driversByStatus.available + J.driversByStatus.busy,
89
- icon: /* @__PURE__ */ D(a, { size: 20 }),
75
+ icon: /* @__PURE__ */ k(o, { size: 20 }),
90
76
  accent: "success",
91
77
  subtitle: "Available or delivering"
92
78
  }),
93
- /* @__PURE__ */ D(C, {
79
+ /* @__PURE__ */ k(x, {
94
80
  label: "On break",
95
81
  value: Y.onBreak,
96
- icon: /* @__PURE__ */ D(e, { size: 20 }),
82
+ icon: /* @__PURE__ */ k(e, { size: 20 }),
97
83
  accent: "warning",
98
84
  subtitle: "Back on shift shortly"
99
85
  }),
100
- /* @__PURE__ */ D(C, {
86
+ /* @__PURE__ */ k(x, {
101
87
  label: "Off duty",
102
88
  value: Y.offDuty,
103
- icon: /* @__PURE__ */ D(o, { size: 20 }),
89
+ icon: /* @__PURE__ */ k(s, { size: 20 }),
104
90
  accent: "neutral",
105
91
  subtitle: Y.inactive > 0 ? `${Y.inactive} inactive` : void 0
106
92
  }),
107
- /* @__PURE__ */ D(C, {
93
+ /* @__PURE__ */ k(x, {
108
94
  label: "Avg rating",
109
95
  value: J.avgDriverRating > 0 ? J.avgDriverRating.toFixed(1) : "—",
110
- icon: /* @__PURE__ */ D(i, { size: 20 }),
96
+ icon: /* @__PURE__ */ k(i, { size: 20 }),
111
97
  accent: "brand",
112
98
  subtitle: `${Z} drivers`
113
99
  })
114
100
  ]
115
101
  })] }),
116
- /* @__PURE__ */ D(h, { children: /* @__PURE__ */ D(g, {
102
+ /* @__PURE__ */ k(m, { children: /* @__PURE__ */ k(h, {
117
103
  className: "p-4",
118
- children: /* @__PURE__ */ O("div", {
104
+ children: /* @__PURE__ */ A("div", {
119
105
  className: "flex flex-wrap items-center gap-4",
120
106
  children: [
121
- /* @__PURE__ */ O("div", {
107
+ /* @__PURE__ */ A("div", {
122
108
  className: "flex items-center gap-2",
123
- children: [/* @__PURE__ */ D(n, {
109
+ children: [/* @__PURE__ */ k(n, {
124
110
  size: 16,
125
111
  className: "text-text-secondary"
126
- }), /* @__PURE__ */ D("span", {
112
+ }), /* @__PURE__ */ k("span", {
127
113
  className: "text-sm font-medium",
128
114
  children: "Filters:"
129
115
  })]
130
116
  }),
131
- /* @__PURE__ */ O(_, {
132
- value: V,
117
+ /* @__PURE__ */ A(g, {
118
+ value: H,
133
119
  onValueChange: (e) => {
134
- H(e), F(0);
120
+ U(e), I(0);
135
121
  },
136
- children: [/* @__PURE__ */ D(b, {
122
+ children: [/* @__PURE__ */ k(y, {
137
123
  className: "w-[180px]",
138
- children: /* @__PURE__ */ D(x, { placeholder: "Status" })
139
- }), /* @__PURE__ */ D(v, { children: j.map((e) => /* @__PURE__ */ D(y, {
124
+ children: /* @__PURE__ */ k(b, { placeholder: "Status" })
125
+ }), /* @__PURE__ */ k(_, { children: N.map((e) => /* @__PURE__ */ k(v, {
140
126
  value: e.value,
141
127
  children: e.label
142
128
  }, e.value)) })]
143
129
  }),
144
- /* @__PURE__ */ O(_, {
145
- value: U,
146
- onValueChange: W,
147
- children: [/* @__PURE__ */ D(b, {
130
+ /* @__PURE__ */ A(g, {
131
+ value: W,
132
+ onValueChange: G,
133
+ children: [/* @__PURE__ */ k(y, {
148
134
  className: "w-[180px]",
149
- children: /* @__PURE__ */ D(x, { placeholder: "License class" })
150
- }), /* @__PURE__ */ O(v, { children: [/* @__PURE__ */ D(y, {
135
+ children: /* @__PURE__ */ k(b, { placeholder: "License class" })
136
+ }), /* @__PURE__ */ A(_, { children: [/* @__PURE__ */ k(v, {
151
137
  value: "all",
152
138
  children: "All licence classes"
153
- }), fe.map((e) => /* @__PURE__ */ D(y, {
139
+ }), fe.map((e) => /* @__PURE__ */ k(v, {
154
140
  value: e,
155
141
  children: e
156
142
  }, e))] })]
157
143
  }),
158
- Q && /* @__PURE__ */ D(m, {
144
+ Q && /* @__PURE__ */ k(ie, {
159
145
  variant: "ghost",
160
146
  size: "sm",
161
147
  onClick: () => {
162
- H("all"), W("all"), z(""), F(0);
148
+ U("all"), G("all"), B(""), I(0);
163
149
  },
164
150
  children: "Clear filters"
165
151
  })
166
152
  ]
167
153
  })
168
154
  }) }),
169
- /* @__PURE__ */ D(oe, {
155
+ /* @__PURE__ */ k(T, {
170
156
  columns: [
171
157
  {
172
158
  id: "driver",
173
159
  header: "Driver",
174
- cell: (e) => /* @__PURE__ */ O("div", {
160
+ cell: (e) => /* @__PURE__ */ A("div", {
175
161
  className: "flex items-center gap-3",
176
- children: [/* @__PURE__ */ D(f, { children: /* @__PURE__ */ D(p, { children: e.fullName.split(" ").map((e) => e[0]).join("") }) }), /* @__PURE__ */ O("div", { children: [/* @__PURE__ */ D("p", {
162
+ children: [/* @__PURE__ */ k(ne, { children: /* @__PURE__ */ k(re, { children: e.fullName.split(" ").map((e) => e[0]).join("") }) }), /* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k("p", {
177
163
  className: "font-medium",
178
164
  children: e.fullName
179
- }), /* @__PURE__ */ D("p", {
165
+ }), /* @__PURE__ */ k("p", {
180
166
  className: "text-sm text-text-secondary",
181
167
  children: e.employeeId
182
168
  })] })]
@@ -187,7 +173,7 @@ function M() {
187
173
  header: "Status",
188
174
  accessorKey: "status",
189
175
  sortable: !0,
190
- cell: (e) => /* @__PURE__ */ D(ae, {
176
+ cell: (e) => /* @__PURE__ */ k(w, {
191
177
  status: e.status,
192
178
  type: "driver"
193
179
  })
@@ -195,11 +181,11 @@ function M() {
195
181
  {
196
182
  id: "license",
197
183
  header: "License",
198
- cell: (e) => /* @__PURE__ */ O("div", {
184
+ cell: (e) => /* @__PURE__ */ A("div", {
199
185
  className: "text-sm",
200
- children: [/* @__PURE__ */ D("p", { children: e.licenseType }), /* @__PURE__ */ O("p", {
186
+ children: [/* @__PURE__ */ k("p", { children: e.licenseType }), /* @__PURE__ */ A("p", {
201
187
  className: "text-text-secondary",
202
- children: ["Exp: ", w(e.licenseExpiry, "short")]
188
+ children: ["Exp: ", E(e.licenseExpiry, "short")]
203
189
  })]
204
190
  })
205
191
  },
@@ -207,12 +193,12 @@ function M() {
207
193
  id: "phone",
208
194
  header: "Phone",
209
195
  accessorKey: "phone",
210
- cell: (e) => e.phone ? /* @__PURE__ */ D("a", {
196
+ cell: (e) => e.phone ? /* @__PURE__ */ k("a", {
211
197
  href: `tel:${e.phone}`,
212
198
  className: "text-sm hover:underline",
213
199
  onClick: (e) => e.stopPropagation(),
214
200
  children: e.phone
215
- }) : /* @__PURE__ */ D("span", {
201
+ }) : /* @__PURE__ */ k("span", {
216
202
  className: "text-sm text-text-secondary",
217
203
  children: "—"
218
204
  })
@@ -220,16 +206,16 @@ function M() {
220
206
  {
221
207
  id: "rating",
222
208
  header: "Rating",
223
- cell: (e) => e.ratings.overall > 0 ? /* @__PURE__ */ O("div", {
209
+ cell: (e) => e.rating > 0 ? /* @__PURE__ */ A("div", {
224
210
  className: "flex items-center gap-1",
225
- children: [/* @__PURE__ */ D(i, {
211
+ children: [/* @__PURE__ */ k(i, {
226
212
  size: 14,
227
213
  className: "text-status-warning-text fill-current"
228
- }), /* @__PURE__ */ D("span", {
214
+ }), /* @__PURE__ */ k("span", {
229
215
  className: "font-medium",
230
- children: e.ratings.overall.toFixed(1)
216
+ children: e.rating.toFixed(1)
231
217
  })]
232
- }) : /* @__PURE__ */ D("span", {
218
+ }) : /* @__PURE__ */ k("span", {
233
219
  className: "text-sm text-text-secondary",
234
220
  children: "Not rated"
235
221
  })
@@ -238,14 +224,14 @@ function M() {
238
224
  id: "vehicle",
239
225
  header: "Assigned vehicle",
240
226
  cell: (e) => {
241
- if (!e.assignedVehicle) return /* @__PURE__ */ D("span", {
227
+ if (!e.assignedVehicle) return /* @__PURE__ */ k("span", {
242
228
  className: "text-sm text-text-secondary",
243
229
  children: "Unassigned"
244
230
  });
245
231
  let t = de.get(e.assignedVehicle);
246
- return /* @__PURE__ */ O("span", {
232
+ return /* @__PURE__ */ A("span", {
247
233
  className: "inline-flex items-center gap-1.5 text-sm font-medium",
248
- children: [/* @__PURE__ */ D(te, {
234
+ children: [/* @__PURE__ */ k(a, {
249
235
  size: 14,
250
236
  className: "text-text-secondary"
251
237
  }), t ?? "Assigned"]
@@ -254,32 +240,35 @@ function M() {
254
240
  },
255
241
  {
256
242
  id: "joined",
257
- header: "Join Date",
258
- accessorKey: "joinDate",
243
+ header: "Hire Date",
244
+ accessorKey: "hireDate",
259
245
  sortable: !0,
260
- cell: (e) => w(e.joinDate, "short")
246
+ cell: (e) => e.hireDate ? E(e.hireDate, "short") : /* @__PURE__ */ k("span", {
247
+ className: "text-text-secondary",
248
+ children: "Not recorded"
249
+ })
261
250
  }
262
251
  ],
263
- data: G,
252
+ data: K,
264
253
  isLoading: le,
265
254
  error: ue,
266
255
  onRetry: q,
267
256
  searchable: !0,
268
257
  searchPlaceholder: "Search drivers...",
269
258
  searchFields: ["fullName", "employeeId"],
270
- searchQuery: R,
259
+ searchQuery: z,
271
260
  onSearchQueryChange: (e) => {
272
- z(e), F(0);
261
+ B(e), I(0);
273
262
  },
274
263
  onRowClick: (e) => $(`fleet/drivers/${e.id}`),
275
264
  getRowId: (e) => e.id,
276
- pageIndex: P,
277
- pageSize: I,
278
- onPageChange: F,
265
+ pageIndex: F,
266
+ pageSize: L,
267
+ onPageChange: I,
279
268
  onPageSizeChange: (e) => {
280
- L(e), F(0);
269
+ R(e), I(0);
281
270
  },
282
- totalItems: K,
271
+ totalItems: se,
283
272
  hasNextPage: ce,
284
273
  emptyIllustration: "empty-people",
285
274
  emptyTitle: Q ? "No drivers match these filters" : "No drivers yet",
@@ -289,4 +278,4 @@ function M() {
289
278
  });
290
279
  }
291
280
  //#endregion
292
- export { M as default };
281
+ export { P as default };
@@ -253,15 +253,9 @@ function A() {
253
253
  children: [/* @__PURE__ */ C(l, { children: /* @__PURE__ */ C(ne, { children: e.fullName.split(" ").map((e) => e[0]).join("") }) }), /* @__PURE__ */ w("div", { children: [/* @__PURE__ */ C("p", {
254
254
  className: "font-medium",
255
255
  children: e.fullName
256
- }), /* @__PURE__ */ w("p", {
256
+ }), /* @__PURE__ */ C("p", {
257
257
  className: "text-sm text-text-secondary",
258
- children: [
259
- e.employeeId,
260
- " - ",
261
- e.completedOrders,
262
- " ",
263
- j("movethewheels.fleet.drivers.deliveries", "deliveries")
264
- ]
258
+ children: e.employeeId
265
259
  })] })]
266
260
  }), /* @__PURE__ */ w("div", {
267
261
  className: "text-right",
@@ -269,14 +263,14 @@ function A() {
269
263
  status: e.status,
270
264
  type: "driver",
271
265
  size: "sm"
272
- }), /* @__PURE__ */ w("div", {
266
+ }), e.rating > 0 && /* @__PURE__ */ w("div", {
273
267
  className: "mt-1 flex items-center gap-1 justify-end",
274
268
  children: [/* @__PURE__ */ C(n, {
275
269
  size: 12,
276
270
  className: "text-status-warning-text fill-current"
277
271
  }), /* @__PURE__ */ C("span", {
278
272
  className: "text-sm font-medium",
279
- children: e.ratings.overall.toFixed(1)
273
+ children: e.rating.toFixed(1)
280
274
  })]
281
275
  })]
282
276
  })]