mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 19:58:11 +00:00
booking operations and trains scheduling also allocations
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
import { Badge } from "@mantine/core";
|
||||
|
||||
const STATUS_COLORS: Record<string, string> = {
|
||||
DRAFT: "gray",
|
||||
SCHEDULED: "blue",
|
||||
DISPATCHED: "green",
|
||||
ARRIVED: "teal",
|
||||
CANCELLED: "red",
|
||||
};
|
||||
|
||||
export function ScheduleStatusBadge({ status }: { status: string }) {
|
||||
return (
|
||||
<Badge variant="light" color={STATUS_COLORS[status] ?? "gray"} size="sm">
|
||||
{status}
|
||||
</Badge>
|
||||
);
|
||||
}
|
||||
|
||||
export function FreightTypeBadge({ freightType }: { freightType?: string | null }) {
|
||||
if (!freightType) return <Badge variant="light" color="gray" size="sm">—</Badge>;
|
||||
const color =
|
||||
freightType === "BULK" ? "orange" : freightType === "MIXED" ? "grape" : "cyan";
|
||||
return (
|
||||
<Badge variant="light" color={color} size="sm">
|
||||
{freightType}
|
||||
</Badge>
|
||||
);
|
||||
}
|
||||
|
||||
export function SchedulingStatusBadge({ status }: { status?: string | null }) {
|
||||
if (!status) return null;
|
||||
const colors: Record<string, string> = {
|
||||
NOT_SCHEDULED: "gray",
|
||||
HOLDING: "yellow",
|
||||
ELIGIBLE: "blue",
|
||||
SCHEDULED: "indigo",
|
||||
DISPATCHED: "green",
|
||||
};
|
||||
return (
|
||||
<Badge variant="light" color={colors[status] ?? "gray"} size="sm">
|
||||
{status.replace(/_/g, " ")}
|
||||
</Badge>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user