mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 09:30:59 +00:00
feat(warehouse): fetch all PAID bookings in one call, classified IMPORT/EXPORT by route
- eligibleBookings(direction?) now returns all import+export bookings when direction omitted (DOMESTIC excluded); per-direction filter preserved for backward compatibility - GET /warehouse-inventory/eligible-bookings (no query) returns the combined set - Frontend: single shared useEligibleBookings() query; both Receive tabs filter client-side by route-derived direction, so only one HTTP request fires Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -189,10 +189,15 @@ export const useDeliverInventory = () =>
|
||||
);
|
||||
|
||||
// ── Receive (Import/Export bulk) ───────────────────────────────────────────
|
||||
export function useEligibleBookings(direction: 'IMPORT' | 'EXPORT', enabled = true) {
|
||||
/**
|
||||
* All not-yet-received PAID bookings, classified IMPORT/EXPORT by route, in one call.
|
||||
* Both Receive tabs share this single query (same key) — only one HTTP request fires —
|
||||
* then filter client-side by direction.
|
||||
*/
|
||||
export function useEligibleBookings(enabled = true) {
|
||||
return useQuery({
|
||||
queryKey: ['warehouse-inventory', 'eligible-bookings', direction],
|
||||
queryFn: () => warehouseService.eligibleBookings(direction).then((r) => r.data),
|
||||
queryKey: ['warehouse-inventory', 'eligible-bookings'],
|
||||
queryFn: () => warehouseService.eligibleBookings().then((r) => r.data),
|
||||
enabled,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user