@burdenoff/microfe-movethewheels 2026.1031.3 → 2026.1031.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.
- package/dist/MoveTheWheelsRoot.js +136 -127
- package/dist/MoveTheWheelsRoutes.js +140 -135
- package/dist/components/DocumentsCard.js +11 -11
- package/dist/components/ProofOfDeliveryCard.js +13 -13
- package/dist/components/ShipmentRiskDialog.js +24 -24
- package/dist/components/ShippingQuoteResults.js +46 -46
- package/dist/components/TrackingAlertList.js +17 -17
- package/dist/generated/tracking-quality-operations.d.ts +56 -0
- package/dist/hooks/useOrderDispatch.js +17 -17
- package/dist/movethewheels/pages/SettingsPage.d.ts +1 -0
- package/dist/movethewheels/providers/ModuleSettingsProvider.d.ts +17 -0
- package/dist/movethewheels/utils/formatters.d.ts +23 -3
- package/dist/movethewheels/utils/moduleSettings.d.ts +52 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/bell.js +11 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/key-round.js +14 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/plug.js +22 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/rotate-ccw.js +11 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/settings.js +13 -0
- package/dist/pages/AnalyticsPage.js +27 -27
- package/dist/pages/CreateOrderPage.js +340 -317
- package/dist/pages/CustomerDetailsPage.js +246 -246
- package/dist/pages/CustomersPage.js +19 -19
- package/dist/pages/DashboardPage.js +24 -24
- package/dist/pages/DeliveryCapturePage.js +74 -74
- package/dist/pages/DriverDetailsPage.js +337 -337
- package/dist/pages/DriversPage.js +26 -26
- package/dist/pages/FinancePage.js +26 -26
- package/dist/pages/InventoryPage.js +28 -28
- package/dist/pages/LiveTrackingPage.js +108 -108
- package/dist/pages/MarketplacePage.js +44 -44
- package/dist/pages/OrderDetailsPage.js +306 -306
- package/dist/pages/OrdersListPage.js +27 -27
- package/dist/pages/ProductDetailsPage.js +89 -89
- package/dist/pages/ProductsPage.js +73 -73
- package/dist/pages/RouteDetailsPage.js +282 -285
- package/dist/pages/RoutesPage.js +78 -78
- package/dist/pages/SettingsPage.js +459 -0
- package/dist/pages/TrackingPage.js +41 -41
- package/dist/pages/VehicleDetailsPage.js +207 -207
- package/dist/pages/VehiclesPage.js +17 -16
- package/dist/pages/WarehouseDetailsPage.js +132 -132
- package/dist/providers/ModuleSettingsProvider.js +74 -0
- package/dist/utils/formatters.js +53 -26
- package/dist/utils/moduleSettings.js +132 -0
- package/package.json +3 -2
- package/src/generated/tracking-quality-operations.ts +62 -0
- package/src/movethewheels/MoveTheWheelsRoot.tsx +14 -3
- package/src/movethewheels/MoveTheWheelsRoutes.tsx +9 -0
- package/src/movethewheels/pages/CreateOrderPage.tsx +38 -6
- package/src/movethewheels/pages/ProductsPage.tsx +2 -2
- package/src/movethewheels/pages/RouteDetailsPage.tsx +3 -6
- package/src/movethewheels/pages/RoutesPage.tsx +2 -2
- package/src/movethewheels/pages/SettingsPage.tsx +516 -0
- package/src/movethewheels/pages/VehicleDetailsPage.tsx +4 -2
- package/src/movethewheels/pages/VehiclesPage.tsx +2 -1
- package/src/movethewheels/providers/ModuleSettingsProvider.tsx +133 -0
- package/src/movethewheels/utils/formatters.ts +69 -10
- package/src/movethewheels/utils/moduleSettings.ts +224 -0
|
@@ -11,14 +11,14 @@ import { UserMinus as ae } from "../node_modules/lucide-react/dist/esm/icons/use
|
|
|
11
11
|
import { Users as i } from "../node_modules/lucide-react/dist/esm/icons/users.js";
|
|
12
12
|
import { joinPath as oe } from "../utils/navigation.js";
|
|
13
13
|
import { useMoveTheWheels as a } from "../providers/MoveTheWheelsProvider.js";
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
14
|
+
import { formatDate as o } from "../utils/formatters.js";
|
|
15
|
+
import { useDriverStatusCounts as s, useDrivers as c, useFleetStats as l, useVehicles as u } from "../hooks/useFleet.js";
|
|
16
|
+
import { Avatar as d, AvatarFallback as f, Button as se, Card as p, CardContent as m, Select as h, SelectContent as g, SelectItem as _, SelectTrigger as v, SelectValue as y } from "../components/ui.js";
|
|
16
17
|
import { PageLayout as ce } from "../components/PageLayout.js";
|
|
17
|
-
import { MetricCard as
|
|
18
|
-
import { DRIVER_STATUS_LABELS as
|
|
18
|
+
import { MetricCard as b, MetricGrid as le } from "../components/MetricCard.js";
|
|
19
|
+
import { DRIVER_STATUS_LABELS as x } from "../constants/index.js";
|
|
19
20
|
import { StatusBadge as ue } from "../components/StatusBadge.js";
|
|
20
21
|
import { DataTable as de } from "../components/DataTable.js";
|
|
21
|
-
import { formatDate as x } from "../utils/formatters.js";
|
|
22
22
|
import { useDebouncedValue as fe } from "../hooks/useDebouncedValue.js";
|
|
23
23
|
import { useEntityExport as S } from "../hooks/useEntityExport.js";
|
|
24
24
|
import { ExportStatusBanner as C } from "../components/ExportStatusBanner.js";
|
|
@@ -29,18 +29,18 @@ import { CTAOverflowMenu as O, PagePurpose as k } from "@burdenoff/fe-libs/ui";
|
|
|
29
29
|
var A = [{
|
|
30
30
|
value: "all",
|
|
31
31
|
label: "All statuses"
|
|
32
|
-
}, ...Object.entries(
|
|
32
|
+
}, ...Object.entries(x).map(([e, t]) => ({
|
|
33
33
|
value: e,
|
|
34
34
|
label: t
|
|
35
35
|
}))];
|
|
36
36
|
function j() {
|
|
37
|
-
let { basePath:
|
|
37
|
+
let { basePath: x, navigate: j } = a(), { state: M, isExporting: N, startExport: P, dismiss: F } = S("drivers", "driver"), [I, L] = T(0), [R, z] = T(25), [B, V] = T(""), pe = fe(B), [H, U] = T("all"), [W, G] = T("all"), { drivers: K, totalDrivers: me, hasMore: he, isLoading: ge, error: _e, refetch: q } = c({
|
|
38
38
|
limit: R,
|
|
39
39
|
offset: I * R,
|
|
40
40
|
search: pe || void 0,
|
|
41
41
|
status: H === "all" ? void 0 : H,
|
|
42
42
|
licenseClass: W === "all" ? void 0 : W
|
|
43
|
-
}), { stats: J } =
|
|
43
|
+
}), { stats: J } = l(), { counts: Y } = s(), { vehicles: X } = u({ ids: w(() => Array.from(new Set(K.map((e) => e.assignedVehicle).filter(Boolean))), [K]) }), ve = w(() => new Map(X.map((e) => [e.id, e.vehicleNumber])), [X]), Z = J.totalDrivers, ye = w(() => Array.from(new Set(K.map((e) => e.licenseType).filter(Boolean))).sort((e, t) => e.localeCompare(t)), [K]), Q = H !== "all" || W !== "all" || B.length > 0, $ = (e) => j?.(oe(x, e));
|
|
44
44
|
return /* @__PURE__ */ D(ce, {
|
|
45
45
|
title: "Drivers",
|
|
46
46
|
subtitle: `${Z} drivers`,
|
|
@@ -84,28 +84,28 @@ function j() {
|
|
|
84
84
|
}), /* @__PURE__ */ D(le, {
|
|
85
85
|
columns: 4,
|
|
86
86
|
children: [
|
|
87
|
-
/* @__PURE__ */ E(
|
|
87
|
+
/* @__PURE__ */ E(b, {
|
|
88
88
|
label: "On duty",
|
|
89
89
|
value: J.driversByStatus.available + J.driversByStatus.busy,
|
|
90
90
|
icon: /* @__PURE__ */ E(ie, { size: 20 }),
|
|
91
91
|
accent: "success",
|
|
92
92
|
subtitle: "Available or delivering"
|
|
93
93
|
}),
|
|
94
|
-
/* @__PURE__ */ E(
|
|
94
|
+
/* @__PURE__ */ E(b, {
|
|
95
95
|
label: "On break",
|
|
96
96
|
value: Y.onBreak,
|
|
97
97
|
icon: /* @__PURE__ */ E(e, { size: 20 }),
|
|
98
98
|
accent: "warning",
|
|
99
99
|
subtitle: "Back on shift shortly"
|
|
100
100
|
}),
|
|
101
|
-
/* @__PURE__ */ E(
|
|
101
|
+
/* @__PURE__ */ E(b, {
|
|
102
102
|
label: "Off duty",
|
|
103
103
|
value: Y.offDuty,
|
|
104
104
|
icon: /* @__PURE__ */ E(ae, { size: 20 }),
|
|
105
105
|
accent: "neutral",
|
|
106
106
|
subtitle: Y.inactive > 0 ? `${Y.inactive} inactive` : void 0
|
|
107
107
|
}),
|
|
108
|
-
/* @__PURE__ */ E(
|
|
108
|
+
/* @__PURE__ */ E(b, {
|
|
109
109
|
label: "Avg rating",
|
|
110
110
|
value: J.avgDriverRating > 0 ? J.avgDriverRating.toFixed(1) : "—",
|
|
111
111
|
icon: /* @__PURE__ */ E(r, { size: 20 }),
|
|
@@ -114,7 +114,7 @@ function j() {
|
|
|
114
114
|
})
|
|
115
115
|
]
|
|
116
116
|
})] }),
|
|
117
|
-
/* @__PURE__ */ E(
|
|
117
|
+
/* @__PURE__ */ E(p, { children: /* @__PURE__ */ E(m, {
|
|
118
118
|
className: "p-4",
|
|
119
119
|
children: /* @__PURE__ */ D("div", {
|
|
120
120
|
className: "flex flex-wrap items-center gap-4",
|
|
@@ -129,36 +129,36 @@ function j() {
|
|
|
129
129
|
children: "Filters:"
|
|
130
130
|
})]
|
|
131
131
|
}),
|
|
132
|
-
/* @__PURE__ */ D(
|
|
132
|
+
/* @__PURE__ */ D(h, {
|
|
133
133
|
value: H,
|
|
134
134
|
onValueChange: (e) => {
|
|
135
135
|
U(e), L(0);
|
|
136
136
|
},
|
|
137
|
-
children: [/* @__PURE__ */ E(
|
|
137
|
+
children: [/* @__PURE__ */ E(v, {
|
|
138
138
|
className: "w-[180px]",
|
|
139
|
-
children: /* @__PURE__ */ E(
|
|
140
|
-
}), /* @__PURE__ */ E(
|
|
139
|
+
children: /* @__PURE__ */ E(y, { placeholder: "Status" })
|
|
140
|
+
}), /* @__PURE__ */ E(g, { children: A.map((e) => /* @__PURE__ */ E(_, {
|
|
141
141
|
value: e.value,
|
|
142
142
|
children: e.label
|
|
143
143
|
}, e.value)) })]
|
|
144
144
|
}),
|
|
145
|
-
/* @__PURE__ */ D(
|
|
145
|
+
/* @__PURE__ */ D(h, {
|
|
146
146
|
value: W,
|
|
147
147
|
onValueChange: (e) => {
|
|
148
148
|
G(e), L(0);
|
|
149
149
|
},
|
|
150
|
-
children: [/* @__PURE__ */ E(
|
|
150
|
+
children: [/* @__PURE__ */ E(v, {
|
|
151
151
|
className: "w-[180px]",
|
|
152
|
-
children: /* @__PURE__ */ E(
|
|
153
|
-
}), /* @__PURE__ */ D(
|
|
152
|
+
children: /* @__PURE__ */ E(y, { placeholder: "License class" })
|
|
153
|
+
}), /* @__PURE__ */ D(g, { children: [/* @__PURE__ */ E(_, {
|
|
154
154
|
value: "all",
|
|
155
155
|
children: "All licence classes"
|
|
156
|
-
}), ye.map((e) => /* @__PURE__ */ E(
|
|
156
|
+
}), ye.map((e) => /* @__PURE__ */ E(_, {
|
|
157
157
|
value: e,
|
|
158
158
|
children: e
|
|
159
159
|
}, e))] })]
|
|
160
160
|
}),
|
|
161
|
-
Q && /* @__PURE__ */ E(
|
|
161
|
+
Q && /* @__PURE__ */ E(se, {
|
|
162
162
|
variant: "ghost",
|
|
163
163
|
size: "sm",
|
|
164
164
|
onClick: () => {
|
|
@@ -176,7 +176,7 @@ function j() {
|
|
|
176
176
|
header: "Driver",
|
|
177
177
|
cell: (e) => /* @__PURE__ */ D("div", {
|
|
178
178
|
className: "flex items-center gap-3",
|
|
179
|
-
children: [/* @__PURE__ */ E(
|
|
179
|
+
children: [/* @__PURE__ */ E(d, { children: /* @__PURE__ */ E(f, { children: e.fullName.split(" ").map((e) => e[0]).join("") }) }), /* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E("p", {
|
|
180
180
|
className: "font-medium",
|
|
181
181
|
children: e.fullName
|
|
182
182
|
}), /* @__PURE__ */ E("p", {
|
|
@@ -202,7 +202,7 @@ function j() {
|
|
|
202
202
|
className: "text-sm",
|
|
203
203
|
children: [/* @__PURE__ */ E("p", { children: e.licenseType }), /* @__PURE__ */ E("p", {
|
|
204
204
|
className: "text-text-secondary",
|
|
205
|
-
children: e.licenseExpiry ? `Exp: ${
|
|
205
|
+
children: e.licenseExpiry ? `Exp: ${o(e.licenseExpiry, "short")}` : "Expiry not recorded"
|
|
206
206
|
})]
|
|
207
207
|
})
|
|
208
208
|
},
|
|
@@ -260,7 +260,7 @@ function j() {
|
|
|
260
260
|
header: "Hire Date",
|
|
261
261
|
accessorKey: "hireDate",
|
|
262
262
|
sortable: !0,
|
|
263
|
-
cell: (e) => e.hireDate ?
|
|
263
|
+
cell: (e) => e.hireDate ? o(e.hireDate, "short") : /* @__PURE__ */ E("span", {
|
|
264
264
|
className: "text-text-secondary",
|
|
265
265
|
children: "Not recorded"
|
|
266
266
|
})
|
|
@@ -5,21 +5,21 @@ import { FileText as r } from "../node_modules/lucide-react/dist/esm/icons/file-
|
|
|
5
5
|
import { Fuel as i } from "../node_modules/lucide-react/dist/esm/icons/fuel.js";
|
|
6
6
|
import { TrendingUp as a } from "../node_modules/lucide-react/dist/esm/icons/trending-up.js";
|
|
7
7
|
import { useMoveTheWheels as o } from "../providers/MoveTheWheelsProvider.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
8
|
+
import { formatCurrency as s } from "../utils/formatters.js";
|
|
9
|
+
import { useAnalytics as c, useFinanceMetrics as l } from "../hooks/useAnalytics.js";
|
|
10
|
+
import { Button as u, Card as d, CardContent as f, CardHeader as p, CardTitle as m } from "../components/ui.js";
|
|
11
|
+
import { PageLayout as h } from "../components/PageLayout.js";
|
|
12
|
+
import { chartTokens as g } from "../components/charts/chartTokens.js";
|
|
13
|
+
import { MetricCard as _, MetricGrid as v } from "../components/MetricCard.js";
|
|
14
|
+
import { TrendChart as y } from "../components/charts/TrendChart.js";
|
|
15
|
+
import { VolumeBar as b } from "../components/charts/VolumeBar.js";
|
|
15
16
|
import "../components/charts/index.js";
|
|
16
|
-
import { formatCurrency as b } from "../utils/formatters.js";
|
|
17
17
|
import { useMemo as x } from "react";
|
|
18
18
|
import { jsx as S, jsxs as C } from "react/jsx-runtime";
|
|
19
19
|
import { EmphasisPanel as w, PagePurpose as T } from "@burdenoff/fe-libs/ui";
|
|
20
20
|
//#region src/movethewheels/pages/FinancePage.tsx
|
|
21
21
|
function E() {
|
|
22
|
-
let { analytics: E } =
|
|
22
|
+
let { analytics: E } = c(), { metrics: D } = l(), { navigate: O } = o(), k = () => O("/billing"), A = x(() => E.trends.revenue.map((e) => ({
|
|
23
23
|
month: e.month,
|
|
24
24
|
revenue: e.revenue
|
|
25
25
|
})), [E.trends.revenue]), j = x(() => [
|
|
@@ -40,11 +40,11 @@ function E() {
|
|
|
40
40
|
D.deliveredRevenue,
|
|
41
41
|
D.fuelCost
|
|
42
42
|
]), M = j.some((e) => e.amount > 0);
|
|
43
|
-
return /* @__PURE__ */ C(
|
|
43
|
+
return /* @__PURE__ */ C(h, {
|
|
44
44
|
title: "Finance",
|
|
45
45
|
subtitle: "Financial overview and reports",
|
|
46
46
|
icon: /* @__PURE__ */ S(n, { size: 24 }),
|
|
47
|
-
headerActions: /* @__PURE__ */ C(
|
|
47
|
+
headerActions: /* @__PURE__ */ C(u, {
|
|
48
48
|
variant: "outline",
|
|
49
49
|
onClick: k,
|
|
50
50
|
children: [/* @__PURE__ */ S(r, { size: 16 }), " Invoices & Billing"]
|
|
@@ -54,30 +54,30 @@ function E() {
|
|
|
54
54
|
icon: /* @__PURE__ */ S(n, { size: 18 }),
|
|
55
55
|
children: "Follow the money behind your deliveries. See total revenue, how much has already been collected on delivered orders, fuel cost and how many invoices are still open — then head to Billing to raise and settle invoices."
|
|
56
56
|
}),
|
|
57
|
-
/* @__PURE__ */ C(
|
|
57
|
+
/* @__PURE__ */ C(v, {
|
|
58
58
|
columns: 4,
|
|
59
59
|
children: [
|
|
60
|
-
/* @__PURE__ */ S(
|
|
60
|
+
/* @__PURE__ */ S(_, {
|
|
61
61
|
treatment: "glass",
|
|
62
62
|
glow: !0,
|
|
63
63
|
label: "Total Revenue",
|
|
64
|
-
value:
|
|
64
|
+
value: s(D.totalRevenue),
|
|
65
65
|
icon: /* @__PURE__ */ S(n, { size: 20 }),
|
|
66
66
|
accent: "success"
|
|
67
67
|
}),
|
|
68
|
-
/* @__PURE__ */ S(
|
|
68
|
+
/* @__PURE__ */ S(_, {
|
|
69
69
|
label: "Collected (Delivered)",
|
|
70
|
-
value:
|
|
70
|
+
value: s(D.deliveredRevenue),
|
|
71
71
|
icon: /* @__PURE__ */ S(a, { size: 20 }),
|
|
72
72
|
accent: "brand"
|
|
73
73
|
}),
|
|
74
|
-
/* @__PURE__ */ S(
|
|
74
|
+
/* @__PURE__ */ S(_, {
|
|
75
75
|
label: "Fuel Cost",
|
|
76
|
-
value:
|
|
76
|
+
value: s(D.fuelCost),
|
|
77
77
|
icon: /* @__PURE__ */ S(i, { size: 20 }),
|
|
78
78
|
accent: "warning"
|
|
79
79
|
}),
|
|
80
|
-
/* @__PURE__ */ S(
|
|
80
|
+
/* @__PURE__ */ S(_, {
|
|
81
81
|
label: "Open Invoices",
|
|
82
82
|
value: String(D.openInvoices),
|
|
83
83
|
icon: /* @__PURE__ */ S(t, { size: 20 }),
|
|
@@ -87,9 +87,9 @@ function E() {
|
|
|
87
87
|
}),
|
|
88
88
|
/* @__PURE__ */ C("div", {
|
|
89
89
|
className: "grid grid-cols-1 lg:grid-cols-3 gap-6",
|
|
90
|
-
children: [/* @__PURE__ */ C(
|
|
90
|
+
children: [/* @__PURE__ */ C(d, {
|
|
91
91
|
className: "lg:col-span-2",
|
|
92
|
-
children: [/* @__PURE__ */ S(
|
|
92
|
+
children: [/* @__PURE__ */ S(p, { children: /* @__PURE__ */ S(m, { children: "Revenue trend" }) }), /* @__PURE__ */ S(f, { children: /* @__PURE__ */ S(y, {
|
|
93
93
|
xKey: "month",
|
|
94
94
|
variant: "area",
|
|
95
95
|
height: 280,
|
|
@@ -98,9 +98,9 @@ function E() {
|
|
|
98
98
|
series: [{
|
|
99
99
|
dataKey: "revenue",
|
|
100
100
|
name: "Revenue",
|
|
101
|
-
color:
|
|
101
|
+
color: g.brandBlue
|
|
102
102
|
}],
|
|
103
|
-
valueFormatter: (e) =>
|
|
103
|
+
valueFormatter: (e) => s(Number(e)),
|
|
104
104
|
emptyMessage: "No revenue recorded yet. Revenue appears here as orders are delivered."
|
|
105
105
|
}) })]
|
|
106
106
|
}), /* @__PURE__ */ C(w, {
|
|
@@ -136,7 +136,7 @@ function E() {
|
|
|
136
136
|
children: D.openInvoices
|
|
137
137
|
})]
|
|
138
138
|
}),
|
|
139
|
-
/* @__PURE__ */ C(
|
|
139
|
+
/* @__PURE__ */ C(u, {
|
|
140
140
|
className: "w-full",
|
|
141
141
|
onClick: k,
|
|
142
142
|
children: ["Open Billing ", /* @__PURE__ */ S(e, { size: 16 })]
|
|
@@ -144,7 +144,7 @@ function E() {
|
|
|
144
144
|
]
|
|
145
145
|
})]
|
|
146
146
|
}),
|
|
147
|
-
/* @__PURE__ */ C(
|
|
147
|
+
/* @__PURE__ */ C(d, { children: [/* @__PURE__ */ S(p, { children: /* @__PURE__ */ S(m, { children: "Revenue vs cost" }) }), /* @__PURE__ */ S(f, { children: M ? /* @__PURE__ */ S(b, {
|
|
148
148
|
xKey: "label",
|
|
149
149
|
height: 260,
|
|
150
150
|
showLegend: !1,
|
|
@@ -153,7 +153,7 @@ function E() {
|
|
|
153
153
|
dataKey: "amount",
|
|
154
154
|
name: "Amount"
|
|
155
155
|
}],
|
|
156
|
-
valueFormatter: (e) =>
|
|
156
|
+
valueFormatter: (e) => s(Number(e))
|
|
157
157
|
}) : /* @__PURE__ */ S("p", {
|
|
158
158
|
className: "py-8 text-center text-sm text-text-secondary",
|
|
159
159
|
children: "Revenue and cost figures appear here as orders are delivered."
|
|
@@ -14,14 +14,14 @@ import { TriangleAlert as s } from "../node_modules/lucide-react/dist/esm/icons/
|
|
|
14
14
|
import { Warehouse as ae } from "../node_modules/lucide-react/dist/esm/icons/warehouse.js";
|
|
15
15
|
import { joinPath as c } from "../utils/navigation.js";
|
|
16
16
|
import { useMoveTheWheels as l } from "../providers/MoveTheWheelsProvider.js";
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
17
|
+
import { formatCurrency as oe, formatDate as se } from "../utils/formatters.js";
|
|
18
|
+
import { useInventory as ce, useInventoryStats as le, useInventoryTransactions as ue } from "../hooks/useInventory.js";
|
|
19
|
+
import { Badge as u, Button as d, Card as f, CardContent as p, CardHeader as de, CardTitle as m, Progress as fe } from "../components/ui.js";
|
|
20
|
+
import { PageLayout as pe, PageSection as h } from "../components/PageLayout.js";
|
|
21
|
+
import { MetricCard as g, MetricCardSkeleton as me, MetricGrid as _ } from "../components/MetricCard.js";
|
|
22
|
+
import { StatusBadge as he } from "../components/StatusBadge.js";
|
|
23
|
+
import { DataTable as ge } from "../components/DataTable.js";
|
|
24
|
+
import { Notice as _e, useNotice as ve } from "../components/Notice.js";
|
|
25
25
|
import { useDebouncedValue as ye } from "../hooks/useDebouncedValue.js";
|
|
26
26
|
import { AdjustStockDialog as be, ReceiveStockDialog as xe, TransferStockDialog as Se } from "../components/StockActionDialogs.js";
|
|
27
27
|
import { useMemo as Ce, useState as v } from "react";
|
|
@@ -63,11 +63,11 @@ function O() {
|
|
|
63
63
|
let { t: O } = we(), k = (e, t) => {
|
|
64
64
|
let n = O(e);
|
|
65
65
|
return n === e ? t : n;
|
|
66
|
-
}, { basePath: Te, navigate: Ee } = l(), [A, De] = v(""), [j, M] = v(0), [N, Oe] = v(10), { inventory: P, lowStockItems: F, products: I, warehouses: ke, totalItems: Ae, hasMore: je, isLoading: L, error: R, refetch: z } =
|
|
66
|
+
}, { basePath: Te, navigate: Ee } = l(), [A, De] = v(""), [j, M] = v(0), [N, Oe] = v(10), { inventory: P, lowStockItems: F, products: I, warehouses: ke, totalItems: Ae, hasMore: je, isLoading: L, error: R, refetch: z } = ce({
|
|
67
67
|
search: ye(A),
|
|
68
68
|
limit: N,
|
|
69
69
|
offset: j * N
|
|
70
|
-
}), { stats: B, refetch: Me } =
|
|
70
|
+
}), { stats: B, refetch: Me } = le(), { transactions: V, isLoading: Ne, error: H, refetch: Pe } = ue({ limit: 8 }), { message: U, notify: Fe } = ve(6e3), [Ie, W] = v(!1), [G, K] = v(null), [q, J] = v(null), Y = (e) => ({
|
|
71
71
|
id: e.id,
|
|
72
72
|
productName: e.productName,
|
|
73
73
|
sku: e.sku,
|
|
@@ -155,7 +155,7 @@ function O() {
|
|
|
155
155
|
{
|
|
156
156
|
id: "state",
|
|
157
157
|
header: k("movethewheels.inventory.stock.status", "Status"),
|
|
158
|
-
cell: (e) => /* @__PURE__ */ y(
|
|
158
|
+
cell: (e) => /* @__PURE__ */ y(he, {
|
|
159
159
|
status: e.stockState === "out_of_stock" ? k("movethewheels.inventory.stock.outOfStock", "Out of stock") : e.stockState === "low" ? k("movethewheels.inventory.stock.low", "Low") : k("movethewheels.inventory.stock.inStock", "In stock"),
|
|
160
160
|
customColors: w[e.stockState],
|
|
161
161
|
size: "sm"
|
|
@@ -193,7 +193,7 @@ function O() {
|
|
|
193
193
|
})
|
|
194
194
|
}
|
|
195
195
|
];
|
|
196
|
-
return /* @__PURE__ */ b(
|
|
196
|
+
return /* @__PURE__ */ b(pe, {
|
|
197
197
|
title: k("movethewheels.inventory.title", "Inventory"),
|
|
198
198
|
subtitle: k("movethewheels.inventory.subtitle", "Manage your products and warehouses"),
|
|
199
199
|
icon: /* @__PURE__ */ y(o, { size: 24 }),
|
|
@@ -226,7 +226,7 @@ function O() {
|
|
|
226
226
|
}),
|
|
227
227
|
U && /* @__PURE__ */ y("div", {
|
|
228
228
|
className: "mb-2",
|
|
229
|
-
children: /* @__PURE__ */ y(
|
|
229
|
+
children: /* @__PURE__ */ y(_e, { message: U })
|
|
230
230
|
}),
|
|
231
231
|
R && !L ? /* @__PURE__ */ y(f, {
|
|
232
232
|
className: "border-status-error-border",
|
|
@@ -250,46 +250,46 @@ function O() {
|
|
|
250
250
|
})
|
|
251
251
|
}) : L ? /* @__PURE__ */ y(_, {
|
|
252
252
|
columns: 6,
|
|
253
|
-
children: Array.from({ length: 6 }).map((e, t) => /* @__PURE__ */ y(
|
|
253
|
+
children: Array.from({ length: 6 }).map((e, t) => /* @__PURE__ */ y(me, {}, t))
|
|
254
254
|
}) : /* @__PURE__ */ b(_, {
|
|
255
255
|
columns: 6,
|
|
256
256
|
children: [
|
|
257
|
-
/* @__PURE__ */ y(
|
|
257
|
+
/* @__PURE__ */ y(g, {
|
|
258
258
|
label: k("movethewheels.inventory.metrics.totalOnHand", "Total on-hand"),
|
|
259
259
|
value: B.totalOnHand.toLocaleString(),
|
|
260
260
|
icon: /* @__PURE__ */ y(r, { size: 20 }),
|
|
261
261
|
accent: "brand",
|
|
262
262
|
subtitle: k("movethewheels.inventory.metrics.onHandHint", "Units in the network")
|
|
263
263
|
}),
|
|
264
|
-
/* @__PURE__ */ y(
|
|
264
|
+
/* @__PURE__ */ y(g, {
|
|
265
265
|
label: k("movethewheels.inventory.metrics.available", "Available"),
|
|
266
266
|
value: B.totalAvailable.toLocaleString(),
|
|
267
267
|
icon: /* @__PURE__ */ y(a, { size: 20 }),
|
|
268
268
|
accent: "success",
|
|
269
269
|
subtitle: k("movethewheels.inventory.metrics.availableHint", "Free to promise")
|
|
270
270
|
}),
|
|
271
|
-
/* @__PURE__ */ y(
|
|
271
|
+
/* @__PURE__ */ y(g, {
|
|
272
272
|
label: k("movethewheels.inventory.metrics.allocated", "Allocated"),
|
|
273
273
|
value: B.totalAllocated.toLocaleString(),
|
|
274
274
|
icon: /* @__PURE__ */ y(te, { size: 20 }),
|
|
275
275
|
accent: "blue",
|
|
276
276
|
subtitle: k("movethewheels.inventory.metrics.allocatedHint", "Committed to orders")
|
|
277
277
|
}),
|
|
278
|
-
/* @__PURE__ */ y(
|
|
278
|
+
/* @__PURE__ */ y(g, {
|
|
279
279
|
label: k("movethewheels.inventory.metrics.lowStock", "Low-stock items"),
|
|
280
280
|
value: B.lowStockCount.toLocaleString(),
|
|
281
281
|
icon: /* @__PURE__ */ y(s, { size: 20 }),
|
|
282
282
|
accent: "warning",
|
|
283
283
|
subtitle: k("movethewheels.inventory.metrics.lowStockHint", "At or under reorder point")
|
|
284
284
|
}),
|
|
285
|
-
/* @__PURE__ */ y(
|
|
285
|
+
/* @__PURE__ */ y(g, {
|
|
286
286
|
label: k("movethewheels.inventory.metrics.totalProducts", "Catalog items"),
|
|
287
287
|
value: B.totalProducts.toLocaleString(),
|
|
288
288
|
icon: /* @__PURE__ */ y(o, { size: 20 }),
|
|
289
289
|
accent: "neutral",
|
|
290
290
|
onClick: () => Z("inventory/products")
|
|
291
291
|
}),
|
|
292
|
-
/* @__PURE__ */ y(
|
|
292
|
+
/* @__PURE__ */ y(g, {
|
|
293
293
|
label: k("movethewheels.inventory.metrics.warehouses", "Warehouses"),
|
|
294
294
|
value: B.totalWarehouses.toLocaleString(),
|
|
295
295
|
icon: /* @__PURE__ */ y(ae, { size: 20 }),
|
|
@@ -350,9 +350,9 @@ function O() {
|
|
|
350
350
|
className: "grid grid-cols-1 xl:grid-cols-3 gap-6",
|
|
351
351
|
children: [/* @__PURE__ */ y("div", {
|
|
352
352
|
className: "xl:col-span-2",
|
|
353
|
-
children: /* @__PURE__ */ y(
|
|
353
|
+
children: /* @__PURE__ */ y(h, {
|
|
354
354
|
title: k("movethewheels.inventory.stock.title", "Stock position"),
|
|
355
|
-
children: /* @__PURE__ */ y(
|
|
355
|
+
children: /* @__PURE__ */ y(ge, {
|
|
356
356
|
columns: Re,
|
|
357
357
|
data: Le,
|
|
358
358
|
isLoading: L,
|
|
@@ -386,7 +386,7 @@ function O() {
|
|
|
386
386
|
})
|
|
387
387
|
}), /* @__PURE__ */ b(f, {
|
|
388
388
|
className: "h-fit",
|
|
389
|
-
children: [/* @__PURE__ */ y(
|
|
389
|
+
children: [/* @__PURE__ */ y(de, { children: /* @__PURE__ */ b(m, {
|
|
390
390
|
className: "flex items-center gap-2",
|
|
391
391
|
children: [/* @__PURE__ */ y(ee, { size: 18 }), k("movethewheels.inventory.transactions.title", "Recent transactions")]
|
|
392
392
|
}) }), /* @__PURE__ */ y(p, {
|
|
@@ -428,7 +428,7 @@ function O() {
|
|
|
428
428
|
}),
|
|
429
429
|
/* @__PURE__ */ y("p", {
|
|
430
430
|
className: "text-xs text-text-secondary",
|
|
431
|
-
children:
|
|
431
|
+
children: se(r.createdAt, "short")
|
|
432
432
|
})
|
|
433
433
|
]
|
|
434
434
|
}), /* @__PURE__ */ y("span", {
|
|
@@ -443,7 +443,7 @@ function O() {
|
|
|
443
443
|
}),
|
|
444
444
|
/* @__PURE__ */ b("div", {
|
|
445
445
|
className: "grid grid-cols-1 lg:grid-cols-2 gap-6",
|
|
446
|
-
children: [/* @__PURE__ */ y(
|
|
446
|
+
children: [/* @__PURE__ */ y(h, {
|
|
447
447
|
title: k("movethewheels.inventory.warehouses.title", "Warehouses"),
|
|
448
448
|
actions: /* @__PURE__ */ b(d, {
|
|
449
449
|
variant: "ghost",
|
|
@@ -487,7 +487,7 @@ function O() {
|
|
|
487
487
|
}), e.utilization === void 0 ? /* @__PURE__ */ y("p", {
|
|
488
488
|
className: "text-xs text-text-tertiary",
|
|
489
489
|
children: "Not provided"
|
|
490
|
-
}) : /* @__PURE__ */ y(
|
|
490
|
+
}) : /* @__PURE__ */ y(fe, {
|
|
491
491
|
value: e.utilization,
|
|
492
492
|
className: "w-24 h-2"
|
|
493
493
|
})]
|
|
@@ -497,7 +497,7 @@ function O() {
|
|
|
497
497
|
}, e.id))
|
|
498
498
|
})
|
|
499
499
|
}) })
|
|
500
|
-
}), /* @__PURE__ */ y(
|
|
500
|
+
}), /* @__PURE__ */ y(h, {
|
|
501
501
|
title: k("movethewheels.inventory.products.title", "Recent Products"),
|
|
502
502
|
actions: /* @__PURE__ */ b(d, {
|
|
503
503
|
variant: "ghost",
|
|
@@ -532,7 +532,7 @@ function O() {
|
|
|
532
532
|
className: "text-right",
|
|
533
533
|
children: [/* @__PURE__ */ y("p", {
|
|
534
534
|
className: "font-medium",
|
|
535
|
-
children: e.value === void 0 ? "Not provided" :
|
|
535
|
+
children: e.value === void 0 ? "Not provided" : oe(e.value)
|
|
536
536
|
}), /* @__PURE__ */ y(u, {
|
|
537
537
|
variant: "outline",
|
|
538
538
|
children: e.category ?? "Not provided"
|