@burdenoff/microfe-movethewheels 2026.510.105
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.
- package/README.md +82 -0
- package/dist/AIAssistantPage-hD0VYJdH.js +210 -0
- package/dist/AnalyticsPage-DHTHCUtr.js +201 -0
- package/dist/CreateOrderPage-Cprg4Y9V.js +471 -0
- package/dist/CustomerDetailsPage-DNDEw7IW.js +239 -0
- package/dist/CustomersPage-CDjjeCEL.js +119 -0
- package/dist/DashboardPage-8iTPXRAG.js +374 -0
- package/dist/DataTable-CRIKfdIN.js +239 -0
- package/dist/DriverDetailsPage-CRyRCno7.js +297 -0
- package/dist/DriversPage-16O8fVmf.js +127 -0
- package/dist/FinancePage-BYUxK5dR.js +154 -0
- package/dist/FleetPage-CHYETCWT.js +293 -0
- package/dist/ImportExportPage-C3MKKxfc.js +232 -0
- package/dist/InventoryPage--822AxZM.js +223 -0
- package/dist/LiveTrackingPage-Dp3rTJDr.js +332 -0
- package/dist/MarketplacePage-DjEqudfM.js +192 -0
- package/dist/MetricCard-GTbxAk1a.js +135 -0
- package/dist/OrderDetailsPage-BIuYG0ub.js +398 -0
- package/dist/OrdersListPage-CW5V0Uvh.js +257 -0
- package/dist/PageLayout-B7b0vl0R.js +1894 -0
- package/dist/ProductDetailsPage-Q3X7AT-7.js +168 -0
- package/dist/ProductsPage-CUj9JpnW.js +131 -0
- package/dist/ReportsPage-DblO5CdJ.js +227 -0
- package/dist/RouteDetailsPage-CLctgk6A.js +240 -0
- package/dist/RoutesPage-8hrv6RWT.js +116 -0
- package/dist/SettingsPage-BJ5BQeqn.js +247 -0
- package/dist/StatusBadge-BrrwraIA.js +206 -0
- package/dist/TrackingPage-BGqHDh-w.js +322 -0
- package/dist/VehicleDetailsPage-XnDH4iQR.js +194 -0
- package/dist/VehiclesPage-Cs4XxHkA.js +127 -0
- package/dist/WarehouseDetailsPage-GemdMvr_.js +215 -0
- package/dist/WarehousesPage-QTiuDuXy.js +121 -0
- package/dist/arrow-left-6CiLhqVp.js +11 -0
- package/dist/box-BunB_4UH.js +18 -0
- package/dist/chart-column-DWwVEVQ-.js +22 -0
- package/dist/chevron-right-DhZVf20o.js +8 -0
- package/dist/circle-alert-D5f6RZxt.js +26 -0
- package/dist/circle-check-big-D-JMHcTe.js +11 -0
- package/dist/clock-CvwBKbQP.js +13 -0
- package/dist/dev/main.d.ts +1 -0
- package/dist/dollar-sign-CP9qeU5d.js +14 -0
- package/dist/download-CIuG04pJ.js +21 -0
- package/dist/file-text-Dd_thxkn.js +26 -0
- package/dist/filter-DyRMX9CU.js +8 -0
- package/dist/formatters-_vJlC-47.js +50 -0
- package/dist/generated/global-operations.d.ts +1 -0
- package/dist/generated/global-types.d.ts +20715 -0
- package/dist/generated/wspace-operations.d.ts +3704 -0
- package/dist/generated/wspace-types.d.ts +53362 -0
- package/dist/graphqlClient-CdJyR_ed.js +55 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +772 -0
- package/dist/map-BqH1cBJi.js +18 -0
- package/dist/map-pin-CFBOmh-A.js +13 -0
- package/dist/movethewheels/MoveTheWheelsRoot.d.ts +25 -0
- package/dist/movethewheels/MoveTheWheelsRoutes.d.ts +7 -0
- package/dist/movethewheels/components/DataTable.d.ts +32 -0
- package/dist/movethewheels/components/MetricCard.d.ts +43 -0
- package/dist/movethewheels/components/PageLayout.d.ts +68 -0
- package/dist/movethewheels/components/StatusBadge.d.ts +49 -0
- package/dist/movethewheels/components/index.d.ts +10 -0
- package/dist/movethewheels/components/ui.d.ts +22 -0
- package/dist/movethewheels/constants/index.d.ts +24 -0
- package/dist/movethewheels/constants/mockData.d.ts +33 -0
- package/dist/movethewheels/hooks/index.d.ts +12 -0
- package/dist/movethewheels/hooks/useAnalytics.d.ts +118 -0
- package/dist/movethewheels/hooks/useCustomers.d.ts +37 -0
- package/dist/movethewheels/hooks/useFleet.d.ts +71 -0
- package/dist/movethewheels/hooks/useInventory.d.ts +60 -0
- package/dist/movethewheels/hooks/useOrders.d.ts +47 -0
- package/dist/movethewheels/hooks/useRoutes.d.ts +41 -0
- package/dist/movethewheels/hooks/useTracking.d.ts +69 -0
- package/dist/movethewheels/index.d.ts +30 -0
- package/dist/movethewheels/pages/AIAssistantPage.d.ts +4 -0
- package/dist/movethewheels/pages/AnalyticsPage.d.ts +4 -0
- package/dist/movethewheels/pages/CreateOrderPage.d.ts +6 -0
- package/dist/movethewheels/pages/CustomerDetailsPage.d.ts +4 -0
- package/dist/movethewheels/pages/CustomersPage.d.ts +4 -0
- package/dist/movethewheels/pages/DashboardPage.d.ts +6 -0
- package/dist/movethewheels/pages/DriverDetailsPage.d.ts +4 -0
- package/dist/movethewheels/pages/DriversPage.d.ts +4 -0
- package/dist/movethewheels/pages/FinancePage.d.ts +4 -0
- package/dist/movethewheels/pages/FleetPage.d.ts +6 -0
- package/dist/movethewheels/pages/ImportExportPage.d.ts +4 -0
- package/dist/movethewheels/pages/InventoryPage.d.ts +4 -0
- package/dist/movethewheels/pages/LiveTrackingPage.d.ts +6 -0
- package/dist/movethewheels/pages/MarketplacePage.d.ts +4 -0
- package/dist/movethewheels/pages/OrderDetailsPage.d.ts +6 -0
- package/dist/movethewheels/pages/OrdersListPage.d.ts +6 -0
- package/dist/movethewheels/pages/ProductDetailsPage.d.ts +4 -0
- package/dist/movethewheels/pages/ProductsPage.d.ts +4 -0
- package/dist/movethewheels/pages/ReportsPage.d.ts +4 -0
- package/dist/movethewheels/pages/RouteDetailsPage.d.ts +4 -0
- package/dist/movethewheels/pages/RoutesPage.d.ts +4 -0
- package/dist/movethewheels/pages/SettingsPage.d.ts +4 -0
- package/dist/movethewheels/pages/TrackingPage.d.ts +6 -0
- package/dist/movethewheels/pages/VehicleDetailsPage.d.ts +4 -0
- package/dist/movethewheels/pages/VehiclesPage.d.ts +4 -0
- package/dist/movethewheels/pages/WarehouseDetailsPage.d.ts +4 -0
- package/dist/movethewheels/pages/WarehousesPage.d.ts +4 -0
- package/dist/movethewheels/providers/MoveTheWheelsProvider.d.ts +16 -0
- package/dist/movethewheels/store/movethewheelsStore.d.ts +73 -0
- package/dist/movethewheels/types/index.d.ts +655 -0
- package/dist/movethewheels/utils/cn.d.ts +6 -0
- package/dist/movethewheels/utils/formatters.d.ts +60 -0
- package/dist/movethewheels/utils/graphqlClient.d.ts +11 -0
- package/dist/movethewheels/utils/index.d.ts +7 -0
- package/dist/movethewheels/utils/navigation.d.ts +23 -0
- package/dist/navigation-BgnOfsVd.js +6 -0
- package/dist/navigation-C2fY_aS9.js +8 -0
- package/dist/package-DVZbDRcV.js +22 -0
- package/dist/phone-KdwpVmC4.js +18 -0
- package/dist/plus-Bl7uX6Ji.js +11 -0
- package/dist/refresh-cw-BYjl3K-8.js +22 -0
- package/dist/route-Ce_poKFi.js +51 -0
- package/dist/save-C-qDVat-.js +18 -0
- package/dist/search-5pdn5eOO.js +13 -0
- package/dist/settings-C4kIDsYg.js +28 -0
- package/dist/square-pen-BwQ67vLE.js +11 -0
- package/dist/star-BlVsC3Ad.js +8 -0
- package/dist/store-DTmQT5M0.js +26 -0
- package/dist/trending-up-C1faflCI.js +11 -0
- package/dist/triangle-alert-CUoVAA4L.js +18 -0
- package/dist/truck-BmDAzu05.js +30 -0
- package/dist/useAnalytics-ph7eTIK6.js +297 -0
- package/dist/useCustomers-bS3a4ytk.js +186 -0
- package/dist/useFleet-BdETplNE.js +398 -0
- package/dist/useInventory-Dwn18FPz.js +323 -0
- package/dist/useOrders-D_3_hGMp.js +324 -0
- package/dist/useRoutes-v4aBaS-E.js +224 -0
- package/dist/useTracking-De2KIUNu.js +261 -0
- package/dist/user-BplzDrLP.js +13 -0
- package/dist/users-i-igmsP4.js +24 -0
- package/dist/warehouse-DewG0PXh.js +25 -0
- package/dist/wrench-CoSDEIC7.js +31 -0
- package/package.json +107 -0
- package/src/dev/main.tsx +110 -0
- package/src/dev/styles.css +139 -0
- package/src/generated/global-operations.ts +2 -0
- package/src/generated/global-types.ts +24048 -0
- package/src/generated/wspace-operations.ts +3734 -0
- package/src/generated/wspace-types.ts +60715 -0
- package/src/index.ts +4 -0
- package/src/movethewheels/MoveTheWheelsRoot.tsx +258 -0
- package/src/movethewheels/MoveTheWheelsRoutes.tsx +119 -0
- package/src/movethewheels/components/DataTable.tsx +367 -0
- package/src/movethewheels/components/MetricCard.tsx +180 -0
- package/src/movethewheels/components/PageLayout.tsx +234 -0
- package/src/movethewheels/components/StatusBadge.tsx +243 -0
- package/src/movethewheels/components/index.ts +26 -0
- package/src/movethewheels/components/ui.tsx +124 -0
- package/src/movethewheels/constants/index.ts +65 -0
- package/src/movethewheels/constants/mockData.ts +1342 -0
- package/src/movethewheels/hooks/index.ts +55 -0
- package/src/movethewheels/hooks/useAnalytics.ts +476 -0
- package/src/movethewheels/hooks/useCustomers.ts +359 -0
- package/src/movethewheels/hooks/useFleet.ts +778 -0
- package/src/movethewheels/hooks/useInventory.ts +632 -0
- package/src/movethewheels/hooks/useOrders.ts +703 -0
- package/src/movethewheels/hooks/useRoutes.ts +453 -0
- package/src/movethewheels/hooks/useTracking.ts +505 -0
- package/src/movethewheels/index.ts +68 -0
- package/src/movethewheels/pages/AIAssistantPage.tsx +160 -0
- package/src/movethewheels/pages/AnalyticsPage.tsx +190 -0
- package/src/movethewheels/pages/CreateOrderPage.tsx +454 -0
- package/src/movethewheels/pages/CustomerDetailsPage.tsx +207 -0
- package/src/movethewheels/pages/CustomersPage.tsx +115 -0
- package/src/movethewheels/pages/DashboardPage.tsx +414 -0
- package/src/movethewheels/pages/DriverDetailsPage.tsx +261 -0
- package/src/movethewheels/pages/DriversPage.tsx +118 -0
- package/src/movethewheels/pages/FinancePage.tsx +141 -0
- package/src/movethewheels/pages/FleetPage.tsx +289 -0
- package/src/movethewheels/pages/ImportExportPage.tsx +165 -0
- package/src/movethewheels/pages/InventoryPage.tsx +212 -0
- package/src/movethewheels/pages/LiveTrackingPage.tsx +325 -0
- package/src/movethewheels/pages/MarketplacePage.tsx +235 -0
- package/src/movethewheels/pages/OrderDetailsPage.tsx +387 -0
- package/src/movethewheels/pages/OrdersListPage.tsx +241 -0
- package/src/movethewheels/pages/ProductDetailsPage.tsx +155 -0
- package/src/movethewheels/pages/ProductsPage.tsx +124 -0
- package/src/movethewheels/pages/ReportsPage.tsx +164 -0
- package/src/movethewheels/pages/RouteDetailsPage.tsx +245 -0
- package/src/movethewheels/pages/RoutesPage.tsx +104 -0
- package/src/movethewheels/pages/SettingsPage.tsx +242 -0
- package/src/movethewheels/pages/TrackingPage.tsx +419 -0
- package/src/movethewheels/pages/VehicleDetailsPage.tsx +218 -0
- package/src/movethewheels/pages/VehiclesPage.tsx +124 -0
- package/src/movethewheels/pages/WarehouseDetailsPage.tsx +216 -0
- package/src/movethewheels/pages/WarehousesPage.tsx +122 -0
- package/src/movethewheels/providers/MoveTheWheelsProvider.tsx +66 -0
- package/src/movethewheels/store/movethewheelsStore.ts +136 -0
- package/src/movethewheels/types/index.ts +744 -0
- package/src/movethewheels/utils/cn.ts +9 -0
- package/src/movethewheels/utils/formatters.ts +215 -0
- package/src/movethewheels/utils/graphqlClient.ts +63 -0
- package/src/movethewheels/utils/index.ts +8 -0
- package/src/movethewheels/utils/navigation.ts +70 -0
- package/src/operations/global/.gitkeep +0 -0
- package/src/operations/wspace/movethewheels/fragments/core.graphql +191 -0
- package/src/operations/wspace/movethewheels/mutations/entities.graphql +87 -0
- package/src/operations/wspace/movethewheels/mutations/logistics.graphql +86 -0
- package/src/operations/wspace/movethewheels/mutations/marketplace-reports.graphql +81 -0
- package/src/operations/wspace/movethewheels/mutations/orders.graphql +21 -0
- package/src/operations/wspace/movethewheels/queries/dashboard.graphql +61 -0
- package/src/operations/wspace/movethewheels/queries/entities.graphql +83 -0
- package/src/operations/wspace/movethewheels/queries/logistics.graphql +84 -0
- package/src/operations/wspace/movethewheels/queries/marketplace-reports.graphql +40 -0
- package/src/operations/wspace/movethewheels/queries/orders.graphql +43 -0
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
import { r as e, t } from "./graphqlClient-CdJyR_ed.js";
|
|
2
|
+
import { useCallback as n, useEffect as r, useMemo as i, useState as a } from "react";
|
|
3
|
+
//#region src/movethewheels/hooks/useInventory.ts
|
|
4
|
+
var o = "\n query ListInventoryItems($filter: InventoryFilterInput, $pagination: PaginationInput) {\n inventoryItems(filter: $filter, pagination: $pagination) {\n id\n productId\n warehouseId\n onHand\n available\n allocated\n damaged\n reorderPoint\n createdAt\n updatedAt\n }\n }\n", s = "\n query ListProducts($filter: ProductFilterInput, $pagination: PaginationInput) {\n products(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 }\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 }\n", l = "\n query GetProduct($id: ID!) {\n product(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 }\n", f = "\n mutation AdjustInventoryStock($input: AdjustInventoryStockInput!) {\n adjustInventoryStock(input: $input) {\n id\n productId\n warehouseId\n onHand\n available\n allocated\n damaged\n reorderPoint\n createdAt\n updatedAt\n }\n }\n";
|
|
5
|
+
function p(e) {
|
|
6
|
+
return {
|
|
7
|
+
id: e.id,
|
|
8
|
+
sku: e.sku,
|
|
9
|
+
name: e.name,
|
|
10
|
+
description: e.description ?? "",
|
|
11
|
+
category: e.category ?? "general",
|
|
12
|
+
brand: e.brand ?? void 0,
|
|
13
|
+
dimensions: {
|
|
14
|
+
length: 0,
|
|
15
|
+
width: 0,
|
|
16
|
+
height: 0,
|
|
17
|
+
unit: "cm",
|
|
18
|
+
...e.dimensions ?? {}
|
|
19
|
+
},
|
|
20
|
+
weight: e.weight ?? 0,
|
|
21
|
+
value: e.value ?? 0,
|
|
22
|
+
barcode: void 0,
|
|
23
|
+
images: [],
|
|
24
|
+
attributes: [],
|
|
25
|
+
hazardous: e.hazardous,
|
|
26
|
+
temperatureControlled: e.temperatureControlled,
|
|
27
|
+
fragile: e.fragile,
|
|
28
|
+
createdAt: new Date(e.createdAt),
|
|
29
|
+
updatedAt: new Date(e.updatedAt)
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function m(e) {
|
|
33
|
+
let t = e.totalCapacity ?? 0, n = e.usedCapacity ?? 0;
|
|
34
|
+
return {
|
|
35
|
+
id: e.id,
|
|
36
|
+
name: e.name,
|
|
37
|
+
code: e.code,
|
|
38
|
+
address: {
|
|
39
|
+
street: "",
|
|
40
|
+
city: "",
|
|
41
|
+
state: "",
|
|
42
|
+
postalCode: "",
|
|
43
|
+
country: "",
|
|
44
|
+
...e.address ?? {}
|
|
45
|
+
},
|
|
46
|
+
type: e.type?.toLowerCase() ?? "distribution",
|
|
47
|
+
capacity: {
|
|
48
|
+
totalSpace: t,
|
|
49
|
+
usedSpace: n,
|
|
50
|
+
totalPallets: 0,
|
|
51
|
+
usedPallets: 0,
|
|
52
|
+
specialAreas: []
|
|
53
|
+
},
|
|
54
|
+
operatingHours: {},
|
|
55
|
+
contacts: [],
|
|
56
|
+
zones: [],
|
|
57
|
+
equipment: [],
|
|
58
|
+
staff: [],
|
|
59
|
+
metrics: {
|
|
60
|
+
throughput: 0,
|
|
61
|
+
accuracy: 0,
|
|
62
|
+
productivity: 0,
|
|
63
|
+
utilization: t > 0 ? n / t * 100 : 0,
|
|
64
|
+
ordersFulfilled: 0,
|
|
65
|
+
averageProcessingTime: 0,
|
|
66
|
+
lastUpdated: /* @__PURE__ */ new Date()
|
|
67
|
+
},
|
|
68
|
+
isActive: !0,
|
|
69
|
+
createdAt: new Date(e.createdAt)
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function h(e) {
|
|
73
|
+
return {
|
|
74
|
+
id: e.id,
|
|
75
|
+
productId: e.productId,
|
|
76
|
+
warehouseId: e.warehouseId,
|
|
77
|
+
zoneId: "",
|
|
78
|
+
quantity: e.onHand,
|
|
79
|
+
reservedQuantity: e.allocated,
|
|
80
|
+
availableQuantity: e.available,
|
|
81
|
+
reorderLevel: e.reorderPoint ?? 0,
|
|
82
|
+
maxLevel: Math.max(e.onHand * 2, e.available),
|
|
83
|
+
lastRestocked: new Date(e.updatedAt),
|
|
84
|
+
location: {
|
|
85
|
+
aisle: "",
|
|
86
|
+
shelf: "",
|
|
87
|
+
position: "",
|
|
88
|
+
level: 0
|
|
89
|
+
},
|
|
90
|
+
movements: [],
|
|
91
|
+
createdAt: new Date(e.createdAt),
|
|
92
|
+
updatedAt: new Date(e.updatedAt)
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
function g() {
|
|
96
|
+
let { apiGatewayUrl: t, authToken: n, workspaceToken: r, workspaceId: a, tenantId: o, currentUser: s } = e();
|
|
97
|
+
return i(() => ({
|
|
98
|
+
apiGatewayUrl: t,
|
|
99
|
+
authToken: n,
|
|
100
|
+
workspaceToken: r,
|
|
101
|
+
workspaceId: a,
|
|
102
|
+
tenantId: o,
|
|
103
|
+
actorId: s?.id
|
|
104
|
+
}), [
|
|
105
|
+
t,
|
|
106
|
+
n,
|
|
107
|
+
r,
|
|
108
|
+
a,
|
|
109
|
+
o,
|
|
110
|
+
s?.id
|
|
111
|
+
]);
|
|
112
|
+
}
|
|
113
|
+
function _(e = {}) {
|
|
114
|
+
let { filters: l } = e, u = i(() => l, [
|
|
115
|
+
l?.lowStock,
|
|
116
|
+
l?.productId,
|
|
117
|
+
l?.warehouseId
|
|
118
|
+
]), d = g(), [_, v] = a([]), [y, b] = a([]), [x, S] = a([]), [C, w] = a(!1), [T, E] = a(null), D = n(async () => {
|
|
119
|
+
w(!0), E(null);
|
|
120
|
+
try {
|
|
121
|
+
let [e, n, r] = await Promise.all([
|
|
122
|
+
t(d, o, {
|
|
123
|
+
filter: {
|
|
124
|
+
warehouseId: u?.warehouseId,
|
|
125
|
+
productId: u?.productId
|
|
126
|
+
},
|
|
127
|
+
pagination: {
|
|
128
|
+
limit: 500,
|
|
129
|
+
offset: 0
|
|
130
|
+
}
|
|
131
|
+
}),
|
|
132
|
+
t(d, s, { pagination: {
|
|
133
|
+
limit: 500,
|
|
134
|
+
offset: 0
|
|
135
|
+
} }),
|
|
136
|
+
t(d, c, { pagination: {
|
|
137
|
+
limit: 500,
|
|
138
|
+
offset: 0
|
|
139
|
+
} })
|
|
140
|
+
]), i = e.inventoryItems.map(h);
|
|
141
|
+
u?.lowStock && (i = i.filter((e) => e.availableQuantity <= e.reorderLevel)), v(i), b(n.products.map(p)), S(r.warehouses.map(m));
|
|
142
|
+
} catch (e) {
|
|
143
|
+
E(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load inventory data"));
|
|
144
|
+
} finally {
|
|
145
|
+
w(!1);
|
|
146
|
+
}
|
|
147
|
+
}, [u, d]);
|
|
148
|
+
r(() => {
|
|
149
|
+
D();
|
|
150
|
+
}, [D]);
|
|
151
|
+
let O = n(() => {
|
|
152
|
+
D();
|
|
153
|
+
}, [D]), k = n(async (e, n, r) => {
|
|
154
|
+
let i = _.find((t) => t.id === e);
|
|
155
|
+
if (!i) throw Error("Inventory item not found");
|
|
156
|
+
let a = h((await t(d, f, { input: {
|
|
157
|
+
id: e,
|
|
158
|
+
onHand: i.quantity + n,
|
|
159
|
+
available: i.availableQuantity + n,
|
|
160
|
+
allocated: i.reservedQuantity,
|
|
161
|
+
damaged: 0
|
|
162
|
+
} })).adjustInventoryStock);
|
|
163
|
+
return v((t) => t.map((t) => t.id === e ? a : t)), a;
|
|
164
|
+
}, [d, _]), A = n(async (e, t, n, r) => {
|
|
165
|
+
let i = _.find((t) => t.warehouseId === e && t.productId === n);
|
|
166
|
+
if (!i) throw Error("Source inventory not found");
|
|
167
|
+
await k(i.id, -Math.abs(r), "transfer out");
|
|
168
|
+
let a = _.find((e) => e.warehouseId === t && e.productId === n);
|
|
169
|
+
a && await k(a.id, Math.abs(r), "transfer in");
|
|
170
|
+
}, [_, k]);
|
|
171
|
+
return {
|
|
172
|
+
inventory: _,
|
|
173
|
+
products: y,
|
|
174
|
+
warehouses: x,
|
|
175
|
+
totalItems: _.length,
|
|
176
|
+
isLoading: C,
|
|
177
|
+
error: T,
|
|
178
|
+
refetch: O,
|
|
179
|
+
updateStock: k,
|
|
180
|
+
transferStock: A
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
function v() {
|
|
184
|
+
let e = g(), [i, o] = a([]), [c, l] = a(!1), [u, d] = a(null), f = n(async () => {
|
|
185
|
+
l(!0), d(null);
|
|
186
|
+
try {
|
|
187
|
+
o((await t(e, s, { pagination: {
|
|
188
|
+
limit: 500,
|
|
189
|
+
offset: 0
|
|
190
|
+
} })).products.map(p));
|
|
191
|
+
} catch (e) {
|
|
192
|
+
d(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load products"));
|
|
193
|
+
} finally {
|
|
194
|
+
l(!1);
|
|
195
|
+
}
|
|
196
|
+
}, [e]);
|
|
197
|
+
return r(() => {
|
|
198
|
+
f();
|
|
199
|
+
}, [f]), {
|
|
200
|
+
products: i,
|
|
201
|
+
totalProducts: i.length,
|
|
202
|
+
isLoading: c,
|
|
203
|
+
error: u,
|
|
204
|
+
refetch: () => void f()
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
function y(e) {
|
|
208
|
+
let i = g(), [o, s] = a(null), [c, u] = a(!1), [d, f] = a(null), m = n(async () => {
|
|
209
|
+
if (!e) {
|
|
210
|
+
s(null);
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
u(!0), f(null);
|
|
214
|
+
try {
|
|
215
|
+
let n = await t(i, l, { id: e });
|
|
216
|
+
s(n.product ? p(n.product) : null);
|
|
217
|
+
} catch (e) {
|
|
218
|
+
f(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load product"));
|
|
219
|
+
} finally {
|
|
220
|
+
u(!1);
|
|
221
|
+
}
|
|
222
|
+
}, [i, e]);
|
|
223
|
+
return r(() => {
|
|
224
|
+
m();
|
|
225
|
+
}, [m]), {
|
|
226
|
+
product: o,
|
|
227
|
+
isLoading: c,
|
|
228
|
+
error: d,
|
|
229
|
+
refetch: () => void m()
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
function b() {
|
|
233
|
+
let e = g(), [i, o] = a([]), [s, l] = a(!1), [u, d] = a(null), f = n(async () => {
|
|
234
|
+
l(!0), d(null);
|
|
235
|
+
try {
|
|
236
|
+
o((await t(e, c, { pagination: {
|
|
237
|
+
limit: 500,
|
|
238
|
+
offset: 0
|
|
239
|
+
} })).warehouses.map(m));
|
|
240
|
+
} catch (e) {
|
|
241
|
+
d(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load warehouses"));
|
|
242
|
+
} finally {
|
|
243
|
+
l(!1);
|
|
244
|
+
}
|
|
245
|
+
}, [e]);
|
|
246
|
+
return r(() => {
|
|
247
|
+
f();
|
|
248
|
+
}, [f]), {
|
|
249
|
+
warehouses: i,
|
|
250
|
+
totalWarehouses: i.length,
|
|
251
|
+
isLoading: s,
|
|
252
|
+
error: u,
|
|
253
|
+
refetch: () => void f()
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
function x(e) {
|
|
257
|
+
let i = g(), [o, s] = a(null), [c, l] = a(!1), [d, f] = a(null), p = n(async () => {
|
|
258
|
+
if (!e) {
|
|
259
|
+
s(null);
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
l(!0), f(null);
|
|
263
|
+
try {
|
|
264
|
+
let n = await t(i, u, { id: e });
|
|
265
|
+
s(n.warehouse ? m(n.warehouse) : null);
|
|
266
|
+
} catch (e) {
|
|
267
|
+
f(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load warehouse"));
|
|
268
|
+
} finally {
|
|
269
|
+
l(!1);
|
|
270
|
+
}
|
|
271
|
+
}, [i, e]);
|
|
272
|
+
return r(() => {
|
|
273
|
+
p();
|
|
274
|
+
}, [p]), {
|
|
275
|
+
warehouse: o,
|
|
276
|
+
isLoading: c,
|
|
277
|
+
error: d,
|
|
278
|
+
refetch: () => void p()
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
function S() {
|
|
282
|
+
let e = g(), [n, i] = a({
|
|
283
|
+
totalItems: 0,
|
|
284
|
+
lowStockItems: 0,
|
|
285
|
+
totalValue: 0,
|
|
286
|
+
totalProducts: 0,
|
|
287
|
+
totalWarehouses: 0,
|
|
288
|
+
warehouseUtilization: []
|
|
289
|
+
}), [o, s] = a(!1), [l, u] = a(null);
|
|
290
|
+
return r(() => {
|
|
291
|
+
(async () => {
|
|
292
|
+
s(!0), u(null);
|
|
293
|
+
try {
|
|
294
|
+
let [n, r] = await Promise.all([t(e, d), t(e, c, { pagination: {
|
|
295
|
+
limit: 500,
|
|
296
|
+
offset: 0
|
|
297
|
+
} })]);
|
|
298
|
+
i({
|
|
299
|
+
totalItems: n.inventoryStats.totalOnHand,
|
|
300
|
+
lowStockItems: n.inventoryStats.lowStockCount,
|
|
301
|
+
totalValue: 0,
|
|
302
|
+
totalProducts: 0,
|
|
303
|
+
totalWarehouses: r.warehouses.length,
|
|
304
|
+
warehouseUtilization: r.warehouses.map((e) => ({
|
|
305
|
+
id: e.id,
|
|
306
|
+
name: e.name,
|
|
307
|
+
utilization: (e.totalCapacity ?? 0) > 0 ? (e.usedCapacity ?? 0) / (e.totalCapacity ?? 1) * 100 : 0
|
|
308
|
+
}))
|
|
309
|
+
});
|
|
310
|
+
} catch (e) {
|
|
311
|
+
u(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load inventory stats"));
|
|
312
|
+
} finally {
|
|
313
|
+
s(!1);
|
|
314
|
+
}
|
|
315
|
+
})();
|
|
316
|
+
}, [e]), {
|
|
317
|
+
stats: n,
|
|
318
|
+
isLoading: o,
|
|
319
|
+
error: l
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
//#endregion
|
|
323
|
+
export { x as a, v as i, S as n, b as o, y as r, _ as t };
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
import { r as e, t } from "./graphqlClient-CdJyR_ed.js";
|
|
2
|
+
import { useCallback as n, useEffect as r, useMemo as i, useState as a } from "react";
|
|
3
|
+
//#region src/movethewheels/hooks/useOrders.ts
|
|
4
|
+
var o = "\n query ListMovethewheelsOrders($filter: OrderFilterInput, $pagination: PaginationInput) {\n movethewheelsOrders(filter: $filter, pagination: $pagination) {\n id\n orderNumber\n customerId\n orderType\n status\n priority\n pickupAddress\n deliveryAddress\n items\n pricing\n trackingNumber\n specialInstructions\n scheduledDelivery\n vehicleId\n driverId\n createdAt\n updatedAt\n customer {\n name\n email\n phone\n company\n }\n statusHistory {\n status\n notes\n location\n createdAt\n createdBy\n }\n }\n }\n", s = "\n query GetMovethewheelsOrder($id: ID!) {\n movethewheelsOrder(id: $id) {\n id\n orderNumber\n customerId\n orderType\n status\n priority\n pickupAddress\n deliveryAddress\n items\n pricing\n trackingNumber\n specialInstructions\n scheduledDelivery\n vehicleId\n driverId\n createdAt\n updatedAt\n customer {\n name\n email\n phone\n company\n }\n statusHistory {\n status\n notes\n location\n createdAt\n createdBy\n }\n }\n }\n", c = "\n query GetOrderStatsBundle {\n orderStats {\n total\n pending\n inTransit\n delivered\n cancelled\n failed\n }\n financeMetrics {\n revenue {\n totalRevenue\n averageOrderValue\n }\n }\n }\n", l = "\n mutation CreateMovethewheelsOrder($input: CreateOrderInput!) {\n createMovethewheelsOrder(input: $input) {\n id\n orderNumber\n customerId\n orderType\n status\n priority\n pickupAddress\n deliveryAddress\n items\n pricing\n trackingNumber\n specialInstructions\n scheduledDelivery\n vehicleId\n driverId\n createdAt\n updatedAt\n customer {\n name\n email\n phone\n company\n }\n statusHistory {\n status\n notes\n location\n createdAt\n createdBy\n }\n }\n }\n", u = "\n mutation UpdateMovethewheelsOrder($id: ID!, $input: UpdateOrderInput!) {\n updateMovethewheelsOrder(id: $id, input: $input) {\n id\n orderNumber\n customerId\n orderType\n status\n priority\n pickupAddress\n deliveryAddress\n items\n pricing\n trackingNumber\n specialInstructions\n scheduledDelivery\n vehicleId\n driverId\n createdAt\n updatedAt\n customer {\n name\n email\n phone\n company\n }\n statusHistory {\n status\n notes\n location\n createdAt\n createdBy\n }\n }\n }\n", d = "\n mutation UpdateMovethewheelsOrderStatus($id: ID!, $input: UpdateOrderStatusInput!) {\n updateMovethewheelsOrderStatus(id: $id, input: $input) {\n id\n orderNumber\n customerId\n orderType\n status\n priority\n pickupAddress\n deliveryAddress\n items\n pricing\n trackingNumber\n specialInstructions\n scheduledDelivery\n vehicleId\n driverId\n createdAt\n updatedAt\n customer {\n name\n email\n phone\n company\n }\n statusHistory {\n status\n notes\n location\n createdAt\n createdBy\n }\n }\n }\n", f = "\n mutation DeleteMovethewheelsOrder($id: ID!) {\n deleteMovethewheelsOrder(id: $id)\n }\n";
|
|
5
|
+
function p(e) {
|
|
6
|
+
switch (e) {
|
|
7
|
+
case "PENDING": return "pending";
|
|
8
|
+
case "CONFIRMED": return "confirmed";
|
|
9
|
+
case "ASSIGNED": return "assigned";
|
|
10
|
+
case "PICKED_UP": return "picked_up";
|
|
11
|
+
case "IN_TRANSIT": return "in_transit";
|
|
12
|
+
case "OUT_FOR_DELIVERY": return "out_for_delivery";
|
|
13
|
+
case "DELIVERED": return "delivered";
|
|
14
|
+
case "CANCELLED": return "cancelled";
|
|
15
|
+
default: return "failed";
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function m(e) {
|
|
19
|
+
return e === "B2B" ? "b2b" : "b2c";
|
|
20
|
+
}
|
|
21
|
+
function h(e) {
|
|
22
|
+
switch (e) {
|
|
23
|
+
case "LOW": return "low";
|
|
24
|
+
case "HIGH": return "high";
|
|
25
|
+
case "URGENT":
|
|
26
|
+
case "CRITICAL": return "urgent";
|
|
27
|
+
default: return "normal";
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function g(e) {
|
|
31
|
+
switch (e) {
|
|
32
|
+
case "pending": return "PENDING";
|
|
33
|
+
case "confirmed": return "CONFIRMED";
|
|
34
|
+
case "assigned": return "ASSIGNED";
|
|
35
|
+
case "picked_up": return "PICKED_UP";
|
|
36
|
+
case "in_transit": return "IN_TRANSIT";
|
|
37
|
+
case "out_for_delivery": return "OUT_FOR_DELIVERY";
|
|
38
|
+
case "delivered": return "DELIVERED";
|
|
39
|
+
case "cancelled": return "CANCELLED";
|
|
40
|
+
default: return "FAILED";
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function _(e) {
|
|
44
|
+
return e === "b2b" ? "B2B" : "B2C";
|
|
45
|
+
}
|
|
46
|
+
function v(e) {
|
|
47
|
+
switch (e) {
|
|
48
|
+
case "low": return "LOW";
|
|
49
|
+
case "high": return "HIGH";
|
|
50
|
+
case "urgent": return "URGENT";
|
|
51
|
+
default: return "MEDIUM";
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function y(e) {
|
|
55
|
+
return {
|
|
56
|
+
street: "",
|
|
57
|
+
city: "",
|
|
58
|
+
state: "",
|
|
59
|
+
postalCode: "",
|
|
60
|
+
country: "",
|
|
61
|
+
...e ?? {}
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function b(e) {
|
|
65
|
+
return {
|
|
66
|
+
id: e.id,
|
|
67
|
+
orderNumber: e.orderNumber,
|
|
68
|
+
customerId: e.customerId,
|
|
69
|
+
customerInfo: {
|
|
70
|
+
name: e.customer?.name ?? "Unknown Customer",
|
|
71
|
+
email: e.customer?.email ?? "",
|
|
72
|
+
phone: e.customer?.phone ?? "",
|
|
73
|
+
company: e.customer?.company ?? void 0
|
|
74
|
+
},
|
|
75
|
+
items: Array.isArray(e.items) ? e.items : [],
|
|
76
|
+
status: p(e.status),
|
|
77
|
+
orderType: m(e.orderType),
|
|
78
|
+
priority: h(e.priority),
|
|
79
|
+
pickupAddress: y(e.pickupAddress),
|
|
80
|
+
deliveryAddress: y(e.deliveryAddress),
|
|
81
|
+
trackingNumber: e.trackingNumber ?? "",
|
|
82
|
+
specialInstructions: e.specialInstructions ?? void 0,
|
|
83
|
+
pricing: {
|
|
84
|
+
subtotal: 0,
|
|
85
|
+
taxes: 0,
|
|
86
|
+
fees: {
|
|
87
|
+
delivery: 0,
|
|
88
|
+
handling: 0
|
|
89
|
+
},
|
|
90
|
+
total: 0,
|
|
91
|
+
currency: "USD",
|
|
92
|
+
paymentMethod: "unknown",
|
|
93
|
+
paymentStatus: "pending",
|
|
94
|
+
...typeof e.pricing == "object" && e.pricing !== null ? e.pricing : {}
|
|
95
|
+
},
|
|
96
|
+
timeline: e.statusHistory?.map((e) => ({
|
|
97
|
+
timestamp: new Date(e.createdAt),
|
|
98
|
+
status: p(e.status),
|
|
99
|
+
location: e.location,
|
|
100
|
+
notes: e.notes ?? void 0,
|
|
101
|
+
performedBy: e.createdBy ?? "system"
|
|
102
|
+
})) ?? [],
|
|
103
|
+
scheduledDelivery: e.scheduledDelivery ? new Date(e.scheduledDelivery) : void 0,
|
|
104
|
+
vehicleId: e.vehicleId ?? void 0,
|
|
105
|
+
driverId: e.driverId ?? void 0,
|
|
106
|
+
createdAt: new Date(e.createdAt),
|
|
107
|
+
updatedAt: new Date(e.updatedAt)
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
function x(s = {}) {
|
|
111
|
+
let { filters: c, limit: p = 20, offset: m = 0 } = s, { apiGatewayUrl: h, authToken: y, workspaceToken: x, workspaceId: S, tenantId: C, currentUser: w } = e(), [T, E] = a([]), [D, O] = a(!1), [k, A] = a(null), j = i(() => ({
|
|
112
|
+
apiGatewayUrl: h,
|
|
113
|
+
authToken: y,
|
|
114
|
+
workspaceToken: x,
|
|
115
|
+
workspaceId: S,
|
|
116
|
+
tenantId: C,
|
|
117
|
+
actorId: w?.id
|
|
118
|
+
}), [
|
|
119
|
+
h,
|
|
120
|
+
y,
|
|
121
|
+
x,
|
|
122
|
+
S,
|
|
123
|
+
C,
|
|
124
|
+
w?.id
|
|
125
|
+
]), M = n(async () => {
|
|
126
|
+
O(!0), A(null);
|
|
127
|
+
try {
|
|
128
|
+
E((await t(j, o, {
|
|
129
|
+
filter: {
|
|
130
|
+
status: c?.status ? g(c.status) : void 0,
|
|
131
|
+
priority: c?.priority ? v(c.priority) : void 0,
|
|
132
|
+
orderType: c?.orderType ? _(c.orderType) : void 0,
|
|
133
|
+
customerId: c?.customerId,
|
|
134
|
+
driverId: c?.driverId
|
|
135
|
+
},
|
|
136
|
+
pagination: {
|
|
137
|
+
limit: p,
|
|
138
|
+
offset: m
|
|
139
|
+
}
|
|
140
|
+
})).movethewheelsOrders.map(b));
|
|
141
|
+
} catch (e) {
|
|
142
|
+
A(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load orders"));
|
|
143
|
+
} finally {
|
|
144
|
+
O(!1);
|
|
145
|
+
}
|
|
146
|
+
}, [
|
|
147
|
+
c,
|
|
148
|
+
j,
|
|
149
|
+
p,
|
|
150
|
+
m
|
|
151
|
+
]);
|
|
152
|
+
r(() => {
|
|
153
|
+
M();
|
|
154
|
+
}, [M]);
|
|
155
|
+
let N = n(() => {
|
|
156
|
+
M();
|
|
157
|
+
}, [M]), P = n(async (e) => {
|
|
158
|
+
let n = b((await t(j, l, { input: {
|
|
159
|
+
orderNumber: e.orderNumber ?? `ORD-${(/* @__PURE__ */ new Date()).getFullYear()}-${Date.now().toString().slice(-6)}`,
|
|
160
|
+
orderType: _(e.orderType),
|
|
161
|
+
status: g(e.status ?? "pending"),
|
|
162
|
+
priority: v(e.priority),
|
|
163
|
+
customerId: e.customerId,
|
|
164
|
+
pickupAddress: e.pickupAddress ?? {},
|
|
165
|
+
deliveryAddress: e.deliveryAddress ?? {},
|
|
166
|
+
items: e.items ?? [],
|
|
167
|
+
pricing: e.pricing ?? null,
|
|
168
|
+
specialInstructions: e.specialInstructions,
|
|
169
|
+
trackingNumber: e.trackingNumber,
|
|
170
|
+
scheduledDelivery: e.scheduledDelivery?.toISOString(),
|
|
171
|
+
vehicleId: e.vehicleId,
|
|
172
|
+
driverId: e.driverId
|
|
173
|
+
} })).createMovethewheelsOrder);
|
|
174
|
+
return E((e) => [n, ...e]), n;
|
|
175
|
+
}, [j]), F = n(async (e, n) => {
|
|
176
|
+
let r = b((await t(j, u, {
|
|
177
|
+
id: e,
|
|
178
|
+
input: {
|
|
179
|
+
orderType: n.orderType ? _(n.orderType) : void 0,
|
|
180
|
+
status: n.status ? g(n.status) : void 0,
|
|
181
|
+
priority: n.priority ? v(n.priority) : void 0,
|
|
182
|
+
customerId: n.customerId,
|
|
183
|
+
pickupAddress: n.pickupAddress,
|
|
184
|
+
deliveryAddress: n.deliveryAddress,
|
|
185
|
+
items: n.items,
|
|
186
|
+
pricing: n.pricing,
|
|
187
|
+
specialInstructions: n.specialInstructions,
|
|
188
|
+
trackingNumber: n.trackingNumber,
|
|
189
|
+
scheduledDelivery: n.scheduledDelivery?.toISOString(),
|
|
190
|
+
vehicleId: n.vehicleId,
|
|
191
|
+
driverId: n.driverId
|
|
192
|
+
}
|
|
193
|
+
})).updateMovethewheelsOrder);
|
|
194
|
+
return E((t) => t.map((t) => t.id === e ? r : t)), r;
|
|
195
|
+
}, [j]), I = n(async (e) => {
|
|
196
|
+
await t(j, f, { id: e }), E((t) => t.filter((t) => t.id !== e));
|
|
197
|
+
}, [j]), L = n(async (e, n) => {
|
|
198
|
+
let r = b((await t(j, d, {
|
|
199
|
+
id: e,
|
|
200
|
+
input: { status: g(n) }
|
|
201
|
+
})).updateMovethewheelsOrderStatus);
|
|
202
|
+
return E((t) => t.map((t) => t.id === e ? r : t)), r;
|
|
203
|
+
}, [j]);
|
|
204
|
+
return {
|
|
205
|
+
orders: T,
|
|
206
|
+
totalOrders: T.length,
|
|
207
|
+
isLoading: D,
|
|
208
|
+
error: k,
|
|
209
|
+
refetch: N,
|
|
210
|
+
createOrder: P,
|
|
211
|
+
updateOrder: F,
|
|
212
|
+
deleteOrder: I,
|
|
213
|
+
updateOrderStatus: L
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
function S(o) {
|
|
217
|
+
let { apiGatewayUrl: c, authToken: l, workspaceToken: u, workspaceId: d, tenantId: f, currentUser: p } = e(), [m, h] = a(null), [g, _] = a(!1), [v, y] = a(null), x = i(() => ({
|
|
218
|
+
apiGatewayUrl: c,
|
|
219
|
+
authToken: l,
|
|
220
|
+
workspaceToken: u,
|
|
221
|
+
workspaceId: d,
|
|
222
|
+
tenantId: f,
|
|
223
|
+
actorId: p?.id
|
|
224
|
+
}), [
|
|
225
|
+
c,
|
|
226
|
+
l,
|
|
227
|
+
u,
|
|
228
|
+
d,
|
|
229
|
+
f,
|
|
230
|
+
p?.id
|
|
231
|
+
]), S = n(async () => {
|
|
232
|
+
if (!o) {
|
|
233
|
+
h(null);
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
_(!0), y(null);
|
|
237
|
+
try {
|
|
238
|
+
let e = await t(x, s, { id: o });
|
|
239
|
+
h(e.movethewheelsOrder ? b(e.movethewheelsOrder) : null);
|
|
240
|
+
} catch (e) {
|
|
241
|
+
y(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load order"));
|
|
242
|
+
} finally {
|
|
243
|
+
_(!1);
|
|
244
|
+
}
|
|
245
|
+
}, [x, o]);
|
|
246
|
+
return r(() => {
|
|
247
|
+
S();
|
|
248
|
+
}, [S]), {
|
|
249
|
+
order: m,
|
|
250
|
+
isLoading: g,
|
|
251
|
+
error: v,
|
|
252
|
+
refetch: n(() => {
|
|
253
|
+
S();
|
|
254
|
+
}, [S])
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
function C() {
|
|
258
|
+
let { apiGatewayUrl: o, authToken: s, workspaceToken: l, workspaceId: u, tenantId: d, currentUser: f } = e(), [p, m] = a(!1), [h, g] = a(null), [_, v] = a({
|
|
259
|
+
total: 0,
|
|
260
|
+
byStatus: {
|
|
261
|
+
pending: 0,
|
|
262
|
+
confirmed: 0,
|
|
263
|
+
assigned: 0,
|
|
264
|
+
picked_up: 0,
|
|
265
|
+
in_transit: 0,
|
|
266
|
+
out_for_delivery: 0,
|
|
267
|
+
delivered: 0,
|
|
268
|
+
cancelled: 0,
|
|
269
|
+
failed: 0
|
|
270
|
+
},
|
|
271
|
+
totalRevenue: 0,
|
|
272
|
+
todayOrders: 0,
|
|
273
|
+
avgOrderValue: 0
|
|
274
|
+
}), y = i(() => ({
|
|
275
|
+
apiGatewayUrl: o,
|
|
276
|
+
authToken: s,
|
|
277
|
+
workspaceToken: l,
|
|
278
|
+
workspaceId: u,
|
|
279
|
+
tenantId: d,
|
|
280
|
+
actorId: f?.id
|
|
281
|
+
}), [
|
|
282
|
+
o,
|
|
283
|
+
s,
|
|
284
|
+
l,
|
|
285
|
+
u,
|
|
286
|
+
d,
|
|
287
|
+
f?.id
|
|
288
|
+
]), b = n(async () => {
|
|
289
|
+
m(!0), g(null);
|
|
290
|
+
try {
|
|
291
|
+
let e = await t(y, c);
|
|
292
|
+
v({
|
|
293
|
+
total: e.orderStats.total,
|
|
294
|
+
byStatus: {
|
|
295
|
+
pending: e.orderStats.pending,
|
|
296
|
+
confirmed: 0,
|
|
297
|
+
assigned: 0,
|
|
298
|
+
picked_up: 0,
|
|
299
|
+
in_transit: e.orderStats.inTransit,
|
|
300
|
+
out_for_delivery: 0,
|
|
301
|
+
delivered: e.orderStats.delivered,
|
|
302
|
+
cancelled: e.orderStats.cancelled,
|
|
303
|
+
failed: e.orderStats.failed
|
|
304
|
+
},
|
|
305
|
+
totalRevenue: e.financeMetrics.revenue.totalRevenue,
|
|
306
|
+
todayOrders: 0,
|
|
307
|
+
avgOrderValue: e.financeMetrics.revenue.averageOrderValue
|
|
308
|
+
});
|
|
309
|
+
} catch (e) {
|
|
310
|
+
g(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load order stats"));
|
|
311
|
+
} finally {
|
|
312
|
+
m(!1);
|
|
313
|
+
}
|
|
314
|
+
}, [y]);
|
|
315
|
+
return r(() => {
|
|
316
|
+
b();
|
|
317
|
+
}, [b]), {
|
|
318
|
+
stats: _,
|
|
319
|
+
isLoading: p,
|
|
320
|
+
error: h
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
//#endregion
|
|
324
|
+
export { C as n, x as r, S as t };
|