mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-27 16:40:56 +00:00
15 lines
640 B
TypeScript
15 lines
640 B
TypeScript
import type { FreightType } from "@/types/trainScheduling";
|
|
|
|
const isContainerFreight = (freightType?: string | null) => freightType === "CONTAINER";
|
|
|
|
/** Show container number placement step when train includes container cargo. */
|
|
export function shouldShowContainerPlacementStep(params: {
|
|
containerUnitCount: number;
|
|
scheduleFreightType?: FreightType | string | null;
|
|
bookingFreightTypes: Array<FreightType | string | null | undefined>;
|
|
}): boolean {
|
|
if (params.containerUnitCount > 0) return true;
|
|
if (isContainerFreight(params.scheduleFreightType)) return true;
|
|
return params.bookingFreightTypes.some(isContainerFreight);
|
|
}
|