Files
edr-platform/apps/edr-freight-web/backoffice/src/components/contracts/HazardDeclarationPanel.tsx
Marshal 9a1c8e5603 feat: add hazardous goods declaration feature
- Introduced HazardDeclarationPanel component to display dangerous goods declaration details.
- Updated URL constants to include CLEARANCE_PROCEED endpoint for re-requesting operations.
- Enhanced permissions to include hazardous approval roles for contract approvals.
- Integrated HazardDeclarationPanel into ContractRequestDetailPage and ContractClearanceDetailPage.
- Added proceedToOperation method in bookings service for handling operation re-requests.
- Updated contract forms and schemas to include hazard class and UN number fields.
- Implemented validation for hazardous contracts in the contract creation flow.
- Added expiry notice functionality for contracts nearing validity end.
- Created tests for expiry notice calculations and labels.
- Updated UI components to reflect hazardous cargo information and validation errors.
2026-07-25 21:10:09 +00:00

66 lines
1.9 KiB
TypeScript

import { Badge, Box, Group, Stack, Text } from "@mantine/core";
import { Flame } from "lucide-react";
import { hazardClassLabel, type Freight } from "@edr/types";
/**
* The contract's dangerous-goods declaration — the UN/ADR class and UN number
* the customer declared alongside the hazard documents. Shown wherever a
* hazardous contract is reviewed: the cargo-scope card and the two hazardous
* approval confirmations, so no one signs off without seeing what is moving.
*/
export function HazardDeclarationPanel({
contract,
}: {
contract: Pick<Freight.IContract, "hazardClass" | "unNumber">;
}) {
const classLabel = hazardClassLabel(contract.hazardClass);
return (
<Group
gap="sm"
align="flex-start"
wrap="nowrap"
px="md"
py="sm"
style={{
borderRadius: 12,
border: "1px solid #F3D5D0",
background: "#FEF7F6",
}}
>
<Box
style={{
width: 34,
height: 34,
borderRadius: 10,
flexShrink: 0,
display: "flex",
alignItems: "center",
justifyContent: "center",
background: "#FBEAE7",
color: "#C0392B",
}}
>
<Flame size={16} />
</Box>
<Stack gap={6} style={{ minWidth: 0 }}>
<Text size="sm" fw={700}>
Dangerous goods declaration
</Text>
<Group gap={6} wrap="wrap">
<Badge color="red" variant="light" radius="sm" size="sm">
{classLabel ?? "Class not declared"}
</Badge>
<Badge color="red" variant="light" radius="sm" size="sm">
{contract.unNumber ? `UN ${contract.unNumber}` : "UN number not declared"}
</Badge>
</Group>
<Text size="xs" c="dimmed">
Check the declaration against the uploaded hazard documents before
approving.
</Text>
</Stack>
</Group>
);
}