@burdenoff/microfe-movethewheels 2026.925.1 → 2026.925.3

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 (47) hide show
  1. package/dist/components/StatusBadge.js +31 -31
  2. package/dist/constants/index.js +19 -5
  3. package/dist/hooks/useCustomers.js +0 -3
  4. package/dist/hooks/useFleet.js +197 -175
  5. package/dist/hooks/useInventory.js +144 -145
  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 +2 -0
  9. package/dist/movethewheels/hooks/useFleet.d.ts +53 -1
  10. package/dist/movethewheels/hooks/useInventory.d.ts +10 -0
  11. package/dist/movethewheels/types/index.d.ts +29 -108
  12. package/dist/node_modules/lucide-react/dist/esm/icons/sticky-note.js +11 -0
  13. package/dist/node_modules/lucide-react/dist/esm/icons/user-x.js +30 -0
  14. package/dist/pages/CustomerDetailsPage.js +666 -344
  15. package/dist/pages/CustomersPage.js +71 -80
  16. package/dist/pages/DriverDetailsPage.js +702 -421
  17. package/dist/pages/DriversPage.js +106 -117
  18. package/dist/pages/FleetPage.js +5 -13
  19. package/dist/pages/InventoryPage.js +4 -4
  20. package/dist/pages/OrderDetailsPage.js +279 -274
  21. package/dist/pages/RouteDetailsPage.js +300 -263
  22. package/dist/pages/RoutesPage.js +130 -67
  23. package/dist/pages/VehicleDetailsPage.js +562 -287
  24. package/dist/pages/VehiclesPage.js +119 -70
  25. package/dist/pages/WarehouseDetailsPage.js +410 -370
  26. package/dist/pages/WarehousesPage.js +131 -82
  27. package/package.json +1 -1
  28. package/src/movethewheels/components/StatusBadge.tsx +16 -2
  29. package/src/movethewheels/constants/index.ts +21 -0
  30. package/src/movethewheels/hooks/useCustomers.ts +0 -3
  31. package/src/movethewheels/hooks/useFleet.ts +236 -62
  32. package/src/movethewheels/hooks/useInventory.ts +76 -32
  33. package/src/movethewheels/hooks/useRoutes.ts +17 -12
  34. package/src/movethewheels/pages/CustomerDetailsPage.tsx +376 -109
  35. package/src/movethewheels/pages/CustomersPage.tsx +6 -15
  36. package/src/movethewheels/pages/DriverDetailsPage.tsx +516 -156
  37. package/src/movethewheels/pages/DriversPage.tsx +28 -11
  38. package/src/movethewheels/pages/FleetPage.tsx +9 -11
  39. package/src/movethewheels/pages/InventoryPage.tsx +14 -5
  40. package/src/movethewheels/pages/OrderDetailsPage.tsx +12 -7
  41. package/src/movethewheels/pages/RouteDetailsPage.tsx +89 -41
  42. package/src/movethewheels/pages/RoutesPage.tsx +66 -2
  43. package/src/movethewheels/pages/VehicleDetailsPage.tsx +282 -20
  44. package/src/movethewheels/pages/VehiclesPage.tsx +68 -3
  45. package/src/movethewheels/pages/WarehouseDetailsPage.tsx +213 -135
  46. package/src/movethewheels/pages/WarehousesPage.tsx +77 -16
  47. package/src/movethewheels/types/index.ts +30 -108
@@ -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,296 +39,436 @@ 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 }) {
50
+ let { basePath: n, navigate: a } = l(), { createWarehouse: f, updateWarehouse: b, deleteWarehouse: E } = u(), { warehouse: D } = d(t), A = !!t, [N, P] = 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
+ }), [R, W] = M(!1), [G, K] = M(null), [ie, q] = M(!1), [J, Y] = M(!1), [ae, 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 || !D || P({
67
+ code: D.code || "",
68
+ name: D.name || "",
69
+ type: D.type ? D.type.toUpperCase() : "DISTRIBUTION",
70
+ status: D.status || "ACTIVE",
71
+ street: D.address.street || "",
72
+ city: D.address.city || "",
73
+ state: D.address.state || "",
74
+ postalCode: D.address.postalCode || "",
75
+ country: D.address.country || "USA",
76
+ totalCapacity: D.capacity.totalSpace ? String(D.capacity.totalSpace) : "",
77
+ usedCapacity: D.capacity.usedSpace ? String(D.capacity.usedSpace) : "",
78
+ contactEmail: D.contactInfo?.email || "",
79
+ contactPhone: D.contactInfo?.phone || ""
66
80
  });
67
- }, [t, b]);
68
- let H = () => a?.(c(n, "inventory/warehouses")), U = (e, t) => A((n) => ({
81
+ }, [t, D]);
82
+ let Z = () => a?.(c(n, "inventory/warehouses")), Q = (e, t) => P((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(), !N.code.trim() || !N.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 (!N.street.trim() || !N.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
+ W(!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 = N.totalCapacity.trim() ? Number(N.totalCapacity) : void 0, r = N.usedCapacity.trim() ? Number(N.usedCapacity) : void 0, i = {
97
+ code: N.code.trim(),
98
+ name: N.name.trim(),
99
+ type: N.type,
100
+ status: N.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: N.street.trim(),
103
+ city: N.city.trim(),
104
+ state: N.state.trim(),
105
+ postalCode: N.postalCode.trim(),
106
+ country: N.country.trim()
92
107
  },
93
- totalCapacity: e !== void 0 && !Number.isNaN(e) ? e : void 0
108
+ contactInfo: N.contactEmail.trim() || N.contactPhone.trim() ? {
109
+ email: N.contactEmail.trim() || void 0,
110
+ phone: N.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 b(t, i), a?.(c(n, `inventory/warehouses/${t}`));
96
116
  else {
97
- let e = await o(r);
117
+ let e = await f(i);
98
118
  a?.(c(n, `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."), W(!1);
102
122
  }
103
123
  };
104
124
  return /* @__PURE__ */ I(O, {
105
- title: E ? "Edit Warehouse" : "Add Warehouse",
125
+ title: A ? "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: R,
114
134
  children: [/* @__PURE__ */ F(e, { size: 16 }), " Cancel"]
115
135
  }), /* @__PURE__ */ I(p, {
116
- onClick: W,
117
- disabled: N,
136
+ onClick: $,
137
+ disabled: R,
118
138
  children: [
119
139
  /* @__PURE__ */ F(i, { size: 16 }),
120
140
  " ",
121
- E ? N ? "Saving..." : "Save Changes" : N ? "Saving..." : "Add Warehouse"
141
+ A ? R ? "Saving..." : "Save Changes" : R ? "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: G }),
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: N.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: N.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: N.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: N.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: N.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: N.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: N.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: N.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: N.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: N.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: N.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: N.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: N.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
+ A && /* @__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: ie,
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
+ N.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: ae })
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 E(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 } = d(i), w = () => u?.(c(o, "inventory/warehouses")), T = (e) => u?.(c(o, e));
434
+ if (!i) return /* @__PURE__ */ F(W, {});
435
+ if (v) return /* @__PURE__ */ F(W, { editId: i });
436
+ if (x) return /* @__PURE__ */ F(D, { message: "Loading warehouse details..." });
437
+ if (S || !y) return /* @__PURE__ */ F(E, {
298
438
  title: "Warehouse not found",
299
- onRetry: w
439
+ onRetry: C
300
440
  });
301
- let j = x.capacity.usedSpace / x.capacity.totalSpace * 100;
441
+ let k = y.status.toUpperCase() === "ACTIVE";
302
442
  return /* @__PURE__ */ I(O, {
303
- title: x.name,
304
- subtitle: `Code: ${x.code}`,
443
+ title: y.name,
444
+ subtitle: `Code: ${y.code}`,
305
445
  icon: /* @__PURE__ */ F(s, { size: 24 }),
306
446
  headerActions: /* @__PURE__ */ I("div", {
307
447
  className: "flex gap-2",
308
448
  children: [/* @__PURE__ */ I(p, {
309
449
  variant: "outline",
310
- onClick: T,
450
+ onClick: w,
311
451
  children: [/* @__PURE__ */ F(e, { size: 16 }), " Back"]
312
452
  }), /* @__PURE__ */ I(p, {
313
- onClick: () => v?.(c(u, `inventory/warehouses/${i}/edit`)),
453
+ onClick: () => u?.(c(o, `inventory/warehouses/${i}/edit`)),
314
454
  children: [/* @__PURE__ */ F(a, { size: 16 }), " Edit"]
315
455
  })]
316
456
  }),
317
457
  headerContent: /* @__PURE__ */ I("div", {
318
458
  className: "flex gap-2",
319
459
  children: [/* @__PURE__ */ F(f, {
320
- variant: x.isActive ? "default" : "secondary",
321
- children: x.isActive ? "Active" : "Inactive"
460
+ variant: k ? "default" : "secondary",
461
+ children: k ? "Active" : "Inactive"
322
462
  }), /* @__PURE__ */ F(f, {
323
463
  variant: "outline",
324
464
  className: "capitalize",
325
- children: x.type.replace("_", " ")
465
+ children: y.type.replace("_", " ")
326
466
  })]
327
467
  }),
328
468
  children: [
329
469
  /* @__PURE__ */ F(z, {
330
470
  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."
471
+ 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
472
  }),
333
473
  /* @__PURE__ */ F(R, {
334
474
  storageKey: "movethewheels-warehouse-details",
@@ -337,182 +477,82 @@ function H() {
337
477
  label: "Review stock here",
338
478
  description: "See which products are stored at this site.",
339
479
  icon: /* @__PURE__ */ F(t, { size: 16 }),
340
- onClick: () => k("inventory/products")
480
+ onClick: () => T("inventory/products")
341
481
  }, {
342
482
  id: "fulfil",
343
483
  label: "Fulfil an order from this site",
344
484
  description: "Pick a pending order to ship out of this warehouse.",
345
485
  icon: /* @__PURE__ */ F(r, { size: 16 }),
346
- onClick: () => k("orders")
486
+ onClick: () => T("orders")
347
487
  }]
348
488
  }),
349
489
  /* @__PURE__ */ I("div", {
350
490
  className: "grid grid-cols-1 lg:grid-cols-3 gap-6",
351
491
  children: [/* @__PURE__ */ I("div", {
352
492
  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",
493
+ children: [/* @__PURE__ */ I(L, { children: [/* @__PURE__ */ I("h2", {
494
+ className: "flex items-center gap-2 text-base font-semibold text-text-primary mb-4",
495
+ children: [/* @__PURE__ */ F(t, { size: 18 }), " Capacity"]
496
+ }), /* @__PURE__ */ I("div", { children: [
497
+ /* @__PURE__ */ I("div", {
498
+ className: "flex justify-between text-sm mb-2",
499
+ children: [/* @__PURE__ */ F("span", { children: "Space Utilization" }), /* @__PURE__ */ I("span", { children: [y.utilization.toFixed(0), "%"] })]
500
+ }),
501
+ /* @__PURE__ */ F(b, { value: y.utilization }),
502
+ /* @__PURE__ */ I("p", {
503
+ className: "text-sm text-text-secondary mt-1",
489
504
  children: [
490
- /* @__PURE__ */ F(o, { size: 18 }),
491
- " Staff (",
492
- x.staff.length,
493
- ")"
505
+ y.capacity.usedSpace.toLocaleString(),
506
+ " /",
507
+ " ",
508
+ y.capacity.totalSpace.toLocaleString(),
509
+ " sq ft"
494
510
  ]
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
- ]
511
+ })
512
+ ] })] }), /* @__PURE__ */ I(m, { children: [/* @__PURE__ */ F(g, { children: /* @__PURE__ */ I(_, {
513
+ className: "flex items-center gap-2",
514
+ children: [/* @__PURE__ */ F(n, { size: 18 }), " Operating Hours"]
515
+ }) }), /* @__PURE__ */ F(h, { children: Object.keys(y.operatingHours).length > 0 ? /* @__PURE__ */ F("div", {
516
+ className: "grid grid-cols-2 md:grid-cols-4 gap-4",
517
+ children: Object.entries(y.operatingHours).map(([e, t]) => /* @__PURE__ */ I("div", { children: [/* @__PURE__ */ F("p", {
518
+ className: "text-sm font-medium",
519
+ children: e
520
+ }), /* @__PURE__ */ F("p", {
521
+ className: "text-sm text-text-secondary",
522
+ children: t ? `${t.open} - ${t.close}` : "Closed"
523
+ })] }, e))
524
+ }) : /* @__PURE__ */ F("p", {
525
+ className: "text-sm text-text-secondary",
526
+ children: "Not recorded"
527
+ }) })] })]
528
+ }), /* @__PURE__ */ I("div", {
529
+ className: "space-y-6",
530
+ children: [/* @__PURE__ */ I(m, { children: [/* @__PURE__ */ F(g, { children: /* @__PURE__ */ I(_, {
531
+ className: "flex items-center gap-2",
532
+ children: [/* @__PURE__ */ F(r, { size: 18 }), " Location"]
533
+ }) }), /* @__PURE__ */ F(h, { children: /* @__PURE__ */ F("p", {
534
+ className: "text-sm",
535
+ children: A(y.address) || "—"
536
+ }) })] }), (y.contactInfo?.email || y.contactInfo?.phone) && /* @__PURE__ */ I(m, { children: [/* @__PURE__ */ F(g, { children: /* @__PURE__ */ F(_, { children: "Contact" }) }), /* @__PURE__ */ I(h, {
537
+ className: "space-y-3",
538
+ children: [y.contactInfo?.email && /* @__PURE__ */ I("div", { children: [/* @__PURE__ */ F("p", {
539
+ className: "text-sm text-text-secondary",
540
+ children: "Email"
541
+ }), /* @__PURE__ */ F("p", {
542
+ className: "font-medium",
543
+ children: y.contactInfo.email
544
+ })] }), y.contactInfo?.phone && /* @__PURE__ */ I("div", { children: [/* @__PURE__ */ F("p", {
545
+ className: "text-sm text-text-secondary",
546
+ children: "Phone"
547
+ }), /* @__PURE__ */ F("p", {
548
+ className: "font-medium",
549
+ children: y.contactInfo.phone
550
+ })] })]
551
+ })] })]
512
552
  })]
513
553
  })
514
554
  ]
515
555
  });
516
556
  }
517
557
  //#endregion
518
- export { H as default };
558
+ export { G as default };