@burdenoff/microfe-movethewheels 2026.920.2 → 2026.921.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/dist/components/CarbonFootprintPanel.js +1 -1
  2. package/dist/components/CustomerPicker.js +271 -0
  3. package/dist/components/DataTable.js +140 -139
  4. package/dist/components/DocumentsCard.js +14 -8
  5. package/dist/generated/wspace-types.d.ts +1043 -5
  6. package/dist/hooks/useAnalytics.js +21 -1
  7. package/dist/hooks/useCustomers.js +94 -78
  8. package/dist/hooks/useDebouncedValue.js +11 -0
  9. package/dist/hooks/useEntityDocuments.js +28 -18
  10. package/dist/hooks/useEpod.js +24 -17
  11. package/dist/hooks/useFleet.js +146 -125
  12. package/dist/hooks/useInventory.js +255 -186
  13. package/dist/hooks/useMultiModalShipments.js +35 -27
  14. package/dist/hooks/useOrders.js +73 -73
  15. package/dist/hooks/useRoutes.js +97 -75
  16. package/dist/hooks/useTracking.js +100 -88
  17. package/dist/movethewheels/components/CustomerPicker.d.ts +19 -0
  18. package/dist/movethewheels/components/DataTable.d.ts +5 -1
  19. package/dist/movethewheels/hooks/useCustomers.d.ts +0 -1
  20. package/dist/movethewheels/hooks/useDebouncedValue.d.ts +1 -0
  21. package/dist/movethewheels/hooks/useEntityDocuments.d.ts +2 -0
  22. package/dist/movethewheels/hooks/useEpod.d.ts +6 -1
  23. package/dist/movethewheels/hooks/useFleet.d.ts +49 -5
  24. package/dist/movethewheels/hooks/useInventory.d.ts +24 -17
  25. package/dist/movethewheels/hooks/useMultiModalShipments.d.ts +6 -1
  26. package/dist/movethewheels/hooks/useOrders.d.ts +33 -5
  27. package/dist/movethewheels/hooks/useRoutes.d.ts +2 -1
  28. package/dist/movethewheels/hooks/useTracking.d.ts +12 -11
  29. package/dist/movethewheels/types/index.d.ts +7 -5
  30. package/dist/movethewheels/utils/navigation.d.ts +14 -0
  31. package/dist/pages/CreateOrderPage.js +228 -217
  32. package/dist/pages/CustomerDetailsPage.js +220 -220
  33. package/dist/pages/CustomersPage.js +61 -54
  34. package/dist/pages/DeliveryCapturePage.js +131 -109
  35. package/dist/pages/DriversPage.js +100 -92
  36. package/dist/pages/InventoryPage.js +239 -236
  37. package/dist/pages/MultiModalShipmentPage.js +163 -130
  38. package/dist/pages/OrderDetailsPage.js +224 -208
  39. package/dist/pages/OrdersListPage.js +66 -60
  40. package/dist/pages/ProductDetailsPage.js +241 -200
  41. package/dist/pages/ProductsPage.js +59 -52
  42. package/dist/pages/RouteDetailsPage.js +343 -321
  43. package/dist/pages/RoutesPage.js +55 -48
  44. package/dist/pages/VehiclesPage.js +63 -56
  45. package/dist/pages/WarehousesPage.js +60 -53
  46. package/dist/utils/navigation.js +22 -1
  47. package/package.json +1 -1
  48. package/src/generated/wspace-types.ts +1188 -5
  49. package/src/movethewheels/components/CarbonFootprintPanel.tsx +0 -1
  50. package/src/movethewheels/components/CustomerPicker.tsx +321 -0
  51. package/src/movethewheels/components/DataTable.tsx +34 -18
  52. package/src/movethewheels/components/DocumentsCard.tsx +6 -1
  53. package/src/movethewheels/components/maps/leaflet-setup.ts +1 -8
  54. package/src/movethewheels/hooks/useAnalytics.ts +27 -0
  55. package/src/movethewheels/hooks/useCustomers.ts +64 -24
  56. package/src/movethewheels/hooks/useDebouncedValue.ts +12 -0
  57. package/src/movethewheels/hooks/useEntityDocuments.ts +43 -25
  58. package/src/movethewheels/hooks/useEpod.ts +14 -7
  59. package/src/movethewheels/hooks/useFleet.ts +58 -37
  60. package/src/movethewheels/hooks/useFleetIntelligence.ts +1 -4
  61. package/src/movethewheels/hooks/useInventory.ts +211 -90
  62. package/src/movethewheels/hooks/useMultiModalShipments.ts +15 -11
  63. package/src/movethewheels/hooks/useOrders.ts +13 -14
  64. package/src/movethewheels/hooks/useRoutes.ts +80 -23
  65. package/src/movethewheels/hooks/useTracking.ts +130 -98
  66. package/src/movethewheels/pages/CreateOrderPage.tsx +92 -31
  67. package/src/movethewheels/pages/CustomerDetailsPage.tsx +15 -6
  68. package/src/movethewheels/pages/CustomersPage.tsx +11 -1
  69. package/src/movethewheels/pages/DeliveryCapturePage.tsx +31 -1
  70. package/src/movethewheels/pages/DriversPage.tsx +24 -12
  71. package/src/movethewheels/pages/InventoryPage.tsx +57 -32
  72. package/src/movethewheels/pages/MultiModalShipmentPage.tsx +52 -3
  73. package/src/movethewheels/pages/OrderDetailsPage.tsx +17 -1
  74. package/src/movethewheels/pages/OrdersListPage.tsx +20 -3
  75. package/src/movethewheels/pages/ProductDetailsPage.tsx +52 -3
  76. package/src/movethewheels/pages/ProductsPage.tsx +11 -1
  77. package/src/movethewheels/pages/RouteDetailsPage.tsx +35 -5
  78. package/src/movethewheels/pages/RoutesPage.tsx +11 -1
  79. package/src/movethewheels/pages/VehiclesPage.tsx +19 -2
  80. package/src/movethewheels/pages/WarehousesPage.tsx +11 -1
  81. package/src/movethewheels/types/index.ts +7 -5
  82. package/src/movethewheels/utils/navigation.ts +32 -0
@@ -73,7 +73,7 @@ function p() {
73
73
  children: "By vehicle"
74
74
  }), /* @__PURE__ */ l("div", {
75
75
  className: "space-y-2",
76
- children: p.byVehicle.filter((e) => e.totalDistanceKm > 0 || e.co2eKg > 0).slice(0, 5).map((e) => /* @__PURE__ */ u("div", {
76
+ children: p.byVehicle.filter((e) => e.totalDistanceKm > 0 || e.co2eKg > 0).map((e) => /* @__PURE__ */ u("div", {
77
77
  className: "flex items-center justify-between rounded-lg bg-bg-sunken px-3 py-2",
78
78
  children: [/* @__PURE__ */ u("div", {
79
79
  className: "flex items-center gap-2",
@@ -0,0 +1,271 @@
1
+ import { Plus as e } from "../node_modules/lucide-react/dist/esm/icons/plus.js";
2
+ import { RefreshCw as t } from "../node_modules/lucide-react/dist/esm/icons/refresh-cw.js";
3
+ import { UserPlus as n } from "../node_modules/lucide-react/dist/esm/icons/user-plus.js";
4
+ import { Button as r, Dialog as i, DialogContent as a, DialogDescription as o, DialogFooter as s, DialogHeader as c, DialogTitle as l, Input as u, Label as d, Select as f, SelectContent as p, SelectItem as m, SelectTrigger as h, SelectValue as g } from "./ui.js";
5
+ import { FormError as _ } from "./FormError.js";
6
+ import { useState as v } from "react";
7
+ import { jsx as y, jsxs as b } from "react/jsx-runtime";
8
+ //#region src/movethewheels/components/CustomerPicker.tsx
9
+ var x = {
10
+ name: "",
11
+ type: "b2c",
12
+ email: "",
13
+ phone: "",
14
+ company: ""
15
+ };
16
+ function S(e, t) {
17
+ return !t || e.some((e) => e.id === t.id) ? e : [t, ...e];
18
+ }
19
+ function C({ customers: C, value: w, onValueChange: T, onCreated: E, createCustomer: D, isLoading: O, error: k, onRetry: A, onOpenCustomers: j, selectedCustomer: M, searchQuery: N = "", onSearchQueryChange: P, disabled: F = !1 }) {
20
+ let [I, L] = v(!1), [R, z] = v(x), [B, V] = v(!1), [H, U] = v(null), W = S(C, M), G = () => {
21
+ U(null), z(x), L(!0);
22
+ }, K = () => {
23
+ B || L(!1);
24
+ };
25
+ return /* @__PURE__ */ b("div", {
26
+ className: "space-y-2",
27
+ children: [
28
+ /* @__PURE__ */ b("div", {
29
+ className: "flex items-center justify-between gap-2",
30
+ children: [/* @__PURE__ */ y(d, {
31
+ htmlFor: "customer",
32
+ children: "Customer"
33
+ }), /* @__PURE__ */ b(r, {
34
+ type: "button",
35
+ variant: "ghost",
36
+ size: "sm",
37
+ onClick: G,
38
+ disabled: F || O,
39
+ children: [/* @__PURE__ */ y(e, {
40
+ size: 14,
41
+ className: "mr-1"
42
+ }), "Add customer"]
43
+ })]
44
+ }),
45
+ /* @__PURE__ */ b("div", {
46
+ className: "flex flex-col gap-2 sm:flex-row sm:items-start",
47
+ children: [
48
+ P && /* @__PURE__ */ y(u, {
49
+ value: N,
50
+ onChange: (e) => P(e.target.value),
51
+ placeholder: "Search customers",
52
+ "aria-label": "Search customers",
53
+ disabled: F,
54
+ className: "sm:max-w-56"
55
+ }),
56
+ /* @__PURE__ */ b(f, {
57
+ value: w,
58
+ onValueChange: T,
59
+ disabled: F || O || !!k,
60
+ children: [/* @__PURE__ */ y(h, {
61
+ id: "customer",
62
+ className: "flex-1",
63
+ children: /* @__PURE__ */ y(g, { placeholder: O ? "Loading customers..." : "Select customer" })
64
+ }), /* @__PURE__ */ y(p, { children: W.map((e) => /* @__PURE__ */ b(m, {
65
+ value: e.id,
66
+ children: [
67
+ e.name,
68
+ " ",
69
+ e.email ? `(${e.email})` : ""
70
+ ]
71
+ }, e.id)) })]
72
+ }),
73
+ k && /* @__PURE__ */ b(r, {
74
+ type: "button",
75
+ variant: "outline",
76
+ size: "sm",
77
+ onClick: A,
78
+ children: [/* @__PURE__ */ y(t, {
79
+ size: 14,
80
+ className: "mr-1"
81
+ }), "Retry"]
82
+ })
83
+ ]
84
+ }),
85
+ k ? /* @__PURE__ */ b("div", {
86
+ className: "flex flex-wrap items-center gap-2",
87
+ children: [/* @__PURE__ */ y("p", {
88
+ role: "alert",
89
+ className: "text-sm text-status-error-text",
90
+ children: "Customers could not be loaded. Retry or add a customer to continue."
91
+ }), j && /* @__PURE__ */ y(r, {
92
+ type: "button",
93
+ variant: "outline",
94
+ size: "sm",
95
+ onClick: j,
96
+ children: "Open customer page"
97
+ })]
98
+ }) : !O && W.length === 0 ? /* @__PURE__ */ b("div", {
99
+ className: "rounded-lg border border-border-seam bg-bg-sunken/40 p-3",
100
+ children: [/* @__PURE__ */ b("div", {
101
+ className: "flex items-start gap-2",
102
+ children: [/* @__PURE__ */ y(n, {
103
+ size: 16,
104
+ className: "mt-0.5 shrink-0 text-text-secondary"
105
+ }), /* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("p", {
106
+ className: "text-sm font-medium text-text-primary",
107
+ children: "Add a customer to continue"
108
+ }), /* @__PURE__ */ y("p", {
109
+ className: "text-sm text-text-secondary",
110
+ children: "The customer will be selected automatically and your order details will stay here."
111
+ })] })]
112
+ }), /* @__PURE__ */ b(r, {
113
+ type: "button",
114
+ size: "sm",
115
+ className: "mt-3",
116
+ onClick: G,
117
+ disabled: F,
118
+ children: [/* @__PURE__ */ y(e, {
119
+ size: 14,
120
+ className: "mr-1.5"
121
+ }), "Create customer"]
122
+ })]
123
+ }) : null,
124
+ /* @__PURE__ */ y(i, {
125
+ open: I,
126
+ onOpenChange: (e) => e ? L(!0) : K(),
127
+ children: /* @__PURE__ */ b(a, { children: [/* @__PURE__ */ b(c, { children: [/* @__PURE__ */ y(l, { children: "Create customer" }), /* @__PURE__ */ y(o, { children: "Add the customer without leaving this order. They will be selected automatically." })] }), /* @__PURE__ */ b("form", {
128
+ onSubmit: async (e) => {
129
+ e.preventDefault(), e.stopPropagation();
130
+ let t = R.name.trim();
131
+ if (!t) {
132
+ U("Customer name is required.");
133
+ return;
134
+ }
135
+ V(!0), U(null);
136
+ try {
137
+ E(await D({
138
+ name: t,
139
+ type: R.type,
140
+ email: R.email.trim() || void 0,
141
+ phone: R.phone.trim() || void 0,
142
+ company: R.company.trim() || void 0
143
+ })), L(!1), z(x);
144
+ } catch (e) {
145
+ U(e instanceof Error ? e.message : "Could not create the customer. Please try again.");
146
+ } finally {
147
+ V(!1);
148
+ }
149
+ },
150
+ className: "space-y-4",
151
+ children: [
152
+ /* @__PURE__ */ y(_, { message: H }),
153
+ /* @__PURE__ */ b("div", {
154
+ className: "space-y-2",
155
+ children: [/* @__PURE__ */ y(d, {
156
+ htmlFor: "quick-customer-name",
157
+ children: "Name"
158
+ }), /* @__PURE__ */ y(u, {
159
+ id: "quick-customer-name",
160
+ value: R.name,
161
+ onChange: (e) => z((t) => ({
162
+ ...t,
163
+ name: e.target.value
164
+ })),
165
+ placeholder: "Acme Corp or Jane Doe",
166
+ autoFocus: !0,
167
+ required: !0
168
+ })]
169
+ }),
170
+ /* @__PURE__ */ b("div", {
171
+ className: "space-y-2",
172
+ children: [/* @__PURE__ */ y(d, {
173
+ htmlFor: "quick-customer-type",
174
+ children: "Customer type"
175
+ }), /* @__PURE__ */ b(f, {
176
+ value: R.type,
177
+ onValueChange: (e) => z((t) => ({
178
+ ...t,
179
+ type: e
180
+ })),
181
+ children: [/* @__PURE__ */ y(h, {
182
+ id: "quick-customer-type",
183
+ children: /* @__PURE__ */ y(g, {})
184
+ }), /* @__PURE__ */ b(p, { children: [/* @__PURE__ */ y(m, {
185
+ value: "b2c",
186
+ children: "B2C (Individual)"
187
+ }), /* @__PURE__ */ y(m, {
188
+ value: "b2b",
189
+ children: "B2B (Business)"
190
+ })] })]
191
+ })]
192
+ }),
193
+ /* @__PURE__ */ b("div", {
194
+ className: "grid grid-cols-1 gap-4 sm:grid-cols-2",
195
+ children: [/* @__PURE__ */ b("div", {
196
+ className: "space-y-2",
197
+ children: [/* @__PURE__ */ y(d, {
198
+ htmlFor: "quick-customer-email",
199
+ children: "Email"
200
+ }), /* @__PURE__ */ y(u, {
201
+ id: "quick-customer-email",
202
+ type: "email",
203
+ value: R.email,
204
+ onChange: (e) => z((t) => ({
205
+ ...t,
206
+ email: e.target.value
207
+ })),
208
+ placeholder: "customer@example.com"
209
+ })]
210
+ }), /* @__PURE__ */ b("div", {
211
+ className: "space-y-2",
212
+ children: [/* @__PURE__ */ y(d, {
213
+ htmlFor: "quick-customer-phone",
214
+ children: "Phone"
215
+ }), /* @__PURE__ */ y(u, {
216
+ id: "quick-customer-phone",
217
+ value: R.phone,
218
+ onChange: (e) => z((t) => ({
219
+ ...t,
220
+ phone: e.target.value
221
+ })),
222
+ placeholder: "+1-555-0100"
223
+ })]
224
+ })]
225
+ }),
226
+ /* @__PURE__ */ b("div", {
227
+ className: "space-y-2",
228
+ children: [/* @__PURE__ */ y(d, {
229
+ htmlFor: "quick-customer-company",
230
+ children: "Company"
231
+ }), /* @__PURE__ */ y(u, {
232
+ id: "quick-customer-company",
233
+ value: R.company,
234
+ onChange: (e) => z((t) => ({
235
+ ...t,
236
+ company: e.target.value
237
+ })),
238
+ placeholder: "Company name (optional)"
239
+ })]
240
+ }),
241
+ /* @__PURE__ */ b(s, { children: [
242
+ j && /* @__PURE__ */ y(r, {
243
+ type: "button",
244
+ variant: "outline",
245
+ onClick: () => {
246
+ K(), j();
247
+ },
248
+ disabled: B,
249
+ children: "Use customer page"
250
+ }),
251
+ /* @__PURE__ */ y(r, {
252
+ type: "button",
253
+ variant: "outline",
254
+ onClick: K,
255
+ disabled: B,
256
+ children: "Cancel"
257
+ }),
258
+ /* @__PURE__ */ b(r, {
259
+ type: "submit",
260
+ disabled: B,
261
+ children: [/* @__PURE__ */ y(e, { size: 16 }), B ? "Creating..." : "Create and select"]
262
+ })
263
+ ] })
264
+ ]
265
+ })] })
266
+ })
267
+ ]
268
+ });
269
+ }
270
+ //#endregion
271
+ export { C as CustomerPicker };