@burdenoff/microfe-movethewheels 2026.703.3 → 2026.703.5

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 (173) hide show
  1. package/dist/{AIAssistantPage-C3cPsWt-.js → AIAssistantPage-D2gaEL1U.js} +16 -15
  2. package/dist/AnalyticsPage-DZMlEoBi.js +194 -0
  3. package/dist/CreateOrderPage-CWHx8yys.js +490 -0
  4. package/dist/CustomerDetailsPage-nR4oZ_ju.js +615 -0
  5. package/dist/CustomersPage-Bbvwvn8k.js +205 -0
  6. package/dist/DashboardPage-DrEhNf7N.js +542 -0
  7. package/dist/DataTable-CqMUD4er.js +340 -0
  8. package/dist/DocumentsCard-edDkgnJj.js +169 -0
  9. package/dist/DriverDetailsPage-whEMOWs9.js +490 -0
  10. package/dist/DriversPage-CHF2ZEzd.js +221 -0
  11. package/dist/FinancePage-Dn9GrW-1.js +175 -0
  12. package/dist/{FleetPage-DqkFi3s3.js → FleetPage-CrtGPy-p.js} +36 -35
  13. package/dist/{FormError-BlOjnXOq.js → FormError-BKcb_wT-.js} +1 -1
  14. package/dist/{ImportExportPage-DKJRCezl.js → ImportExportPage-WYdwZomZ.js} +52 -72
  15. package/dist/InventoryPage-l5A1f753.js +259 -0
  16. package/dist/LiveTrackingPage-DhEaNKZ4.js +429 -0
  17. package/dist/MarketplacePage-B9RYOb1Y.js +426 -0
  18. package/dist/MetricCard-y3bWHKUQ.js +191 -0
  19. package/dist/Notice-DOO-tjpV.js +46 -0
  20. package/dist/OrderDetailsPage-CwYHwk1K.js +584 -0
  21. package/dist/OrdersListPage-DhZJoQeI.js +386 -0
  22. package/dist/{PageLayout-D4LDHJJq.js → PageLayout-BniRJaQ6.js} +1 -1
  23. package/dist/{ProductDetailsPage-C9uOiYLp.js → ProductDetailsPage-1Gm9JKy0.js} +56 -56
  24. package/dist/ProductsPage-C8sn-1tN.js +186 -0
  25. package/dist/ReportsPage-D1tb0dcz.js +377 -0
  26. package/dist/RouteDetailsPage-CkMyR9b_.js +610 -0
  27. package/dist/{RoutesPage-DMfoicM1.js → RoutesPage-QkENzsE5.js} +58 -47
  28. package/dist/{SettingsPage-Bn-v0mbQ.js → SettingsPage-DV3_tU_X.js} +16 -38
  29. package/dist/Sparkline-K2RMJ58u.js +16729 -0
  30. package/dist/{StatusBadge-BZurYHMy.js → StatusBadge-BNHXYvZx.js} +7 -7
  31. package/dist/TrackingPage-BZrg4RCu.js +368 -0
  32. package/dist/VehicleDetailsPage-D-8XPZ2G.js +393 -0
  33. package/dist/VehiclesPage-D5BELbtM.js +184 -0
  34. package/dist/{WarehouseDetailsPage-L_6sWigM.js → WarehouseDetailsPage-Cmg-8Frn.js} +70 -70
  35. package/dist/WarehousesPage-C1Y1M867.js +182 -0
  36. package/dist/{arrow-left-n48Y-Wis.js → arrow-left-ClW4Isj7.js} +1 -1
  37. package/dist/arrow-right-CmKOmIkh.js +11 -0
  38. package/dist/arrow-up-BJijRLAZ.js +17 -0
  39. package/dist/{box-D9Pal4HM.js → box-BT3NsRQP.js} +1 -1
  40. package/dist/boxes-B_OGvQiW.js +54 -0
  41. package/dist/{chart-column-BFIJysDR.js → chart-column-DQTTdUPk.js} +1 -1
  42. package/dist/charts-Tj_PPTfA.js +2018 -0
  43. package/dist/chevron-left-B1rZyWWb.js +8 -0
  44. package/dist/{chevron-right-EMIIyyJ1.js → chevron-right-BIcwUJZq.js} +1 -1
  45. package/dist/chunk-BdsCSvBP.js +20 -0
  46. package/dist/{circle-alert-iY24lSlp.js → circle-alert-CNkuDNc6.js} +1 -1
  47. package/dist/circle-check-Cs1OVjtV.js +13 -0
  48. package/dist/{circle-check-big-w0TrLKMF.js → circle-check-big-C-p4eNwn.js} +1 -1
  49. package/dist/{clock-DJZtdl8u.js → clock-dRGG4rkF.js} +1 -1
  50. package/dist/{dollar-sign-CgKQRz_e.js → dollar-sign-B6RoYHHz.js} +1 -1
  51. package/dist/{download-DRXxoiQR.js → download-DP04iWTd.js} +1 -1
  52. package/dist/{file-text-DWWY6_f5.js → file-text-BuDx4hZp.js} +1 -1
  53. package/dist/{filter-DloLC2eE.js → filter-BD483_8g.js} +1 -1
  54. package/dist/{wrench-CANXWxF-.js → fuel-DLH1ag04.js} +3 -6
  55. package/dist/index.css +2 -0
  56. package/dist/index.js +150 -172
  57. package/dist/{map-CkJaULb2.js → map-DNQn9fyY.js} +1 -1
  58. package/dist/{map-pin-BGiCvyCs.js → map-pin-CqN1bbT1.js} +1 -1
  59. package/dist/mapMarkers-NCV9MRKR.js +28 -0
  60. package/dist/maps-yzLqiK_C.js +5070 -0
  61. package/dist/{navigation-D36prnAn.js → navigation-CgGUt2tR.js} +1 -1
  62. package/dist/{package-BChUzpJS.js → package-DmRF7iQD.js} +1 -1
  63. package/dist/{phone-Ac9s3mo_.js → phone-Cl32EXKW.js} +1 -1
  64. package/dist/{plus-Z76q-FZm.js → plus-DlANgOFx.js} +1 -1
  65. package/dist/{refresh-cw-DKt6f5T6.js → refresh-cw-rW59D4b7.js} +1 -1
  66. package/dist/route-CWjPrtAN.js +22 -0
  67. package/dist/{save-CojywNhG.js → save-UDlog7hg.js} +1 -1
  68. package/dist/{search-CDGefqb3.js → search-DNIG5Ck7.js} +1 -1
  69. package/dist/{square-pen-CopE9GmB.js → square-pen-BcfB3Grd.js} +1 -1
  70. package/dist/{star-nHlLjDKR.js → star-CVZHFwDx.js} +1 -1
  71. package/dist/{store-BR9Voi5E.js → store-bwnmCK9f.js} +1 -1
  72. package/dist/{trash-2-BKhar6Hs.js → trash-2-B80G12d4.js} +1 -1
  73. package/dist/{trending-up-Dohgd4t_.js → trending-up-CH4R4KOa.js} +1 -1
  74. package/dist/{triangle-alert-i-XQL9Rd.js → triangle-alert-CmS8AUU6.js} +1 -1
  75. package/dist/{truck-C0v_hbLR.js → truck-9rLDncav.js} +1 -1
  76. package/dist/upload-DanJY1Vo.js +21 -0
  77. package/dist/{useAssistant-D4v3oxD3.js → useAssistant-CnEwkTLm.js} +11 -28
  78. package/dist/{useCustomers-BmTNGxiI.js → useCustomers-ChJao1ET.js} +30 -27
  79. package/dist/{useFleet-DKqXZ16m.js → useFleet-g5Yri0G8.js} +82 -70
  80. package/dist/{useImportExport-DHr-SWSw.js → useImportExport-MYwIT3rE.js} +1 -1
  81. package/dist/{useInventory-DkyiVY_A.js → useInventory-BSOn-R1c.js} +84 -39
  82. package/dist/{useOrders-Cfk1GLiq.js → useOrders-BSiqo61w.js} +59 -48
  83. package/dist/{useReports-CTqZr-AB.js → useReports-fWESfsF9.js} +41 -35
  84. package/dist/{useRoutes-BQWO607N.js → useRoutes-zD8Yp323.js} +50 -42
  85. package/dist/{useSettings-CkDH_-gM.js → useSettings-B1lsWeZ1.js} +6 -6
  86. package/dist/{useTracking-B-va1kO3.js → useTracking-BKG0I2ln.js} +3 -3
  87. package/dist/{user-jyFU3lXk.js → user-DU51el3m.js} +1 -1
  88. package/dist/user-check-IMhk-qkX.js +20 -0
  89. package/dist/{users-DZ-ilS6B.js → users-B8KhJBGg.js} +1 -1
  90. package/dist/{warehouse-6m5kXMLu.js → warehouse-CcMMioeY.js} +1 -1
  91. package/dist/wrench-Dg-sgH2e.js +8 -0
  92. package/dist/x-C4ObLVEa.js +11 -0
  93. package/package.json +5 -1
  94. package/src/movethewheels/components/DataTable.tsx +252 -84
  95. package/src/movethewheels/components/DocumentsCard.tsx +102 -0
  96. package/src/movethewheels/components/GlassPanel.tsx +71 -0
  97. package/src/movethewheels/components/MetricCard.tsx +171 -73
  98. package/src/movethewheels/components/Notice.tsx +61 -0
  99. package/src/movethewheels/components/StatusBadge.tsx +7 -6
  100. package/src/movethewheels/components/charts/ChartShell.tsx +78 -0
  101. package/src/movethewheels/components/charts/Sparkline.tsx +85 -0
  102. package/src/movethewheels/components/charts/StatusDonut.tsx +115 -0
  103. package/src/movethewheels/components/charts/TrendChart.tsx +179 -0
  104. package/src/movethewheels/components/charts/VolumeBar.tsx +97 -0
  105. package/src/movethewheels/components/charts/chartTokens.ts +43 -0
  106. package/src/movethewheels/components/charts/index.ts +9 -0
  107. package/src/movethewheels/components/index.ts +51 -1
  108. package/src/movethewheels/components/maps/LogisticsMap.tsx +94 -0
  109. package/src/movethewheels/components/maps/MapCanvas.tsx +118 -0
  110. package/src/movethewheels/components/maps/RouteMap.tsx +71 -0
  111. package/src/movethewheels/components/maps/TrackingMap.tsx +102 -0
  112. package/src/movethewheels/components/maps/index.ts +16 -0
  113. package/src/movethewheels/components/maps/leaflet-setup.ts +124 -0
  114. package/src/movethewheels/components/maps/map-markers.css +121 -0
  115. package/src/movethewheels/hooks/index.ts +9 -0
  116. package/src/movethewheels/hooks/useAnalytics.ts +109 -4
  117. package/src/movethewheels/hooks/useCustomers.ts +11 -4
  118. package/src/movethewheels/hooks/useEntityDocuments.ts +132 -0
  119. package/src/movethewheels/hooks/useFleet.ts +26 -7
  120. package/src/movethewheels/hooks/useInventory.ts +70 -7
  121. package/src/movethewheels/hooks/useOrders.ts +32 -2
  122. package/src/movethewheels/hooks/useReports.ts +14 -4
  123. package/src/movethewheels/hooks/useRoutes.ts +20 -3
  124. package/src/movethewheels/pages/AnalyticsPage.tsx +93 -73
  125. package/src/movethewheels/pages/CreateOrderPage.tsx +48 -20
  126. package/src/movethewheels/pages/CustomerDetailsPage.tsx +239 -33
  127. package/src/movethewheels/pages/CustomersPage.tsx +53 -28
  128. package/src/movethewheels/pages/DashboardPage.tsx +238 -12
  129. package/src/movethewheels/pages/DriverDetailsPage.tsx +17 -31
  130. package/src/movethewheels/pages/DriversPage.tsx +59 -31
  131. package/src/movethewheels/pages/FinancePage.tsx +103 -82
  132. package/src/movethewheels/pages/InventoryPage.tsx +15 -3
  133. package/src/movethewheels/pages/LiveTrackingPage.tsx +124 -16
  134. package/src/movethewheels/pages/MarketplacePage.tsx +265 -50
  135. package/src/movethewheels/pages/OrderDetailsPage.tsx +214 -10
  136. package/src/movethewheels/pages/OrdersListPage.tsx +118 -47
  137. package/src/movethewheels/pages/ProductsPage.tsx +52 -28
  138. package/src/movethewheels/pages/ReportsPage.tsx +88 -4
  139. package/src/movethewheels/pages/RouteDetailsPage.tsx +119 -19
  140. package/src/movethewheels/pages/RoutesPage.tsx +22 -6
  141. package/src/movethewheels/pages/SettingsPage.tsx +5 -21
  142. package/src/movethewheels/pages/TrackingPage.tsx +76 -6
  143. package/src/movethewheels/pages/VehicleDetailsPage.tsx +4 -34
  144. package/src/movethewheels/pages/VehiclesPage.tsx +58 -27
  145. package/src/movethewheels/pages/WarehouseDetailsPage.tsx +1 -1
  146. package/src/movethewheels/pages/WarehousesPage.tsx +47 -36
  147. package/src/movethewheels/types/index.ts +9 -1
  148. package/src/movethewheels/utils/download.ts +62 -0
  149. package/src/movethewheels/utils/mapMarkers.ts +58 -0
  150. package/dist/AnalyticsPage-Dz6g2MvK.js +0 -215
  151. package/dist/CreateOrderPage-C5iwnjp4.js +0 -479
  152. package/dist/CustomerDetailsPage-B6nwFyLO.js +0 -406
  153. package/dist/CustomersPage-BKxMS1AV.js +0 -161
  154. package/dist/DashboardPage-BVjQi0EB.js +0 -387
  155. package/dist/DataTable-DmciIKKM.js +0 -249
  156. package/dist/DriverDetailsPage-CN3WQ0B9.js +0 -507
  157. package/dist/DriversPage-CH9rjQC-.js +0 -165
  158. package/dist/FinancePage-DEDykSOP.js +0 -158
  159. package/dist/InventoryPage-e0ze63iX.js +0 -253
  160. package/dist/LiveTrackingPage-DCX-K-LR.js +0 -379
  161. package/dist/MarketplacePage-CIQ97_zp.js +0 -247
  162. package/dist/MetricCard-BY0QrMD4.js +0 -146
  163. package/dist/OrderDetailsPage-DYiZ-9UK.js +0 -429
  164. package/dist/OrdersListPage-Cn90P1Xx.js +0 -307
  165. package/dist/ProductsPage-QJfHHpqB.js +0 -169
  166. package/dist/ReportsPage-Zp53q3_8.js +0 -284
  167. package/dist/RouteDetailsPage-DUStXSf9.js +0 -531
  168. package/dist/TrackingPage-W-jtdM3Y.js +0 -325
  169. package/dist/VehicleDetailsPage-Bceo5oz3.js +0 -410
  170. package/dist/VehiclesPage-ApKThYeG.js +0 -165
  171. package/dist/WarehousesPage-DCbXXXWE.js +0 -162
  172. package/dist/useAnalytics-DS8n0xgg.js +0 -297
  173. /package/dist/{formatters-CF2S2l1m.js → formatters-FWJDwTFv.js} +0 -0
@@ -0,0 +1,615 @@
1
+ import { A as e, F as t, I as n, L as r, P as i, R as a, d as o, f as s, g as c, h as l, i as u, j as d, l as f, lt as p, n as m, r as h, st as g, u as _, ut as v } from "./PageLayout-BniRJaQ6.js";
2
+ import { t as y } from "./arrow-left-ClW4Isj7.js";
3
+ import { t as b } from "./file-text-BuDx4hZp.js";
4
+ import { n as x, t as S } from "./Notice-DOO-tjpV.js";
5
+ import { n as ee, t as te } from "./phone-Cl32EXKW.js";
6
+ import { t as ne } from "./map-pin-CqN1bbT1.js";
7
+ import { t as C } from "./package-DmRF7iQD.js";
8
+ import { t as w } from "./save-UDlog7hg.js";
9
+ import { t as T } from "./square-pen-BcfB3Grd.js";
10
+ import { t as re } from "./star-CVZHFwDx.js";
11
+ import { t as E } from "./users-B8KhJBGg.js";
12
+ import { t as ie } from "./x-C4ObLVEa.js";
13
+ import { r as ae } from "./useOrders-BSiqo61w.js";
14
+ import { r as D, t as O } from "./useCustomers-ChJao1ET.js";
15
+ import { i as k, r as oe } from "./StatusBadge-BNHXYvZx.js";
16
+ import { t as A } from "./FormError-BKcb_wT-.js";
17
+ import { n as se, r as j, t as ce } from "./formatters-FWJDwTFv.js";
18
+ import { useEffect as le, useState as M } from "react";
19
+ import { useParams as ue } from "react-router-dom";
20
+ import { Fragment as de, jsx as N, jsxs as P } from "react/jsx-runtime";
21
+ import { EmphasisPanel as F, NextSteps as I, PagePurpose as L } from "@burdenoff/fe-libs/ui";
22
+ //#region node_modules/lucide-react/dist/esm/icons/building.js
23
+ var R = v("Building", [
24
+ ["rect", {
25
+ width: "16",
26
+ height: "20",
27
+ x: "4",
28
+ y: "2",
29
+ rx: "2",
30
+ ry: "2",
31
+ key: "76otgf"
32
+ }],
33
+ ["path", {
34
+ d: "M9 22v-4h6v4",
35
+ key: "r93iot"
36
+ }],
37
+ ["path", {
38
+ d: "M8 6h.01",
39
+ key: "1dz90k"
40
+ }],
41
+ ["path", {
42
+ d: "M16 6h.01",
43
+ key: "1x0f13"
44
+ }],
45
+ ["path", {
46
+ d: "M12 6h.01",
47
+ key: "1vi96p"
48
+ }],
49
+ ["path", {
50
+ d: "M12 10h.01",
51
+ key: "1nrarc"
52
+ }],
53
+ ["path", {
54
+ d: "M12 14h.01",
55
+ key: "1etili"
56
+ }],
57
+ ["path", {
58
+ d: "M16 10h.01",
59
+ key: "1m94wz"
60
+ }],
61
+ ["path", {
62
+ d: "M16 14h.01",
63
+ key: "1gbofw"
64
+ }],
65
+ ["path", {
66
+ d: "M8 10h.01",
67
+ key: "19clt8"
68
+ }],
69
+ ["path", {
70
+ d: "M8 14h.01",
71
+ key: "6423bh"
72
+ }]
73
+ ]);
74
+ //#endregion
75
+ //#region src/movethewheels/pages/CustomerDetailsPage.tsx
76
+ function z(e) {
77
+ if (!e) return null;
78
+ let t = e.trim(), n = /^https?:\/\//i.test(t) ? t : `https://${t}`;
79
+ try {
80
+ let e = new URL(n);
81
+ return e.protocol === "http:" || e.protocol === "https:" ? e.href : null;
82
+ } catch {
83
+ return null;
84
+ }
85
+ }
86
+ function B() {
87
+ let { basePath: o, navigate: s } = g(), { createCustomer: c } = D(), [l, f] = M({
88
+ name: "",
89
+ type: "b2c",
90
+ email: "",
91
+ phone: "",
92
+ company: ""
93
+ }), [m, h] = M(!1), [v, b] = M(null), x = () => s?.(p(o, "customers")), S = async (e) => {
94
+ if (e.preventDefault(), !l.name.trim()) {
95
+ b("Customer name is required.");
96
+ return;
97
+ }
98
+ h(!0), b(null);
99
+ try {
100
+ let e = await c({
101
+ name: l.name.trim(),
102
+ type: l.type,
103
+ email: l.email.trim() || void 0,
104
+ phone: l.phone.trim() || void 0,
105
+ company: l.company.trim() || void 0
106
+ });
107
+ s?.(p(o, `customers/${e.id}`));
108
+ } catch (e) {
109
+ console.error("Failed to create customer:", e), b(e instanceof Error ? e.message : "Failed to create customer. Please try again."), h(!1);
110
+ }
111
+ };
112
+ return /* @__PURE__ */ P(u, {
113
+ title: "New Customer",
114
+ subtitle: "Add a new customer to your account",
115
+ icon: /* @__PURE__ */ N(E, { size: 24 }),
116
+ headerActions: /* @__PURE__ */ P("div", {
117
+ className: "flex gap-2",
118
+ children: [/* @__PURE__ */ P(_, {
119
+ variant: "outline",
120
+ onClick: x,
121
+ disabled: m,
122
+ children: [/* @__PURE__ */ N(y, { size: 16 }), " Cancel"]
123
+ }), /* @__PURE__ */ P(_, {
124
+ onClick: S,
125
+ disabled: m,
126
+ children: [
127
+ /* @__PURE__ */ N(w, { size: 16 }),
128
+ " ",
129
+ m ? "Saving..." : "Create Customer"
130
+ ]
131
+ })]
132
+ }),
133
+ children: [/* @__PURE__ */ N(L, {
134
+ icon: /* @__PURE__ */ N(E, { size: 18 }),
135
+ children: "Add a customer once and their contact details auto-fill every future order you book for them. Only a name is required — add email, phone and company to make deliveries easier to arrange."
136
+ }), /* @__PURE__ */ P("form", {
137
+ onSubmit: S,
138
+ className: "max-w-2xl space-y-6",
139
+ children: [/* @__PURE__ */ N(A, { message: v }), /* @__PURE__ */ P(F, { children: [/* @__PURE__ */ N("h2", {
140
+ className: "text-base font-semibold text-text-primary mb-4",
141
+ children: "Customer Details"
142
+ }), /* @__PURE__ */ P("div", {
143
+ className: "space-y-4",
144
+ children: [
145
+ /* @__PURE__ */ P("div", {
146
+ className: "grid grid-cols-1 md:grid-cols-2 gap-4",
147
+ children: [/* @__PURE__ */ P("div", {
148
+ className: "space-y-2",
149
+ children: [/* @__PURE__ */ P(d, {
150
+ htmlFor: "name",
151
+ children: ["Name ", /* @__PURE__ */ N("span", {
152
+ className: "text-status-error-text",
153
+ children: "*"
154
+ })]
155
+ }), /* @__PURE__ */ N(e, {
156
+ id: "name",
157
+ value: l.name,
158
+ onChange: (e) => f((t) => ({
159
+ ...t,
160
+ name: e.target.value
161
+ })),
162
+ placeholder: "Acme Corp or Jane Doe",
163
+ required: !0
164
+ })]
165
+ }), /* @__PURE__ */ P("div", {
166
+ className: "space-y-2",
167
+ children: [/* @__PURE__ */ N(d, {
168
+ htmlFor: "type",
169
+ children: "Customer Type"
170
+ }), /* @__PURE__ */ P(i, {
171
+ value: l.type,
172
+ onValueChange: (e) => f((t) => ({
173
+ ...t,
174
+ type: e
175
+ })),
176
+ children: [/* @__PURE__ */ N(r, {
177
+ id: "type",
178
+ children: /* @__PURE__ */ N(a, {})
179
+ }), /* @__PURE__ */ P(t, { children: [/* @__PURE__ */ N(n, {
180
+ value: "b2c",
181
+ children: "B2C (Individual)"
182
+ }), /* @__PURE__ */ N(n, {
183
+ value: "b2b",
184
+ children: "B2B (Business)"
185
+ })] })]
186
+ })]
187
+ })]
188
+ }),
189
+ /* @__PURE__ */ P("div", {
190
+ className: "grid grid-cols-1 md:grid-cols-2 gap-4",
191
+ children: [/* @__PURE__ */ P("div", {
192
+ className: "space-y-2",
193
+ children: [/* @__PURE__ */ N(d, {
194
+ htmlFor: "email",
195
+ children: "Email"
196
+ }), /* @__PURE__ */ N(e, {
197
+ id: "email",
198
+ type: "email",
199
+ value: l.email,
200
+ onChange: (e) => f((t) => ({
201
+ ...t,
202
+ email: e.target.value
203
+ })),
204
+ placeholder: "customer@example.com"
205
+ })]
206
+ }), /* @__PURE__ */ P("div", {
207
+ className: "space-y-2",
208
+ children: [/* @__PURE__ */ N(d, {
209
+ htmlFor: "phone",
210
+ children: "Phone"
211
+ }), /* @__PURE__ */ N(e, {
212
+ id: "phone",
213
+ value: l.phone,
214
+ onChange: (e) => f((t) => ({
215
+ ...t,
216
+ phone: e.target.value
217
+ })),
218
+ placeholder: "+1-555-0100"
219
+ })]
220
+ })]
221
+ }),
222
+ /* @__PURE__ */ P("div", {
223
+ className: "space-y-2",
224
+ children: [/* @__PURE__ */ N(d, {
225
+ htmlFor: "company",
226
+ children: "Company"
227
+ }), /* @__PURE__ */ N(e, {
228
+ id: "company",
229
+ value: l.company,
230
+ onChange: (e) => f((t) => ({
231
+ ...t,
232
+ company: e.target.value
233
+ })),
234
+ placeholder: "Company name (for B2B accounts)"
235
+ })]
236
+ })
237
+ ]
238
+ })] })]
239
+ })]
240
+ });
241
+ }
242
+ function V() {
243
+ let { customerId: t } = ue(), { basePath: n, navigate: r } = g(), { customer: i, isLoading: a, error: v, refetch: V } = O(t), { updateCustomer: fe } = D(), { orders: H, isLoading: pe } = ae({ filters: { customerId: t } }), { message: U, notify: me } = x(), [W, G] = M(!1), [K, q] = M(!1), [J, Y] = M(null), [X, Z] = M({
244
+ name: "",
245
+ email: "",
246
+ phone: "",
247
+ company: ""
248
+ });
249
+ le(() => {
250
+ i && Z({
251
+ name: i.name,
252
+ email: i.email,
253
+ phone: i.phone,
254
+ company: i.company ?? ""
255
+ });
256
+ }, [i]);
257
+ let he = () => r?.(p(n, "customers")), Q = (e) => r?.(p(n, e)), $ = () => {
258
+ Y(null), G(!0);
259
+ };
260
+ return t ? a ? /* @__PURE__ */ N(h, { message: "Loading customer details..." }) : v || !i ? /* @__PURE__ */ N(m, {
261
+ title: "Customer not found",
262
+ onRetry: V
263
+ }) : /* @__PURE__ */ P(u, {
264
+ title: i.name,
265
+ subtitle: i.company || i.email,
266
+ icon: /* @__PURE__ */ N(E, { size: 24 }),
267
+ headerActions: /* @__PURE__ */ P("div", {
268
+ className: "flex gap-2",
269
+ children: [/* @__PURE__ */ P(_, {
270
+ variant: "outline",
271
+ onClick: he,
272
+ children: [/* @__PURE__ */ N(y, { size: 16 }), " Back"]
273
+ }), W ? /* @__PURE__ */ P(de, { children: [/* @__PURE__ */ P(_, {
274
+ variant: "outline",
275
+ onClick: () => {
276
+ Y(null), G(!1), i && Z({
277
+ name: i.name,
278
+ email: i.email,
279
+ phone: i.phone,
280
+ company: i.company ?? ""
281
+ });
282
+ },
283
+ disabled: K,
284
+ children: [/* @__PURE__ */ N(ie, { size: 16 }), " Cancel"]
285
+ }), /* @__PURE__ */ P(_, {
286
+ onClick: async () => {
287
+ if (t) {
288
+ if (!X.name.trim()) {
289
+ Y("Customer name is required.");
290
+ return;
291
+ }
292
+ q(!0), Y(null);
293
+ try {
294
+ await fe(t, {
295
+ name: X.name.trim(),
296
+ email: X.email.trim(),
297
+ phone: X.phone.trim(),
298
+ company: X.company.trim() || void 0
299
+ }), me("Customer updated."), G(!1), V();
300
+ } catch (e) {
301
+ Y(e instanceof Error ? e.message : "Failed to update customer.");
302
+ } finally {
303
+ q(!1);
304
+ }
305
+ }
306
+ },
307
+ disabled: K,
308
+ children: [
309
+ /* @__PURE__ */ N(w, { size: 16 }),
310
+ " ",
311
+ K ? "Saving…" : "Save"
312
+ ]
313
+ })] }) : /* @__PURE__ */ P(_, {
314
+ onClick: $,
315
+ children: [/* @__PURE__ */ N(T, { size: 16 }), " Edit"]
316
+ })]
317
+ }),
318
+ headerContent: /* @__PURE__ */ P("div", {
319
+ className: "flex items-center gap-4",
320
+ children: [
321
+ /* @__PURE__ */ N(k, { type: i.type }),
322
+ /* @__PURE__ */ N(f, {
323
+ variant: i.isActive ? "default" : "secondary",
324
+ children: i.isActive ? "Active" : "Inactive"
325
+ }),
326
+ /* @__PURE__ */ P("div", {
327
+ className: "flex items-center gap-1",
328
+ children: [/* @__PURE__ */ N(re, {
329
+ size: 16,
330
+ className: "text-status-warning-text fill-current"
331
+ }), /* @__PURE__ */ N("span", {
332
+ className: "font-medium",
333
+ children: i.rating.toFixed(1)
334
+ })]
335
+ })
336
+ ]
337
+ }),
338
+ children: [
339
+ /* @__PURE__ */ N(L, {
340
+ icon: /* @__PURE__ */ N(E, { size: 18 }),
341
+ children: "Everything you know about this customer — how to reach them, where they are, and their account standing. Use it to confirm contact details before a delivery, check their rating, or book their next order."
342
+ }),
343
+ /* @__PURE__ */ N(I, {
344
+ storageKey: "movethewheels-customer-details",
345
+ steps: [{
346
+ id: "new-order",
347
+ label: "Book a delivery for this customer",
348
+ description: "Start a new order pre-filled for this account.",
349
+ icon: /* @__PURE__ */ N(b, { size: 16 }),
350
+ onClick: () => Q("orders/new")
351
+ }, {
352
+ id: "edit",
353
+ label: "Update contact details",
354
+ description: "Keep email, phone and address current.",
355
+ icon: /* @__PURE__ */ N(T, { size: 16 }),
356
+ onClick: $
357
+ }]
358
+ }),
359
+ U && /* @__PURE__ */ N("div", {
360
+ className: "mb-2",
361
+ children: /* @__PURE__ */ N(S, { message: U })
362
+ }),
363
+ /* @__PURE__ */ P("div", {
364
+ className: "grid grid-cols-1 lg:grid-cols-3 gap-6",
365
+ children: [/* @__PURE__ */ P("div", {
366
+ className: "lg:col-span-2 space-y-6",
367
+ children: [
368
+ /* @__PURE__ */ P(F, { children: [/* @__PURE__ */ N("h2", {
369
+ className: "text-base font-semibold text-text-primary mb-4",
370
+ children: "Contact Information"
371
+ }), W ? /* @__PURE__ */ P("div", {
372
+ className: "space-y-4",
373
+ children: [/* @__PURE__ */ N(A, { message: J }), /* @__PURE__ */ P("div", {
374
+ className: "grid grid-cols-1 md:grid-cols-2 gap-4",
375
+ children: [
376
+ /* @__PURE__ */ P("div", {
377
+ className: "space-y-2",
378
+ children: [/* @__PURE__ */ P(d, {
379
+ htmlFor: "edit-name",
380
+ children: ["Name ", /* @__PURE__ */ N("span", {
381
+ className: "text-status-error-text",
382
+ children: "*"
383
+ })]
384
+ }), /* @__PURE__ */ N(e, {
385
+ id: "edit-name",
386
+ value: X.name,
387
+ onChange: (e) => Z((t) => ({
388
+ ...t,
389
+ name: e.target.value
390
+ }))
391
+ })]
392
+ }),
393
+ /* @__PURE__ */ P("div", {
394
+ className: "space-y-2",
395
+ children: [/* @__PURE__ */ N(d, {
396
+ htmlFor: "edit-company",
397
+ children: "Company"
398
+ }), /* @__PURE__ */ N(e, {
399
+ id: "edit-company",
400
+ value: X.company,
401
+ onChange: (e) => Z((t) => ({
402
+ ...t,
403
+ company: e.target.value
404
+ })),
405
+ placeholder: "Company name (for B2B accounts)"
406
+ })]
407
+ }),
408
+ /* @__PURE__ */ P("div", {
409
+ className: "space-y-2",
410
+ children: [/* @__PURE__ */ N(d, {
411
+ htmlFor: "edit-email",
412
+ children: "Email"
413
+ }), /* @__PURE__ */ N(e, {
414
+ id: "edit-email",
415
+ type: "email",
416
+ value: X.email,
417
+ onChange: (e) => Z((t) => ({
418
+ ...t,
419
+ email: e.target.value
420
+ }))
421
+ })]
422
+ }),
423
+ /* @__PURE__ */ P("div", {
424
+ className: "space-y-2",
425
+ children: [/* @__PURE__ */ N(d, {
426
+ htmlFor: "edit-phone",
427
+ children: "Phone"
428
+ }), /* @__PURE__ */ N(e, {
429
+ id: "edit-phone",
430
+ value: X.phone,
431
+ onChange: (e) => Z((t) => ({
432
+ ...t,
433
+ phone: e.target.value
434
+ }))
435
+ })]
436
+ })
437
+ ]
438
+ })]
439
+ }) : /* @__PURE__ */ P("div", {
440
+ className: "grid grid-cols-1 md:grid-cols-2 gap-6",
441
+ children: [/* @__PURE__ */ P("div", {
442
+ className: "space-y-4",
443
+ children: [/* @__PURE__ */ P("div", {
444
+ className: "flex items-center gap-3",
445
+ children: [/* @__PURE__ */ N(ee, {
446
+ size: 18,
447
+ className: "text-text-secondary"
448
+ }), /* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("p", {
449
+ className: "text-sm text-text-secondary",
450
+ children: "Email"
451
+ }), /* @__PURE__ */ N("p", {
452
+ className: "font-medium",
453
+ children: i.email || "—"
454
+ })] })]
455
+ }), /* @__PURE__ */ P("div", {
456
+ className: "flex items-center gap-3",
457
+ children: [/* @__PURE__ */ N(te, {
458
+ size: 18,
459
+ className: "text-text-secondary"
460
+ }), /* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("p", {
461
+ className: "text-sm text-text-secondary",
462
+ children: "Phone"
463
+ }), /* @__PURE__ */ N("p", {
464
+ className: "font-medium",
465
+ children: i.phone || "—"
466
+ })] })]
467
+ })]
468
+ }), /* @__PURE__ */ P("div", {
469
+ className: "space-y-4",
470
+ children: [i.company && /* @__PURE__ */ P("div", {
471
+ className: "flex items-center gap-3",
472
+ children: [/* @__PURE__ */ N(R, {
473
+ size: 18,
474
+ className: "text-text-secondary"
475
+ }), /* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("p", {
476
+ className: "text-sm text-text-secondary",
477
+ children: "Company"
478
+ }), /* @__PURE__ */ N("p", {
479
+ className: "font-medium",
480
+ children: i.company
481
+ })] })]
482
+ }), (() => {
483
+ let e = z(i.website);
484
+ return e ? /* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("p", {
485
+ className: "text-sm text-text-secondary",
486
+ children: "Website"
487
+ }), /* @__PURE__ */ N("a", {
488
+ href: e,
489
+ target: "_blank",
490
+ rel: "noopener noreferrer",
491
+ className: "text-primary hover:underline",
492
+ children: e
493
+ })] }) : null;
494
+ })()]
495
+ })]
496
+ })] }),
497
+ /* @__PURE__ */ P(o, { children: [/* @__PURE__ */ N(l, { children: /* @__PURE__ */ P(c, {
498
+ className: "flex items-center gap-2",
499
+ children: [/* @__PURE__ */ N(ne, { size: 18 }), " Address"]
500
+ }) }), /* @__PURE__ */ N(s, { children: /* @__PURE__ */ N("p", { children: ce(i.address) }) })] }),
501
+ i.notes && /* @__PURE__ */ P(o, { children: [/* @__PURE__ */ N(l, { children: /* @__PURE__ */ P(c, {
502
+ className: "flex items-center gap-2",
503
+ children: [/* @__PURE__ */ N(b, { size: 18 }), " Notes"]
504
+ }) }), /* @__PURE__ */ N(s, { children: /* @__PURE__ */ N("p", { children: i.notes }) })] }),
505
+ /* @__PURE__ */ P(o, { children: [/* @__PURE__ */ P(l, {
506
+ className: "flex flex-row items-center justify-between",
507
+ children: [/* @__PURE__ */ P(c, {
508
+ className: "flex items-center gap-2",
509
+ children: [/* @__PURE__ */ N(C, { size: 18 }), " Orders"]
510
+ }), /* @__PURE__ */ P(_, {
511
+ variant: "outline",
512
+ size: "sm",
513
+ onClick: () => Q("orders/new"),
514
+ children: [/* @__PURE__ */ N(b, { size: 14 }), " New order"]
515
+ })]
516
+ }), /* @__PURE__ */ N(s, { children: pe ? /* @__PURE__ */ N("p", {
517
+ className: "text-text-secondary text-center py-4",
518
+ children: "Loading orders…"
519
+ }) : H.length > 0 ? /* @__PURE__ */ N("div", {
520
+ className: "space-y-2",
521
+ children: H.map((e) => /* @__PURE__ */ P("button", {
522
+ type: "button",
523
+ onClick: () => Q(`orders/${e.id}`),
524
+ className: "w-full flex items-center justify-between gap-3 p-3 border rounded-lg text-left hover:bg-bg-sunken/50 transition-colors",
525
+ children: [/* @__PURE__ */ P("div", {
526
+ className: "min-w-0",
527
+ children: [/* @__PURE__ */ N("p", {
528
+ className: "font-medium truncate",
529
+ children: e.orderNumber
530
+ }), /* @__PURE__ */ P("p", {
531
+ className: "text-sm text-text-secondary",
532
+ children: [
533
+ j(e.createdAt, "relative"),
534
+ " ·",
535
+ " ",
536
+ se(e.pricing.total)
537
+ ]
538
+ })]
539
+ }), /* @__PURE__ */ N(oe, {
540
+ status: e.status,
541
+ type: "order",
542
+ size: "sm"
543
+ })]
544
+ }, e.id))
545
+ }) : /* @__PURE__ */ P("div", {
546
+ className: "text-center py-6",
547
+ children: [
548
+ /* @__PURE__ */ N(C, {
549
+ size: 32,
550
+ className: "mx-auto mb-2 text-text-secondary opacity-50"
551
+ }),
552
+ /* @__PURE__ */ N("p", {
553
+ className: "text-text-secondary",
554
+ children: "No orders yet for this customer"
555
+ }),
556
+ /* @__PURE__ */ N("button", {
557
+ type: "button",
558
+ onClick: () => Q("orders/new"),
559
+ className: "mt-1 text-sm text-primary hover:underline",
560
+ children: "Book their first delivery"
561
+ })
562
+ ]
563
+ }) })] })
564
+ ]
565
+ }), /* @__PURE__ */ P("div", {
566
+ className: "space-y-6",
567
+ children: [/* @__PURE__ */ P(o, { children: [/* @__PURE__ */ N(l, { children: /* @__PURE__ */ N(c, { children: "Business Details" }) }), /* @__PURE__ */ P(s, {
568
+ className: "space-y-3",
569
+ children: [
570
+ i.businessLicense && /* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("p", {
571
+ className: "text-sm text-text-secondary",
572
+ children: "Business License"
573
+ }), /* @__PURE__ */ N("p", {
574
+ className: "font-mono",
575
+ children: i.businessLicense
576
+ })] }),
577
+ i.taxId && /* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("p", {
578
+ className: "text-sm text-text-secondary",
579
+ children: "Tax ID"
580
+ }), /* @__PURE__ */ N("p", {
581
+ className: "font-mono",
582
+ children: i.taxId
583
+ })] }),
584
+ /* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("p", {
585
+ className: "text-sm text-text-secondary",
586
+ children: "Preferred Contact"
587
+ }), /* @__PURE__ */ N("p", {
588
+ className: "capitalize",
589
+ children: i.preferredContactMethod
590
+ })] }),
591
+ /* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("p", {
592
+ className: "text-sm text-text-secondary",
593
+ children: "Marketing Opt-in"
594
+ }), /* @__PURE__ */ N(f, {
595
+ variant: i.marketingOptIn ? "default" : "secondary",
596
+ children: i.marketingOptIn ? "Yes" : "No"
597
+ })] })
598
+ ]
599
+ })] }), /* @__PURE__ */ P(o, { children: [/* @__PURE__ */ N(l, { children: /* @__PURE__ */ N(c, { children: "Account Info" }) }), /* @__PURE__ */ P(s, {
600
+ className: "space-y-3",
601
+ children: [/* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("p", {
602
+ className: "text-sm text-text-secondary",
603
+ children: "Created"
604
+ }), /* @__PURE__ */ N("p", { children: j(i.createdAt, "full") })] }), /* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("p", {
605
+ className: "text-sm text-text-secondary",
606
+ children: "Last Updated"
607
+ }), /* @__PURE__ */ N("p", { children: j(i.updatedAt, "relative") })] })]
608
+ })] })]
609
+ })]
610
+ })
611
+ ]
612
+ }) : /* @__PURE__ */ N(B, {});
613
+ }
614
+ //#endregion
615
+ export { V as default };