@burdenoff/microfe-movethewheels 2026.929.3 → 2026.929.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/dist/generated/wspace-types.d.ts +1547 -64
  2. package/dist/hooks/useCustomers.js +3 -9
  3. package/dist/hooks/useFleet.js +146 -149
  4. package/dist/hooks/useInventory.js +178 -153
  5. package/dist/hooks/useRoutes.js +9 -9
  6. package/dist/hooks/useTracking.js +14 -16
  7. package/dist/movethewheels/hooks/useFleet.d.ts +9 -2
  8. package/dist/movethewheels/hooks/useInventory.d.ts +13 -12
  9. package/dist/movethewheels/hooks/useRoutes.d.ts +4 -1
  10. package/dist/movethewheels/types/index.d.ts +33 -23
  11. package/dist/movethewheels/utils/formatters.d.ts +1 -1
  12. package/dist/pages/CustomerDetailsPage.js +6 -6
  13. package/dist/pages/CustomersPage.js +2 -2
  14. package/dist/pages/DashboardPage.js +1 -1
  15. package/dist/pages/DriverDetailsPage.js +7 -3
  16. package/dist/pages/DriversPage.js +4 -4
  17. package/dist/pages/FleetPage.js +1 -1
  18. package/dist/pages/InventoryPage.js +11 -12
  19. package/dist/pages/LiveTrackingPage.js +4 -4
  20. package/dist/pages/ProductDetailsPage.js +408 -249
  21. package/dist/pages/ProductsPage.js +5 -5
  22. package/dist/pages/RouteDetailsPage.js +8 -10
  23. package/dist/pages/RoutesPage.js +2 -2
  24. package/dist/pages/TrackingPage.js +14 -8
  25. package/dist/pages/WarehouseDetailsPage.js +166 -163
  26. package/dist/pages/WarehousesPage.js +29 -21
  27. package/package.json +1 -1
  28. package/src/generated/wspace-types.ts +1762 -64
  29. package/src/movethewheels/hooks/useCustomers.ts +7 -9
  30. package/src/movethewheels/hooks/useFleet.ts +89 -31
  31. package/src/movethewheels/hooks/useInventory.ts +143 -49
  32. package/src/movethewheels/hooks/useRoutes.ts +36 -16
  33. package/src/movethewheels/hooks/useTracking.ts +23 -15
  34. package/src/movethewheels/pages/CustomerDetailsPage.tsx +14 -8
  35. package/src/movethewheels/pages/CustomersPage.tsx +5 -2
  36. package/src/movethewheels/pages/DashboardPage.tsx +3 -1
  37. package/src/movethewheels/pages/DriverDetailsPage.tsx +13 -3
  38. package/src/movethewheels/pages/DriversPage.tsx +1 -1
  39. package/src/movethewheels/pages/FleetPage.tsx +1 -1
  40. package/src/movethewheels/pages/InventoryPage.tsx +20 -16
  41. package/src/movethewheels/pages/LiveTrackingPage.tsx +6 -4
  42. package/src/movethewheels/pages/ProductDetailsPage.tsx +228 -49
  43. package/src/movethewheels/pages/ProductsPage.tsx +13 -5
  44. package/src/movethewheels/pages/RouteDetailsPage.tsx +16 -8
  45. package/src/movethewheels/pages/RoutesPage.tsx +4 -2
  46. package/src/movethewheels/pages/TrackingPage.tsx +25 -10
  47. package/src/movethewheels/pages/WarehouseDetailsPage.tsx +42 -29
  48. package/src/movethewheels/pages/WarehousesPage.tsx +23 -15
  49. package/src/movethewheels/types/index.ts +36 -24
  50. package/src/movethewheels/utils/formatters.ts +1 -1
@@ -7,384 +7,493 @@ import { Package as a } from "../node_modules/lucide-react/dist/esm/icons/packag
7
7
  import { Save as o } from "../node_modules/lucide-react/dist/esm/icons/save.js";
8
8
  import { SquarePen as s } from "../node_modules/lucide-react/dist/esm/icons/square-pen.js";
9
9
  import { Tag as c } from "../node_modules/lucide-react/dist/esm/icons/tag.js";
10
- import { Warehouse as l } from "../node_modules/lucide-react/dist/esm/icons/warehouse.js";
11
- import { joinPath as u } from "../utils/navigation.js";
12
- import { useMoveTheWheels as d } from "../providers/MoveTheWheelsProvider.js";
13
- import { useInventory as f, useProduct as p, useProductStockLevels as m } from "../hooks/useInventory.js";
14
- import { Badge as h, Button as g, Card as _, CardContent as v, CardHeader as y, CardTitle as b, Input as x, Label as S } from "../components/ui.js";
15
- import { ErrorState as C, LoadingState as w, PageLayout as T } from "../components/PageLayout.js";
16
- import { FormError as E } from "../components/FormError.js";
17
- import { formatCurrency as D } from "../utils/formatters.js";
18
- import { useEffect as O, useState as k } from "react";
19
- import { useLocation as A, useParams as j } from "react-router";
20
- import { Fragment as M, 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";
10
+ import { Trash2 as l } from "../node_modules/lucide-react/dist/esm/icons/trash-2.js";
11
+ import { Warehouse as u } from "../node_modules/lucide-react/dist/esm/icons/warehouse.js";
12
+ import { joinPath as d } from "../utils/navigation.js";
13
+ import { useMoveTheWheels as f } from "../providers/MoveTheWheelsProvider.js";
14
+ import { useInventory as p, useProduct as m, useProductStockLevels as h } from "../hooks/useInventory.js";
15
+ import { Badge as g, Button as _, Card as v, CardContent as y, CardHeader as b, CardTitle as x, Checkbox as S, Input as C, Label as w, Textarea as T } from "../components/ui.js";
16
+ import { ErrorState as E, LoadingState as ee, PageLayout as D } from "../components/PageLayout.js";
17
+ import { FormError as O } from "../components/FormError.js";
18
+ import { formatCurrency as te } from "../utils/formatters.js";
19
+ import { useEffect as k, useState as A } from "react";
20
+ import { useLocation as j, useParams as ne } from "react-router";
21
+ import { Fragment as re, jsx as M, jsxs as N } from "react/jsx-runtime";
22
+ import { EmphasisPanel as P, NextSteps as ie, PagePurpose as F, ResponsiveDialog as I, ResponsiveDialogContent as ae, ResponsiveDialogDescription as oe, ResponsiveDialogFooter as se, ResponsiveDialogHeader as ce, ResponsiveDialogTitle as le } from "@burdenoff/fe-libs/ui";
22
23
  //#region src/movethewheels/pages/ProductDetailsPage.tsx
23
- function R({ editId: t }) {
24
- let { basePath: n, navigate: r } = d(), { createProduct: i, updateProduct: s } = f(), { product: c } = p(t), l = !!t, [m, h] = k({
24
+ function L({ editId: t }) {
25
+ let { basePath: n, navigate: r } = f(), { createProduct: i, updateProduct: s } = p(), { product: c } = m(t), l = !!t, [u, h] = A({
25
26
  name: "",
26
27
  sku: "",
28
+ description: "",
27
29
  category: "",
28
30
  brand: "",
29
- weight: ""
30
- }), [_, v] = k(!1), [y, b] = k(null);
31
- O(() => {
31
+ length: "",
32
+ width: "",
33
+ height: "",
34
+ dimensionUnit: "",
35
+ weight: "",
36
+ value: "",
37
+ hazardous: !1,
38
+ fragile: !1,
39
+ temperatureControlled: !1
40
+ }), [g, v] = A(!1), [y, b] = A(null);
41
+ k(() => {
32
42
  t && c && h({
33
43
  name: c.name ?? "",
34
44
  sku: c.sku ?? "",
45
+ description: c.description ?? "",
35
46
  category: c.category ?? "",
36
47
  brand: c.brand ?? "",
37
- weight: c.weight == null ? "" : String(c.weight)
48
+ length: c.dimensions?.length === void 0 ? "" : String(c.dimensions.length),
49
+ width: c.dimensions?.width === void 0 ? "" : String(c.dimensions.width),
50
+ height: c.dimensions?.height === void 0 ? "" : String(c.dimensions.height),
51
+ dimensionUnit: c.dimensions?.unit ?? "",
52
+ weight: c.weight === void 0 ? "" : String(c.weight),
53
+ value: c.value === void 0 ? "" : String(c.value),
54
+ hazardous: c.hazardous,
55
+ fragile: c.fragile,
56
+ temperatureControlled: c.temperatureControlled
38
57
  });
39
58
  }, [t, c]);
40
- let C = () => r?.(u(n, "inventory/products")), w = async (e) => {
41
- if (e.preventDefault(), !m.name.trim() || !m.sku.trim()) {
59
+ let x = () => r?.(d(n, "inventory/products")), E = async (e) => {
60
+ if (e.preventDefault(), !u.name.trim() || !u.sku.trim()) {
42
61
  b("Product name and SKU are required.");
43
62
  return;
44
63
  }
45
64
  v(!0), b(null);
46
65
  try {
47
- let e = m.weight.trim() ? Number(m.weight) : void 0;
66
+ let e = (e) => {
67
+ if (!e.trim()) return;
68
+ let t = Number(e);
69
+ return Number.isFinite(t) ? t : void 0;
70
+ }, a = u.length.trim() || u.width.trim() || u.height.trim() || u.dimensionUnit.trim() ? {
71
+ ...e(u.length) === void 0 ? {} : { length: e(u.length) },
72
+ ...e(u.width) === void 0 ? {} : { width: e(u.width) },
73
+ ...e(u.height) === void 0 ? {} : { height: e(u.height) },
74
+ ...u.dimensionUnit.trim() ? { unit: u.dimensionUnit.trim() } : {}
75
+ } : void 0, o = {
76
+ name: u.name.trim(),
77
+ sku: u.sku.trim(),
78
+ description: u.description.trim() || (l ? null : void 0),
79
+ category: u.category.trim() || (l ? null : void 0),
80
+ brand: u.brand.trim() || (l ? null : void 0),
81
+ dimensions: a ?? (l ? null : void 0),
82
+ weight: e(u.weight) ?? (l ? null : void 0),
83
+ value: e(u.value) ?? (l ? null : void 0),
84
+ hazardous: u.hazardous,
85
+ fragile: u.fragile,
86
+ temperatureControlled: u.temperatureControlled
87
+ };
48
88
  if (l && t) {
49
- let i = await s(t, {
50
- name: m.name.trim(),
51
- sku: m.sku.trim(),
52
- category: m.category.trim() || void 0,
53
- brand: m.brand.trim() || void 0,
54
- weight: e !== void 0 && !Number.isNaN(e) ? e : void 0
55
- });
56
- r?.(u(n, `inventory/products/${i.id}`));
89
+ let e = await s(t, o);
90
+ r?.(d(n, `inventory/products/${e.id}`));
57
91
  } else {
58
- let t = await i({
59
- name: m.name.trim(),
60
- sku: m.sku.trim(),
61
- category: m.category.trim() || void 0,
62
- brand: m.brand.trim() || void 0,
63
- weight: e !== void 0 && !Number.isNaN(e) ? e : void 0
64
- });
65
- r?.(u(n, `inventory/products/${t.id}`));
92
+ let e = await i(o);
93
+ r?.(d(n, `inventory/products/${e.id}`));
66
94
  }
67
95
  } catch (e) {
68
96
  console.error("Failed to create product:", e), b(e instanceof Error ? e.message : "Failed to create product. Please try again."), v(!1);
69
97
  }
70
98
  };
71
- return /* @__PURE__ */ P(T, {
99
+ return /* @__PURE__ */ N(D, {
72
100
  title: l ? "Edit Product" : "Add Product",
73
101
  subtitle: "Add an item to your catalog",
74
- icon: /* @__PURE__ */ N(a, { size: 24 }),
75
- headerActions: /* @__PURE__ */ P("div", {
102
+ icon: /* @__PURE__ */ M(a, { size: 24 }),
103
+ headerActions: /* @__PURE__ */ N("div", {
76
104
  className: "flex gap-2",
77
- children: [/* @__PURE__ */ P(g, {
105
+ children: [/* @__PURE__ */ N(_, {
78
106
  variant: "outline",
79
- onClick: C,
80
- disabled: _,
81
- children: [/* @__PURE__ */ N(e, { size: 16 }), " Cancel"]
82
- }), /* @__PURE__ */ P(g, {
83
- onClick: w,
84
- disabled: _,
107
+ onClick: x,
108
+ disabled: g,
109
+ children: [/* @__PURE__ */ M(e, { size: 16 }), " Cancel"]
110
+ }), /* @__PURE__ */ N(_, {
111
+ onClick: E,
112
+ disabled: g,
85
113
  children: [
86
- /* @__PURE__ */ N(o, { size: 16 }),
114
+ /* @__PURE__ */ M(o, { size: 16 }),
87
115
  " ",
88
- l ? _ ? "Saving..." : "Save Changes" : _ ? "Saving..." : "Add Product"
116
+ l ? g ? "Saving..." : "Save Changes" : g ? "Saving..." : "Add Product"
89
117
  ]
90
118
  })]
91
119
  }),
92
- children: [/* @__PURE__ */ N(L, {
93
- icon: /* @__PURE__ */ N(a, { size: 18 }),
120
+ children: [/* @__PURE__ */ M(F, {
121
+ icon: /* @__PURE__ */ M(a, { size: 18 }),
94
122
  children: "Add a product so it can be added to orders and stocked in warehouses. A name and SKU are all it takes to start — category, brand and weight help with picking, pricing and routing."
95
- }), /* @__PURE__ */ P("form", {
96
- onSubmit: w,
123
+ }), /* @__PURE__ */ N("form", {
124
+ onSubmit: E,
97
125
  className: "max-w-2xl space-y-6",
98
- children: [/* @__PURE__ */ N(E, { message: y }), /* @__PURE__ */ P(F, { children: [/* @__PURE__ */ N("h2", {
126
+ children: [/* @__PURE__ */ M(O, { message: y }), /* @__PURE__ */ N(P, { children: [/* @__PURE__ */ M("h2", {
99
127
  className: "text-base font-semibold text-text-primary mb-4",
100
128
  children: "Product Details"
101
- }), /* @__PURE__ */ P("div", {
129
+ }), /* @__PURE__ */ N("div", {
102
130
  className: "space-y-4",
103
- children: [/* @__PURE__ */ P("div", {
104
- className: "grid grid-cols-1 md:grid-cols-2 gap-4",
105
- children: [/* @__PURE__ */ P("div", {
106
- className: "space-y-2",
107
- children: [/* @__PURE__ */ P(S, {
108
- htmlFor: "name",
109
- children: ["Name ", /* @__PURE__ */ N("span", {
110
- className: "text-status-error-text",
111
- children: "*"
131
+ children: [
132
+ /* @__PURE__ */ N("div", {
133
+ className: "grid grid-cols-1 md:grid-cols-2 gap-4",
134
+ children: [/* @__PURE__ */ N("div", {
135
+ className: "space-y-2",
136
+ children: [/* @__PURE__ */ N(w, {
137
+ htmlFor: "name",
138
+ children: ["Name ", /* @__PURE__ */ M("span", {
139
+ className: "text-status-error-text",
140
+ children: "*"
141
+ })]
142
+ }), /* @__PURE__ */ M(C, {
143
+ id: "name",
144
+ value: u.name,
145
+ onChange: (e) => h((t) => ({
146
+ ...t,
147
+ name: e.target.value
148
+ })),
149
+ placeholder: "Wireless Headphones",
150
+ required: !0
112
151
  })]
113
- }), /* @__PURE__ */ N(x, {
114
- id: "name",
115
- value: m.name,
116
- onChange: (e) => h((t) => ({
117
- ...t,
118
- name: e.target.value
119
- })),
120
- placeholder: "Wireless Headphones",
121
- required: !0
122
- })]
123
- }), /* @__PURE__ */ P("div", {
124
- className: "space-y-2",
125
- children: [/* @__PURE__ */ P(S, {
126
- htmlFor: "sku",
127
- children: ["SKU ", /* @__PURE__ */ N("span", {
128
- className: "text-status-error-text",
129
- children: "*"
152
+ }), /* @__PURE__ */ N("div", {
153
+ className: "space-y-2",
154
+ children: [/* @__PURE__ */ N(w, {
155
+ htmlFor: "sku",
156
+ children: ["SKU ", /* @__PURE__ */ M("span", {
157
+ className: "text-status-error-text",
158
+ children: "*"
159
+ })]
160
+ }), /* @__PURE__ */ M(C, {
161
+ id: "sku",
162
+ value: u.sku,
163
+ onChange: (e) => h((t) => ({
164
+ ...t,
165
+ sku: e.target.value
166
+ })),
167
+ placeholder: "SKU-001",
168
+ required: !0
130
169
  })]
131
- }), /* @__PURE__ */ N(x, {
132
- id: "sku",
133
- value: m.sku,
134
- onChange: (e) => h((t) => ({
135
- ...t,
136
- sku: e.target.value
137
- })),
138
- placeholder: "SKU-001",
139
- required: !0
140
170
  })]
141
- })]
142
- }), /* @__PURE__ */ P("div", {
143
- className: "grid grid-cols-1 md:grid-cols-3 gap-4",
144
- children: [
145
- /* @__PURE__ */ P("div", {
171
+ }),
172
+ /* @__PURE__ */ N("div", {
173
+ className: "grid grid-cols-1 md:grid-cols-3 gap-4",
174
+ children: [/* @__PURE__ */ N("div", {
146
175
  className: "space-y-2",
147
- children: [/* @__PURE__ */ N(S, {
176
+ children: [/* @__PURE__ */ M(w, {
148
177
  htmlFor: "category",
149
178
  children: "Category"
150
- }), /* @__PURE__ */ N(x, {
179
+ }), /* @__PURE__ */ M(C, {
151
180
  id: "category",
152
- value: m.category,
181
+ value: u.category,
153
182
  onChange: (e) => h((t) => ({
154
183
  ...t,
155
184
  category: e.target.value
156
185
  })),
157
186
  placeholder: "Electronics"
158
187
  })]
159
- }),
160
- /* @__PURE__ */ P("div", {
188
+ }), /* @__PURE__ */ N("div", {
161
189
  className: "space-y-2",
162
- children: [/* @__PURE__ */ N(S, {
190
+ children: [/* @__PURE__ */ M(w, {
163
191
  htmlFor: "brand",
164
192
  children: "Brand"
165
- }), /* @__PURE__ */ N(x, {
193
+ }), /* @__PURE__ */ M(C, {
166
194
  id: "brand",
167
- value: m.brand,
195
+ value: u.brand,
168
196
  onChange: (e) => h((t) => ({
169
197
  ...t,
170
198
  brand: e.target.value
171
199
  })),
172
200
  placeholder: "Acme"
173
201
  })]
174
- }),
175
- /* @__PURE__ */ P("div", {
202
+ })]
203
+ }),
204
+ /* @__PURE__ */ N("div", {
205
+ className: "space-y-2",
206
+ children: [/* @__PURE__ */ M(w, {
207
+ htmlFor: "description",
208
+ children: "Description"
209
+ }), /* @__PURE__ */ M(T, {
210
+ id: "description",
211
+ value: u.description,
212
+ onChange: (e) => h((t) => ({
213
+ ...t,
214
+ description: e.target.value
215
+ })),
216
+ placeholder: "Describe the item",
217
+ rows: 3
218
+ })]
219
+ }),
220
+ /* @__PURE__ */ N("div", {
221
+ className: "grid grid-cols-2 md:grid-cols-4 gap-4",
222
+ children: [[
223
+ ["length", "Length"],
224
+ ["width", "Width"],
225
+ ["height", "Height"]
226
+ ].map(([e, t]) => /* @__PURE__ */ N("div", {
227
+ className: "space-y-2",
228
+ children: [/* @__PURE__ */ M(w, {
229
+ htmlFor: e,
230
+ children: t
231
+ }), /* @__PURE__ */ M(C, {
232
+ id: e,
233
+ type: "number",
234
+ min: "0",
235
+ step: "0.01",
236
+ value: u[e],
237
+ onChange: (t) => h((n) => ({
238
+ ...n,
239
+ [e]: t.target.value
240
+ })),
241
+ placeholder: "Not provided"
242
+ })]
243
+ }, e)), /* @__PURE__ */ N("div", {
244
+ className: "space-y-2",
245
+ children: [/* @__PURE__ */ M(w, {
246
+ htmlFor: "dimensionUnit",
247
+ children: "Dimension unit"
248
+ }), /* @__PURE__ */ M(C, {
249
+ id: "dimensionUnit",
250
+ value: u.dimensionUnit,
251
+ onChange: (e) => h((t) => ({
252
+ ...t,
253
+ dimensionUnit: e.target.value
254
+ })),
255
+ placeholder: "cm"
256
+ })]
257
+ })]
258
+ }),
259
+ /* @__PURE__ */ N("div", {
260
+ className: "grid grid-cols-1 md:grid-cols-2 gap-4",
261
+ children: [/* @__PURE__ */ N("div", {
262
+ className: "space-y-2",
263
+ children: [/* @__PURE__ */ M(w, {
264
+ htmlFor: "value",
265
+ children: "Unit value"
266
+ }), /* @__PURE__ */ M(C, {
267
+ id: "value",
268
+ type: "number",
269
+ min: "0",
270
+ step: "0.01",
271
+ value: u.value,
272
+ onChange: (e) => h((t) => ({
273
+ ...t,
274
+ value: e.target.value
275
+ })),
276
+ placeholder: "Not provided"
277
+ })]
278
+ }), /* @__PURE__ */ N("div", {
176
279
  className: "space-y-2",
177
- children: [/* @__PURE__ */ N(S, {
280
+ children: [/* @__PURE__ */ M(w, {
178
281
  htmlFor: "weight",
179
282
  children: "Weight (kg)"
180
- }), /* @__PURE__ */ N(x, {
283
+ }), /* @__PURE__ */ M(C, {
181
284
  id: "weight",
182
285
  type: "number",
183
286
  min: "0",
184
287
  step: "0.01",
185
- value: m.weight,
288
+ value: u.weight,
186
289
  onChange: (e) => h((t) => ({
187
290
  ...t,
188
291
  weight: e.target.value
189
292
  })),
190
- placeholder: "0.5"
293
+ placeholder: "Not provided"
191
294
  })]
192
- })
193
- ]
194
- })]
295
+ })]
296
+ }),
297
+ /* @__PURE__ */ M("div", {
298
+ className: "flex flex-wrap gap-4",
299
+ children: [
300
+ ["fragile", "Fragile"],
301
+ ["hazardous", "Hazardous"],
302
+ ["temperatureControlled", "Temperature controlled"]
303
+ ].map(([e, t]) => /* @__PURE__ */ N("label", {
304
+ className: "flex items-center gap-2 text-sm",
305
+ children: [/* @__PURE__ */ M(S, {
306
+ checked: u[e],
307
+ onCheckedChange: (t) => h((n) => ({
308
+ ...n,
309
+ [e]: t === !0
310
+ }))
311
+ }), t]
312
+ }, e))
313
+ })
314
+ ]
195
315
  })] })]
196
316
  })]
197
317
  });
198
318
  }
199
- function z() {
200
- let { productId: o } = j(), { basePath: f, navigate: x } = d(), { product: S, isLoading: E, error: z, refetch: B } = p(o), V = A().pathname.endsWith("/edit"), [H, U] = k(0), { levels: W, totalLevels: G, totalAvailable: K, hasMore: q, isLoading: J, error: Y } = m(V ? void 0 : o, {
319
+ function R() {
320
+ let { productId: o } = ne(), { basePath: S, navigate: C } = f(), { product: w, isLoading: T, error: R, refetch: ue } = m(o), { deleteProduct: de } = p(), z = j().pathname.endsWith("/edit"), [B, V] = A(!1), [H, U] = A(!1), [fe, W] = A(null), [G, K] = A(0), { levels: q, totalLevels: J, totalAvailable: pe, hasMore: Y, isLoading: X, error: Z } = h(z ? void 0 : o, {
201
321
  limit: 20,
202
- offset: H * 20
322
+ offset: G * 20
203
323
  });
204
- O(() => {
205
- U(0);
324
+ k(() => {
325
+ K(0);
206
326
  }, [o]);
207
- let X = () => x?.(u(f, "inventory/products")), Z = (e) => x?.(u(f, e));
208
- return o ? V ? /* @__PURE__ */ N(R, { editId: o }) : E ? /* @__PURE__ */ N(w, { message: "Loading product details..." }) : z || !S ? /* @__PURE__ */ N(C, {
327
+ let Q = () => C?.(d(S, "inventory/products")), $ = (e) => C?.(d(S, e));
328
+ return o ? z ? /* @__PURE__ */ M(L, { editId: o }) : T ? /* @__PURE__ */ M(ee, { message: "Loading product details..." }) : R || !w ? /* @__PURE__ */ M(E, {
209
329
  title: "Product not found",
210
- onRetry: B
211
- }) : /* @__PURE__ */ P(T, {
212
- title: S.name,
213
- subtitle: `SKU: ${S.sku}`,
214
- icon: /* @__PURE__ */ N(a, { size: 24 }),
215
- headerActions: /* @__PURE__ */ P("div", {
330
+ onRetry: ue
331
+ }) : /* @__PURE__ */ N(D, {
332
+ title: w.name,
333
+ subtitle: `SKU: ${w.sku}`,
334
+ icon: /* @__PURE__ */ M(a, { size: 24 }),
335
+ headerActions: /* @__PURE__ */ N("div", {
216
336
  className: "flex gap-2",
217
- children: [/* @__PURE__ */ P(g, {
337
+ children: [/* @__PURE__ */ N(_, {
218
338
  variant: "outline",
219
- onClick: X,
220
- children: [/* @__PURE__ */ N(e, { size: 16 }), " Back"]
221
- }), /* @__PURE__ */ P(g, {
222
- onClick: () => x?.(u(f, `inventory/products/${o}/edit`)),
223
- children: [/* @__PURE__ */ N(s, { size: 16 }), " Edit"]
339
+ onClick: Q,
340
+ children: [/* @__PURE__ */ M(e, { size: 16 }), " Back"]
341
+ }), /* @__PURE__ */ N(_, {
342
+ onClick: () => C?.(d(S, `inventory/products/${o}/edit`)),
343
+ children: [/* @__PURE__ */ M(s, { size: 16 }), " Edit"]
224
344
  })]
225
345
  }),
226
- headerContent: /* @__PURE__ */ P("div", {
346
+ headerContent: /* @__PURE__ */ N("div", {
227
347
  className: "flex gap-2",
228
348
  children: [
229
- /* @__PURE__ */ N(h, {
349
+ /* @__PURE__ */ M(g, {
230
350
  variant: "outline",
231
- children: S.category
351
+ children: w.category ?? "Not provided"
232
352
  }),
233
- S.brand && /* @__PURE__ */ N(h, {
353
+ w.brand && /* @__PURE__ */ M(g, {
234
354
  variant: "secondary",
235
- children: S.brand
355
+ children: w.brand
236
356
  }),
237
- S.fragile && /* @__PURE__ */ N(h, {
357
+ w.fragile && /* @__PURE__ */ M(g, {
238
358
  variant: "destructive",
239
359
  children: "Fragile"
240
360
  }),
241
- S.hazardous && /* @__PURE__ */ N(h, {
361
+ w.hazardous && /* @__PURE__ */ M(g, {
242
362
  variant: "destructive",
243
363
  children: "Hazardous"
244
364
  }),
245
- S.temperatureControlled && /* @__PURE__ */ N(h, {
365
+ w.temperatureControlled && /* @__PURE__ */ M(g, {
246
366
  variant: "secondary",
247
367
  children: "Temp Controlled"
248
368
  })
249
369
  ]
250
370
  }),
251
371
  children: [
252
- /* @__PURE__ */ N(L, {
253
- icon: /* @__PURE__ */ N(a, { size: 18 }),
372
+ /* @__PURE__ */ M(F, {
373
+ icon: /* @__PURE__ */ M(a, { size: 18 }),
254
374
  children: "The catalog record for this item — its dimensions, weight, value and handling flags. These drive how it's packed, priced and routed, so keep them accurate before adding the product to an order or stocking it in a warehouse."
255
375
  }),
256
- /* @__PURE__ */ N(I, {
376
+ /* @__PURE__ */ M(ie, {
257
377
  storageKey: "movethewheels-product-details",
258
378
  steps: [{
259
379
  id: "order",
260
380
  label: "Add this product to an order",
261
381
  description: "Include it on a new delivery.",
262
- icon: /* @__PURE__ */ N(a, { size: 16 }),
263
- onClick: () => Z("orders/new")
382
+ icon: /* @__PURE__ */ M(a, { size: 16 }),
383
+ onClick: () => $("orders/new")
264
384
  }, {
265
385
  id: "edit",
266
386
  label: "Edit product details",
267
387
  description: "Update dimensions, value or handling flags.",
268
- icon: /* @__PURE__ */ N(c, { size: 16 }),
269
- onClick: () => Z(`inventory/products/${o}/edit`)
388
+ icon: /* @__PURE__ */ M(c, { size: 16 }),
389
+ onClick: () => $(`inventory/products/${o}/edit`)
270
390
  }]
271
391
  }),
272
- /* @__PURE__ */ P("div", {
392
+ /* @__PURE__ */ N("div", {
273
393
  className: "grid grid-cols-1 lg:grid-cols-3 gap-6",
274
- children: [/* @__PURE__ */ P("div", {
394
+ children: [/* @__PURE__ */ N("div", {
275
395
  className: "lg:col-span-2 space-y-6",
276
396
  children: [
277
- /* @__PURE__ */ P(_, { children: [/* @__PURE__ */ N(y, { children: /* @__PURE__ */ N(b, { children: "Description" }) }), /* @__PURE__ */ N(v, { children: /* @__PURE__ */ N("p", { children: S.description }) })] }),
278
- /* @__PURE__ */ P(_, { children: [/* @__PURE__ */ N(y, { children: /* @__PURE__ */ P(b, {
397
+ /* @__PURE__ */ N(v, { children: [/* @__PURE__ */ M(b, { children: /* @__PURE__ */ M(x, { children: "Description" }) }), /* @__PURE__ */ M(y, { children: /* @__PURE__ */ M("p", { children: w.description ?? "Not provided" }) })] }),
398
+ /* @__PURE__ */ N(v, { children: [/* @__PURE__ */ M(b, { children: /* @__PURE__ */ N(x, {
279
399
  className: "flex items-center gap-2",
280
- children: [/* @__PURE__ */ N(t, { size: 18 }), " Dimensions & Weight"]
281
- }) }), /* @__PURE__ */ N(v, { children: /* @__PURE__ */ P("div", {
400
+ children: [/* @__PURE__ */ M(t, { size: 18 }), " Dimensions & Weight"]
401
+ }) }), /* @__PURE__ */ M(y, { children: /* @__PURE__ */ M("div", {
282
402
  className: "grid grid-cols-2 md:grid-cols-4 gap-4",
283
403
  children: [
284
- /* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("p", {
285
- className: "text-sm text-text-secondary",
286
- children: "Length"
287
- }), /* @__PURE__ */ P("p", {
288
- className: "text-2xl font-bold",
289
- children: [S.dimensions.length, /* @__PURE__ */ P("span", {
290
- className: "text-sm font-normal",
291
- children: [" ", S.dimensions.unit]
292
- })]
293
- })] }),
294
- /* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("p", {
295
- className: "text-sm text-text-secondary",
296
- children: "Width"
297
- }), /* @__PURE__ */ P("p", {
298
- className: "text-2xl font-bold",
299
- children: [S.dimensions.width, /* @__PURE__ */ P("span", {
300
- className: "text-sm font-normal",
301
- children: [" ", S.dimensions.unit]
302
- })]
303
- })] }),
304
- /* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("p", {
305
- className: "text-sm text-text-secondary",
306
- children: "Height"
307
- }), /* @__PURE__ */ P("p", {
308
- className: "text-2xl font-bold",
309
- children: [S.dimensions.height, /* @__PURE__ */ P("span", {
310
- className: "text-sm font-normal",
311
- children: [" ", S.dimensions.unit]
312
- })]
313
- })] }),
314
- /* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("p", {
315
- className: "text-sm text-text-secondary",
316
- children: "Weight"
317
- }), /* @__PURE__ */ P("p", {
318
- className: "text-2xl font-bold",
319
- children: [S.weight, /* @__PURE__ */ N("span", {
320
- className: "text-sm font-normal",
321
- children: " kg"
322
- })]
323
- })] })
324
- ]
404
+ [
405
+ "Length",
406
+ w.dimensions?.length,
407
+ w.dimensions?.unit
408
+ ],
409
+ [
410
+ "Width",
411
+ w.dimensions?.width,
412
+ w.dimensions?.unit
413
+ ],
414
+ [
415
+ "Height",
416
+ w.dimensions?.height,
417
+ w.dimensions?.unit
418
+ ],
419
+ [
420
+ "Weight",
421
+ w.weight,
422
+ "kg"
423
+ ]
424
+ ].map(([e, t, n]) => /* @__PURE__ */ N("div", { children: [/* @__PURE__ */ M("p", {
425
+ className: "text-sm text-text-secondary",
426
+ children: e
427
+ }), /* @__PURE__ */ N("p", {
428
+ className: "text-2xl font-bold",
429
+ children: [t === void 0 ? "Not provided" : t, t !== void 0 && n && /* @__PURE__ */ N("span", {
430
+ className: "text-sm font-normal",
431
+ children: [" ", n]
432
+ })]
433
+ })] }, e))
325
434
  }) })] }),
326
- S.attributes.length > 0 && /* @__PURE__ */ P(_, { children: [/* @__PURE__ */ N(y, { children: /* @__PURE__ */ P(b, {
435
+ w.attributes.length > 0 && /* @__PURE__ */ N(v, { children: [/* @__PURE__ */ M(b, { children: /* @__PURE__ */ N(x, {
327
436
  className: "flex items-center gap-2",
328
- children: [/* @__PURE__ */ N(c, { size: 18 }), " Attributes"]
329
- }) }), /* @__PURE__ */ N(v, { children: /* @__PURE__ */ N("div", {
437
+ children: [/* @__PURE__ */ M(c, { size: 18 }), " Attributes"]
438
+ }) }), /* @__PURE__ */ M(y, { children: /* @__PURE__ */ M("div", {
330
439
  className: "grid grid-cols-2 md:grid-cols-3 gap-4",
331
- children: S.attributes.map((e, t) => /* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("p", {
440
+ children: w.attributes.map((e, t) => /* @__PURE__ */ N("div", { children: [/* @__PURE__ */ M("p", {
332
441
  className: "text-sm text-text-secondary",
333
442
  children: e.name
334
- }), /* @__PURE__ */ N("p", {
443
+ }), /* @__PURE__ */ M("p", {
335
444
  className: "font-medium",
336
445
  children: e.value
337
446
  })] }, t))
338
447
  }) })] })
339
448
  ]
340
- }), /* @__PURE__ */ P("div", {
449
+ }), /* @__PURE__ */ N("div", {
341
450
  className: "space-y-6",
342
451
  children: [
343
- /* @__PURE__ */ P(F, { children: [
344
- /* @__PURE__ */ P("h2", {
452
+ /* @__PURE__ */ N(P, { children: [
453
+ /* @__PURE__ */ N("h2", {
345
454
  className: "flex items-center gap-2 text-base font-semibold text-text-primary mb-3",
346
- children: [/* @__PURE__ */ N(i, { size: 18 }), " Pricing"]
455
+ children: [/* @__PURE__ */ M(i, { size: 18 }), " Pricing"]
347
456
  }),
348
- /* @__PURE__ */ N("p", {
457
+ /* @__PURE__ */ M("p", {
349
458
  className: "text-3xl font-bold",
350
- children: D(S.value)
459
+ children: w.value === void 0 ? "Not provided" : te(w.value)
351
460
  }),
352
- /* @__PURE__ */ N("p", {
461
+ /* @__PURE__ */ M("p", {
353
462
  className: "text-sm text-text-secondary",
354
463
  children: "Unit price"
355
464
  })
356
465
  ] }),
357
- /* @__PURE__ */ P(_, { children: [/* @__PURE__ */ N(y, { children: /* @__PURE__ */ P(b, {
466
+ /* @__PURE__ */ N(v, { children: [/* @__PURE__ */ M(b, { children: /* @__PURE__ */ N(x, {
358
467
  className: "flex items-center gap-2",
359
- children: [/* @__PURE__ */ N(l, { size: 18 }), " Stock Levels"]
360
- }) }), /* @__PURE__ */ N(v, {
468
+ children: [/* @__PURE__ */ M(u, { size: 18 }), " Stock Levels"]
469
+ }) }), /* @__PURE__ */ M(y, {
361
470
  className: "space-y-3",
362
- children: Y ? /* @__PURE__ */ N("p", {
471
+ children: Z ? /* @__PURE__ */ M("p", {
363
472
  className: "text-sm text-status-error-text",
364
- children: Y.message
365
- }) : J ? /* @__PURE__ */ N("p", {
473
+ children: Z.message
474
+ }) : X ? /* @__PURE__ */ M("p", {
366
475
  className: "text-sm text-text-secondary",
367
476
  children: "Loading stock levels…"
368
- }) : W.length === 0 ? /* @__PURE__ */ P("div", {
477
+ }) : q.length === 0 ? /* @__PURE__ */ N("div", {
369
478
  className: "space-y-3",
370
- children: [/* @__PURE__ */ N("p", {
479
+ children: [/* @__PURE__ */ M("p", {
371
480
  className: "text-sm text-text-secondary",
372
481
  children: "This item isn't stocked in any warehouse yet, so nothing can be promised on an order."
373
- }), /* @__PURE__ */ N(g, {
482
+ }), /* @__PURE__ */ M(_, {
374
483
  variant: "outline",
375
484
  size: "sm",
376
- onClick: () => Z("inventory/warehouses"),
485
+ onClick: () => $("inventory/warehouses"),
377
486
  children: "View warehouses"
378
487
  })]
379
- }) : /* @__PURE__ */ P(M, { children: [
380
- W.map((e) => /* @__PURE__ */ P("div", {
488
+ }) : /* @__PURE__ */ N(re, { children: [
489
+ q.map((e) => /* @__PURE__ */ N("div", {
381
490
  className: "flex items-baseline justify-between gap-3",
382
- children: [/* @__PURE__ */ P("div", {
491
+ children: [/* @__PURE__ */ N("div", {
383
492
  className: "min-w-0",
384
- children: [/* @__PURE__ */ N("p", {
493
+ children: [/* @__PURE__ */ M("p", {
385
494
  className: "truncate text-sm font-medium",
386
495
  children: e.warehouseName
387
- }), /* @__PURE__ */ P("p", {
496
+ }), /* @__PURE__ */ N("p", {
388
497
  className: "text-xs text-text-secondary",
389
498
  children: [
390
499
  e.allocated.toLocaleString(),
@@ -392,73 +501,123 @@ function z() {
392
501
  e.reorderPoint === void 0 ? "" : ` · reorder at ${e.reorderPoint.toLocaleString()}`
393
502
  ]
394
503
  })]
395
- }), /* @__PURE__ */ N("span", {
504
+ }), /* @__PURE__ */ M("span", {
396
505
  className: e.reorderPoint !== void 0 && e.available <= e.reorderPoint ? "font-semibold text-status-warning-text" : "font-semibold",
397
506
  children: e.available.toLocaleString()
398
507
  })]
399
508
  }, e.inventoryItemId)),
400
- H > 0 || q ? /* @__PURE__ */ P("div", {
509
+ G > 0 || Y ? /* @__PURE__ */ N("div", {
401
510
  className: "flex items-center justify-between gap-2 border-t border-border-seam pt-3",
402
- children: [/* @__PURE__ */ P("span", {
511
+ children: [/* @__PURE__ */ N("span", {
403
512
  className: "text-xs text-text-secondary",
404
513
  children: [
405
- H * 20 + 1,
514
+ G * 20 + 1,
406
515
  "–",
407
- Math.min(H * 20 + W.length, G),
516
+ Math.min(G * 20 + q.length, J),
408
517
  " ",
409
518
  "of ",
410
- G
519
+ J
411
520
  ]
412
- }), /* @__PURE__ */ P("div", {
521
+ }), /* @__PURE__ */ N("div", {
413
522
  className: "flex gap-2",
414
- children: [/* @__PURE__ */ P(g, {
523
+ children: [/* @__PURE__ */ N(_, {
415
524
  variant: "outline",
416
525
  size: "sm",
417
- disabled: H === 0 || J,
418
- onClick: () => U((e) => Math.max(0, e - 1)),
419
- children: [/* @__PURE__ */ N(n, { size: 14 }), " Previous"]
420
- }), /* @__PURE__ */ P(g, {
526
+ disabled: G === 0 || X,
527
+ onClick: () => K((e) => Math.max(0, e - 1)),
528
+ children: [/* @__PURE__ */ M(n, { size: 14 }), " Previous"]
529
+ }), /* @__PURE__ */ N(_, {
421
530
  variant: "outline",
422
531
  size: "sm",
423
- disabled: !q || J,
424
- onClick: () => U((e) => e + 1),
425
- children: ["Next ", /* @__PURE__ */ N(r, { size: 14 })]
532
+ disabled: !Y || X,
533
+ onClick: () => K((e) => e + 1),
534
+ children: ["Next ", /* @__PURE__ */ M(r, { size: 14 })]
426
535
  })]
427
536
  })]
428
537
  }) : null,
429
- /* @__PURE__ */ P("div", {
538
+ /* @__PURE__ */ N("div", {
430
539
  className: "flex items-baseline justify-between gap-3 border-t border-border-seam pt-3",
431
- children: [/* @__PURE__ */ N("p", {
540
+ children: [/* @__PURE__ */ M("p", {
432
541
  className: "text-sm text-text-secondary",
433
542
  children: "Available across the network"
434
- }), /* @__PURE__ */ N("span", {
543
+ }), /* @__PURE__ */ M("span", {
435
544
  className: "font-bold",
436
- children: K.toLocaleString()
545
+ children: pe.toLocaleString()
437
546
  })]
438
547
  })
439
548
  ] })
440
549
  })] }),
441
- /* @__PURE__ */ P(_, { children: [/* @__PURE__ */ N(y, { children: /* @__PURE__ */ N(b, { children: "Identifiers" }) }), /* @__PURE__ */ P(v, {
550
+ /* @__PURE__ */ N(v, { children: [/* @__PURE__ */ M(b, { children: /* @__PURE__ */ M(x, { children: "Identifiers" }) }), /* @__PURE__ */ N(y, {
442
551
  className: "space-y-3",
443
- children: [/* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("p", {
552
+ children: [/* @__PURE__ */ N("div", { children: [/* @__PURE__ */ M("p", {
444
553
  className: "text-sm text-text-secondary",
445
554
  children: "SKU"
446
- }), /* @__PURE__ */ N("p", {
555
+ }), /* @__PURE__ */ M("p", {
447
556
  className: "font-mono",
448
- children: S.sku
449
- })] }), S.barcode && /* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("p", {
557
+ children: w.sku
558
+ })] }), w.barcode && /* @__PURE__ */ N("div", { children: [/* @__PURE__ */ M("p", {
450
559
  className: "text-sm text-text-secondary",
451
560
  children: "Barcode"
452
- }), /* @__PURE__ */ N("p", {
561
+ }), /* @__PURE__ */ M("p", {
453
562
  className: "font-mono",
454
- children: S.barcode
563
+ children: w.barcode
455
564
  })] })]
456
- })] })
565
+ })] }),
566
+ /* @__PURE__ */ N(v, {
567
+ className: "border-status-error-border",
568
+ children: [/* @__PURE__ */ M(b, { children: /* @__PURE__ */ N(x, {
569
+ className: "flex items-center gap-2 text-status-error-text",
570
+ children: [/* @__PURE__ */ M(l, { size: 18 }), " Delete Product"]
571
+ }) }), /* @__PURE__ */ N(y, { children: [/* @__PURE__ */ M("p", {
572
+ className: "mb-3 text-sm text-text-secondary",
573
+ children: "Removes this catalog item. Existing inventory records may prevent deletion."
574
+ }), /* @__PURE__ */ N(_, {
575
+ variant: "outline",
576
+ className: "border-status-error-border text-status-error-text hover:bg-status-error-bg-subtle",
577
+ onClick: () => V(!0),
578
+ children: [/* @__PURE__ */ M(l, { size: 16 }), " Delete this product"]
579
+ })] })]
580
+ })
457
581
  ]
458
582
  })]
583
+ }),
584
+ /* @__PURE__ */ M(I, {
585
+ open: B,
586
+ onOpenChange: V,
587
+ children: /* @__PURE__ */ N(ae, { children: [
588
+ /* @__PURE__ */ N(ce, { children: [/* @__PURE__ */ M(le, { children: "Delete this product?" }), /* @__PURE__ */ N(oe, { children: [
589
+ "This removes ",
590
+ w.name,
591
+ " from the catalog and cannot be undone from here."
592
+ ] })] }),
593
+ /* @__PURE__ */ M("div", {
594
+ className: "px-1",
595
+ children: /* @__PURE__ */ M(O, { message: fe })
596
+ }),
597
+ /* @__PURE__ */ N(se, { children: [/* @__PURE__ */ M(_, {
598
+ variant: "outline",
599
+ onClick: () => V(!1),
600
+ disabled: H,
601
+ children: "Cancel"
602
+ }), /* @__PURE__ */ M(_, {
603
+ className: "bg-status-error-text text-text-inverse hover:opacity-90",
604
+ onClick: async () => {
605
+ if (o) {
606
+ U(!0), W(null);
607
+ try {
608
+ await de(o), V(!1), Q();
609
+ } catch (e) {
610
+ W(e instanceof Error ? e.message : "Failed to delete product."), U(!1);
611
+ }
612
+ }
613
+ },
614
+ disabled: H,
615
+ children: H ? "Deleting..." : "Delete product"
616
+ })] })
617
+ ] })
459
618
  })
460
619
  ]
461
- }) : /* @__PURE__ */ N(R, {});
620
+ }) : /* @__PURE__ */ M(L, {});
462
621
  }
463
622
  //#endregion
464
- export { z as default };
623
+ export { R as default };