@burdenoff/microfe-movethewheels 2026.703.4 → 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 (149) hide show
  1. package/dist/{AIAssistantPage-3YOnHO9Y.js → AIAssistantPage-D2gaEL1U.js} +16 -15
  2. package/dist/AnalyticsPage-DZMlEoBi.js +194 -0
  3. package/dist/{CreateOrderPage-DRAgGo9i.js → CreateOrderPage-CWHx8yys.js} +40 -40
  4. package/dist/{CustomerDetailsPage-BCeMmOFe.js → CustomerDetailsPage-nR4oZ_ju.js} +71 -71
  5. package/dist/CustomersPage-Bbvwvn8k.js +205 -0
  6. package/dist/DashboardPage-DrEhNf7N.js +542 -0
  7. package/dist/{DataTable-XvUcTjwi.js → DataTable-CqMUD4er.js} +31 -31
  8. package/dist/{DocumentsCard-U2lSe-cn.js → DocumentsCard-edDkgnJj.js} +25 -25
  9. package/dist/{DriverDetailsPage-BQrYd_Lp.js → DriverDetailsPage-whEMOWs9.js} +64 -64
  10. package/dist/DriversPage-CHF2ZEzd.js +221 -0
  11. package/dist/FinancePage-Dn9GrW-1.js +175 -0
  12. package/dist/{FleetPage-3ZHsB-TN.js → FleetPage-CrtGPy-p.js} +22 -22
  13. package/dist/{FormError-cuLV2jVD.js → FormError-BKcb_wT-.js} +1 -1
  14. package/dist/{ImportExportPage-C6f7DqhM.js → ImportExportPage-WYdwZomZ.js} +12 -12
  15. package/dist/InventoryPage-l5A1f753.js +259 -0
  16. package/dist/LiveTrackingPage-DhEaNKZ4.js +429 -0
  17. package/dist/{MarketplacePage-Bh_2ns4v.js → MarketplacePage-B9RYOb1Y.js} +116 -116
  18. package/dist/MetricCard-y3bWHKUQ.js +191 -0
  19. package/dist/{Notice-CSoDYKw9.js → Notice-DOO-tjpV.js} +2 -2
  20. package/dist/{OrderDetailsPage-zCj0lW0j.js → OrderDetailsPage-CwYHwk1K.js} +58 -58
  21. package/dist/OrdersListPage-DhZJoQeI.js +386 -0
  22. package/dist/{PageLayout-D4LDHJJq.js → PageLayout-BniRJaQ6.js} +1 -1
  23. package/dist/{ProductDetailsPage-wsxAQkA0.js → ProductDetailsPage-1Gm9JKy0.js} +55 -55
  24. package/dist/ProductsPage-C8sn-1tN.js +186 -0
  25. package/dist/ReportsPage-D1tb0dcz.js +377 -0
  26. package/dist/{RouteDetailsPage-DyMJE9AS.js → RouteDetailsPage-CkMyR9b_.js} +208 -181
  27. package/dist/{RoutesPage-Dtc669yc.js → RoutesPage-QkENzsE5.js} +12 -12
  28. package/dist/{SettingsPage-CpH9xhQg.js → SettingsPage-DV3_tU_X.js} +15 -15
  29. package/dist/Sparkline-K2RMJ58u.js +16729 -0
  30. package/dist/{StatusBadge-C87mDpDP.js → StatusBadge-BNHXYvZx.js} +7 -7
  31. package/dist/TrackingPage-BZrg4RCu.js +368 -0
  32. package/dist/{VehicleDetailsPage-DldYNsYV.js → VehicleDetailsPage-D-8XPZ2G.js} +53 -53
  33. package/dist/VehiclesPage-D5BELbtM.js +184 -0
  34. package/dist/{WarehouseDetailsPage-CMG7or6G.js → WarehouseDetailsPage-Cmg-8Frn.js} +64 -64
  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-Q3XQpTPR.js → arrow-right-CmKOmIkh.js} +1 -1
  38. package/dist/{arrow-up-xNF1zJUG.js → arrow-up-BJijRLAZ.js} +1 -1
  39. package/dist/{box-Eu05PXDh.js → box-BT3NsRQP.js} +1 -1
  40. package/dist/boxes-B_OGvQiW.js +54 -0
  41. package/dist/{chart-column-ouzgxIv_.js → chart-column-DQTTdUPk.js} +1 -1
  42. package/dist/charts-Tj_PPTfA.js +2018 -0
  43. package/dist/{chevron-left-B2_r0Elx.js → chevron-left-B1rZyWWb.js} +1 -1
  44. package/dist/{chevron-right-eV4LjaSi.js → chevron-right-BIcwUJZq.js} +1 -1
  45. package/dist/chunk-BdsCSvBP.js +20 -0
  46. package/dist/{circle-alert-Bzh2DBSF.js → circle-alert-CNkuDNc6.js} +1 -1
  47. package/dist/circle-check-Cs1OVjtV.js +13 -0
  48. package/dist/{circle-check-big-CGMSpQmD.js → circle-check-big-C-p4eNwn.js} +1 -1
  49. package/dist/{clock-Bl3ptexL.js → clock-dRGG4rkF.js} +1 -1
  50. package/dist/{dollar-sign-CAVU95SO.js → dollar-sign-B6RoYHHz.js} +1 -1
  51. package/dist/{download-C5NbvVDc.js → download-DP04iWTd.js} +1 -1
  52. package/dist/{file-text-D-1uvLZG.js → file-text-BuDx4hZp.js} +1 -1
  53. package/dist/{filter-DUfUg6BO.js → filter-BD483_8g.js} +1 -1
  54. package/dist/{fuel-B6_lnKDs.js → fuel-DLH1ag04.js} +1 -1
  55. package/dist/index.css +2 -0
  56. package/dist/index.js +214 -225
  57. package/dist/{map-C-M-FQLR.js → map-DNQn9fyY.js} +1 -1
  58. package/dist/{map-pin-Dznl5l40.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-BJSJl-VG.js → navigation-CgGUt2tR.js} +1 -1
  62. package/dist/{package-CcRttV2N.js → package-DmRF7iQD.js} +1 -1
  63. package/dist/{phone-DVSZHt_j.js → phone-Cl32EXKW.js} +1 -1
  64. package/dist/{plus-C_XZDwBz.js → plus-DlANgOFx.js} +1 -1
  65. package/dist/{refresh-cw-CfgN67l3.js → refresh-cw-rW59D4b7.js} +1 -1
  66. package/dist/route-CWjPrtAN.js +22 -0
  67. package/dist/{save-DJE8Fpdv.js → save-UDlog7hg.js} +1 -1
  68. package/dist/{search-D_VyGcZT.js → search-DNIG5Ck7.js} +1 -1
  69. package/dist/{square-pen-D-6JYrVQ.js → square-pen-BcfB3Grd.js} +1 -1
  70. package/dist/{star-BpRlUZuU.js → star-CVZHFwDx.js} +1 -1
  71. package/dist/{store-B-8HMuyZ.js → store-bwnmCK9f.js} +1 -1
  72. package/dist/{trash-2-8vmv-XV_.js → trash-2-B80G12d4.js} +1 -1
  73. package/dist/{trending-up-Dz6PqPRj.js → trending-up-CH4R4KOa.js} +1 -1
  74. package/dist/{triangle-alert-D7Y3J_4z.js → triangle-alert-CmS8AUU6.js} +1 -1
  75. package/dist/{truck-D-y2IDzv.js → truck-9rLDncav.js} +1 -1
  76. package/dist/{upload-CHZofOqb.js → upload-DanJY1Vo.js} +1 -1
  77. package/dist/{useAssistant-DVW4QgQb.js → useAssistant-CnEwkTLm.js} +11 -28
  78. package/dist/{useCustomers-BPW4__PR.js → useCustomers-ChJao1ET.js} +1 -1
  79. package/dist/{useFleet-ChBkxAd6.js → useFleet-g5Yri0G8.js} +1 -1
  80. package/dist/{useImportExport-DrPDHEDK.js → useImportExport-MYwIT3rE.js} +1 -1
  81. package/dist/{useInventory-CAAVMRp6.js → useInventory-BSOn-R1c.js} +1 -1
  82. package/dist/{useOrders-B465S2nt.js → useOrders-BSiqo61w.js} +1 -1
  83. package/dist/{useReports-jQ3GpNOm.js → useReports-fWESfsF9.js} +1 -1
  84. package/dist/{useRoutes-hS3d5-xr.js → useRoutes-zD8Yp323.js} +1 -1
  85. package/dist/{useSettings-BB8X2RLh.js → useSettings-B1lsWeZ1.js} +6 -6
  86. package/dist/{useTracking-RjGz9PZG.js → useTracking-BKG0I2ln.js} +3 -3
  87. package/dist/{user-DzfTn4dE.js → user-DU51el3m.js} +1 -1
  88. package/dist/{user-check-BEKRCi7v.js → user-check-IMhk-qkX.js} +1 -1
  89. package/dist/{users-CCrq-w0C.js → users-B8KhJBGg.js} +1 -1
  90. package/dist/{warehouse-CaqfmMKh.js → warehouse-CcMMioeY.js} +1 -1
  91. package/dist/{wrench-q_rgJfaP.js → wrench-Dg-sgH2e.js} +1 -1
  92. package/dist/{x-tMeDMcCw.js → x-C4ObLVEa.js} +1 -1
  93. package/package.json +5 -1
  94. package/src/movethewheels/components/GlassPanel.tsx +71 -0
  95. package/src/movethewheels/components/MetricCard.tsx +171 -73
  96. package/src/movethewheels/components/StatusBadge.tsx +7 -6
  97. package/src/movethewheels/components/charts/ChartShell.tsx +78 -0
  98. package/src/movethewheels/components/charts/Sparkline.tsx +85 -0
  99. package/src/movethewheels/components/charts/StatusDonut.tsx +115 -0
  100. package/src/movethewheels/components/charts/TrendChart.tsx +179 -0
  101. package/src/movethewheels/components/charts/VolumeBar.tsx +97 -0
  102. package/src/movethewheels/components/charts/chartTokens.ts +43 -0
  103. package/src/movethewheels/components/charts/index.ts +9 -0
  104. package/src/movethewheels/components/index.ts +44 -1
  105. package/src/movethewheels/components/maps/LogisticsMap.tsx +94 -0
  106. package/src/movethewheels/components/maps/MapCanvas.tsx +118 -0
  107. package/src/movethewheels/components/maps/RouteMap.tsx +71 -0
  108. package/src/movethewheels/components/maps/TrackingMap.tsx +102 -0
  109. package/src/movethewheels/components/maps/index.ts +16 -0
  110. package/src/movethewheels/components/maps/leaflet-setup.ts +124 -0
  111. package/src/movethewheels/components/maps/map-markers.css +121 -0
  112. package/src/movethewheels/hooks/useAnalytics.ts +14 -4
  113. package/src/movethewheels/pages/AnalyticsPage.tsx +93 -73
  114. package/src/movethewheels/pages/CreateOrderPage.tsx +4 -4
  115. package/src/movethewheels/pages/CustomersPage.tsx +29 -20
  116. package/src/movethewheels/pages/DashboardPage.tsx +238 -12
  117. package/src/movethewheels/pages/DriverDetailsPage.tsx +1 -1
  118. package/src/movethewheels/pages/DriversPage.tsx +35 -24
  119. package/src/movethewheels/pages/FinancePage.tsx +68 -30
  120. package/src/movethewheels/pages/InventoryPage.tsx +15 -3
  121. package/src/movethewheels/pages/LiveTrackingPage.tsx +124 -16
  122. package/src/movethewheels/pages/OrdersListPage.tsx +46 -38
  123. package/src/movethewheels/pages/ProductsPage.tsx +28 -24
  124. package/src/movethewheels/pages/ReportsPage.tsx +23 -0
  125. package/src/movethewheels/pages/RouteDetailsPage.tsx +46 -7
  126. package/src/movethewheels/pages/SettingsPage.tsx +2 -2
  127. package/src/movethewheels/pages/TrackingPage.tsx +76 -6
  128. package/src/movethewheels/pages/VehicleDetailsPage.tsx +1 -1
  129. package/src/movethewheels/pages/VehiclesPage.tsx +34 -24
  130. package/src/movethewheels/pages/WarehouseDetailsPage.tsx +1 -1
  131. package/src/movethewheels/pages/WarehousesPage.tsx +28 -22
  132. package/src/movethewheels/types/index.ts +1 -1
  133. package/src/movethewheels/utils/mapMarkers.ts +58 -0
  134. package/dist/AnalyticsPage-CMpI1070.js +0 -215
  135. package/dist/CustomersPage-CaNBMXmM.js +0 -172
  136. package/dist/DashboardPage-DIKlXde3.js +0 -387
  137. package/dist/DriversPage-PYmdFiby.js +0 -176
  138. package/dist/FinancePage-Cwh9Bw4M.js +0 -136
  139. package/dist/InventoryPage-DpiqVu1v.js +0 -253
  140. package/dist/LiveTrackingPage-FAzzlVnX.js +0 -379
  141. package/dist/MetricCard-CVBVpu7o.js +0 -146
  142. package/dist/OrdersListPage-CAMsuUck.js +0 -384
  143. package/dist/ProductsPage-DC5qDLfz.js +0 -180
  144. package/dist/ReportsPage-BwUJ37eO.js +0 -356
  145. package/dist/TrackingPage-DaNEFG_h.js +0 -325
  146. package/dist/VehiclesPage-BFw13iMt.js +0 -176
  147. package/dist/WarehousesPage-Wkytnt86.js +0 -173
  148. package/dist/useAnalytics-D7HW2XRb.js +0 -347
  149. /package/dist/{formatters-BQr-aR5W.js → formatters-FWJDwTFv.js} +0 -0
@@ -0,0 +1,186 @@
1
+ import { i as e, l as t, lt as n, st as r, ut as i } from "./PageLayout-BniRJaQ6.js";
2
+ import { t as a } from "./DataTable-CqMUD4er.js";
3
+ import { t as o } from "./download-DP04iWTd.js";
4
+ import { t as s } from "./package-DmRF7iQD.js";
5
+ import { t as c } from "./plus-DlANgOFx.js";
6
+ import { t as l } from "./refresh-cw-rW59D4b7.js";
7
+ import { t as u } from "./triangle-alert-CmS8AUU6.js";
8
+ import { a as d, i as f } from "./useInventory-BSOn-R1c.js";
9
+ import { r as p, t as m } from "./MetricCard-y3bWHKUQ.js";
10
+ import { n as h } from "./formatters-FWJDwTFv.js";
11
+ import { useState as g } from "react";
12
+ import { jsx as _, jsxs as v } from "react/jsx-runtime";
13
+ import { CTAOverflowMenu as y, PagePurpose as b } from "@burdenoff/fe-libs/ui";
14
+ //#region node_modules/lucide-react/dist/esm/icons/thermometer.js
15
+ var x = i("Thermometer", [["path", {
16
+ d: "M14 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z",
17
+ key: "17jzev"
18
+ }]]);
19
+ //#endregion
20
+ //#region src/movethewheels/pages/ProductsPage.tsx
21
+ function S() {
22
+ let { basePath: i, navigate: S } = r(), [C, w] = g(0), [T, E] = g(25), { products: D, hasMore: O, isLoading: k, refetch: A } = d({
23
+ limit: T,
24
+ offset: C * T
25
+ }), { stats: j } = f(), M = (e) => S?.(n(i, e));
26
+ return /* @__PURE__ */ v(e, {
27
+ title: "Products",
28
+ subtitle: `${j.total} products`,
29
+ icon: /* @__PURE__ */ _(s, { size: 24 }),
30
+ headerActions: /* @__PURE__ */ _(y, {
31
+ primary: {
32
+ label: "Add Product",
33
+ icon: /* @__PURE__ */ _(c, { size: 16 }),
34
+ onSelect: () => M("inventory/products/new")
35
+ },
36
+ actions: [{
37
+ label: "Refresh",
38
+ icon: /* @__PURE__ */ _(l, { size: 16 }),
39
+ onSelect: () => A()
40
+ }, {
41
+ label: "Export",
42
+ icon: /* @__PURE__ */ _(o, { size: 16 }),
43
+ onSelect: () => M("import-export")
44
+ }]
45
+ }),
46
+ children: [
47
+ /* @__PURE__ */ _(b, {
48
+ icon: /* @__PURE__ */ _(s, { size: 18 }),
49
+ children: "The catalog of items you ship. Each product's dimensions, weight, value and handling flags (fragile, hazardous, temperature-controlled) drive how it's packed, priced and routed — keep them accurate so shipments are quoted and handled correctly."
50
+ }),
51
+ /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("p", {
52
+ className: "mb-3 text-sm font-medium text-text-secondary",
53
+ children: "Catalog at a glance"
54
+ }), /* @__PURE__ */ v(p, {
55
+ columns: 3,
56
+ children: [
57
+ /* @__PURE__ */ _(m, {
58
+ label: "Total products",
59
+ value: j.total,
60
+ icon: /* @__PURE__ */ _(s, { size: 20 }),
61
+ accent: "brand"
62
+ }),
63
+ /* @__PURE__ */ _(m, {
64
+ label: "Special handling",
65
+ value: j.specialHandling,
66
+ icon: /* @__PURE__ */ _(u, { size: 20 }),
67
+ accent: "warning",
68
+ subtitle: "Fragile or hazardous"
69
+ }),
70
+ /* @__PURE__ */ _(m, {
71
+ label: "Temp-controlled",
72
+ value: j.temperatureControlled,
73
+ icon: /* @__PURE__ */ _(x, { size: 20 }),
74
+ accent: "blue"
75
+ })
76
+ ]
77
+ })] }),
78
+ /* @__PURE__ */ _(a, {
79
+ columns: [
80
+ {
81
+ id: "sku",
82
+ header: "SKU",
83
+ accessorKey: "sku",
84
+ sortable: !0,
85
+ cell: (e) => /* @__PURE__ */ _("span", {
86
+ className: "font-mono",
87
+ children: e.sku
88
+ })
89
+ },
90
+ {
91
+ id: "name",
92
+ header: "Product Name",
93
+ accessorKey: "name",
94
+ sortable: !0,
95
+ cell: (e) => /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("p", {
96
+ className: "font-medium",
97
+ children: e.name
98
+ }), /* @__PURE__ */ _("p", {
99
+ className: "text-sm text-text-secondary line-clamp-1",
100
+ children: e.description
101
+ })] })
102
+ },
103
+ {
104
+ id: "category",
105
+ header: "Category",
106
+ accessorKey: "category",
107
+ sortable: !0,
108
+ cell: (e) => /* @__PURE__ */ _(t, {
109
+ variant: "outline",
110
+ children: e.category
111
+ })
112
+ },
113
+ {
114
+ id: "dimensions",
115
+ header: "Dimensions",
116
+ cell: (e) => `${e.dimensions.length}x${e.dimensions.width}x${e.dimensions.height} ${e.dimensions.unit}`
117
+ },
118
+ {
119
+ id: "weight",
120
+ header: "Weight",
121
+ accessorKey: "weight",
122
+ sortable: !0,
123
+ cell: (e) => `${e.weight} kg`
124
+ },
125
+ {
126
+ id: "value",
127
+ header: "Value",
128
+ accessorKey: "value",
129
+ sortable: !0,
130
+ cell: (e) => /* @__PURE__ */ _("span", {
131
+ className: "font-medium",
132
+ children: h(e.value)
133
+ })
134
+ },
135
+ {
136
+ id: "flags",
137
+ header: "Flags",
138
+ cell: (e) => /* @__PURE__ */ v("div", {
139
+ className: "flex gap-1",
140
+ children: [
141
+ e.fragile && /* @__PURE__ */ _(t, {
142
+ variant: "destructive",
143
+ className: "text-xs",
144
+ children: "Fragile"
145
+ }),
146
+ e.hazardous && /* @__PURE__ */ _(t, {
147
+ variant: "destructive",
148
+ className: "text-xs",
149
+ children: "Hazardous"
150
+ }),
151
+ e.temperatureControlled && /* @__PURE__ */ _(t, {
152
+ variant: "secondary",
153
+ className: "text-xs",
154
+ children: "Temp Control"
155
+ })
156
+ ]
157
+ })
158
+ }
159
+ ],
160
+ data: D,
161
+ isLoading: k,
162
+ searchable: !0,
163
+ searchPlaceholder: "Search products...",
164
+ searchFields: [
165
+ "name",
166
+ "sku",
167
+ "category"
168
+ ],
169
+ onRowClick: (e) => M(`inventory/products/${e.id}`),
170
+ getRowId: (e) => e.id,
171
+ pageIndex: C,
172
+ pageSize: T,
173
+ onPageChange: w,
174
+ onPageSizeChange: (e) => {
175
+ E(e), w(0);
176
+ },
177
+ hasNextPage: O,
178
+ emptyIllustration: "empty-files",
179
+ emptyTitle: "No products yet",
180
+ emptyDescription: "Add products to your catalog so they can be added to orders and stocked in warehouses."
181
+ })
182
+ ]
183
+ });
184
+ }
185
+ //#endregion
186
+ export { S as default };
@@ -0,0 +1,377 @@
1
+ import { B 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, l as d, u as f, ut as p } from "./PageLayout-BniRJaQ6.js";
2
+ import { t as m } from "./chevron-left-B1rZyWWb.js";
3
+ import { t as h } from "./chevron-right-BIcwUJZq.js";
4
+ import { t as ee } from "./clock-dRGG4rkF.js";
5
+ import { t as te } from "./download-DP04iWTd.js";
6
+ import { t as g } from "./filter-BD483_8g.js";
7
+ import { t as _ } from "./plus-DlANgOFx.js";
8
+ import { n as v, o as y } from "./charts-Tj_PPTfA.js";
9
+ import { t as b } from "./useReports-fWESfsF9.js";
10
+ import { r as x } from "./formatters-FWJDwTFv.js";
11
+ import { useState as S } from "react";
12
+ import { jsx as C, jsxs as w } from "react/jsx-runtime";
13
+ import { EmphasisPanel as T, IllustratedEmptyState as E, PagePurpose as ne } from "@burdenoff/fe-libs/ui";
14
+ //#region node_modules/lucide-react/dist/esm/icons/calendar.js
15
+ var re = p("Calendar", [
16
+ ["path", {
17
+ d: "M8 2v4",
18
+ key: "1cmpym"
19
+ }],
20
+ ["path", {
21
+ d: "M16 2v4",
22
+ key: "4m81vk"
23
+ }],
24
+ ["rect", {
25
+ width: "18",
26
+ height: "18",
27
+ x: "3",
28
+ y: "4",
29
+ rx: "2",
30
+ key: "1hopcy"
31
+ }],
32
+ ["path", {
33
+ d: "M3 10h18",
34
+ key: "8toen8"
35
+ }]
36
+ ]), D = p("FileChartColumnIncreasing", [
37
+ ["path", {
38
+ d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",
39
+ key: "1rqfz7"
40
+ }],
41
+ ["path", {
42
+ d: "M14 2v4a2 2 0 0 0 2 2h4",
43
+ key: "tnqrlb"
44
+ }],
45
+ ["path", {
46
+ d: "M8 18v-2",
47
+ key: "qcmpov"
48
+ }],
49
+ ["path", {
50
+ d: "M12 18v-4",
51
+ key: "q1q25u"
52
+ }],
53
+ ["path", {
54
+ d: "M16 18v-6",
55
+ key: "15y0np"
56
+ }]
57
+ ]);
58
+ //#endregion
59
+ //#region src/movethewheels/utils/download.ts
60
+ function O(e, t, n) {
61
+ if (typeof document > "u") return;
62
+ let r = new Blob([t], { type: n }), i = URL.createObjectURL(r), a = document.createElement("a");
63
+ a.href = i, a.download = e, document.body.appendChild(a), a.click(), a.remove(), URL.revokeObjectURL(i);
64
+ }
65
+ function ie(e, t) {
66
+ O(e, JSON.stringify(t, null, 2), "application/json");
67
+ }
68
+ function k(e) {
69
+ if (!e || typeof e != "object") return null;
70
+ let t = Object.entries(e);
71
+ if (t.length === 0) return null;
72
+ let n = (e) => /[",\n]/.test(e) ? `"${e.replace(/"/g, "\"\"")}"` : e, r = (e) => e == null ? "" : typeof e == "object" ? JSON.stringify(e) : String(e), i = ["Field,Value"];
73
+ for (let [e, a] of t) i.push(`${n(e)},${n(r(a))}`);
74
+ return i.join("\n");
75
+ }
76
+ function A(e) {
77
+ return e.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "report";
78
+ }
79
+ //#endregion
80
+ //#region src/movethewheels/pages/ReportsPage.tsx
81
+ var j = [
82
+ {
83
+ value: "operations",
84
+ label: "Operations Summary"
85
+ },
86
+ {
87
+ value: "finance",
88
+ label: "Financial Report"
89
+ },
90
+ {
91
+ value: "fleet",
92
+ label: "Fleet Utilization"
93
+ },
94
+ {
95
+ value: "customers",
96
+ label: "Customer Analytics"
97
+ },
98
+ {
99
+ value: "inventory",
100
+ label: "Inventory Status"
101
+ }
102
+ ], M = 10;
103
+ function N() {
104
+ let [p, N] = S(0), { reports: P, hasMore: F, isLoading: I, error: L, refetch: R, createReport: z, generateReport: B } = b({
105
+ limit: M,
106
+ offset: p * M
107
+ }), { analytics: V } = y(), H = V.trends.dailyOrders.slice(-7), [U, W] = S("operations"), [G, K] = S(null), [q, J] = S(!1), [Y, X] = S(null), Z = (e) => j.find((t) => t.value === e)?.label ?? e, Q = async (e) => {
108
+ J(!0), X(null);
109
+ let t = {
110
+ name: `${Z(U)}${e ? " (Scheduled)" : ""}`,
111
+ type: U,
112
+ description: `${Z(U)} generated from live operational data`,
113
+ ...e ? { schedule: e } : {}
114
+ };
115
+ try {
116
+ await z(t), X({
117
+ tone: "success",
118
+ text: e ? "Scheduled report created." : "Report created."
119
+ });
120
+ } catch (e) {
121
+ X({
122
+ tone: "error",
123
+ text: e instanceof Error ? e.message : "Could not create report."
124
+ });
125
+ } finally {
126
+ J(!1);
127
+ }
128
+ }, ae = async (e) => {
129
+ K(e), X(null);
130
+ try {
131
+ let t = await B(e), n = `${A(t.report.name)}-${t.generatedAt.slice(0, 10)}`, r = k(t.result ?? null);
132
+ r ? O(`${n}.csv`, r, "text/csv") : ie(`${n}.json`, t), X({
133
+ tone: "success",
134
+ text: "Report generated and downloaded."
135
+ });
136
+ } catch (e) {
137
+ X({
138
+ tone: "error",
139
+ text: e instanceof Error ? e.message : "Could not generate report."
140
+ });
141
+ } finally {
142
+ K(null);
143
+ }
144
+ }, $ = P.filter((e) => e.schedule);
145
+ return /* @__PURE__ */ w(u, {
146
+ title: "Reports",
147
+ subtitle: "Generate and schedule reports",
148
+ icon: /* @__PURE__ */ C(D, { size: 24 }),
149
+ headerActions: /* @__PURE__ */ w("div", {
150
+ className: "flex gap-2",
151
+ children: [/* @__PURE__ */ w(i, {
152
+ value: U,
153
+ onValueChange: W,
154
+ children: [/* @__PURE__ */ C(r, {
155
+ className: "w-[190px]",
156
+ children: /* @__PURE__ */ C(a, {})
157
+ }), /* @__PURE__ */ C(t, { children: j.map((e) => /* @__PURE__ */ C(n, {
158
+ value: e.value,
159
+ children: e.label
160
+ }, e.value)) })]
161
+ }), /* @__PURE__ */ w(f, {
162
+ onClick: () => void Q(),
163
+ disabled: q,
164
+ children: [/* @__PURE__ */ C(_, { size: 16 }), " Create Report"]
165
+ })]
166
+ }),
167
+ children: [
168
+ /* @__PURE__ */ C(ne, {
169
+ icon: /* @__PURE__ */ C(D, { size: 18 }),
170
+ children: "Turn your operational data into shareable summaries. Generate one-off reports on orders, finance, fleet, customers or inventory, or schedule them to land in inboxes automatically — so stakeholders always have the latest numbers without logging in."
171
+ }),
172
+ Y && /* @__PURE__ */ C("div", {
173
+ role: "status",
174
+ className: `rounded-lg p-3 text-sm ${Y.tone === "success" ? "bg-status-success-bg-subtle text-status-success-text" : "bg-status-error-bg-subtle text-status-error-text"}`,
175
+ children: Y.text
176
+ }),
177
+ /* @__PURE__ */ w("div", {
178
+ className: "grid grid-cols-1 lg:grid-cols-3 gap-6",
179
+ children: [/* @__PURE__ */ w("div", {
180
+ className: "lg:col-span-2 space-y-4",
181
+ children: [
182
+ /* @__PURE__ */ C("h3", {
183
+ className: "font-semibold",
184
+ children: "Available Reports"
185
+ }),
186
+ I ? /* @__PURE__ */ C("div", {
187
+ className: "space-y-3",
188
+ children: Array.from({ length: 3 }).map((t, n) => /* @__PURE__ */ C(e, { className: "h-20 w-full rounded-lg" }, n))
189
+ }) : L ? /* @__PURE__ */ C(o, {
190
+ className: "border-status-error-border",
191
+ children: /* @__PURE__ */ w(s, {
192
+ className: "p-6 text-center space-y-3",
193
+ children: [
194
+ /* @__PURE__ */ C("p", {
195
+ className: "text-status-error-text font-medium",
196
+ children: "Couldn't load reports"
197
+ }),
198
+ /* @__PURE__ */ C("p", {
199
+ className: "text-sm text-text-secondary",
200
+ children: L.message
201
+ }),
202
+ /* @__PURE__ */ C(f, {
203
+ variant: "outline",
204
+ onClick: R,
205
+ children: "Retry"
206
+ })
207
+ ]
208
+ })
209
+ }) : P.length === 0 ? /* @__PURE__ */ C(o, { children: /* @__PURE__ */ C(s, {
210
+ className: "p-0",
211
+ children: /* @__PURE__ */ C(E, {
212
+ illustration: "empty-data",
213
+ title: "No reports yet",
214
+ description: "Create your first report to turn live operational data into a shareable summary.",
215
+ action: /* @__PURE__ */ w(f, {
216
+ onClick: () => void Q(),
217
+ disabled: q,
218
+ children: [/* @__PURE__ */ C(_, {
219
+ size: 16,
220
+ className: "mr-1.5"
221
+ }), " Create Report"]
222
+ })
223
+ })
224
+ }) }) : P.map((e) => /* @__PURE__ */ C(o, { children: /* @__PURE__ */ C(s, {
225
+ className: "p-4",
226
+ children: /* @__PURE__ */ w("div", {
227
+ className: "flex items-center justify-between",
228
+ children: [/* @__PURE__ */ w("div", {
229
+ className: "flex items-center gap-3",
230
+ children: [/* @__PURE__ */ C("div", {
231
+ className: "w-10 h-10 rounded-lg bg-action-primary-bg/10 flex items-center justify-center",
232
+ children: /* @__PURE__ */ C(D, {
233
+ size: 20,
234
+ className: "text-primary"
235
+ })
236
+ }), /* @__PURE__ */ w("div", { children: [/* @__PURE__ */ C("p", {
237
+ className: "font-medium",
238
+ children: e.name
239
+ }), /* @__PURE__ */ C("p", {
240
+ className: "text-sm text-text-secondary",
241
+ children: e.description ?? Z(e.type)
242
+ })] })]
243
+ }), /* @__PURE__ */ w("div", {
244
+ className: "flex items-center gap-3",
245
+ children: [/* @__PURE__ */ w("div", {
246
+ className: "text-right",
247
+ children: [/* @__PURE__ */ C(d, {
248
+ variant: "outline",
249
+ children: e.schedule ?? "On demand"
250
+ }), e.lastGenerated && /* @__PURE__ */ w("p", {
251
+ className: "text-xs text-text-secondary mt-1",
252
+ children: ["Last: ", x(new Date(e.lastGenerated), "short")]
253
+ })]
254
+ }), /* @__PURE__ */ C(f, {
255
+ variant: "outline",
256
+ size: "sm",
257
+ "aria-label": `Generate ${e.name}`,
258
+ disabled: G === e.id,
259
+ onClick: () => void ae(e.id),
260
+ children: /* @__PURE__ */ C(te, { size: 14 })
261
+ })]
262
+ })]
263
+ })
264
+ }) }, e.id)),
265
+ !I && !L && (P.length > 0 || p > 0) && /* @__PURE__ */ w("div", {
266
+ className: "flex flex-wrap items-center justify-between gap-3 pt-1",
267
+ children: [/* @__PURE__ */ w("span", {
268
+ className: "text-sm text-text-secondary",
269
+ children: [
270
+ "Showing ",
271
+ P.length === 0 ? 0 : p * M + 1,
272
+ " to",
273
+ " ",
274
+ p * M + P.length
275
+ ]
276
+ }), /* @__PURE__ */ w("div", {
277
+ className: "flex items-center gap-1",
278
+ children: [
279
+ /* @__PURE__ */ C(f, {
280
+ variant: "outline",
281
+ size: "icon",
282
+ className: "h-8 w-8",
283
+ "aria-label": "Previous page",
284
+ onClick: () => N((e) => Math.max(0, e - 1)),
285
+ disabled: p === 0,
286
+ children: /* @__PURE__ */ C(m, { className: "h-4 w-4" })
287
+ }),
288
+ /* @__PURE__ */ w("span", {
289
+ className: "px-3 text-sm",
290
+ children: ["Page ", p + 1]
291
+ }),
292
+ /* @__PURE__ */ C(f, {
293
+ variant: "outline",
294
+ size: "icon",
295
+ className: "h-8 w-8",
296
+ "aria-label": "Next page",
297
+ onClick: () => N((e) => e + 1),
298
+ disabled: !F,
299
+ children: /* @__PURE__ */ C(h, { className: "h-4 w-4" })
300
+ })
301
+ ]
302
+ })]
303
+ })
304
+ ]
305
+ }), /* @__PURE__ */ w("div", {
306
+ className: "space-y-6",
307
+ children: [
308
+ /* @__PURE__ */ w(o, { children: [/* @__PURE__ */ C(l, { children: /* @__PURE__ */ C(c, {
309
+ className: "text-base",
310
+ children: "Data preview"
311
+ }) }), /* @__PURE__ */ w(s, { children: [/* @__PURE__ */ C("p", {
312
+ className: "mb-2 text-xs text-text-secondary",
313
+ children: "Order volume · last 7 days"
314
+ }), /* @__PURE__ */ C(v, {
315
+ xKey: "date",
316
+ height: 160,
317
+ showLegend: !1,
318
+ data: H,
319
+ series: [{
320
+ dataKey: "orders",
321
+ name: "Orders"
322
+ }],
323
+ emptyMessage: "No order data to preview yet"
324
+ })] })] }),
325
+ /* @__PURE__ */ w(T, {
326
+ className: "space-y-3",
327
+ children: [
328
+ /* @__PURE__ */ w("h2", {
329
+ className: "flex items-center gap-2 text-base font-semibold text-text-primary",
330
+ children: [/* @__PURE__ */ C(ee, { size: 18 }), " Scheduled Reports"]
331
+ }),
332
+ $.length === 0 ? /* @__PURE__ */ C("p", {
333
+ className: "text-sm text-text-secondary",
334
+ children: "No scheduled reports yet. Schedule one to have it generated automatically."
335
+ }) : $.map((e) => /* @__PURE__ */ w("div", {
336
+ className: "p-3 border border-border-seam rounded-lg",
337
+ children: [/* @__PURE__ */ C("p", {
338
+ className: "font-medium",
339
+ children: e.name
340
+ }), /* @__PURE__ */ w("p", {
341
+ className: "text-sm text-text-secondary",
342
+ children: ["Schedule: ", e.schedule]
343
+ })]
344
+ }, e.id)),
345
+ /* @__PURE__ */ C(f, {
346
+ variant: "outline",
347
+ className: "w-full",
348
+ disabled: q,
349
+ onClick: () => void Q("daily"),
350
+ children: "Schedule New Report"
351
+ })
352
+ ]
353
+ }),
354
+ /* @__PURE__ */ w(o, { children: [/* @__PURE__ */ C(l, { children: /* @__PURE__ */ C(c, { children: "Quick Actions" }) }), /* @__PURE__ */ w(s, {
355
+ className: "space-y-2",
356
+ children: [/* @__PURE__ */ w(f, {
357
+ variant: "outline",
358
+ className: "w-full justify-start",
359
+ disabled: q,
360
+ onClick: () => void Q("weekly"),
361
+ children: [/* @__PURE__ */ C(re, { size: 16 }), " Schedule Report"]
362
+ }), /* @__PURE__ */ w(f, {
363
+ variant: "outline",
364
+ className: "w-full justify-start",
365
+ disabled: q,
366
+ onClick: () => void Q(),
367
+ children: [/* @__PURE__ */ C(g, { size: 16 }), " Custom Report"]
368
+ })]
369
+ })] })
370
+ ]
371
+ })]
372
+ })
373
+ ]
374
+ });
375
+ }
376
+ //#endregion
377
+ export { N as default };