update joins in repository services to use entity classes and enhance booking form with hazardous/reefer toggles

This commit is contained in:
Marshal
2026-07-04 04:26:14 +00:00
parent 2c0e115c14
commit c650a2dcbd
2 changed files with 59 additions and 15 deletions

View File

@@ -596,21 +596,58 @@ export default function ContractRequestDetailPage() {
No cargo scope lines. No cargo scope lines.
</Text> </Text>
) : ( ) : (
<Stack gap="xs"> <Stack gap="sm">
{(contract.cargoScope ?? []).map((s) => ( {(contract.cargoScope ?? []).map((s) => {
<Group key={s.id} gap={8} wrap="nowrap"> const isContainer = Boolean(s.containerSize);
<BoxIcon // Bulk lines carry their commodity detail (name + unit);
size={15} // container lines carry the size (20ft / 40ft).
color="var(--mantine-color-edr-green-6)" const title = isContainer
/> ? `${s.containerSize} container`
<Text size="sm"> : (s.cargoType?.cargoTypeName ??
{s.containerSize ?? s.cargoFreeText ??
s.cargoFreeText ?? s.cargoType?.code ??
s.cargoTypeId ?? "Bulk cargo");
"Cargo"} // quantityCap unit: containers for a size line, else the
</Text> // cargo type's unit of measure (tons / items / …), default tons.
</Group> const capUnit = isContainer
))} ? "containers"
: (s.cargoType?.unitOfMeasure?.toLowerCase() ?? "tons");
return (
<Group key={s.id} gap={8} wrap="nowrap" align="flex-start">
<BoxIcon
size={15}
color="var(--mantine-color-edr-green-6)"
style={{ marginTop: 2, flexShrink: 0 }}
/>
<div>
<Text size="sm" fw={500}>
{title}
</Text>
<Group gap={6} mt={2}>
<Badge
variant="light"
color={isContainer ? "blue" : "grape"}
radius="sm"
size="xs"
tt="uppercase"
>
{isContainer ? "Container" : "Bulk"}
</Badge>
{s.cargoType?.code ? (
<Text size="xs" c="dimmed">
Code: {s.cargoType.code}
</Text>
) : null}
<Text size="xs" c="dimmed">
{s.quantityCap != null
? `Cap: ${s.quantityCap} ${capUnit}`
: "Cap: uncapped"}
</Text>
</Group>
</div>
</Group>
);
})}
</Stack> </Stack>
)} )}
</SectionCard> </SectionCard>

View File

@@ -132,6 +132,13 @@ export interface IContractCargoScope {
/** "20ft" | "40ft"; null for bulk. */ /** "20ft" | "40ft"; null for bulk. */
containerSize?: string | null; containerSize?: string | null;
cargoTypeId?: string | null; cargoTypeId?: string | null;
/** Bulk cargo type detail (name + unit), loaded on the contract detail. */
cargoType?: {
id: string;
code?: string | null;
cargoTypeName?: string | null;
unitOfMeasure?: string | null;
} | null;
cargoFreeText?: string | null; cargoFreeText?: string | null;
/** /**
* GENERAL contracts: total quantity bookable across all shipments on this line * GENERAL contracts: total quantity bookable across all shipments on this line