update booking process for customs clearance contracts, allowing customers to create bookings post-clearance finalization

This commit is contained in:
Marshal
2026-06-28 21:47:40 +00:00
parent f45d260c53
commit 506b269207
6 changed files with 43 additions and 42 deletions

View File

@@ -12,7 +12,6 @@ import {
Check,
FileSignature,
MessageSquareWarning,
PackagePlus,
ShieldCheck,
Sparkles,
XCircle,
@@ -21,8 +20,6 @@ import {
import type { Freight } from "@edr/types";
import { SectionCard } from "@/components/bookings/detail/SectionCard";
import { useAuth } from "@/auth/useAuth";
import { canCreateContractBooking } from "@/lib/permissions";
import type { useContractMutations } from "@/hooks/contracts/useContracts";
type Mutations = ReturnType<typeof useContractMutations>;
@@ -49,7 +46,6 @@ export function ContractActionsToolbar({
onReviewClearance,
}: ContractActionsToolbarProps) {
const navigate = useNavigate();
const { user } = useAuth();
const { status } = contract;
const [acceptOpen, setAcceptOpen] = useState(false);
@@ -85,10 +81,6 @@ export function ContractActionsToolbar({
const canViewContract =
["CONTRACT_READY", "SIGNED_CUSTOMER"].includes(status) &&
Boolean(contract.contractGeneratedAt);
const canCreateBooking =
status === "CLEARANCE_READY_FOR_BOOKING" &&
contract.customsClearingEnabled &&
canCreateContractBooking(user);
// Show "Review clearance" while the contract is in the document-review phase.
// Reviewer = GL (Path B / customs) or Operations (Path A / no customs).
const canReviewClearance =
@@ -174,23 +166,12 @@ export function ContractActionsToolbar({
</Button>
)}
{canCreateBooking && (
<Button
fullWidth
color="edr-green"
leftSection={<PackagePlus size={16} />}
onClick={() =>
navigate(`/dashboard/contracts/${contract.id}/create-booking`)
}
>
Create booking (GL)
</Button>
)}
{/* GL "Create booking" removed for now — clearance ends at finalize and
the customer creates the booking in the portal. */}
{!canAccept &&
!needsManualGenerate &&
!canViewContract &&
!canCreateBooking &&
!canReviewClearance && (
<Text size="sm" c="dimmed">
No staff actions available for this status. Monitor until the