@burdenoff/microfe-movethewheels 2026.929.3 → 2026.930.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/dist/components/CustomerPicker.js +52 -48
  2. package/dist/components/EntityCombobox.js +25 -23
  3. package/dist/components/OrderItemRow.js +123 -78
  4. package/dist/generated/wspace-types.d.ts +1547 -64
  5. package/dist/hooks/useCustomers.js +55 -26
  6. package/dist/hooks/useFleet.js +236 -157
  7. package/dist/hooks/useInventory.js +214 -153
  8. package/dist/hooks/useMultiModalShipments.js +30 -26
  9. package/dist/hooks/useRoutes.js +64 -24
  10. package/dist/hooks/useTracking.js +14 -16
  11. package/dist/movethewheels/components/CustomerPicker.d.ts +5 -1
  12. package/dist/movethewheels/components/EntityCombobox.d.ts +6 -3
  13. package/dist/movethewheels/components/OrderItemRow.d.ts +7 -1
  14. package/dist/movethewheels/hooks/useCustomers.d.ts +3 -0
  15. package/dist/movethewheels/hooks/useFleet.d.ts +15 -2
  16. package/dist/movethewheels/hooks/useInventory.d.ts +15 -12
  17. package/dist/movethewheels/hooks/useMultiModalShipments.d.ts +1 -0
  18. package/dist/movethewheels/hooks/useRoutes.d.ts +7 -1
  19. package/dist/movethewheels/types/index.d.ts +33 -23
  20. package/dist/movethewheels/utils/formatters.d.ts +1 -1
  21. package/dist/movethewheels/utils/orderValidation.d.ts +11 -0
  22. package/dist/pages/CreateOrderPage.js +349 -297
  23. package/dist/pages/CustomerDetailsPage.js +6 -6
  24. package/dist/pages/CustomersPage.js +2 -2
  25. package/dist/pages/DashboardPage.js +1 -1
  26. package/dist/pages/DriverDetailsPage.js +340 -332
  27. package/dist/pages/DriversPage.js +7 -5
  28. package/dist/pages/FleetPage.js +1 -1
  29. package/dist/pages/InventoryPage.js +11 -12
  30. package/dist/pages/LiveTrackingPage.js +4 -4
  31. package/dist/pages/MultiModalShipmentPage.js +139 -125
  32. package/dist/pages/OrderDetailsPage.js +132 -140
  33. package/dist/pages/ProductDetailsPage.js +408 -249
  34. package/dist/pages/ProductsPage.js +5 -5
  35. package/dist/pages/RouteDetailsPage.js +208 -210
  36. package/dist/pages/RoutesPage.js +2 -2
  37. package/dist/pages/TrackingPage.js +16 -9
  38. package/dist/pages/WarehouseDetailsPage.js +166 -163
  39. package/dist/pages/WarehousesPage.js +29 -21
  40. package/dist/utils/orderValidation.js +18 -0
  41. package/package.json +1 -1
  42. package/src/generated/wspace-types.ts +1762 -64
  43. package/src/movethewheels/components/CustomerPicker.tsx +12 -0
  44. package/src/movethewheels/components/EntityCombobox.tsx +30 -11
  45. package/src/movethewheels/components/OrderItemRow.tsx +44 -0
  46. package/src/movethewheels/hooks/useCustomers.ts +45 -9
  47. package/src/movethewheels/hooks/useFleet.ts +214 -36
  48. package/src/movethewheels/hooks/useInventory.ts +185 -49
  49. package/src/movethewheels/hooks/useMultiModalShipments.ts +9 -7
  50. package/src/movethewheels/hooks/useRoutes.ts +87 -16
  51. package/src/movethewheels/hooks/useTracking.ts +23 -15
  52. package/src/movethewheels/pages/CreateOrderPage.tsx +66 -2
  53. package/src/movethewheels/pages/CustomerDetailsPage.tsx +14 -8
  54. package/src/movethewheels/pages/CustomersPage.tsx +5 -2
  55. package/src/movethewheels/pages/DashboardPage.tsx +3 -1
  56. package/src/movethewheels/pages/DriverDetailsPage.tsx +25 -4
  57. package/src/movethewheels/pages/DriversPage.tsx +8 -2
  58. package/src/movethewheels/pages/FleetPage.tsx +1 -1
  59. package/src/movethewheels/pages/InventoryPage.tsx +20 -16
  60. package/src/movethewheels/pages/LiveTrackingPage.tsx +6 -4
  61. package/src/movethewheels/pages/MultiModalShipmentPage.tsx +15 -1
  62. package/src/movethewheels/pages/OrderDetailsPage.tsx +25 -25
  63. package/src/movethewheels/pages/ProductDetailsPage.tsx +228 -49
  64. package/src/movethewheels/pages/ProductsPage.tsx +13 -5
  65. package/src/movethewheels/pages/RouteDetailsPage.tsx +24 -12
  66. package/src/movethewheels/pages/RoutesPage.tsx +4 -2
  67. package/src/movethewheels/pages/TrackingPage.tsx +32 -12
  68. package/src/movethewheels/pages/WarehouseDetailsPage.tsx +42 -29
  69. package/src/movethewheels/pages/WarehousesPage.tsx +23 -15
  70. package/src/movethewheels/types/index.ts +36 -24
  71. package/src/movethewheels/utils/formatters.ts +1 -1
  72. package/src/movethewheels/utils/orderValidation.ts +53 -0
@@ -15,10 +15,10 @@ import { FormError as k } from "../components/FormError.js";
15
15
  import { formatAddress as A } from "../utils/formatters.js";
16
16
  import { useEffect as j, useState as M } from "react";
17
17
  import { useLocation as N, useParams as P } from "react-router";
18
- import { jsx as F, jsxs as I } from "react/jsx-runtime";
19
- import { EmphasisPanel as L, NextSteps as R, PagePurpose as z, ResponsiveDialog as B, ResponsiveDialogContent as V, ResponsiveDialogDescription as H, ResponsiveDialogFooter as U, ResponsiveDialogHeader as ee, ResponsiveDialogTitle as te } from "@burdenoff/fe-libs/ui";
18
+ import { Fragment as F, jsx as I, jsxs as L } from "react/jsx-runtime";
19
+ import { EmphasisPanel as R, NextSteps as z, PagePurpose as B, ResponsiveDialog as V, ResponsiveDialogContent as H, ResponsiveDialogDescription as U, ResponsiveDialogFooter as ee, ResponsiveDialogHeader as te, ResponsiveDialogTitle as ne } from "@burdenoff/fe-libs/ui";
20
20
  //#region src/movethewheels/pages/WarehouseDetailsPage.tsx
21
- var ne = [
21
+ var re = [
22
22
  {
23
23
  value: "DISTRIBUTION",
24
24
  label: "Distribution"
@@ -39,7 +39,7 @@ var ne = [
39
39
  value: "RETAIL",
40
40
  label: "Retail"
41
41
  }
42
- ], re = [{
42
+ ], ie = [{
43
43
  value: "ACTIVE",
44
44
  label: "Active"
45
45
  }, {
@@ -47,39 +47,39 @@ var ne = [
47
47
  label: "Inactive"
48
48
  }];
49
49
  function W({ editId: t, onSaved: n }) {
50
- let { basePath: a, navigate: f } = l(), { createWarehouse: b, updateWarehouse: E, deleteWarehouse: D } = u(), { warehouse: A } = d(t), N = !!t, [P, R] = M({
50
+ let { basePath: a, navigate: f } = l(), { createWarehouse: b, updateWarehouse: E, deleteWarehouse: D } = u(), { warehouse: A } = d(t), N = !!t, [P, F] = M({
51
51
  code: "",
52
52
  name: "",
53
53
  type: "DISTRIBUTION",
54
- status: "ACTIVE",
54
+ status: "",
55
55
  street: "",
56
56
  city: "",
57
57
  state: "",
58
58
  postalCode: "",
59
- country: "USA",
59
+ country: "",
60
60
  totalCapacity: "",
61
61
  usedCapacity: "",
62
62
  contactEmail: "",
63
63
  contactPhone: ""
64
- }), [W, G] = M(!1), [ie, K] = M(null), [ae, q] = M(!1), [J, Y] = M(!1), [oe, X] = M(null);
64
+ }), [z, W] = M(!1), [G, K] = M(null), [ae, q] = M(!1), [J, Y] = M(!1), [oe, X] = M(null);
65
65
  j(() => {
66
- !t || !A || R({
66
+ !t || !A || F({
67
67
  code: A.code || "",
68
68
  name: A.name || "",
69
69
  type: A.type ? A.type.toUpperCase() : "DISTRIBUTION",
70
- status: A.status || "ACTIVE",
71
- street: A.address.street || "",
72
- city: A.address.city || "",
73
- state: A.address.state || "",
74
- postalCode: A.address.postalCode || "",
75
- country: A.address.country || "USA",
76
- totalCapacity: A.capacity.totalSpace ? String(A.capacity.totalSpace) : "",
77
- usedCapacity: A.capacity.usedSpace ? String(A.capacity.usedSpace) : "",
70
+ status: A.status ?? "",
71
+ street: A.address.street ?? "",
72
+ city: A.address.city ?? "",
73
+ state: A.address.state ?? "",
74
+ postalCode: A.address.postalCode ?? "",
75
+ country: A.address.country ?? "",
76
+ totalCapacity: A.capacity.totalSpace === void 0 ? "" : String(A.capacity.totalSpace),
77
+ usedCapacity: A.capacity.usedSpace === void 0 ? "" : String(A.capacity.usedSpace),
78
78
  contactEmail: A.contactInfo?.email || "",
79
79
  contactPhone: A.contactInfo?.phone || ""
80
80
  });
81
81
  }, [t, A]);
82
- let Z = () => f?.(c(a, "inventory/warehouses")), Q = (e, t) => R((n) => ({
82
+ let Z = () => f?.(c(a, "inventory/warehouses")), Q = (e, t) => F((n) => ({
83
83
  ...n,
84
84
  [e]: t
85
85
  })), $ = async (e) => {
@@ -91,20 +91,20 @@ function W({ editId: t, onSaved: n }) {
91
91
  K("A street and city are required for the warehouse address.");
92
92
  return;
93
93
  }
94
- G(!0), K(null);
94
+ W(!0), K(null);
95
95
  try {
96
- let e = P.totalCapacity.trim() ? Number(P.totalCapacity) : void 0, r = P.usedCapacity.trim() ? Number(P.usedCapacity) : void 0, i = {
96
+ let e = P.totalCapacity.trim() ? Number(P.totalCapacity) : void 0, r = P.usedCapacity.trim() ? Number(P.usedCapacity) : void 0, i = Object.fromEntries(Object.entries({
97
+ street: P.street.trim(),
98
+ city: P.city.trim(),
99
+ state: P.state.trim(),
100
+ postalCode: P.postalCode.trim(),
101
+ country: P.country.trim()
102
+ }).filter(([, e]) => e.length > 0)), o = {
97
103
  code: P.code.trim(),
98
104
  name: P.name.trim(),
99
105
  type: P.type,
100
- status: P.status,
101
- address: {
102
- street: P.street.trim(),
103
- city: P.city.trim(),
104
- state: P.state.trim(),
105
- postalCode: P.postalCode.trim(),
106
- country: P.country.trim()
107
- },
106
+ status: P.status.trim() || void 0,
107
+ address: i,
108
108
  contactInfo: P.contactEmail.trim() || P.contactPhone.trim() ? {
109
109
  email: P.contactEmail.trim() || void 0,
110
110
  phone: P.contactPhone.trim() || void 0
@@ -112,64 +112,64 @@ function W({ editId: t, onSaved: n }) {
112
112
  totalCapacity: e !== void 0 && !Number.isNaN(e) ? e : void 0,
113
113
  usedCapacity: r !== void 0 && !Number.isNaN(r) ? r : void 0
114
114
  };
115
- if (t) await E(t, i), await n?.(), f?.(c(a, `inventory/warehouses/${t}`));
115
+ if (t) await E(t, o), await n?.(), f?.(c(a, `inventory/warehouses/${t}`));
116
116
  else {
117
- let e = await b(i);
117
+ let e = await b(o);
118
118
  f?.(c(a, `inventory/warehouses/${e.id}`));
119
119
  }
120
120
  } catch (e) {
121
- console.error("Failed to create warehouse:", e), K(e instanceof Error ? e.message : "Failed to create warehouse. Please try again."), G(!1);
121
+ console.error("Failed to create warehouse:", e), K(e instanceof Error ? e.message : "Failed to create warehouse. Please try again."), W(!1);
122
122
  }
123
123
  };
124
- return /* @__PURE__ */ I(O, {
124
+ return /* @__PURE__ */ L(O, {
125
125
  title: N ? "Edit Warehouse" : "Add Warehouse",
126
126
  subtitle: "Register a storage and fulfilment site",
127
- icon: /* @__PURE__ */ F(s, { size: 24 }),
128
- headerActions: /* @__PURE__ */ I("div", {
127
+ icon: /* @__PURE__ */ I(s, { size: 24 }),
128
+ headerActions: /* @__PURE__ */ L("div", {
129
129
  className: "flex gap-2",
130
- children: [/* @__PURE__ */ I(p, {
130
+ children: [/* @__PURE__ */ L(p, {
131
131
  variant: "outline",
132
132
  onClick: Z,
133
- disabled: W,
134
- children: [/* @__PURE__ */ F(e, { size: 16 }), " Cancel"]
135
- }), /* @__PURE__ */ I(p, {
133
+ disabled: z,
134
+ children: [/* @__PURE__ */ I(e, { size: 16 }), " Cancel"]
135
+ }), /* @__PURE__ */ L(p, {
136
136
  onClick: $,
137
- disabled: W,
137
+ disabled: z,
138
138
  children: [
139
- /* @__PURE__ */ F(i, { size: 16 }),
139
+ /* @__PURE__ */ I(i, { size: 16 }),
140
140
  " ",
141
- N ? W ? "Saving..." : "Save Changes" : W ? "Saving..." : "Add Warehouse"
141
+ N ? z ? "Saving..." : "Save Changes" : z ? "Saving..." : "Add Warehouse"
142
142
  ]
143
143
  })]
144
144
  }),
145
145
  children: [
146
- /* @__PURE__ */ F(z, {
147
- icon: /* @__PURE__ */ F(s, { size: 18 }),
146
+ /* @__PURE__ */ I(B, {
147
+ icon: /* @__PURE__ */ I(s, { size: 18 }),
148
148
  children: "Add a warehouse so you can store inventory and fulfil orders from it. A code, name, type and location get it on the network — set a total capacity to track utilization."
149
149
  }),
150
- /* @__PURE__ */ I("form", {
150
+ /* @__PURE__ */ L("form", {
151
151
  onSubmit: $,
152
152
  className: "max-w-2xl space-y-6",
153
153
  children: [
154
- /* @__PURE__ */ F(k, { message: ie }),
155
- /* @__PURE__ */ I(L, { children: [/* @__PURE__ */ F("h2", {
154
+ /* @__PURE__ */ I(k, { message: G }),
155
+ /* @__PURE__ */ L(R, { children: [/* @__PURE__ */ I("h2", {
156
156
  className: "text-base font-semibold text-text-primary mb-4",
157
157
  children: "Warehouse Details"
158
- }), /* @__PURE__ */ I("div", {
158
+ }), /* @__PURE__ */ L("div", {
159
159
  className: "space-y-4",
160
160
  children: [
161
- /* @__PURE__ */ I("div", {
161
+ /* @__PURE__ */ L("div", {
162
162
  className: "grid grid-cols-1 md:grid-cols-3 gap-4",
163
163
  children: [
164
- /* @__PURE__ */ I("div", {
164
+ /* @__PURE__ */ L("div", {
165
165
  className: "space-y-2",
166
- children: [/* @__PURE__ */ I(y, {
166
+ children: [/* @__PURE__ */ L(y, {
167
167
  htmlFor: "code",
168
- children: ["Code ", /* @__PURE__ */ F("span", {
168
+ children: ["Code ", /* @__PURE__ */ I("span", {
169
169
  className: "text-status-error-text",
170
170
  children: "*"
171
171
  })]
172
- }), /* @__PURE__ */ F(v, {
172
+ }), /* @__PURE__ */ I(v, {
173
173
  id: "code",
174
174
  value: P.code,
175
175
  onChange: (e) => Q("code", e.target.value),
@@ -177,15 +177,15 @@ function W({ editId: t, onSaved: n }) {
177
177
  required: !0
178
178
  })]
179
179
  }),
180
- /* @__PURE__ */ I("div", {
180
+ /* @__PURE__ */ L("div", {
181
181
  className: "space-y-2",
182
- children: [/* @__PURE__ */ I(y, {
182
+ children: [/* @__PURE__ */ L(y, {
183
183
  htmlFor: "name",
184
- children: ["Name ", /* @__PURE__ */ F("span", {
184
+ children: ["Name ", /* @__PURE__ */ I("span", {
185
185
  className: "text-status-error-text",
186
186
  children: "*"
187
187
  })]
188
- }), /* @__PURE__ */ F(v, {
188
+ }), /* @__PURE__ */ I(v, {
189
189
  id: "name",
190
190
  value: P.name,
191
191
  onChange: (e) => Q("name", e.target.value),
@@ -193,21 +193,21 @@ function W({ editId: t, onSaved: n }) {
193
193
  required: !0
194
194
  })]
195
195
  }),
196
- /* @__PURE__ */ I("div", {
196
+ /* @__PURE__ */ L("div", {
197
197
  className: "space-y-2",
198
- children: [/* @__PURE__ */ I(y, {
198
+ children: [/* @__PURE__ */ L(y, {
199
199
  htmlFor: "type",
200
- children: ["Type ", /* @__PURE__ */ F("span", {
200
+ children: ["Type ", /* @__PURE__ */ I("span", {
201
201
  className: "text-status-error-text",
202
202
  children: "*"
203
203
  })]
204
- }), /* @__PURE__ */ I(x, {
204
+ }), /* @__PURE__ */ L(x, {
205
205
  value: P.type,
206
206
  onValueChange: (e) => Q("type", e),
207
- children: [/* @__PURE__ */ F(w, {
207
+ children: [/* @__PURE__ */ I(w, {
208
208
  id: "type",
209
- children: /* @__PURE__ */ F(T, {})
210
- }), /* @__PURE__ */ F(S, { children: ne.map((e) => /* @__PURE__ */ F(C, {
209
+ children: /* @__PURE__ */ I(T, {})
210
+ }), /* @__PURE__ */ I(S, { children: re.map((e) => /* @__PURE__ */ I(C, {
211
211
  value: e.value,
212
212
  children: e.label
213
213
  }, e.value)) })]
@@ -215,32 +215,32 @@ function W({ editId: t, onSaved: n }) {
215
215
  })
216
216
  ]
217
217
  }),
218
- /* @__PURE__ */ I("div", {
218
+ /* @__PURE__ */ L("div", {
219
219
  className: "grid grid-cols-1 md:grid-cols-3 gap-4",
220
220
  children: [
221
- /* @__PURE__ */ I("div", {
221
+ /* @__PURE__ */ L("div", {
222
222
  className: "space-y-2",
223
- children: [/* @__PURE__ */ F(y, {
223
+ children: [/* @__PURE__ */ I(y, {
224
224
  htmlFor: "status",
225
225
  children: "Status"
226
- }), /* @__PURE__ */ I(x, {
226
+ }), /* @__PURE__ */ L(x, {
227
227
  value: P.status,
228
228
  onValueChange: (e) => Q("status", e),
229
- children: [/* @__PURE__ */ F(w, {
229
+ children: [/* @__PURE__ */ I(w, {
230
230
  id: "status",
231
- children: /* @__PURE__ */ F(T, {})
232
- }), /* @__PURE__ */ F(S, { children: re.map((e) => /* @__PURE__ */ F(C, {
231
+ children: /* @__PURE__ */ I(T, {})
232
+ }), /* @__PURE__ */ I(S, { children: ie.map((e) => /* @__PURE__ */ I(C, {
233
233
  value: e.value,
234
234
  children: e.label
235
235
  }, e.value)) })]
236
236
  })]
237
237
  }),
238
- /* @__PURE__ */ I("div", {
238
+ /* @__PURE__ */ L("div", {
239
239
  className: "space-y-2",
240
- children: [/* @__PURE__ */ F(y, {
240
+ children: [/* @__PURE__ */ I(y, {
241
241
  htmlFor: "totalCapacity",
242
242
  children: "Total Capacity (sq ft)"
243
- }), /* @__PURE__ */ F(v, {
243
+ }), /* @__PURE__ */ I(v, {
244
244
  id: "totalCapacity",
245
245
  type: "number",
246
246
  min: "0",
@@ -249,12 +249,12 @@ function W({ editId: t, onSaved: n }) {
249
249
  placeholder: "50000"
250
250
  })]
251
251
  }),
252
- /* @__PURE__ */ I("div", {
252
+ /* @__PURE__ */ L("div", {
253
253
  className: "space-y-2",
254
- children: [/* @__PURE__ */ F(y, {
254
+ children: [/* @__PURE__ */ I(y, {
255
255
  htmlFor: "usedCapacity",
256
256
  children: "Used Capacity (sq ft)"
257
- }), /* @__PURE__ */ F(v, {
257
+ }), /* @__PURE__ */ I(v, {
258
258
  id: "usedCapacity",
259
259
  type: "number",
260
260
  min: "0",
@@ -265,26 +265,26 @@ function W({ editId: t, onSaved: n }) {
265
265
  })
266
266
  ]
267
267
  }),
268
- /* @__PURE__ */ I("div", {
268
+ /* @__PURE__ */ L("div", {
269
269
  className: "grid grid-cols-1 md:grid-cols-2 gap-4",
270
- children: [/* @__PURE__ */ I("div", {
270
+ children: [/* @__PURE__ */ L("div", {
271
271
  className: "space-y-2",
272
- children: [/* @__PURE__ */ F(y, {
272
+ children: [/* @__PURE__ */ I(y, {
273
273
  htmlFor: "contactEmail",
274
274
  children: "Contact Email"
275
- }), /* @__PURE__ */ F(v, {
275
+ }), /* @__PURE__ */ I(v, {
276
276
  id: "contactEmail",
277
277
  type: "email",
278
278
  value: P.contactEmail,
279
279
  onChange: (e) => Q("contactEmail", e.target.value),
280
280
  placeholder: "dc-sf@example.com"
281
281
  })]
282
- }), /* @__PURE__ */ I("div", {
282
+ }), /* @__PURE__ */ L("div", {
283
283
  className: "space-y-2",
284
- children: [/* @__PURE__ */ F(y, {
284
+ children: [/* @__PURE__ */ I(y, {
285
285
  htmlFor: "contactPhone",
286
286
  children: "Contact Phone"
287
- }), /* @__PURE__ */ F(v, {
287
+ }), /* @__PURE__ */ I(v, {
288
288
  id: "contactPhone",
289
289
  value: P.contactPhone,
290
290
  onChange: (e) => Q("contactPhone", e.target.value),
@@ -294,50 +294,50 @@ function W({ editId: t, onSaved: n }) {
294
294
  })
295
295
  ]
296
296
  })] }),
297
- /* @__PURE__ */ I(m, { children: [/* @__PURE__ */ F(g, { children: /* @__PURE__ */ I(_, {
297
+ /* @__PURE__ */ L(m, { children: [/* @__PURE__ */ I(g, { children: /* @__PURE__ */ L(_, {
298
298
  className: "flex items-center gap-2",
299
299
  children: [
300
- /* @__PURE__ */ F(r, { size: 18 }),
300
+ /* @__PURE__ */ I(r, { size: 18 }),
301
301
  " Address ",
302
- /* @__PURE__ */ F("span", {
302
+ /* @__PURE__ */ I("span", {
303
303
  className: "text-status-error-text",
304
304
  children: "*"
305
305
  })
306
306
  ]
307
- }) }), /* @__PURE__ */ I(h, {
307
+ }) }), /* @__PURE__ */ L(h, {
308
308
  className: "space-y-4",
309
309
  children: [
310
- /* @__PURE__ */ I("div", {
310
+ /* @__PURE__ */ L("div", {
311
311
  className: "space-y-2",
312
- children: [/* @__PURE__ */ F(y, {
312
+ children: [/* @__PURE__ */ I(y, {
313
313
  htmlFor: "street",
314
314
  children: "Street"
315
- }), /* @__PURE__ */ F(v, {
315
+ }), /* @__PURE__ */ I(v, {
316
316
  id: "street",
317
317
  value: P.street,
318
318
  onChange: (e) => Q("street", e.target.value),
319
319
  placeholder: "500 Industrial Way"
320
320
  })]
321
321
  }),
322
- /* @__PURE__ */ I("div", {
322
+ /* @__PURE__ */ L("div", {
323
323
  className: "grid grid-cols-1 md:grid-cols-2 gap-4",
324
- children: [/* @__PURE__ */ I("div", {
324
+ children: [/* @__PURE__ */ L("div", {
325
325
  className: "space-y-2",
326
- children: [/* @__PURE__ */ F(y, {
326
+ children: [/* @__PURE__ */ I(y, {
327
327
  htmlFor: "city",
328
328
  children: "City"
329
- }), /* @__PURE__ */ F(v, {
329
+ }), /* @__PURE__ */ I(v, {
330
330
  id: "city",
331
331
  value: P.city,
332
332
  onChange: (e) => Q("city", e.target.value),
333
333
  placeholder: "San Francisco"
334
334
  })]
335
- }), /* @__PURE__ */ I("div", {
335
+ }), /* @__PURE__ */ L("div", {
336
336
  className: "space-y-2",
337
- children: [/* @__PURE__ */ F(y, {
337
+ children: [/* @__PURE__ */ I(y, {
338
338
  htmlFor: "state",
339
339
  children: "State"
340
- }), /* @__PURE__ */ F(v, {
340
+ }), /* @__PURE__ */ I(v, {
341
341
  id: "state",
342
342
  value: P.state,
343
343
  onChange: (e) => Q("state", e.target.value),
@@ -345,25 +345,25 @@ function W({ editId: t, onSaved: n }) {
345
345
  })]
346
346
  })]
347
347
  }),
348
- /* @__PURE__ */ I("div", {
348
+ /* @__PURE__ */ L("div", {
349
349
  className: "grid grid-cols-1 md:grid-cols-2 gap-4",
350
- children: [/* @__PURE__ */ I("div", {
350
+ children: [/* @__PURE__ */ L("div", {
351
351
  className: "space-y-2",
352
- children: [/* @__PURE__ */ F(y, {
352
+ children: [/* @__PURE__ */ I(y, {
353
353
  htmlFor: "postalCode",
354
354
  children: "ZIP / Postal Code"
355
- }), /* @__PURE__ */ F(v, {
355
+ }), /* @__PURE__ */ I(v, {
356
356
  id: "postalCode",
357
357
  value: P.postalCode,
358
358
  onChange: (e) => Q("postalCode", e.target.value),
359
359
  placeholder: "94103"
360
360
  })]
361
- }), /* @__PURE__ */ I("div", {
361
+ }), /* @__PURE__ */ L("div", {
362
362
  className: "space-y-2",
363
- children: [/* @__PURE__ */ F(y, {
363
+ children: [/* @__PURE__ */ I(y, {
364
364
  htmlFor: "country",
365
365
  children: "Country"
366
- }), /* @__PURE__ */ F(v, {
366
+ }), /* @__PURE__ */ I(v, {
367
367
  id: "country",
368
368
  value: P.country,
369
369
  onChange: (e) => Q("country", e.target.value),
@@ -373,43 +373,43 @@ function W({ editId: t, onSaved: n }) {
373
373
  })
374
374
  ]
375
375
  })] }),
376
- N && /* @__PURE__ */ I(m, {
376
+ N && /* @__PURE__ */ L(m, {
377
377
  className: "border-status-error-border",
378
- children: [/* @__PURE__ */ F(g, { children: /* @__PURE__ */ I(_, {
378
+ children: [/* @__PURE__ */ I(g, { children: /* @__PURE__ */ L(_, {
379
379
  className: "flex items-center gap-2 text-status-error-text",
380
- children: [/* @__PURE__ */ F(o, { size: 18 }), " Delete Warehouse"]
381
- }) }), /* @__PURE__ */ I(h, { children: [/* @__PURE__ */ F("p", {
380
+ children: [/* @__PURE__ */ I(o, { size: 18 }), " Delete Warehouse"]
381
+ }) }), /* @__PURE__ */ L(h, { children: [/* @__PURE__ */ I("p", {
382
382
  className: "mb-3 text-sm text-text-secondary",
383
383
  children: "Removes this warehouse from your network. This cannot be undone from here."
384
- }), /* @__PURE__ */ I(p, {
384
+ }), /* @__PURE__ */ L(p, {
385
385
  type: "button",
386
386
  variant: "outline",
387
387
  className: "border-status-error-border text-status-error-text hover:bg-status-error-bg-subtle",
388
388
  onClick: () => q(!0),
389
- children: [/* @__PURE__ */ F(o, { size: 16 }), " Delete this warehouse"]
389
+ children: [/* @__PURE__ */ I(o, { size: 16 }), " Delete this warehouse"]
390
390
  })] })]
391
391
  })
392
392
  ]
393
393
  }),
394
- /* @__PURE__ */ F(B, {
394
+ /* @__PURE__ */ I(V, {
395
395
  open: ae,
396
396
  onOpenChange: q,
397
- children: /* @__PURE__ */ I(V, { children: [
398
- /* @__PURE__ */ I(ee, { children: [/* @__PURE__ */ F(te, { children: "Delete this warehouse?" }), /* @__PURE__ */ I(H, { children: [
397
+ children: /* @__PURE__ */ L(H, { children: [
398
+ /* @__PURE__ */ L(te, { children: [/* @__PURE__ */ I(ne, { children: "Delete this warehouse?" }), /* @__PURE__ */ L(U, { children: [
399
399
  "This removes ",
400
400
  P.name || "this warehouse",
401
401
  " and cannot be undone from here."
402
402
  ] })] }),
403
- /* @__PURE__ */ F("div", {
403
+ /* @__PURE__ */ I("div", {
404
404
  className: "px-1",
405
- children: /* @__PURE__ */ F(k, { message: oe })
405
+ children: /* @__PURE__ */ I(k, { message: oe })
406
406
  }),
407
- /* @__PURE__ */ I(U, { children: [/* @__PURE__ */ F(p, {
407
+ /* @__PURE__ */ L(ee, { children: [/* @__PURE__ */ I(p, {
408
408
  variant: "outline",
409
409
  onClick: () => q(!1),
410
410
  disabled: J,
411
411
  children: "Cancel"
412
- }), /* @__PURE__ */ F(p, {
412
+ }), /* @__PURE__ */ I(p, {
413
413
  className: "bg-status-error-text text-text-inverse hover:opacity-90",
414
414
  onClick: async () => {
415
415
  if (t) {
@@ -431,78 +431,78 @@ function W({ editId: t, onSaved: n }) {
431
431
  }
432
432
  function G() {
433
433
  let { warehouseId: i } = P(), { basePath: o, navigate: u } = l(), v = N().pathname.endsWith("/edit"), { warehouse: y, isLoading: x, error: S, refetch: C, reload: w } = d(i), T = () => u?.(c(o, "inventory/warehouses")), k = (e) => u?.(c(o, e));
434
- if (!i) return /* @__PURE__ */ F(W, {});
435
- if (v) return /* @__PURE__ */ F(W, {
434
+ if (!i) return /* @__PURE__ */ I(W, {});
435
+ if (v) return /* @__PURE__ */ I(W, {
436
436
  editId: i,
437
437
  onSaved: w
438
438
  });
439
- if (x) return /* @__PURE__ */ F(D, { message: "Loading warehouse details..." });
440
- if (S || !y) return /* @__PURE__ */ F(E, {
439
+ if (x) return /* @__PURE__ */ I(D, { message: "Loading warehouse details..." });
440
+ if (S || !y) return /* @__PURE__ */ I(E, {
441
441
  title: "Warehouse not found",
442
442
  onRetry: C
443
443
  });
444
- let j = y.status.toUpperCase() === "ACTIVE";
445
- return /* @__PURE__ */ I(O, {
444
+ let j = y.status?.toUpperCase() === "ACTIVE";
445
+ return /* @__PURE__ */ L(O, {
446
446
  title: y.name,
447
447
  subtitle: `Code: ${y.code}`,
448
- icon: /* @__PURE__ */ F(s, { size: 24 }),
449
- headerActions: /* @__PURE__ */ I("div", {
448
+ icon: /* @__PURE__ */ I(s, { size: 24 }),
449
+ headerActions: /* @__PURE__ */ L("div", {
450
450
  className: "flex gap-2",
451
- children: [/* @__PURE__ */ I(p, {
451
+ children: [/* @__PURE__ */ L(p, {
452
452
  variant: "outline",
453
453
  onClick: T,
454
- children: [/* @__PURE__ */ F(e, { size: 16 }), " Back"]
455
- }), /* @__PURE__ */ I(p, {
454
+ children: [/* @__PURE__ */ I(e, { size: 16 }), " Back"]
455
+ }), /* @__PURE__ */ L(p, {
456
456
  onClick: () => u?.(c(o, `inventory/warehouses/${i}/edit`)),
457
- children: [/* @__PURE__ */ F(a, { size: 16 }), " Edit"]
457
+ children: [/* @__PURE__ */ I(a, { size: 16 }), " Edit"]
458
458
  })]
459
459
  }),
460
- headerContent: /* @__PURE__ */ I("div", {
460
+ headerContent: /* @__PURE__ */ L("div", {
461
461
  className: "flex gap-2",
462
- children: [/* @__PURE__ */ F(f, {
463
- variant: j ? "default" : "secondary",
464
- children: j ? "Active" : "Inactive"
465
- }), /* @__PURE__ */ F(f, {
462
+ children: [/* @__PURE__ */ I(f, {
463
+ variant: y.status ? j ? "default" : "secondary" : "outline",
464
+ children: y.status ? j ? "Active" : "Inactive" : "Not provided"
465
+ }), /* @__PURE__ */ I(f, {
466
466
  variant: "outline",
467
467
  className: "capitalize",
468
468
  children: y.type.replace("_", " ")
469
469
  })]
470
470
  }),
471
471
  children: [
472
- /* @__PURE__ */ F(z, {
473
- icon: /* @__PURE__ */ F(s, { size: 18 }),
472
+ /* @__PURE__ */ I(B, {
473
+ icon: /* @__PURE__ */ I(s, { size: 18 }),
474
474
  children: "A storage and fulfilment site at a glance — how full it is, its operating hours and how to reach it. Use it to decide whether this warehouse has the space and hours to fulfil an order."
475
475
  }),
476
- /* @__PURE__ */ F(R, {
476
+ /* @__PURE__ */ I(z, {
477
477
  storageKey: "movethewheels-warehouse-details",
478
478
  steps: [{
479
479
  id: "inventory",
480
480
  label: "Review stock here",
481
481
  description: "See which products are stored at this site.",
482
- icon: /* @__PURE__ */ F(t, { size: 16 }),
482
+ icon: /* @__PURE__ */ I(t, { size: 16 }),
483
483
  onClick: () => k("inventory/products")
484
484
  }, {
485
485
  id: "fulfil",
486
486
  label: "Fulfil an order from this site",
487
487
  description: "Pick a pending order to ship out of this warehouse.",
488
- icon: /* @__PURE__ */ F(r, { size: 16 }),
488
+ icon: /* @__PURE__ */ I(r, { size: 16 }),
489
489
  onClick: () => k("orders")
490
490
  }]
491
491
  }),
492
- /* @__PURE__ */ I("div", {
492
+ /* @__PURE__ */ L("div", {
493
493
  className: "grid grid-cols-1 lg:grid-cols-3 gap-6",
494
- children: [/* @__PURE__ */ I("div", {
494
+ children: [/* @__PURE__ */ L("div", {
495
495
  className: "lg:col-span-2 space-y-6",
496
- children: [/* @__PURE__ */ I(L, { children: [/* @__PURE__ */ I("h2", {
496
+ children: [/* @__PURE__ */ L(R, { children: [/* @__PURE__ */ L("h2", {
497
497
  className: "flex items-center gap-2 text-base font-semibold text-text-primary mb-4",
498
- children: [/* @__PURE__ */ F(t, { size: 18 }), " Capacity"]
499
- }), /* @__PURE__ */ I("div", { children: [
500
- /* @__PURE__ */ I("div", {
498
+ children: [/* @__PURE__ */ I(t, { size: 18 }), " Capacity"]
499
+ }), /* @__PURE__ */ I("div", { children: y.utilization !== void 0 && y.capacity.usedSpace !== void 0 && y.capacity.totalSpace !== void 0 ? /* @__PURE__ */ L(F, { children: [
500
+ /* @__PURE__ */ L("div", {
501
501
  className: "flex justify-between text-sm mb-2",
502
- children: [/* @__PURE__ */ F("span", { children: "Space Utilization" }), /* @__PURE__ */ I("span", { children: [y.utilization.toFixed(0), "%"] })]
502
+ children: [/* @__PURE__ */ I("span", { children: "Space Utilization" }), /* @__PURE__ */ L("span", { children: [y.utilization.toFixed(0), "%"] })]
503
503
  }),
504
- /* @__PURE__ */ F(b, { value: y.utilization }),
505
- /* @__PURE__ */ I("p", {
504
+ /* @__PURE__ */ I(b, { value: y.utilization }),
505
+ /* @__PURE__ */ L("p", {
506
506
  className: "text-sm text-text-secondary mt-1",
507
507
  children: [
508
508
  y.capacity.usedSpace.toLocaleString(),
@@ -512,42 +512,45 @@ function G() {
512
512
  " sq ft"
513
513
  ]
514
514
  })
515
- ] })] }), /* @__PURE__ */ I(m, { children: [/* @__PURE__ */ F(g, { children: /* @__PURE__ */ I(_, {
515
+ ] }) : /* @__PURE__ */ I("p", {
516
+ className: "text-sm text-text-secondary",
517
+ children: "Not provided"
518
+ }) })] }), /* @__PURE__ */ L(m, { children: [/* @__PURE__ */ I(g, { children: /* @__PURE__ */ L(_, {
516
519
  className: "flex items-center gap-2",
517
- children: [/* @__PURE__ */ F(n, { size: 18 }), " Operating Hours"]
518
- }) }), /* @__PURE__ */ F(h, { children: Object.keys(y.operatingHours).length > 0 ? /* @__PURE__ */ F("div", {
520
+ children: [/* @__PURE__ */ I(n, { size: 18 }), " Operating Hours"]
521
+ }) }), /* @__PURE__ */ I(h, { children: Object.keys(y.operatingHours).length > 0 ? /* @__PURE__ */ I("div", {
519
522
  className: "grid grid-cols-2 md:grid-cols-4 gap-4",
520
- children: Object.entries(y.operatingHours).map(([e, t]) => /* @__PURE__ */ I("div", { children: [/* @__PURE__ */ F("p", {
523
+ children: Object.entries(y.operatingHours).map(([e, t]) => /* @__PURE__ */ L("div", { children: [/* @__PURE__ */ I("p", {
521
524
  className: "text-sm font-medium",
522
525
  children: e
523
- }), /* @__PURE__ */ F("p", {
526
+ }), /* @__PURE__ */ I("p", {
524
527
  className: "text-sm text-text-secondary",
525
528
  children: t ? `${t.open} - ${t.close}` : "Closed"
526
529
  })] }, e))
527
- }) : /* @__PURE__ */ F("p", {
530
+ }) : /* @__PURE__ */ I("p", {
528
531
  className: "text-sm text-text-secondary",
529
532
  children: "Not recorded"
530
533
  }) })] })]
531
- }), /* @__PURE__ */ I("div", {
534
+ }), /* @__PURE__ */ L("div", {
532
535
  className: "space-y-6",
533
- children: [/* @__PURE__ */ I(m, { children: [/* @__PURE__ */ F(g, { children: /* @__PURE__ */ I(_, {
536
+ children: [/* @__PURE__ */ L(m, { children: [/* @__PURE__ */ I(g, { children: /* @__PURE__ */ L(_, {
534
537
  className: "flex items-center gap-2",
535
- children: [/* @__PURE__ */ F(r, { size: 18 }), " Location"]
536
- }) }), /* @__PURE__ */ F(h, { children: /* @__PURE__ */ F("p", {
538
+ children: [/* @__PURE__ */ I(r, { size: 18 }), " Location"]
539
+ }) }), /* @__PURE__ */ I(h, { children: /* @__PURE__ */ I("p", {
537
540
  className: "text-sm",
538
541
  children: A(y.address) || "—"
539
- }) })] }), (y.contactInfo?.email || y.contactInfo?.phone) && /* @__PURE__ */ I(m, { children: [/* @__PURE__ */ F(g, { children: /* @__PURE__ */ F(_, { children: "Contact" }) }), /* @__PURE__ */ I(h, {
542
+ }) })] }), (y.contactInfo?.email || y.contactInfo?.phone) && /* @__PURE__ */ L(m, { children: [/* @__PURE__ */ I(g, { children: /* @__PURE__ */ I(_, { children: "Contact" }) }), /* @__PURE__ */ L(h, {
540
543
  className: "space-y-3",
541
- children: [y.contactInfo?.email && /* @__PURE__ */ I("div", { children: [/* @__PURE__ */ F("p", {
544
+ children: [y.contactInfo?.email && /* @__PURE__ */ L("div", { children: [/* @__PURE__ */ I("p", {
542
545
  className: "text-sm text-text-secondary",
543
546
  children: "Email"
544
- }), /* @__PURE__ */ F("p", {
547
+ }), /* @__PURE__ */ I("p", {
545
548
  className: "font-medium",
546
549
  children: y.contactInfo.email
547
- })] }), y.contactInfo?.phone && /* @__PURE__ */ I("div", { children: [/* @__PURE__ */ F("p", {
550
+ })] }), y.contactInfo?.phone && /* @__PURE__ */ L("div", { children: [/* @__PURE__ */ I("p", {
548
551
  className: "text-sm text-text-secondary",
549
552
  children: "Phone"
550
- }), /* @__PURE__ */ F("p", {
553
+ }), /* @__PURE__ */ I("p", {
551
554
  className: "font-medium",
552
555
  children: y.contactInfo.phone
553
556
  })] })]