@burdenoff/microfe-movethewheels 2026.929.2 → 2026.929.4

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 (50) hide show
  1. package/dist/generated/wspace-types.d.ts +1547 -64
  2. package/dist/hooks/useCustomers.js +3 -9
  3. package/dist/hooks/useFleet.js +147 -150
  4. package/dist/hooks/useInventory.js +178 -153
  5. package/dist/hooks/useRoutes.js +9 -9
  6. package/dist/hooks/useTracking.js +14 -16
  7. package/dist/movethewheels/hooks/useFleet.d.ts +11 -4
  8. package/dist/movethewheels/hooks/useInventory.d.ts +13 -12
  9. package/dist/movethewheels/hooks/useRoutes.d.ts +4 -1
  10. package/dist/movethewheels/types/index.d.ts +33 -23
  11. package/dist/movethewheels/utils/formatters.d.ts +1 -1
  12. package/dist/pages/CustomerDetailsPage.js +6 -6
  13. package/dist/pages/CustomersPage.js +2 -2
  14. package/dist/pages/DashboardPage.js +1 -1
  15. package/dist/pages/DriverDetailsPage.js +68 -43
  16. package/dist/pages/DriversPage.js +4 -4
  17. package/dist/pages/FleetPage.js +1 -1
  18. package/dist/pages/InventoryPage.js +11 -12
  19. package/dist/pages/LiveTrackingPage.js +4 -4
  20. package/dist/pages/ProductDetailsPage.js +408 -249
  21. package/dist/pages/ProductsPage.js +5 -5
  22. package/dist/pages/RouteDetailsPage.js +8 -10
  23. package/dist/pages/RoutesPage.js +2 -2
  24. package/dist/pages/TrackingPage.js +14 -8
  25. package/dist/pages/WarehouseDetailsPage.js +166 -163
  26. package/dist/pages/WarehousesPage.js +29 -21
  27. package/package.json +1 -1
  28. package/src/generated/wspace-types.ts +1762 -64
  29. package/src/movethewheels/hooks/useCustomers.ts +7 -9
  30. package/src/movethewheels/hooks/useFleet.ts +92 -34
  31. package/src/movethewheels/hooks/useInventory.ts +143 -49
  32. package/src/movethewheels/hooks/useRoutes.ts +36 -16
  33. package/src/movethewheels/hooks/useTracking.ts +23 -15
  34. package/src/movethewheels/pages/CustomerDetailsPage.tsx +14 -8
  35. package/src/movethewheels/pages/CustomersPage.tsx +5 -2
  36. package/src/movethewheels/pages/DashboardPage.tsx +3 -1
  37. package/src/movethewheels/pages/DriverDetailsPage.tsx +44 -12
  38. package/src/movethewheels/pages/DriversPage.tsx +1 -1
  39. package/src/movethewheels/pages/FleetPage.tsx +1 -1
  40. package/src/movethewheels/pages/InventoryPage.tsx +20 -16
  41. package/src/movethewheels/pages/LiveTrackingPage.tsx +6 -4
  42. package/src/movethewheels/pages/ProductDetailsPage.tsx +228 -49
  43. package/src/movethewheels/pages/ProductsPage.tsx +13 -5
  44. package/src/movethewheels/pages/RouteDetailsPage.tsx +16 -8
  45. package/src/movethewheels/pages/RoutesPage.tsx +4 -2
  46. package/src/movethewheels/pages/TrackingPage.tsx +25 -10
  47. package/src/movethewheels/pages/WarehouseDetailsPage.tsx +42 -29
  48. package/src/movethewheels/pages/WarehousesPage.tsx +23 -15
  49. package/src/movethewheels/types/index.ts +36 -24
  50. package/src/movethewheels/utils/formatters.ts +1 -1
@@ -25,12 +25,12 @@ import { EntityCombobox as re } from "../components/EntityCombobox.js";
25
25
  import { useEffect as ie, useState as z } from "react";
26
26
  import { useLocation as B, useParams as V } from "react-router";
27
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";
28
+ import { EmphasisPanel as ae, NextSteps as G, PagePurpose as oe, ResponsiveDialog as se, ResponsiveDialogContent as ce, ResponsiveDialogDescription as le, ResponsiveDialogFooter as ue, ResponsiveDialogHeader as de, ResponsiveDialogTitle as fe } from "@burdenoff/fe-libs/ui";
29
29
  //#region src/movethewheels/pages/DriverDetailsPage.tsx
30
- var fe = Object.entries(N).map(([e, t]) => ({
30
+ var pe = Object.entries(N).map(([e, t]) => ({
31
31
  value: e,
32
32
  label: t
33
- })), q = (e) => e ? e.toISOString().slice(0, 10) : "", pe = (e) => e ? `${e}T12:00:00.000Z` : void 0, me = {
33
+ })), K = (e) => e ? e.toISOString().slice(0, 10) : "", q = (e) => e ? `${e}T12:00:00.000Z` : void 0, me = {
34
34
  employeeId: "",
35
35
  firstName: "",
36
36
  lastName: "",
@@ -41,6 +41,7 @@ var fe = Object.entries(N).map(([e, t]) => ({
41
41
  licenseExpiry: "",
42
42
  status: "available",
43
43
  vehicleId: "",
44
+ vehicleIds: [],
44
45
  rating: "",
45
46
  notes: "",
46
47
  hireDate: "",
@@ -65,36 +66,41 @@ function J({ editId: t }) {
65
66
  phone: j.phone || "",
66
67
  licenseNumber: j.licenseNumber || "",
67
68
  licenseClass: j.licenseType || "",
68
- licenseExpiry: q(j.licenseExpiry),
69
+ licenseExpiry: K(j.licenseExpiry),
69
70
  status: j.status,
70
71
  vehicleId: j.assignedVehicle || "",
72
+ vehicleIds: j.vehicleIds,
71
73
  rating: j.rating ? String(j.rating) : "",
72
74
  notes: j.notes || "",
73
- hireDate: q(j.hireDate),
75
+ hireDate: K(j.hireDate),
74
76
  baseSalary: j.baseSalary === void 0 ? "" : String(j.baseSalary),
75
77
  bonusYtd: j.bonusYtd === void 0 ? "" : String(j.bonusYtd),
76
78
  payCurrency: j.payCurrency || "",
77
- onLeaveUntil: q(j.onLeaveUntil)
79
+ onLeaveUntil: K(j.onLeaveUntil)
78
80
  });
79
81
  }, [t, j]);
80
- let we = () => i?.(d(r, "fleet/drivers")), $ = () => ({
81
- employeeId: P.employeeId.trim(),
82
+ let we = () => i?.(d(r, "fleet/drivers")), $ = (e = !0) => ({
82
83
  firstName: P.firstName.trim(),
83
84
  lastName: P.lastName.trim(),
84
85
  email: P.email.trim() || void 0,
85
86
  phone: P.phone.trim() || void 0,
86
87
  licenseNumber: P.licenseNumber.trim() || void 0,
87
88
  licenseClass: P.licenseClass.trim() || void 0,
88
- licenseExpiry: pe(P.licenseExpiry),
89
+ licenseExpiry: q(P.licenseExpiry),
89
90
  status: p(P.status),
90
- vehicleId: P.vehicleId || void 0,
91
- rating: P.rating ? Number(P.rating) : void 0,
91
+ vehicleId: P.vehicleId || null,
92
+ vehicleIds: P.vehicleIds,
93
+ rating: P.rating.trim() ? Number(P.rating) : void 0,
92
94
  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) => {
95
+ hireDate: q(P.hireDate),
96
+ baseSalary: P.baseSalary.trim() ? Number(P.baseSalary) : void 0,
97
+ bonusYtd: P.bonusYtd.trim() ? Number(P.bonusYtd) : void 0,
98
+ payCurrency: P.payCurrency.trim() || void 0,
99
+ ...e ? { onLeaveUntil: q(P.onLeaveUntil) ?? null } : {}
100
+ }), Te = () => ({
101
+ employeeId: P.employeeId.trim(),
102
+ ...$(!1)
103
+ }), Ee = async (e) => {
98
104
  if (e.preventDefault(), !P.employeeId.trim() || !P.firstName.trim() || !P.lastName.trim()) {
99
105
  G("Employee ID, first name and last name are required.");
100
106
  return;
@@ -109,13 +115,13 @@ function J({ editId: t }) {
109
115
  let e = await s(t, $());
110
116
  i?.(d(r, `fleet/drivers/${e.id}`));
111
117
  } else {
112
- let e = await o($());
118
+ let e = await o(Te());
113
119
  i?.(d(r, `fleet/drivers/${e.id}`));
114
120
  }
115
121
  } catch (e) {
116
122
  console.error("Failed to save driver:", e), G(e instanceof Error ? e.message : "Failed to save driver. Please try again."), B(!1);
117
123
  }
118
- }, Ee = async () => {
124
+ }, De = async () => {
119
125
  if (!t || !X.trim()) {
120
126
  Q("A reason is required to dismiss a driver.");
121
127
  return;
@@ -132,7 +138,7 @@ function J({ editId: t }) {
132
138
  } finally {
133
139
  ge(!1);
134
140
  }
135
- }, De = N && !!j?.terminatedAt;
141
+ }, Oe = N && !!j?.terminatedAt;
136
142
  return /* @__PURE__ */ W(M, {
137
143
  title: N ? "Edit Driver" : "Add Driver",
138
144
  subtitle: "Add a driver to your workforce",
@@ -145,7 +151,7 @@ function J({ editId: t }) {
145
151
  disabled: R,
146
152
  children: [/* @__PURE__ */ U(e, { size: 16 }), " Cancel"]
147
153
  }), /* @__PURE__ */ W(v, {
148
- onClick: Te,
154
+ onClick: Ee,
149
155
  disabled: R,
150
156
  children: [
151
157
  /* @__PURE__ */ U(a, { size: 16 }),
@@ -155,11 +161,11 @@ function J({ editId: t }) {
155
161
  })]
156
162
  }),
157
163
  children: [
158
- /* @__PURE__ */ U(K, {
164
+ /* @__PURE__ */ U(oe, {
159
165
  icon: /* @__PURE__ */ U(u, { size: 18 }),
160
166
  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
167
  }),
162
- De && j?.terminatedAt && /* @__PURE__ */ W("div", {
168
+ Oe && j?.terminatedAt && /* @__PURE__ */ W("div", {
163
169
  className: "rounded-card border border-status-error-border bg-status-error-bg-subtle p-4 text-sm text-status-error-text",
164
170
  children: [/* @__PURE__ */ W("p", {
165
171
  className: "font-medium",
@@ -174,7 +180,7 @@ function J({ editId: t }) {
174
180
  })]
175
181
  }),
176
182
  /* @__PURE__ */ W("form", {
177
- onSubmit: Te,
183
+ onSubmit: Ee,
178
184
  className: "max-w-3xl space-y-6",
179
185
  children: [
180
186
  /* @__PURE__ */ U(F, { message: V }),
@@ -191,10 +197,15 @@ function J({ editId: t }) {
191
197
  className: "space-y-2",
192
198
  children: [/* @__PURE__ */ W(w, {
193
199
  htmlFor: "employeeId",
194
- children: ["Employee ID ", /* @__PURE__ */ U("span", {
195
- className: "text-status-error-text",
196
- children: "*"
197
- })]
200
+ children: [
201
+ "Employee ID ",
202
+ N ? "(immutable)" : "",
203
+ " ",
204
+ /* @__PURE__ */ U("span", {
205
+ className: "text-status-error-text",
206
+ children: !N && "*"
207
+ })
208
+ ]
198
209
  }), /* @__PURE__ */ U(C, {
199
210
  id: "employeeId",
200
211
  value: P.employeeId,
@@ -203,7 +214,8 @@ function J({ editId: t }) {
203
214
  employeeId: e.target.value
204
215
  })),
205
216
  placeholder: "EMP-001",
206
- required: !0
217
+ required: !0,
218
+ disabled: N
207
219
  })]
208
220
  }),
209
221
  /* @__PURE__ */ W("div", {
@@ -298,7 +310,7 @@ function J({ editId: t }) {
298
310
  children: [/* @__PURE__ */ U(O, {
299
311
  id: "status",
300
312
  children: /* @__PURE__ */ U(k, {})
301
- }), /* @__PURE__ */ U(E, { children: fe.map((e) => /* @__PURE__ */ U(D, {
313
+ }), /* @__PURE__ */ U(E, { children: pe.map((e) => /* @__PURE__ */ U(D, {
302
314
  value: e.value,
303
315
  children: e.label
304
316
  }, e.value)) })]
@@ -379,7 +391,8 @@ function J({ editId: t }) {
379
391
  value: P.vehicleId,
380
392
  onChange: (e) => I((t) => ({
381
393
  ...t,
382
- vehicleId: e
394
+ vehicleId: e,
395
+ vehicleIds: e ? [e] : []
383
396
  })),
384
397
  options: be,
385
398
  loading: xe,
@@ -441,9 +454,21 @@ function J({ editId: t }) {
441
454
  }),
442
455
  /* @__PURE__ */ W("div", {
443
456
  className: "space-y-2",
444
- children: [/* @__PURE__ */ U(w, {
445
- htmlFor: "onLeaveUntil",
446
- children: "On Leave Until"
457
+ children: [/* @__PURE__ */ W("div", {
458
+ className: "flex items-center justify-between gap-2",
459
+ children: [/* @__PURE__ */ U(w, {
460
+ htmlFor: "onLeaveUntil",
461
+ children: "On Leave Until"
462
+ }), P.onLeaveUntil && /* @__PURE__ */ U(v, {
463
+ type: "button",
464
+ variant: "ghost",
465
+ size: "sm",
466
+ onClick: () => I((e) => ({
467
+ ...e,
468
+ onLeaveUntil: ""
469
+ })),
470
+ children: "Clear"
471
+ })]
447
472
  }), /* @__PURE__ */ U(C, {
448
473
  id: "onLeaveUntil",
449
474
  type: "date",
@@ -530,7 +555,7 @@ function J({ editId: t }) {
530
555
  placeholder: "Performance notes, disciplinary history, anything worth tracking for this driver...",
531
556
  rows: 4
532
557
  }) })] }),
533
- N && !De && /* @__PURE__ */ W(y, {
558
+ N && !Oe && /* @__PURE__ */ W(y, {
534
559
  className: "border-status-error-border",
535
560
  children: [/* @__PURE__ */ U(x, { children: /* @__PURE__ */ W(S, {
536
561
  className: "flex items-center gap-2 text-status-error-text",
@@ -548,11 +573,11 @@ function J({ editId: t }) {
548
573
  })
549
574
  ]
550
575
  }),
551
- /* @__PURE__ */ U(oe, {
576
+ /* @__PURE__ */ U(se, {
552
577
  open: J,
553
578
  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." })] }),
579
+ children: /* @__PURE__ */ W(ce, { children: [
580
+ /* @__PURE__ */ W(de, { children: [/* @__PURE__ */ U(fe, { children: "Dismiss this driver?" }), /* @__PURE__ */ U(le, { children: "This records the driver as dismissed and requires a reason. It cannot be undone from here." })] }),
556
581
  /* @__PURE__ */ W("div", {
557
582
  className: "space-y-2 px-1",
558
583
  children: [
@@ -573,14 +598,14 @@ function J({ editId: t }) {
573
598
  /* @__PURE__ */ U(F, { message: _e })
574
599
  ]
575
600
  }),
576
- /* @__PURE__ */ W(le, { children: [/* @__PURE__ */ U(v, {
601
+ /* @__PURE__ */ W(ue, { children: [/* @__PURE__ */ U(v, {
577
602
  variant: "outline",
578
603
  onClick: () => Y(!1),
579
604
  disabled: Z,
580
605
  children: "Cancel"
581
606
  }), /* @__PURE__ */ U(v, {
582
607
  className: "bg-status-error-text text-text-inverse hover:opacity-90",
583
- onClick: Ee,
608
+ onClick: De,
584
609
  disabled: Z,
585
610
  children: Z ? "Dismissing..." : "Confirm dismissal"
586
611
  })] })
@@ -637,7 +662,7 @@ function Y() {
637
662
  text: "text-status-warning-text"
638
663
  }
639
664
  }),
640
- _.rating > 0 && /* @__PURE__ */ W("div", {
665
+ _.rating !== void 0 && /* @__PURE__ */ W("div", {
641
666
  className: "flex items-center gap-1",
642
667
  children: [/* @__PURE__ */ U(s, {
643
668
  size: 16,
@@ -650,7 +675,7 @@ function Y() {
650
675
  ]
651
676
  }),
652
677
  children: [
653
- /* @__PURE__ */ U(K, {
678
+ /* @__PURE__ */ U(oe, {
654
679
  icon: /* @__PURE__ */ U(u, { size: 18 }),
655
680
  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."
656
681
  }),
@@ -788,9 +813,9 @@ function Y() {
788
813
  }) }), /* @__PURE__ */ W(b, { children: [/* @__PURE__ */ U("p", {
789
814
  className: "text-sm",
790
815
  children: _.currentLocation.address || "Location updating..."
791
- }), /* @__PURE__ */ W("p", {
816
+ }), /* @__PURE__ */ U("p", {
792
817
  className: "text-xs text-text-secondary mt-1",
793
- children: ["Updated ", L(_.currentLocation.timestamp || /* @__PURE__ */ new Date(), "relative")]
818
+ children: _.currentLocation.timestamp ? `Updated ${L(_.currentLocation.timestamp, "relative")}` : "Update time not recorded"
794
819
  })] })] })
795
820
  ]
796
821
  })]
@@ -206,7 +206,10 @@ function P() {
206
206
  {
207
207
  id: "rating",
208
208
  header: "Rating",
209
- cell: (e) => e.rating > 0 ? /* @__PURE__ */ A("div", {
209
+ cell: (e) => e.rating === void 0 ? /* @__PURE__ */ k("span", {
210
+ className: "text-sm text-text-secondary",
211
+ children: "Not rated"
212
+ }) : /* @__PURE__ */ A("div", {
210
213
  className: "flex items-center gap-1",
211
214
  children: [/* @__PURE__ */ k(i, {
212
215
  size: 14,
@@ -215,9 +218,6 @@ function P() {
215
218
  className: "font-medium",
216
219
  children: e.rating.toFixed(1)
217
220
  })]
218
- }) : /* @__PURE__ */ k("span", {
219
- className: "text-sm text-text-secondary",
220
- children: "Not rated"
221
221
  })
222
222
  },
223
223
  {
@@ -261,7 +261,7 @@ function A() {
261
261
  status: e.status,
262
262
  type: "driver",
263
263
  size: "sm"
264
- }), e.rating > 0 && /* @__PURE__ */ w("div", {
264
+ }), e.rating !== void 0 && /* @__PURE__ */ w("div", {
265
265
  className: "mt-1 flex items-center gap-1 justify-end",
266
266
  children: [/* @__PURE__ */ C(n, {
267
267
  size: 12,
@@ -409,25 +409,24 @@ function M() {
409
409
  children: [/* @__PURE__ */ w("div", { children: [/* @__PURE__ */ C("p", {
410
410
  className: "font-medium",
411
411
  children: e.name
412
- }), /* @__PURE__ */ w("p", {
412
+ }), /* @__PURE__ */ C("p", {
413
413
  className: "text-sm text-text-secondary",
414
- children: [
415
- e.address.city,
416
- ", ",
417
- e.address.state
418
- ]
414
+ children: [e.address.city, e.address.state].filter(Boolean).join(", ") || "Not provided"
419
415
  })] }), /* @__PURE__ */ w("div", {
420
416
  className: "text-right",
421
417
  children: [/* @__PURE__ */ C(d, {
422
- variant: e.status.toUpperCase() === "ACTIVE" ? "default" : "secondary",
423
- children: e.status.toUpperCase() === "ACTIVE" ? N("movethewheels.inventory.warehouses.active", "Active") : N("movethewheels.inventory.warehouses.inactive", "Inactive")
418
+ variant: e.status?.toUpperCase() === "ACTIVE" ? "default" : "secondary",
419
+ children: e.status ? e.status.toUpperCase() === "ACTIVE" ? N("movethewheels.inventory.warehouses.active", "Active") : N("movethewheels.inventory.warehouses.inactive", "Inactive") : "Not provided"
424
420
  }), /* @__PURE__ */ w("div", {
425
421
  className: "mt-2",
426
422
  children: [/* @__PURE__ */ C("p", {
427
423
  className: "text-xs text-text-secondary",
428
424
  children: N("movethewheels.inventory.warehouses.utilization", "Utilization")
429
- }), /* @__PURE__ */ C(g, {
430
- value: e.capacity.totalSpace > 0 ? e.capacity.usedSpace / e.capacity.totalSpace * 100 : 0,
425
+ }), e.utilization === void 0 ? /* @__PURE__ */ C("p", {
426
+ className: "text-xs text-text-tertiary",
427
+ children: "Not provided"
428
+ }) : /* @__PURE__ */ C(g, {
429
+ value: e.utilization,
431
430
  className: "w-24 h-2"
432
431
  })]
433
432
  })]
@@ -471,10 +470,10 @@ function M() {
471
470
  className: "text-right",
472
471
  children: [/* @__PURE__ */ C("p", {
473
472
  className: "font-medium",
474
- children: le(e.value)
473
+ children: e.value === void 0 ? "Not provided" : le(e.value)
475
474
  }), /* @__PURE__ */ C(d, {
476
475
  variant: "outline",
477
- children: e.category
476
+ children: e.category ?? "Not provided"
478
477
  })]
479
478
  })]
480
479
  })
@@ -34,7 +34,7 @@ function I() {
34
34
  lng: t.lng,
35
35
  label: e.order.orderNumber,
36
36
  status: D(e.order.status),
37
- sublabel: e.driver?.fullName || e.vehicle?.vehicleNumber || e.tracking?.currentLocation.address || void 0
37
+ sublabel: e.driver?.fullName || e.vehicle?.vehicleNumber || e.tracking?.currentLocation?.address || void 0
38
38
  }] : [];
39
39
  }), [X]), Q = Z.length, $ = [
40
40
  {
@@ -226,7 +226,7 @@ function I() {
226
226
  ]
227
227
  }), /* @__PURE__ */ j("p", {
228
228
  className: "text-xs text-text-secondary",
229
- children: e.tracking?.currentLocation.address || "Location updating..."
229
+ children: e.tracking?.currentLocation?.address || "Location updating..."
230
230
  })]
231
231
  })]
232
232
  })
@@ -299,7 +299,7 @@ function I() {
299
299
  }),
300
300
  /* @__PURE__ */ j("p", {
301
301
  className: "text-sm",
302
- children: Y.tracking?.currentLocation.address || "Updating..."
302
+ children: Y.tracking?.currentLocation?.address || "Updating..."
303
303
  }),
304
304
  (() => {
305
305
  let e = O(Y.vehicle?.currentLocation, Y.driver?.currentLocation, Y.tracking?.currentLocation);
@@ -363,7 +363,7 @@ function I() {
363
363
  children: e.message
364
364
  }), /* @__PURE__ */ j("p", {
365
365
  className: "text-xs text-text-secondary mt-1",
366
- children: E(e.timestamp, "relative")
366
+ children: e.timestamp ? E(e.timestamp, "relative") : "Time not recorded"
367
367
  })]
368
368
  }, e.id))
369
369
  }) : /* @__PURE__ */ j("div", {