@burdenoff/microfe-movethewheels 2026.925.2 → 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 (38) hide show
  1. package/dist/components/StatusBadge.js +30 -30
  2. package/dist/constants/index.js +12 -5
  3. package/dist/hooks/useCustomers.js +0 -3
  4. package/dist/hooks/useFleet.js +144 -131
  5. package/dist/hooks/useInventory.js +144 -145
  6. package/dist/hooks/useRoutes.js +5 -14
  7. package/dist/movethewheels/constants/index.d.ts +1 -0
  8. package/dist/movethewheels/hooks/useFleet.d.ts +13 -1
  9. package/dist/movethewheels/hooks/useInventory.d.ts +10 -0
  10. package/dist/movethewheels/types/index.d.ts +13 -70
  11. package/dist/pages/CustomerDetailsPage.js +666 -344
  12. package/dist/pages/CustomersPage.js +71 -80
  13. package/dist/pages/FleetPage.js +1 -3
  14. package/dist/pages/InventoryPage.js +4 -4
  15. package/dist/pages/RouteDetailsPage.js +273 -248
  16. package/dist/pages/RoutesPage.js +130 -67
  17. package/dist/pages/VehicleDetailsPage.js +506 -391
  18. package/dist/pages/VehiclesPage.js +119 -70
  19. package/dist/pages/WarehouseDetailsPage.js +410 -370
  20. package/dist/pages/WarehousesPage.js +131 -82
  21. package/package.json +1 -1
  22. package/src/movethewheels/components/StatusBadge.tsx +8 -3
  23. package/src/movethewheels/constants/index.ts +9 -0
  24. package/src/movethewheels/hooks/useCustomers.ts +0 -3
  25. package/src/movethewheels/hooks/useFleet.ts +74 -19
  26. package/src/movethewheels/hooks/useInventory.ts +76 -32
  27. package/src/movethewheels/hooks/useRoutes.ts +17 -12
  28. package/src/movethewheels/pages/CustomerDetailsPage.tsx +376 -109
  29. package/src/movethewheels/pages/CustomersPage.tsx +6 -15
  30. package/src/movethewheels/pages/FleetPage.tsx +2 -1
  31. package/src/movethewheels/pages/InventoryPage.tsx +14 -5
  32. package/src/movethewheels/pages/RouteDetailsPage.tsx +74 -34
  33. package/src/movethewheels/pages/RoutesPage.tsx +66 -2
  34. package/src/movethewheels/pages/VehicleDetailsPage.tsx +151 -11
  35. package/src/movethewheels/pages/VehiclesPage.tsx +68 -3
  36. package/src/movethewheels/pages/WarehouseDetailsPage.tsx +213 -135
  37. package/src/movethewheels/pages/WarehousesPage.tsx +77 -16
  38. package/src/movethewheels/types/index.ts +14 -70
@@ -2,8 +2,8 @@ import { useMoveTheWheels as e } from "../providers/MoveTheWheelsProvider.js";
2
2
  import { executeGraphQL as t } from "../utils/graphqlClient.js";
3
3
  import { useCallback as n, useEffect as r, useMemo as i, useState as a } from "react";
4
4
  //#region src/movethewheels/hooks/useInventory.ts
5
- var o = "\n query ListInventoryItems($filter: InventoryFilterInput, $pagination: PaginationInput) {\n inventoryItems(filter: $filter, pagination: $pagination) {\n id\n cargoItemId\n warehouseId\n onHand\n available\n allocated\n damaged\n reorderPoint\n createdAt\n updatedAt\n cargoItem {\n id\n name\n sku\n }\n warehouse {\n id\n name\n code\n }\n }\n inventoryItemsCount(filter: $filter)\n }\n", s = "\n query ListCargoItems($filter: CargoItemFilterInput, $pagination: PaginationInput) {\n cargoItems(filter: $filter, pagination: $pagination) {\n id\n sku\n name\n description\n category\n brand\n dimensions\n weight\n value\n hazardous\n fragile\n temperatureControlled\n createdAt\n updatedAt\n }\n cargoItemsCount(filter: $filter)\n }\n", c = "\n query ListWarehouses($filter: WarehouseFilterInput, $pagination: PaginationInput) {\n warehouses(filter: $filter, pagination: $pagination) {\n id\n name\n code\n type\n address\n totalCapacity\n usedCapacity\n createdAt\n }\n warehousesCount(filter: $filter)\n }\n", l = "\n query GetCargoItem($id: ID!) {\n cargoItem(id: $id) {\n id\n sku\n name\n description\n category\n brand\n dimensions\n weight\n value\n hazardous\n fragile\n temperatureControlled\n createdAt\n updatedAt\n }\n }\n", u = "\n query GetWarehouse($id: ID!) {\n warehouse(id: $id) {\n id\n name\n code\n type\n address\n totalCapacity\n usedCapacity\n createdAt\n }\n }\n", d = "\n query GetInventoryStats {\n inventoryStats {\n totalOnHand\n totalAvailable\n totalAllocated\n totalDamaged\n lowStockCount\n }\n cargoItemsCount\n warehousesCount\n }\n", f = "\n query ListInventoryTransactions($filter: InventoryFilterInput, $pagination: PaginationInput) {\n inventoryTransactions(filter: $filter, pagination: $pagination) {\n id\n transactionNumber\n type\n quantity\n cargoItemId\n warehouseId\n notes\n referenceType\n referenceId\n createdAt\n }\n }\n", p = "\n mutation CreateCargoItem($input: CreateCargoItemInput!) {\n createCargoItem(input: $input) {\n id\n sku\n name\n description\n category\n brand\n dimensions\n weight\n value\n hazardous\n fragile\n temperatureControlled\n createdAt\n updatedAt\n }\n }\n", m = "\n mutation UpdateCargoItem($id: ID!, $input: UpdateCargoItemInput!) {\n updateCargoItem(id: $id, input: $input) {\n id\n sku\n name\n description\n category\n brand\n dimensions\n weight\n value\n hazardous\n fragile\n temperatureControlled\n createdAt\n updatedAt\n }\n }\n", h = "\n mutation CreateWarehouse($input: CreateWarehouseInput!) {\n createWarehouse(input: $input) {\n id\n name\n code\n type\n address\n totalCapacity\n usedCapacity\n createdAt\n }\n }\n", g = "\n mutation UpdateWarehouse($id: ID!, $input: UpdateWarehouseInput!) {\n updateWarehouse(id: $id, input: $input) {\n id\n name\n code\n type\n address\n totalCapacity\n usedCapacity\n createdAt\n }\n }\n", _ = "\n mutation AdjustInventoryStock($input: AdjustInventoryStockInput!) {\n adjustInventoryStock(input: $input) {\n id\n cargoItemId\n warehouseId\n onHand\n available\n allocated\n damaged\n reorderPoint\n createdAt\n updatedAt\n }\n }\n";
6
- function v(e) {
5
+ var o = "\n query ListInventoryItems($filter: InventoryFilterInput, $pagination: PaginationInput) {\n inventoryItems(filter: $filter, pagination: $pagination) {\n id\n cargoItemId\n warehouseId\n onHand\n available\n allocated\n damaged\n reorderPoint\n createdAt\n updatedAt\n cargoItem {\n id\n name\n sku\n }\n warehouse {\n id\n name\n code\n }\n }\n inventoryItemsCount(filter: $filter)\n }\n", s = "\n query ListCargoItems($filter: CargoItemFilterInput, $pagination: PaginationInput) {\n cargoItems(filter: $filter, pagination: $pagination) {\n id\n sku\n name\n description\n category\n brand\n dimensions\n weight\n value\n hazardous\n fragile\n temperatureControlled\n createdAt\n updatedAt\n }\n cargoItemsCount(filter: $filter)\n }\n", c = "\n query ListWarehouses($filter: WarehouseFilterInput, $pagination: PaginationInput) {\n warehouses(filter: $filter, pagination: $pagination) {\n id\n name\n code\n type\n address\n status\n contactInfo\n operatingHours\n totalCapacity\n usedCapacity\n createdAt\n }\n warehousesCount(filter: $filter)\n }\n", l = "\n query GetCargoItem($id: ID!) {\n cargoItem(id: $id) {\n id\n sku\n name\n description\n category\n brand\n dimensions\n weight\n value\n hazardous\n fragile\n temperatureControlled\n createdAt\n updatedAt\n }\n }\n", u = "\n query GetWarehouse($id: ID!) {\n warehouse(id: $id) {\n id\n name\n code\n type\n address\n status\n contactInfo\n operatingHours\n totalCapacity\n usedCapacity\n createdAt\n }\n }\n", d = "\n query GetInventoryStats {\n inventoryStats {\n totalOnHand\n totalAvailable\n totalAllocated\n totalDamaged\n lowStockCount\n }\n cargoItemsCount\n warehousesCount\n }\n", f = "\n query ListInventoryTransactions($filter: InventoryFilterInput, $pagination: PaginationInput) {\n inventoryTransactions(filter: $filter, pagination: $pagination) {\n id\n transactionNumber\n type\n quantity\n cargoItemId\n warehouseId\n notes\n referenceType\n referenceId\n createdAt\n }\n }\n", p = "\n mutation CreateCargoItem($input: CreateCargoItemInput!) {\n createCargoItem(input: $input) {\n id\n sku\n name\n description\n category\n brand\n dimensions\n weight\n value\n hazardous\n fragile\n temperatureControlled\n createdAt\n updatedAt\n }\n }\n", m = "\n mutation UpdateCargoItem($id: ID!, $input: UpdateCargoItemInput!) {\n updateCargoItem(id: $id, input: $input) {\n id\n sku\n name\n description\n category\n brand\n dimensions\n weight\n value\n hazardous\n fragile\n temperatureControlled\n createdAt\n updatedAt\n }\n }\n", h = "\n mutation CreateWarehouse($input: CreateWarehouseInput!) {\n createWarehouse(input: $input) {\n id\n name\n code\n type\n address\n status\n contactInfo\n operatingHours\n totalCapacity\n usedCapacity\n createdAt\n }\n }\n", g = "\n mutation DeleteWarehouse($id: ID!) {\n deleteWarehouse(id: $id)\n }\n", _ = "\n mutation UpdateWarehouse($id: ID!, $input: UpdateWarehouseInput!) {\n updateWarehouse(id: $id, input: $input) {\n id\n name\n code\n type\n address\n status\n contactInfo\n operatingHours\n totalCapacity\n usedCapacity\n createdAt\n }\n }\n", v = "\n mutation AdjustInventoryStock($input: AdjustInventoryStockInput!) {\n adjustInventoryStock(input: $input) {\n id\n cargoItemId\n warehouseId\n onHand\n available\n allocated\n damaged\n reorderPoint\n createdAt\n updatedAt\n }\n }\n";
6
+ function y(e) {
7
7
  return {
8
8
  id: e.id,
9
9
  sku: e.sku,
@@ -30,8 +30,13 @@ function v(e) {
30
30
  updatedAt: new Date(e.updatedAt)
31
31
  };
32
32
  }
33
- function y(e) {
34
- let t = e.totalCapacity ?? 0, n = e.usedCapacity ?? 0;
33
+ function b(e) {
34
+ let t = e.totalCapacity ?? 0, n = e.usedCapacity ?? 0, r = e.operatingHours ?? {}, i = {};
35
+ for (let [e, t] of Object.entries(r)) t && typeof t == "object" && "open" in t && "close" in t ? i[e] = {
36
+ open: String(t.open),
37
+ close: String(t.close)
38
+ } : i[e] = null;
39
+ let a = e.contactInfo ?? void 0;
35
40
  return {
36
41
  id: e.id,
37
42
  name: e.name,
@@ -45,32 +50,21 @@ function y(e) {
45
50
  ...e.address ?? {}
46
51
  },
47
52
  type: e.type?.toLowerCase() ?? "distribution",
53
+ status: e.status ?? "ACTIVE",
48
54
  capacity: {
49
55
  totalSpace: t,
50
- usedSpace: n,
51
- totalPallets: 0,
52
- usedPallets: 0,
53
- specialAreas: []
56
+ usedSpace: n
54
57
  },
55
- operatingHours: {},
56
- contacts: [],
57
- zones: [],
58
- equipment: [],
59
- staff: [],
60
- metrics: {
61
- throughput: 0,
62
- accuracy: 0,
63
- productivity: 0,
64
- utilization: t > 0 ? n / t * 100 : 0,
65
- ordersFulfilled: 0,
66
- averageProcessingTime: 0,
67
- lastUpdated: /* @__PURE__ */ new Date()
68
- },
69
- isActive: !0,
58
+ operatingHours: i,
59
+ contactInfo: a ? {
60
+ email: a.email ?? void 0,
61
+ phone: a.phone ?? void 0
62
+ } : void 0,
63
+ utilization: t > 0 ? n / t * 100 : 0,
70
64
  createdAt: new Date(e.createdAt)
71
65
  };
72
66
  }
73
- function b(e) {
67
+ function x(e) {
74
68
  return {
75
69
  id: e.id,
76
70
  productId: e.cargoItemId,
@@ -78,25 +72,17 @@ function b(e) {
78
72
  productSku: e.cargoItem?.sku,
79
73
  warehouseId: e.warehouseId,
80
74
  warehouseName: e.warehouse?.name,
81
- zoneId: "",
82
75
  quantity: e.onHand,
83
76
  reservedQuantity: e.allocated,
84
77
  availableQuantity: e.available,
85
- reorderLevel: e.reorderPoint ?? 0,
86
- maxLevel: Math.max(e.onHand * 2, e.available),
78
+ damagedQuantity: e.damaged,
79
+ reorderLevel: e.reorderPoint ?? void 0,
87
80
  lastRestocked: new Date(e.updatedAt),
88
- location: {
89
- aisle: "",
90
- shelf: "",
91
- position: "",
92
- level: 0
93
- },
94
- movements: [],
95
81
  createdAt: new Date(e.createdAt),
96
82
  updatedAt: new Date(e.updatedAt)
97
83
  };
98
84
  }
99
- function x() {
85
+ function S() {
100
86
  let { apiGatewayUrl: t, authToken: n, workspaceToken: r, workspaceId: a, tenantId: o, currentUser: s } = e();
101
87
  return i(() => ({
102
88
  apiGatewayUrl: t,
@@ -114,32 +100,32 @@ function x() {
114
100
  s?.id
115
101
  ]);
116
102
  }
117
- function S(e = {}) {
118
- let { filters: l, search: u, limit: d = 10, offset: f = 0 } = e, S = i(() => l, [
103
+ function C(e = {}) {
104
+ let { filters: l, search: u, limit: d = 10, offset: f = 0 } = e, C = i(() => l, [
119
105
  l?.lowStock,
120
106
  l?.productId,
121
107
  l?.search,
122
108
  l?.warehouseId
123
- ]), C = x(), [w, T] = a([]), [E, D] = a([]), [O, k] = a([]), [A, j] = a([]), [M, N] = a(0), [P, F] = a(!1), [I, L] = a(!1), [R, z] = a(null), B = n(async () => {
124
- L(!0), z(null);
109
+ ]), w = S(), [T, E] = a([]), [D, O] = a([]), [k, A] = a([]), [j, M] = a([]), [N, P] = a(0), [F, I] = a(!1), [L, R] = a(!1), [z, B] = a(null), V = n(async () => {
110
+ R(!0), B(null);
125
111
  try {
126
112
  let e = {
127
- warehouseId: S?.warehouseId,
128
- cargoItemId: S?.productId,
129
- search: u || S?.search || void 0,
130
- lowStock: S?.lowStock || void 0
113
+ warehouseId: C?.warehouseId,
114
+ cargoItemId: C?.productId,
115
+ search: u || C?.search || void 0,
116
+ lowStock: C?.lowStock || void 0
131
117
  }, [n, r, i, a] = await Promise.all([
132
- t(C, o, {
118
+ t(w, o, {
133
119
  filter: e,
134
120
  pagination: {
135
121
  limit: d,
136
122
  offset: f
137
123
  }
138
124
  }),
139
- t(C, o, {
125
+ t(w, o, {
140
126
  filter: {
141
- warehouseId: S?.warehouseId,
142
- cargoItemId: S?.productId,
127
+ warehouseId: C?.warehouseId,
128
+ cargoItemId: C?.productId,
143
129
  lowStock: !0
144
130
  },
145
131
  pagination: {
@@ -147,85 +133,88 @@ function S(e = {}) {
147
133
  offset: 0
148
134
  }
149
135
  }),
150
- t(C, s, { pagination: {
136
+ t(w, s, { pagination: {
151
137
  limit: 5,
152
138
  offset: 0
153
139
  } }),
154
- t(C, c, { pagination: {
140
+ t(w, c, { pagination: {
155
141
  limit: 5,
156
142
  offset: 0
157
143
  } })
158
144
  ]);
159
- T(n.inventoryItems.map(b)), D(r.inventoryItems.map(b)), N(n.inventoryItemsCount), F(f + n.inventoryItems.length < n.inventoryItemsCount), k(i.cargoItems.map(v)), j(a.warehouses.map(y));
145
+ E(n.inventoryItems.map(x)), O(r.inventoryItems.map(x)), P(n.inventoryItemsCount), I(f + n.inventoryItems.length < n.inventoryItemsCount), A(i.cargoItems.map(y)), M(a.warehouses.map(b));
160
146
  } catch (e) {
161
- z(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load inventory data"));
147
+ B(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load inventory data"));
162
148
  } finally {
163
- L(!1);
149
+ R(!1);
164
150
  }
165
151
  }, [
166
- S,
167
152
  C,
153
+ w,
168
154
  d,
169
155
  f,
170
156
  u
171
157
  ]);
172
158
  r(() => {
173
- B();
174
- }, [B]);
175
- let V = n(() => {
176
- B();
177
- }, [B]), H = n(async (e, n, r) => {
178
- let i = w.find((t) => t.id === e);
159
+ V();
160
+ }, [V]);
161
+ let H = n(() => {
162
+ V();
163
+ }, [V]), U = n(async (e, n, r) => {
164
+ let i = T.find((t) => t.id === e);
179
165
  if (!i) throw Error("Inventory item not found");
180
- let a = b((await t(C, _, { input: {
166
+ let a = x((await t(w, v, { input: {
181
167
  id: e,
182
168
  onHand: i.quantity + n,
183
169
  available: i.availableQuantity + n,
184
170
  allocated: i.reservedQuantity,
185
- damaged: 0
171
+ damaged: i.damagedQuantity
186
172
  } })).adjustInventoryStock);
187
- return T((t) => t.map((t) => t.id === e ? a : t)), a;
188
- }, [C, w]);
173
+ return E((t) => t.map((t) => t.id === e ? a : t)), a;
174
+ }, [w, T]);
189
175
  return {
190
- inventory: w,
191
- lowStockItems: E,
192
- products: O,
193
- warehouses: A,
194
- totalItems: M,
195
- hasMore: P,
196
- isLoading: I,
197
- error: R,
198
- refetch: V,
199
- updateStock: H,
176
+ inventory: T,
177
+ lowStockItems: D,
178
+ products: k,
179
+ warehouses: j,
180
+ totalItems: N,
181
+ hasMore: F,
182
+ isLoading: L,
183
+ error: z,
184
+ refetch: H,
185
+ updateStock: U,
200
186
  transferStock: n(async (e, t, n, r) => {
201
- let i = w.find((t) => t.warehouseId === e && t.productId === n);
187
+ let i = T.find((t) => t.warehouseId === e && t.productId === n);
202
188
  if (!i) throw Error("Source inventory not found");
203
- await H(i.id, -Math.abs(r), "transfer out");
204
- let a = w.find((e) => e.warehouseId === t && e.productId === n);
205
- a && await H(a.id, Math.abs(r), "transfer in");
206
- }, [w, H]),
189
+ await U(i.id, -Math.abs(r), "transfer out");
190
+ let a = T.find((e) => e.warehouseId === t && e.productId === n);
191
+ a && await U(a.id, Math.abs(r), "transfer in");
192
+ }, [T, U]),
207
193
  createProduct: n(async (e) => {
208
- let n = v((await t(C, p, { input: {
194
+ let n = y((await t(w, p, { input: {
209
195
  name: e.name,
210
196
  sku: e.sku,
211
197
  category: e.category,
212
198
  brand: e.brand,
213
199
  weight: e.weight
214
200
  } })).createCargoItem);
215
- return k((e) => [n, ...e]), n;
216
- }, [C]),
201
+ return A((e) => [n, ...e]), n;
202
+ }, [w]),
217
203
  createWarehouse: n(async (e) => {
218
- let n = y((await t(C, h, { input: {
204
+ let n = b((await t(w, h, { input: {
219
205
  code: e.code,
220
206
  name: e.name,
221
207
  type: e.type,
222
208
  address: e.address,
223
- totalCapacity: e.totalCapacity
209
+ status: e.status,
210
+ contactInfo: e.contactInfo,
211
+ totalCapacity: e.totalCapacity,
212
+ usedCapacity: e.usedCapacity
224
213
  } })).createWarehouse);
225
- return j((e) => [n, ...e]), n;
226
- }, [C]),
214
+ return M((e) => [n, ...e]), n;
215
+ }, [w]),
227
216
  updateProduct: n(async (e, n) => {
228
- let r = v((await t(C, m, {
217
+ let r = y((await t(w, m, {
229
218
  id: e,
230
219
  input: {
231
220
  name: n.name,
@@ -235,26 +224,32 @@ function S(e = {}) {
235
224
  weight: n.weight
236
225
  }
237
226
  })).updateCargoItem);
238
- return k((t) => t.map((t) => t.id === e ? r : t)), r;
239
- }, [C]),
227
+ return A((t) => t.map((t) => t.id === e ? r : t)), r;
228
+ }, [w]),
240
229
  updateWarehouse: n(async (e, n) => {
241
- let r = y((await t(C, g, {
230
+ let r = b((await t(w, _, {
242
231
  id: e,
243
232
  input: {
244
233
  code: n.code,
245
234
  name: n.name,
246
235
  type: n.type,
247
236
  address: n.address,
248
- totalCapacity: n.totalCapacity
237
+ status: n.status,
238
+ contactInfo: n.contactInfo,
239
+ totalCapacity: n.totalCapacity,
240
+ usedCapacity: n.usedCapacity
249
241
  }
250
242
  })).updateWarehouse);
251
- return j((t) => t.map((t) => t.id === e ? r : t)), r;
252
- }, [C])
243
+ return M((t) => t.map((t) => t.id === e ? r : t)), r;
244
+ }, [w]),
245
+ deleteWarehouse: n(async (e) => {
246
+ await t(w, g, { id: e }), M((t) => t.filter((t) => t.id !== e));
247
+ }, [w])
253
248
  };
254
249
  }
255
- function C(e = {}) {
256
- let { limit: i = 20, offset: o = 0, search: c, category: l } = e, u = x(), [d, f] = a([]), [p, m] = a(0), [h, g] = a(!1), [_, y] = a(!1), [b, S] = a(null), C = n(async () => {
257
- y(!0), S(null);
250
+ function w(e = {}) {
251
+ let { limit: i = 20, offset: o = 0, search: c, category: l } = e, u = S(), [d, f] = a([]), [p, m] = a(0), [h, g] = a(!1), [_, v] = a(!1), [b, x] = a(null), C = n(async () => {
252
+ v(!0), x(null);
258
253
  try {
259
254
  let e = await t(u, s, {
260
255
  filter: {
@@ -266,11 +261,11 @@ function C(e = {}) {
266
261
  offset: o
267
262
  }
268
263
  });
269
- g(o + e.cargoItems.length < e.cargoItemsCount), m(e.cargoItemsCount), f(e.cargoItems.map(v));
264
+ g(o + e.cargoItems.length < e.cargoItemsCount), m(e.cargoItemsCount), f(e.cargoItems.map(y));
270
265
  } catch (e) {
271
- S(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load products"));
266
+ x(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load products"));
272
267
  } finally {
273
- y(!1);
268
+ v(!1);
274
269
  }
275
270
  }, [
276
271
  u,
@@ -290,9 +285,9 @@ function C(e = {}) {
290
285
  refetch: () => void C()
291
286
  };
292
287
  }
293
- var w = "\n query CargoItemStats {\n cargoItemStats {\n total\n specialHandling\n temperatureControlled\n }\n }\n";
294
- function T() {
295
- let e = x(), [n, i] = a({
288
+ var T = "\n query CargoItemStats {\n cargoItemStats {\n total\n specialHandling\n temperatureControlled\n }\n }\n";
289
+ function E() {
290
+ let e = S(), [n, i] = a({
296
291
  total: 0,
297
292
  specialHandling: 0,
298
293
  temperatureControlled: 0
@@ -301,7 +296,7 @@ function T() {
301
296
  (async () => {
302
297
  s(!0), l(null);
303
298
  try {
304
- i((await t(e, w)).cargoItemStats);
299
+ i((await t(e, T)).cargoItemStats);
305
300
  } catch (e) {
306
301
  l(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load product stats"));
307
302
  } finally {
@@ -314,8 +309,8 @@ function T() {
314
309
  error: c
315
310
  };
316
311
  }
317
- function E(e) {
318
- let i = x(), [o, s] = a(null), [c, u] = a(!1), [d, f] = a(null), p = n(async () => {
312
+ function D(e) {
313
+ let i = S(), [o, s] = a(null), [c, u] = a(!1), [d, f] = a(null), p = n(async () => {
319
314
  if (!e) {
320
315
  s(null);
321
316
  return;
@@ -323,7 +318,7 @@ function E(e) {
323
318
  u(!0), f(null);
324
319
  try {
325
320
  let n = await t(i, l, { id: e });
326
- s(n.cargoItem ? v(n.cargoItem) : null);
321
+ s(n.cargoItem ? y(n.cargoItem) : null);
327
322
  } catch (e) {
328
323
  f(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load product"));
329
324
  } finally {
@@ -339,43 +334,47 @@ function E(e) {
339
334
  refetch: () => void p()
340
335
  };
341
336
  }
342
- function D(e = {}) {
343
- let { limit: i = 20, offset: o = 0, search: s } = e, l = x(), [u, d] = a([]), [f, p] = a(0), [m, h] = a(!1), [g, _] = a(!1), [v, b] = a(null), S = n(async () => {
344
- _(!0), b(null);
337
+ function O(e = {}) {
338
+ let { limit: i = 20, offset: o = 0, search: s, status: l } = e, u = S(), [d, f] = a([]), [p, m] = a(0), [h, g] = a(!1), [_, v] = a(!1), [y, x] = a(null), C = n(async () => {
339
+ v(!0), x(null);
345
340
  try {
346
- let e = await t(l, c, {
347
- filter: { search: s || void 0 },
341
+ let e = await t(u, c, {
342
+ filter: {
343
+ search: s || void 0,
344
+ status: l || void 0
345
+ },
348
346
  pagination: {
349
347
  limit: i,
350
348
  offset: o
351
349
  }
352
350
  });
353
- p(e.warehousesCount), h(o + e.warehouses.length < e.warehousesCount), d(e.warehouses.map(y));
351
+ m(e.warehousesCount), g(o + e.warehouses.length < e.warehousesCount), f(e.warehouses.map(b));
354
352
  } catch (e) {
355
- b(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load warehouses"));
353
+ x(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load warehouses"));
356
354
  } finally {
357
- _(!1);
355
+ v(!1);
358
356
  }
359
357
  }, [
360
- l,
358
+ u,
361
359
  i,
362
360
  o,
363
- s
361
+ s,
362
+ l
364
363
  ]);
365
364
  return r(() => {
366
- S();
367
- }, [S]), {
368
- warehouses: u,
369
- totalWarehouses: f,
370
- hasMore: m,
371
- isLoading: g,
372
- error: v,
373
- refetch: () => void S()
365
+ C();
366
+ }, [C]), {
367
+ warehouses: d,
368
+ totalWarehouses: p,
369
+ hasMore: h,
370
+ isLoading: _,
371
+ error: y,
372
+ refetch: () => void C()
374
373
  };
375
374
  }
376
- var O = "\n query WarehouseStats {\n warehouseStats {\n total\n active\n avgUtilization\n }\n }\n";
377
- function k() {
378
- let e = x(), [n, i] = a({
375
+ var k = "\n query WarehouseStats {\n warehouseStats {\n total\n active\n avgUtilization\n }\n }\n";
376
+ function A() {
377
+ let e = S(), [n, i] = a({
379
378
  total: 0,
380
379
  active: 0,
381
380
  avgUtilization: 0
@@ -384,7 +383,7 @@ function k() {
384
383
  (async () => {
385
384
  s(!0), l(null);
386
385
  try {
387
- i((await t(e, O)).warehouseStats);
386
+ i((await t(e, k)).warehouseStats);
388
387
  } catch (e) {
389
388
  l(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load warehouse stats"));
390
389
  } finally {
@@ -397,8 +396,8 @@ function k() {
397
396
  error: c
398
397
  };
399
398
  }
400
- function A(e) {
401
- let i = x(), [o, s] = a(null), [c, l] = a(!1), [d, f] = a(null), p = n(async () => {
399
+ function j(e) {
400
+ let i = S(), [o, s] = a(null), [c, l] = a(!1), [d, f] = a(null), p = n(async () => {
402
401
  if (!e) {
403
402
  s(null);
404
403
  return;
@@ -406,7 +405,7 @@ function A(e) {
406
405
  l(!0), f(null);
407
406
  try {
408
407
  let n = await t(i, u, { id: e });
409
- s(n.warehouse ? y(n.warehouse) : null);
408
+ s(n.warehouse ? b(n.warehouse) : null);
410
409
  } catch (e) {
411
410
  f(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load warehouse"));
412
411
  } finally {
@@ -422,8 +421,8 @@ function A(e) {
422
421
  refetch: () => void p()
423
422
  };
424
423
  }
425
- function j() {
426
- let e = x(), [n, i] = a({
424
+ function M() {
425
+ let e = S(), [n, i] = a({
427
426
  totalOnHand: 0,
428
427
  totalAvailable: 0,
429
428
  totalAllocated: 0,
@@ -458,16 +457,16 @@ function j() {
458
457
  error: c
459
458
  };
460
459
  }
461
- var M = "\n query GetCargoItemStockLevels($cargoItemId: ID!, $pagination: PaginationInput) {\n inventoryItems(filter: { cargoItemId: $cargoItemId }, pagination: $pagination) {\n id\n onHand\n available\n allocated\n damaged\n reorderPoint\n warehouse {\n id\n name\n code\n }\n }\n inventoryItemsCount(filter: { cargoItemId: $cargoItemId })\n inventoryStats(filter: { cargoItemId: $cargoItemId }) {\n totalAvailable\n }\n }\n";
462
- function N(e, i = {}) {
463
- let { limit: o = 20, offset: s = 0 } = i, c = x(), [l, u] = a([]), [d, f] = a(0), [p, m] = a(0), [h, g] = a(!1), [_, v] = a(null), y = n(async () => {
460
+ var N = "\n query GetCargoItemStockLevels($cargoItemId: ID!, $pagination: PaginationInput) {\n inventoryItems(filter: { cargoItemId: $cargoItemId }, pagination: $pagination) {\n id\n onHand\n available\n allocated\n damaged\n reorderPoint\n warehouse {\n id\n name\n code\n }\n }\n inventoryItemsCount(filter: { cargoItemId: $cargoItemId })\n inventoryStats(filter: { cargoItemId: $cargoItemId }) {\n totalAvailable\n }\n }\n";
461
+ function P(e, i = {}) {
462
+ let { limit: o = 20, offset: s = 0 } = i, c = S(), [l, u] = a([]), [d, f] = a(0), [p, m] = a(0), [h, g] = a(!1), [_, v] = a(null), y = n(async () => {
464
463
  if (!e) {
465
464
  u([]), f(0), m(0);
466
465
  return;
467
466
  }
468
467
  g(!0), v(null);
469
468
  try {
470
- let n = await t(c, M, {
469
+ let n = await t(c, N, {
471
470
  cargoItemId: e,
472
471
  pagination: {
473
472
  limit: o,
@@ -512,22 +511,22 @@ function N(e, i = {}) {
512
511
  refetch: b
513
512
  };
514
513
  }
515
- var P = [
514
+ var F = [
516
515
  "RECEIPT",
517
516
  "ISSUE",
518
517
  "TRANSFER",
519
518
  "ADJUSTMENT",
520
519
  "RETURN"
521
520
  ];
522
- function F(e) {
521
+ function I(e) {
523
522
  let t = e.toUpperCase();
524
- return P.find((e) => e === t) ?? "ADJUSTMENT";
523
+ return F.find((e) => e === t) ?? "ADJUSTMENT";
525
524
  }
526
- function I(e) {
525
+ function L(e) {
527
526
  return {
528
527
  id: e.id,
529
528
  transactionNumber: e.transactionNumber,
530
- type: F(e.type),
529
+ type: I(e.type),
531
530
  quantity: e.quantity,
532
531
  productId: e.cargoItemId,
533
532
  warehouseId: e.warehouseId,
@@ -537,8 +536,8 @@ function I(e) {
537
536
  createdAt: new Date(e.createdAt)
538
537
  };
539
538
  }
540
- function L(e = {}) {
541
- let { limit: i = 10, productId: o, warehouseId: s } = e, c = x(), [l, u] = a([]), [d, p] = a(!1), [m, h] = a(null), g = n(async () => {
539
+ function R(e = {}) {
540
+ let { limit: i = 10, productId: o, warehouseId: s } = e, c = S(), [l, u] = a([]), [d, p] = a(!1), [m, h] = a(null), g = n(async () => {
542
541
  p(!0), h(null);
543
542
  try {
544
543
  u((await t(c, f, {
@@ -550,7 +549,7 @@ function L(e = {}) {
550
549
  limit: i,
551
550
  offset: 0
552
551
  }
553
- })).inventoryTransactions.map(I));
552
+ })).inventoryTransactions.map(L));
554
553
  } catch (e) {
555
554
  h(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load inventory transactions"));
556
555
  } finally {
@@ -574,4 +573,4 @@ function L(e = {}) {
574
573
  };
575
574
  }
576
575
  //#endregion
577
- export { S as useInventory, j as useInventoryStats, L as useInventoryTransactions, E as useProduct, T as useProductStats, N as useProductStockLevels, C as useProducts, A as useWarehouse, k as useWarehouseStats, D as useWarehouses };
576
+ export { C as useInventory, M as useInventoryStats, R as useInventoryTransactions, D as useProduct, E as useProductStats, P as useProductStockLevels, w as useProducts, j as useWarehouse, A as useWarehouseStats, O as useWarehouses };
@@ -52,14 +52,11 @@ function h(e) {
52
52
  vehicleId: e.vehicleId ?? "",
53
53
  status: f(e.status),
54
54
  stops: m(e.waypoints),
55
- distance: e.estimatedDistance ?? 0,
55
+ distance: e.actualDistance ?? e.estimatedDistance ?? 0,
56
56
  estimatedDuration: e.estimatedDuration ?? 0,
57
57
  fuelCost: e.fuelCost ?? void 0,
58
58
  actualDuration: e.actualDuration ?? void 0,
59
- startTime: void 0,
60
- endTime: void 0,
61
- optimized: !1,
62
- trafficConditions: [],
59
+ optimized: (e.estimatedDistance ?? 0) > 0,
63
60
  createdAt: new Date(e.createdAt)
64
61
  };
65
62
  }
@@ -125,11 +122,8 @@ function _(e = {}) {
125
122
  vehicleId: e.vehicleId,
126
123
  driverId: e.driverId,
127
124
  waypoints: e.stops ?? [],
128
- estimatedDistance: e.distance ?? 0,
129
- estimatedDuration: e.estimatedDuration ?? 0,
130
- fuelCost: e.fuelCost,
131
- actualDistance: e.distance,
132
- actualDuration: e.actualDuration
125
+ estimatedDuration: e.estimatedDuration,
126
+ fuelCost: e.fuelCost
133
127
  } })).createRoute);
134
128
  return x((e) => [n, ...e]), n;
135
129
  }, [y]), N = n(async (e, n) => {
@@ -142,11 +136,8 @@ function _(e = {}) {
142
136
  vehicleId: n.vehicleId,
143
137
  driverId: n.driverId,
144
138
  waypoints: n.stops,
145
- estimatedDistance: n.distance,
146
139
  estimatedDuration: n.estimatedDuration,
147
- fuelCost: n.fuelCost,
148
- actualDistance: n.distance,
149
- actualDuration: n.actualDuration
140
+ fuelCost: n.fuelCost
150
141
  }
151
142
  })).updateRoute);
152
143
  return x((t) => t.map((t) => t.id === e ? r : t)), r;
@@ -12,6 +12,7 @@ export interface StatusColor {
12
12
  }
13
13
  export declare const ORDER_STATUS_COLORS: Record<string, StatusColor>;
14
14
  export declare const VEHICLE_STATUS_COLORS: Record<string, StatusColor>;
15
+ export declare const VEHICLE_STATUS_LABELS: Record<string, string>;
15
16
  export declare const DRIVER_STATUS_COLORS: Record<string, StatusColor>;
16
17
  export declare const DRIVER_STATUS_LABELS: Record<string, string>;
17
18
  export declare const PRIORITY_COLORS: Record<string, StatusColor>;
@@ -18,6 +18,11 @@ export interface CreateVehicleInput {
18
18
  status?: string;
19
19
  fuelType?: string;
20
20
  fuelEfficiencyLPer100Km?: number;
21
+ capacity?: {
22
+ weight?: number;
23
+ volume?: number;
24
+ pallets?: number;
25
+ };
21
26
  }
22
27
  export interface CreateDriverInput {
23
28
  employeeId: string;
@@ -56,6 +61,7 @@ interface UseFleetResult {
56
61
  createDriver: (input: CreateDriverInput) => Promise<Driver>;
57
62
  updateVehicle: (id: string, input: CreateVehicleInput) => Promise<Vehicle>;
58
63
  updateDriver: (id: string, input: UpdateDriverInput) => Promise<Driver>;
64
+ deleteVehicle: (id: string) => Promise<void>;
59
65
  }
60
66
  export interface ApiVehicle {
61
67
  id: string;
@@ -104,7 +110,12 @@ export interface ApiDriver {
104
110
  terminationReason?: string | null;
105
111
  createdAt: string;
106
112
  }
107
- /** Exported so the vehicle edit form's status field can round-trip (BOFF-7909). */
113
+ /**
114
+ * Exported so the vehicle edit form's status field can round-trip (BOFF-7909).
115
+ * `decommissioned` must stay distinct from `out_of_service` — collapsing them
116
+ * used to silently rewrite a DECOMMISSIONED vehicle to INACTIVE on any save
117
+ * that touched status, even without the user changing it.
118
+ */
108
119
  export declare function toApiVehicleStatus(status: VehicleStatus): string;
109
120
  /** Exported so the driver edit form's status field can round-trip losslessly (BOFF-7909). */
110
121
  export declare function toApiDriverStatus(status: DriverStatus): string;
@@ -134,6 +145,7 @@ interface UseVehiclesResult {
134
145
  refetch: () => void;
135
146
  updateVehicleStatus: (id: string, status: VehicleStatus) => Promise<Vehicle>;
136
147
  assignDriver: (vehicleId: string, driverId: string) => Promise<Vehicle>;
148
+ deleteVehicle: (id: string) => Promise<void>;
137
149
  }
138
150
  export declare function useVehicles(options?: UseVehiclesOptions): UseVehiclesResult;
139
151
  export declare function useVehicle(vehicleId: string | undefined): {