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