@burdenoff/microfe-movethewheels 2026.822.1 → 2026.827.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/generated/wspace-operations.d.ts +168 -912
- package/dist/generated/wspace-types.d.ts +78432 -35831
- package/dist/hooks/useFleet.js +142 -74
- package/dist/hooks/useInventory.js +163 -70
- package/dist/hooks/useOrders.js +2 -2
- package/dist/hooks/useTracking.js +5 -5
- package/dist/index.js +33 -33
- package/dist/movethewheels/hooks/index.d.ts +2 -2
- package/dist/movethewheels/hooks/useFleet.d.ts +32 -1
- package/dist/movethewheels/hooks/useInventory.d.ts +67 -12
- package/dist/movethewheels/hooks/useOrders.d.ts +25 -2
- package/dist/movethewheels/types/index.d.ts +2 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/arrow-down-right.js +11 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/arrow-left-right.js +22 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/arrow-up-right.js +11 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/calendar-clock.js +32 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/history.js +18 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/lock.js +16 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/user-round.js +13 -0
- package/dist/pages/CreateOrderPage.js +246 -195
- package/dist/pages/DeliveryCapturePage.js +91 -78
- package/dist/pages/DriversPage.js +202 -108
- package/dist/pages/InventoryPage.js +356 -131
- package/dist/pages/ProductDetailsPage.js +212 -156
- package/dist/pages/VehicleDetailsPage.js +257 -193
- package/dist/utils/formatters.js +4 -1
- package/package.json +1 -1
- package/src/generated/wspace-operations.ts +134 -929
- package/src/generated/wspace-types.ts +91730 -40059
- package/src/movethewheels/hooks/index.ts +9 -0
- package/src/movethewheels/hooks/useFleet.ts +133 -3
- package/src/movethewheels/hooks/useInventory.ts +311 -53
- package/src/movethewheels/hooks/useOrders.ts +31 -7
- package/src/movethewheels/hooks/useTracking.ts +14 -14
- package/src/movethewheels/pages/CreateOrderPage.tsx +67 -10
- package/src/movethewheels/pages/DeliveryCapturePage.tsx +8 -0
- package/src/movethewheels/pages/DriversPage.tsx +181 -31
- package/src/movethewheels/pages/InventoryPage.tsx +299 -19
- package/src/movethewheels/pages/ProductDetailsPage.tsx +68 -3
- package/src/movethewheels/pages/VehicleDetailsPage.tsx +86 -27
- package/src/movethewheels/types/index.ts +2 -0
- package/src/operations/wspace/movethewheels/fragments/core.graphql +23 -53
- package/src/operations/wspace/movethewheels/fragments/core.withdrawn.graphql +59 -0
- package/src/operations/wspace/movethewheels/mutations/entities.graphql +5 -5
- package/src/operations/wspace/movethewheels/mutations/marketplace-reports.graphql +18 -78
- package/src/operations/wspace/movethewheels/mutations/marketplace-reports.withdrawn.graphql +93 -0
- package/src/operations/wspace/movethewheels/mutations/orders.graphql +7 -7
- package/src/operations/wspace/movethewheels/queries/dashboard.graphql +3 -3
- package/src/operations/wspace/movethewheels/queries/entities.graphql +3 -3
- package/src/operations/wspace/movethewheels/queries/logistics.graphql +3 -3
- package/src/operations/wspace/movethewheels/queries/marketplace-reports.withdrawn.graphql +58 -0
- package/src/operations/wspace/movethewheels/queries/orders.graphql +3 -3
- package/src/operations/wspace/movethewheels/queries/marketplace-reports.graphql +0 -40
|
@@ -12,9 +12,12 @@ export {
|
|
|
12
12
|
useFleet,
|
|
13
13
|
useVehicles,
|
|
14
14
|
useVehicle,
|
|
15
|
+
useVehicleDrivers,
|
|
15
16
|
useDrivers,
|
|
16
17
|
useDriver,
|
|
18
|
+
useDriverStatusCounts,
|
|
17
19
|
useFleetStats,
|
|
20
|
+
type DriverStatusCounts,
|
|
18
21
|
} from './useFleet';
|
|
19
22
|
|
|
20
23
|
// Inventory (Products & Warehouses)
|
|
@@ -22,9 +25,15 @@ export {
|
|
|
22
25
|
useInventory,
|
|
23
26
|
useProducts,
|
|
24
27
|
useProduct,
|
|
28
|
+
useProductStockLevels,
|
|
25
29
|
useWarehouses,
|
|
26
30
|
useWarehouse,
|
|
27
31
|
useInventoryStats,
|
|
32
|
+
useInventoryTransactions,
|
|
33
|
+
type InventoryStats,
|
|
34
|
+
type InventoryTransaction,
|
|
35
|
+
type InventoryTransactionType,
|
|
36
|
+
type ProductStockLevel,
|
|
28
37
|
} from './useInventory';
|
|
29
38
|
|
|
30
39
|
// Customers
|
|
@@ -46,6 +46,7 @@ interface ApiVehicle {
|
|
|
46
46
|
make?: string | null;
|
|
47
47
|
model?: string | null;
|
|
48
48
|
licensePlate?: string | null;
|
|
49
|
+
ownershipType?: string | null;
|
|
49
50
|
year?: number | null;
|
|
50
51
|
capacity?: Record<string, unknown> | null;
|
|
51
52
|
status: string;
|
|
@@ -83,6 +84,7 @@ const LIST_VEHICLES_QUERY = `
|
|
|
83
84
|
make
|
|
84
85
|
model
|
|
85
86
|
licensePlate
|
|
87
|
+
ownershipType
|
|
86
88
|
year
|
|
87
89
|
capacity
|
|
88
90
|
status
|
|
@@ -126,6 +128,7 @@ const GET_VEHICLE_QUERY = `
|
|
|
126
128
|
make
|
|
127
129
|
model
|
|
128
130
|
licensePlate
|
|
131
|
+
ownershipType
|
|
129
132
|
year
|
|
130
133
|
capacity
|
|
131
134
|
status
|
|
@@ -169,6 +172,7 @@ const UPDATE_VEHICLE_STATUS_MUTATION = `
|
|
|
169
172
|
make
|
|
170
173
|
model
|
|
171
174
|
licensePlate
|
|
175
|
+
ownershipType
|
|
172
176
|
year
|
|
173
177
|
capacity
|
|
174
178
|
status
|
|
@@ -234,6 +238,7 @@ const CREATE_VEHICLE_MUTATION = `
|
|
|
234
238
|
make
|
|
235
239
|
model
|
|
236
240
|
licensePlate
|
|
241
|
+
ownershipType
|
|
237
242
|
year
|
|
238
243
|
capacity
|
|
239
244
|
status
|
|
@@ -277,6 +282,7 @@ const UPDATE_VEHICLE_MUTATION = `
|
|
|
277
282
|
make
|
|
278
283
|
model
|
|
279
284
|
licensePlate
|
|
285
|
+
ownershipType
|
|
280
286
|
year
|
|
281
287
|
capacity
|
|
282
288
|
status
|
|
@@ -311,6 +317,21 @@ const UPDATE_DRIVER_MUTATION = `
|
|
|
311
317
|
}
|
|
312
318
|
`;
|
|
313
319
|
|
|
320
|
+
/**
|
|
321
|
+
* `fleetStats` only breaks drivers down into available / on-delivery, so an
|
|
322
|
+
* "on break" or "off duty" tile derived from it is always wrong (on-break
|
|
323
|
+
* drivers get lumped into the off-duty remainder). `driversCount` takes the
|
|
324
|
+
* same DriverFilterInput as the list, so each roster tile can be counted
|
|
325
|
+
* exactly, workspace-wide, instead of inferred from a subtraction.
|
|
326
|
+
*/
|
|
327
|
+
const DRIVER_STATUS_COUNTS_QUERY = `
|
|
328
|
+
query GetDriverStatusCounts {
|
|
329
|
+
onBreak: driversCount(filter: { status: ON_BREAK })
|
|
330
|
+
offDuty: driversCount(filter: { status: OFF_DUTY })
|
|
331
|
+
inactive: driversCount(filter: { status: INACTIVE })
|
|
332
|
+
}
|
|
333
|
+
`;
|
|
334
|
+
|
|
314
335
|
const FLEET_STATS_QUERY = `
|
|
315
336
|
query GetFleetStats {
|
|
316
337
|
fleetStats {
|
|
@@ -386,6 +407,7 @@ function mapVehicle(vehicle: ApiVehicle): Vehicle {
|
|
|
386
407
|
make: vehicle.make ?? '',
|
|
387
408
|
model: vehicle.model ?? '',
|
|
388
409
|
licensePlate: vehicle.licensePlate ?? '',
|
|
410
|
+
ownershipType: vehicle.ownershipType ?? undefined,
|
|
389
411
|
year: vehicle.year ?? new Date().getFullYear(),
|
|
390
412
|
capacity: {
|
|
391
413
|
weight: 0,
|
|
@@ -805,8 +827,16 @@ interface UseDriversResult {
|
|
|
805
827
|
assignVehicle: (driverId: string, vehicleId: string) => Promise<Driver>;
|
|
806
828
|
}
|
|
807
829
|
|
|
808
|
-
|
|
809
|
-
|
|
830
|
+
interface UseDriversOptions extends UseListOptions {
|
|
831
|
+
/**
|
|
832
|
+
* Narrows the roster server-side via `DriverFilterInput.status` so the pager
|
|
833
|
+
* still counts whole result sets rather than filtering one fetched page.
|
|
834
|
+
*/
|
|
835
|
+
status?: DriverStatus;
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
export function useDrivers(options: UseDriversOptions = {}): UseDriversResult {
|
|
839
|
+
const { limit = 200, offset = 0, status } = options;
|
|
810
840
|
const graphQLOptions = useGraphqlOptions();
|
|
811
841
|
const [drivers, setDrivers] = useState<Driver[]>([]);
|
|
812
842
|
const [hasMore, setHasMore] = useState(false);
|
|
@@ -821,6 +851,7 @@ export function useDrivers(options: UseListOptions = {}): UseDriversResult {
|
|
|
821
851
|
graphQLOptions,
|
|
822
852
|
LIST_DRIVERS_QUERY,
|
|
823
853
|
{
|
|
854
|
+
filter: status ? { status: toApiDriverStatus(status) } : undefined,
|
|
824
855
|
pagination: { limit, offset },
|
|
825
856
|
}
|
|
826
857
|
);
|
|
@@ -831,7 +862,7 @@ export function useDrivers(options: UseListOptions = {}): UseDriversResult {
|
|
|
831
862
|
} finally {
|
|
832
863
|
setIsLoading(false);
|
|
833
864
|
}
|
|
834
|
-
}, [graphQLOptions, limit, offset]);
|
|
865
|
+
}, [graphQLOptions, limit, offset, status]);
|
|
835
866
|
|
|
836
867
|
useEffect(() => {
|
|
837
868
|
void load();
|
|
@@ -928,6 +959,105 @@ export function useDriver(driverId: string | undefined) {
|
|
|
928
959
|
return { driver, isLoading, error, refetch };
|
|
929
960
|
}
|
|
930
961
|
|
|
962
|
+
export interface DriverStatusCounts {
|
|
963
|
+
onBreak: number;
|
|
964
|
+
offDuty: number;
|
|
965
|
+
inactive: number;
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
/** Exact per-status driver counts for the roster tiles (see DRIVER_STATUS_COUNTS_QUERY). */
|
|
969
|
+
export function useDriverStatusCounts() {
|
|
970
|
+
const graphQLOptions = useGraphqlOptions();
|
|
971
|
+
const [counts, setCounts] = useState<DriverStatusCounts>({
|
|
972
|
+
onBreak: 0,
|
|
973
|
+
offDuty: 0,
|
|
974
|
+
inactive: 0,
|
|
975
|
+
});
|
|
976
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
977
|
+
const [error, setError] = useState<Error | null>(null);
|
|
978
|
+
|
|
979
|
+
const load = useCallback(async () => {
|
|
980
|
+
setIsLoading(true);
|
|
981
|
+
setError(null);
|
|
982
|
+
try {
|
|
983
|
+
const data = await executeGraphQL<DriverStatusCounts>(
|
|
984
|
+
graphQLOptions,
|
|
985
|
+
DRIVER_STATUS_COUNTS_QUERY
|
|
986
|
+
);
|
|
987
|
+
setCounts({
|
|
988
|
+
onBreak: data.onBreak,
|
|
989
|
+
offDuty: data.offDuty,
|
|
990
|
+
inactive: data.inactive,
|
|
991
|
+
});
|
|
992
|
+
} catch (fetchError) {
|
|
993
|
+
setError(
|
|
994
|
+
fetchError instanceof Error ? fetchError : new Error('Failed to load driver status counts')
|
|
995
|
+
);
|
|
996
|
+
} finally {
|
|
997
|
+
setIsLoading(false);
|
|
998
|
+
}
|
|
999
|
+
}, [graphQLOptions]);
|
|
1000
|
+
|
|
1001
|
+
useEffect(() => {
|
|
1002
|
+
void load();
|
|
1003
|
+
}, [load]);
|
|
1004
|
+
|
|
1005
|
+
const refetch = useCallback(() => {
|
|
1006
|
+
void load();
|
|
1007
|
+
}, [load]);
|
|
1008
|
+
|
|
1009
|
+
return { counts, isLoading, error, refetch };
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
/**
|
|
1013
|
+
* The driver(s) currently assigned to a vehicle, resolved server-side through
|
|
1014
|
+
* `DriverFilterInput.vehicleId` (the same link `assignDriverVehicle` writes).
|
|
1015
|
+
* A vehicle normally has one driver, but the filter returns a list, so the
|
|
1016
|
+
* caller gets every assignment rather than a silently-picked first row.
|
|
1017
|
+
*/
|
|
1018
|
+
export function useVehicleDrivers(vehicleId: string | undefined) {
|
|
1019
|
+
const graphQLOptions = useGraphqlOptions();
|
|
1020
|
+
const [drivers, setDrivers] = useState<Driver[]>([]);
|
|
1021
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
1022
|
+
const [error, setError] = useState<Error | null>(null);
|
|
1023
|
+
|
|
1024
|
+
const load = useCallback(async () => {
|
|
1025
|
+
if (!vehicleId) {
|
|
1026
|
+
setDrivers([]);
|
|
1027
|
+
return;
|
|
1028
|
+
}
|
|
1029
|
+
setIsLoading(true);
|
|
1030
|
+
setError(null);
|
|
1031
|
+
try {
|
|
1032
|
+
const data = await executeGraphQL<{ drivers: ApiDriver[] }>(
|
|
1033
|
+
graphQLOptions,
|
|
1034
|
+
LIST_DRIVERS_QUERY,
|
|
1035
|
+
{
|
|
1036
|
+
filter: { vehicleId },
|
|
1037
|
+
pagination: { limit: 25, offset: 0 },
|
|
1038
|
+
}
|
|
1039
|
+
);
|
|
1040
|
+
setDrivers(data.drivers.map(mapDriver));
|
|
1041
|
+
} catch (fetchError) {
|
|
1042
|
+
setError(
|
|
1043
|
+
fetchError instanceof Error ? fetchError : new Error('Failed to load assigned driver')
|
|
1044
|
+
);
|
|
1045
|
+
} finally {
|
|
1046
|
+
setIsLoading(false);
|
|
1047
|
+
}
|
|
1048
|
+
}, [graphQLOptions, vehicleId]);
|
|
1049
|
+
|
|
1050
|
+
useEffect(() => {
|
|
1051
|
+
void load();
|
|
1052
|
+
}, [load]);
|
|
1053
|
+
|
|
1054
|
+
const refetch = useCallback(() => {
|
|
1055
|
+
void load();
|
|
1056
|
+
}, [load]);
|
|
1057
|
+
|
|
1058
|
+
return { drivers, isLoading, error, refetch };
|
|
1059
|
+
}
|
|
1060
|
+
|
|
931
1061
|
export function useFleetStats() {
|
|
932
1062
|
const graphQLOptions = useGraphqlOptions();
|
|
933
1063
|
const [stats, setStats] = useState({
|