rider creation

This commit is contained in:
2026-09-04 16:03:46 +05:30
parent 416c50755b
commit e1a16377ea
17 changed files with 2259 additions and 33 deletions

View File

@@ -10,7 +10,7 @@
import { useQueries, useQuery, type UseQueryOptions } from '@tanstack/react-query';
import { catalogueApi, type CatalogueQuery } from '@/api/catalogue';
import { deliveriesApi } from '@/api/deliveries';
import { deliveriesApi, ridersApi } from '@/api/deliveries';
import { insightsApi, type DateRange, type OrderQuery } from '@/api/insights';
import { productsApi } from '@/api/products';
import { posUsersApi, staffApi } from '@/api/people';
@@ -449,3 +449,39 @@ export function useUploads(tenantid: number | undefined, locationid?: number) {
...stable,
});
}
/**
* The rider directory — everyone, whether or not they are working today.
*
* `stable`, not `live`, and that is the difference from `useRiders`. This is a
* staff list: it changes when somebody is hired or edited, not through the day
* as shifts start and end. The on-duty read is the one that has to keep asking.
*/
export function useRiderRoster(tenantid: number | undefined) {
return useQuery({
queryKey: queryKeys.insights.riderRoster(tenantid ?? 0),
queryFn: () => ridersApi.roster(tenantid as number),
enabled: Boolean(tenantid),
...stable,
});
}
/** Shifts a rider can be put on. Scoped by region; the param is required. */
export function useRiderShifts(applocationid: number | undefined) {
return useQuery({
queryKey: queryKeys.insights.riderShifts(applocationid ?? 0),
queryFn: () => ridersApi.shifts(applocationid as number),
enabled: Boolean(applocationid),
...stable,
});
}
/** Delivery partners in a region. */
export function usePartners(applocationid: number | undefined) {
return useQuery({
queryKey: queryKeys.insights.partners(applocationid ?? 0),
queryFn: () => ridersApi.partners(applocationid as number),
enabled: Boolean(applocationid),
...stable,
});
}