deliveries
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
|
||||
import { useQueries, useQuery, type UseQueryOptions } from '@tanstack/react-query';
|
||||
import { catalogueApi, type CatalogueQuery } from '@/api/catalogue';
|
||||
import { deliveriesApi } from '@/api/deliveries';
|
||||
import { insightsApi, type DateRange, type OrderQuery } from '@/api/insights';
|
||||
import { productsApi } from '@/api/products';
|
||||
import { posUsersApi, staffApi } from '@/api/people';
|
||||
@@ -341,6 +342,26 @@ export function useDeliveries(query: OrderQuery | undefined) {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Riders on duty in one delivery region.
|
||||
*
|
||||
* `live` rather than `stable`, unlike the other reference lists: this one is
|
||||
* not reference data. A rider clocking on or off changes it during the shift,
|
||||
* and a picker offering somebody who went home twenty minutes ago sends the
|
||||
* order nowhere.
|
||||
*
|
||||
* Scoped by `applocationid`. Passing a tenant instead returns an empty list
|
||||
* with a 200 — see `deliveriesApi.riders`.
|
||||
*/
|
||||
export function useRiders(applocationid: number | undefined) {
|
||||
return useQuery({
|
||||
queryKey: queryKeys.insights.riders(applocationid ?? 0),
|
||||
queryFn: () => deliveriesApi.riders({ applocationid: applocationid as number }),
|
||||
enabled: Boolean(applocationid),
|
||||
...live,
|
||||
});
|
||||
}
|
||||
|
||||
/* ── People ──────────────────────────────────────────────────────────────── */
|
||||
|
||||
/** The back-office directory. Role names arrive resolved; never map ids here. */
|
||||
|
||||
Reference in New Issue
Block a user