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 98ed091f9..cb350916d 100644 --- a/apps/edr-freight-web/portal/src/pages/MyPortalPage/MyPortalPage.tsx +++ b/apps/edr-freight-web/portal/src/pages/MyPortalPage/MyPortalPage.tsx @@ -96,6 +96,7 @@ export default function MyPortalPage() { diff --git a/apps/edr-freight-web/portal/src/pages/MyPortalPage/components/RecentContractsSection.tsx b/apps/edr-freight-web/portal/src/pages/MyPortalPage/components/RecentContractsSection.tsx index 898173942..14ac28b2b 100644 --- a/apps/edr-freight-web/portal/src/pages/MyPortalPage/components/RecentContractsSection.tsx +++ b/apps/edr-freight-web/portal/src/pages/MyPortalPage/components/RecentContractsSection.tsx @@ -1,12 +1,13 @@ import { Box, Button, Group, Skeleton, Stack, Text } from "@mantine/core"; import { memo } from "react"; import { useNavigate } from "react-router-dom"; -import { ArrowRight, FileSignature, Package, Plus } from "lucide-react"; +import { ArrowRight, FileSignature, Package, Plus, RefreshCw } from "lucide-react"; import type { Freight } from "@edr/types"; import { ContractDocButton, ContractStatusBadge, } from "@/pages/contracts/contract-ui"; +import { getContractBookingAction } from "@/pages/contracts/contract-booking-action"; import { Card } from "./Card"; import { EmptyState } from "./EmptyState"; @@ -14,16 +15,15 @@ const INK = "#10202F"; const MUTED = "#6B7C8E"; const BORDER = "#E6ECF2"; -// Statuses where a Path A customer may book directly against the contract. -const BOOKABLE = ["FULLY_EXECUTED", "CONTRACT_ACTIVE"]; - interface RecentContractsSectionProps { contracts: Freight.IContract[]; + bookings: Freight.IBooking[]; isLoading: boolean; } export const RecentContractsSection = memo(function RecentContractsSection({ contracts, + bookings, isLoading, }: RecentContractsSectionProps) { const navigate = useNavigate(); @@ -65,7 +65,7 @@ export const RecentContractsSection = memo(function RecentContractsSection({ const isGeneral = c.contractKind === "GENERAL"; const isContainer = c.freightType === "CONTAINER"; const canSign = c.status === "CONTRACT_READY"; - const canBook = !c.customsClearingEnabled && BOOKABLE.includes(c.status); + const bookingAction = getContractBookingAction(c, bookings); return ( Sign - ) : canBook ? ( + ) : bookingAction.kind !== "none" ? ( ) : (