mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 02:58:11 +00:00
enhance gate pass and freight payment handling in train scheduling
- Updated the logic in to ensure that a booking only earns its gate pass once the freight charges are settled. - Added logging for bookings that have not settled freight payment when securing gate passes. - Modified seeders to ensure that bookings have associated company profiles to prevent data inconsistencies. - Updated freight permissions to include new clearance actions for bookings. - Enhanced the UI to reflect changes in the clearance process, including new shipment request pages and improved status handling in the clearance action panel. - Adjusted the contract clearance list to accommodate both customs contracts and shipment bookings. - Improved the handling of GENERAL contracts in various components to ensure proper booking flow and visibility.
This commit is contained in:
@@ -128,7 +128,16 @@ function DirectionIcon({ direction }: { direction: string }) {
|
||||
);
|
||||
}
|
||||
|
||||
export default function DocumentClearanceListPage() {
|
||||
export default function DocumentClearanceListPage({
|
||||
opsMode = false,
|
||||
}: {
|
||||
/**
|
||||
* true → Operations self-clearance queue: NON-customs bookings whose
|
||||
* per-booking clearance docs the operations team reviews (GENERAL Path A).
|
||||
* false → legacy GL queue: customs bookings only.
|
||||
*/
|
||||
opsMode?: boolean;
|
||||
}) {
|
||||
const navigate = useNavigate();
|
||||
const [pageTab, setPageTab] = useState<PageTab>("queue");
|
||||
const [activeTab, setActiveTab] = useState<ClearanceTabKey>("all");
|
||||
@@ -139,7 +148,7 @@ export default function DocumentClearanceListPage() {
|
||||
const isHistory = pageTab === "history";
|
||||
|
||||
const { data, isLoading, isError, isFetching, refetch } = useQuery({
|
||||
queryKey: ["clearance", "list", isHistory],
|
||||
queryKey: ["clearance", "list", isHistory, opsMode],
|
||||
queryFn: () =>
|
||||
bookingsService.list({
|
||||
status: isHistory ? CLEARANCE_HISTORY_STATUS : CLEARANCE_REVIEW_STATUS,
|
||||
@@ -148,8 +157,10 @@ export default function DocumentClearanceListPage() {
|
||||
});
|
||||
|
||||
const allRows = useMemo(() => {
|
||||
// GL clearance queue: customs bookings only
|
||||
const rows = (data?.items ?? []).map(toClearanceRow).filter((r) => r.hasCustoms);
|
||||
// opsMode: self-clearance (non-customs) bookings; else customs bookings only.
|
||||
const rows = (data?.items ?? [])
|
||||
.map(toClearanceRow)
|
||||
.filter((r) => (opsMode ? !r.hasCustoms : r.hasCustoms));
|
||||
|
||||
if (isHistory) {
|
||||
return [...rows].sort((a, b) => {
|
||||
@@ -159,7 +170,7 @@ export default function DocumentClearanceListPage() {
|
||||
});
|
||||
}
|
||||
return rows;
|
||||
}, [data?.items, isHistory]);
|
||||
}, [data?.items, isHistory, opsMode]);
|
||||
|
||||
const tabCounts = useMemo(
|
||||
() => ({
|
||||
@@ -310,8 +321,12 @@ export default function DocumentClearanceListPage() {
|
||||
<PageContainer>
|
||||
<Stack gap="lg">
|
||||
<PageHeader
|
||||
title="Document Clearance"
|
||||
subtitle="Review customer documents, raise queries, and finalize clearance for each booking."
|
||||
title={opsMode ? "Self-Clearance Review" : "Document Clearance"}
|
||||
subtitle={
|
||||
opsMode
|
||||
? "Review the customer's own clearance documents per shipment booking, raise queries, and finalize."
|
||||
: "Review customer documents, raise queries, and finalize clearance for each booking."
|
||||
}
|
||||
meta={statusBadge}
|
||||
action={
|
||||
<ActionIcon
|
||||
|
||||
Reference in New Issue
Block a user