mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-08 17:08:18 +00:00
Customer Truck Assignment and Portal Delivary Approval
This commit is contained in:
@@ -188,3 +188,19 @@ export function useBookingMutations(bookingId: string) {
|
||||
downloadContract: () => bookingsService.downloadContract(bookingId),
|
||||
};
|
||||
}
|
||||
|
||||
export function useBookingEtClearanceQueue(enabled = true) {
|
||||
return useQuery({
|
||||
queryKey: QUERY_KEYS.BOOKINGS.clearanceQueue("ET"),
|
||||
queryFn: () => bookingsService.getEtClearanceQueue(),
|
||||
enabled,
|
||||
});
|
||||
}
|
||||
|
||||
export function useBookingDjClearanceQueue(enabled = true) {
|
||||
return useQuery({
|
||||
queryKey: QUERY_KEYS.BOOKINGS.clearanceQueue("DJ"),
|
||||
queryFn: () => bookingsService.getDjClearanceQueue(),
|
||||
enabled,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -52,6 +52,22 @@ export function useContractClearanceQueue(enabled = true) {
|
||||
});
|
||||
}
|
||||
|
||||
export function useEtClearanceQueue(enabled = true) {
|
||||
return useQuery({
|
||||
queryKey: QUERY_KEYS.CONTRACTS.clearanceQueue("ET"),
|
||||
queryFn: () => contractsService.getEtClearanceQueue(),
|
||||
enabled,
|
||||
});
|
||||
}
|
||||
|
||||
export function useDjClearanceQueue(enabled = true) {
|
||||
return useQuery({
|
||||
queryKey: QUERY_KEYS.CONTRACTS.clearanceQueue("DJ"),
|
||||
queryFn: () => contractsService.getDjClearanceQueue(),
|
||||
enabled,
|
||||
});
|
||||
}
|
||||
|
||||
/** Path A self-clearance queue (Operations reviews non-customs contracts). */
|
||||
export function useOpsClearanceQueue(enabled = true) {
|
||||
return useQuery({
|
||||
@@ -248,7 +264,10 @@ export function useContractClearanceMutations(
|
||||
);
|
||||
refresh();
|
||||
},
|
||||
onError: () => toast.error("Could not update document"),
|
||||
onError: (e) =>
|
||||
toast.error(
|
||||
e instanceof Error ? e.message : "Could not update document",
|
||||
),
|
||||
});
|
||||
|
||||
// Approve every still-pending customer document in one click. There is no
|
||||
|
||||
30
apps/edr-freight-web/backoffice/src/hooks/useScrollToHash.ts
Normal file
30
apps/edr-freight-web/backoffice/src/hooks/useScrollToHash.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { useEffect } from "react";
|
||||
import { useLocation } from "react-router-dom";
|
||||
|
||||
/**
|
||||
* Scroll to the element whose `id` matches the URL hash. Retries for a short
|
||||
* window so it still lands on sections that mount after an async fetch (there is
|
||||
* no router-level hash handling). Deep-link targets give a card an `id`.
|
||||
*/
|
||||
export function useScrollToHash(): void {
|
||||
const { hash } = useLocation();
|
||||
|
||||
useEffect(() => {
|
||||
if (!hash) return;
|
||||
const id = decodeURIComponent(hash.slice(1));
|
||||
let tries = 0;
|
||||
let timer: ReturnType<typeof setTimeout>;
|
||||
|
||||
const tick = () => {
|
||||
const el = document.getElementById(id);
|
||||
if (el) {
|
||||
el.scrollIntoView({ behavior: "smooth", block: "start" });
|
||||
return;
|
||||
}
|
||||
if (tries++ < 20) timer = setTimeout(tick, 100);
|
||||
};
|
||||
|
||||
timer = setTimeout(tick, 100);
|
||||
return () => clearTimeout(timer);
|
||||
}, [hash]);
|
||||
}
|
||||
Reference in New Issue
Block a user