diff --git a/apps/edr-freight-api/src/modules/contracts/contract-clearance.service.ts b/apps/edr-freight-api/src/modules/contracts/contract-clearance.service.ts index a16ccc5c9..cb047b572 100644 --- a/apps/edr-freight-api/src/modules/contracts/contract-clearance.service.ts +++ b/apps/edr-freight-api/src/modules/contracts/contract-clearance.service.ts @@ -294,7 +294,15 @@ export class ContractClearanceService { note?: string, ): Promise { const contract = await this.contractsService.findById(contractId); - if (contract.status !== 'CLEARANCE_UNDER_REVIEW') { + // Reviewing is allowed both while the batch is UNDER_REVIEW and after it has + // dropped back to AWAITING_CLEARANCE_DOCUMENTS — querying one document flips + // the contract to "awaiting" (the customer must re-upload), but the reviewer + // may still be working through the rest of the batch. Restricting to + // UNDER_REVIEW only would 409 every review after the first query. + if ( + contract.status !== 'CLEARANCE_UNDER_REVIEW' && + contract.status !== 'AWAITING_CLEARANCE_DOCUMENTS' + ) { throw new ConflictException( `Cannot review clearance documents on status "${contract.status}".`, ); diff --git a/apps/edr-freight-web/portal/src/pages/MyPortalPage/MyPortalPage.tsx b/apps/edr-freight-web/portal/src/pages/MyPortalPage/MyPortalPage.tsx index a07bd8492..ce69be041 100644 --- a/apps/edr-freight-web/portal/src/pages/MyPortalPage/MyPortalPage.tsx +++ b/apps/edr-freight-web/portal/src/pages/MyPortalPage/MyPortalPage.tsx @@ -5,6 +5,7 @@ import { useState } from "react"; import { useNavigate } from "react-router-dom"; import { PROFILE_TYPE_LABELS } from "@/constants/profileMode"; import { + ActionNeededSection, FreightVolumeSection, HelloSection, InvoicesSection, @@ -13,6 +14,7 @@ import { ShipmentsSection, StatsSection, } from "./components"; +import { deriveActionItems } from "./actions"; import { useMyPortalData } from "./hooks"; export default function MyPortalPage() { @@ -25,6 +27,7 @@ export default function MyPortalPage() { bookingsQuery, dashboardQuery, contractsQuery, + allContracts, recentContracts, activeContractsCount, allBookings, @@ -45,6 +48,8 @@ export default function MyPortalPage() { label: `${PROFILE_TYPE_LABELS[p.type] ?? p.type} · ${p.reference}`, })); + const actionItems = deriveActionItems(allContracts, allBookings); + const handleBookingClick = (id: string) => { navigate(`/bookings/${id}`); }; @@ -53,6 +58,8 @@ export default function MyPortalPage() { + + {serviceOptions.length > 1 && (