root = Card([header, alerts, kpiSection, flightSection, opsSection, connSection, actions], "card", "column", "m")
header = CardHeader("Hub Operations Desk", "DFW · Dallas/Fort Worth · Tue, Jun 3")
alerts = Card([weather, delayAlert], "sunk", "column", "s")
weather = Callout("warning", "Weather advisory at DFW", "Thunderstorms within 30 nmi of the field until 3 PM. Inbound holding up to 45 min; ramp operations pause when lightning is within 5 nmi.")
delayAlert = Callout("error", "3 flights delayed · 1 canceled", "AA 1204 (40 min), UA 883 (55 min) and BA 195 (70 min) are delayed. AC 875 is canceled — 214 passengers need rebooking.")
kpiSection = Card([kpiHeader, otp, load, kpiTable], "sunk", "column", "s")
kpiHeader = Card([kpiHeading, otpTag], "clear", "row", "m")
kpiHeading = Heading("Today's performance", "h3")
otpTag = Tag("On track", null, null, "success")
otp = Progress(87, "On-time performance — 87% of departures")
load = Progress(82, "Average passenger load — 82% of seats")
kpiTable = Table([kpiMetric, kpiValue])
kpiMetric = Col("Metric", ["Average turnaround", "Cancellations today"])
kpiValue = Col("Value", ["52 min", "6 flights"])
flightSection = Card([flightHeading, flightsTable], "sunk", "column", "s")
flightHeading = Heading("Flight board", "h3")
flightsTable = Table([flightNum, flightRoute, flightGate, flightStatus])
flightNum = Col("Flight", ["AA 1204", "UA 883", "DL 2101", "WN 1722", "BA 195", "EK 221", "LH 441", "AC 875"])
flightRoute = Col("Route", ["DFW → LAX", "DFW → ORD", "DFW → ATL", "DFW → DEN", "DFW → LHR", "DFW → DXB", "DFW → FRA", "DFW → YYZ"])
flightGate = Col("Gate", ["C4", "C4", "B9", "D11", "E2", "C8", "B7", "A3"])
flightStatus = Col("Status", ["Delayed", "Delayed", "On time", "Boarding", "Delayed", "On time", "On time", "Canceled"])
opsSection = Card([gateHeading, gateList, separator, crewsHeading, crewsTable, crewsNote], "sunk", "column", "s")
gateHeading = Heading("Recent gate changes", "h3")
gateList = ListBlock([gate1, gate2, gate3, gate4])
gate1 = ListItem("AA 1204", "B12 → C4 · 10:42 AM")
gate2 = ListItem("DL 2101", "A17 → B9 · 10:35 AM")
gate3 = ListItem("WN 1722", "D9 → D11 · 10:18 AM")
gate4 = ListItem("EK 221", "C11 → C8 · 10:02 AM")
separator = Separator()
crewsHeading = Heading("Crews available for reassignment", "h3")
crewsTable = Table([crewRole, crewAvail])
crewRole = Col("Role", ["Pilots", "Flight attendants", "Gate agents", "Ramp"])
crewAvail = Col("Available", ["12", "28", "9", "15"])
crewsNote = TextContent("Qualified and on standby — can cover reassignments within 60 minutes.", "small")
connSection = Card([connHeader, connList], "sunk", "column", "s")
connHeader = Card([connHeading, connTag], "clear", "row", "m")
connHeading = Heading("Connections at risk", "h3")
connTag = Tag("4 at risk", null, null, "danger")
connList = ListBlock([conn1, conn2, conn3, conn4])
conn1 = ListItem("UA 883 → UA 245 to SFO", "38 min connection · gate C4 → C9 · tight")
conn2 = ListItem("BA 195 → BA 178 to MAN", "25 min connection · gate E2 → E5 · will be missed")
conn3 = ListItem("AA 1204 → AA 312 to MIA", "30 min connection · gate C4 → A12 · inbound late")
conn4 = ListItem("AC 875 → AC 101 to YVR", "Canceled inbound · 32 passengers affected")
actions = Card([rebookDialog, hubDialog], "clear", "row", "m")
rebookDialog = DialogBlock("Rebook affected passengers", "Rebook passengers", "Find a passenger on a delayed or canceled flight and rebook them onto a new connection.", [rebookForm])
rebookForm = Form("rebook", rebookButtons, [flightField, paxField, optionField])
flightField = FormControl("Flight", flightSelect)
flightSelect = Select("flight", [optAA, optUA, optBA, optAC], "Select delayed or canceled flight")
optAA = SelectItem("AA1204", "AA 1204 · DFW → LAX · delayed")
optUA = SelectItem("UA883", "UA 883 · DFW → ORD · delayed")
optBA = SelectItem("BA195", "BA 195 · DFW → LHR · delayed")
optAC = SelectItem("AC875", "AC 875 · DFW → YYZ · canceled")
paxField = FormControl("Passenger", paxInput, "Booking reference or passenger name")
paxInput = Input("passenger", "e.g. SR-48293 or J. Smith")
optionField = FormControl("Rebook option", optionRadio)
optionRadio = RadioGroup("option", [optNext, optSame, optAny])
optNext = RadioItem("Next available", "Earliest flight with open seats", "next")
optSame = RadioItem("Same airline", "Any flight on the same carrier today", "same")
optAny = RadioItem("Any airline", "Include partner and interline options", "any")
rebookButtons = Buttons([rebookBtn, rebookCancelBtn])
rebookBtn = Button("Rebook passenger", null, "primary")
rebookCancelBtn = Button("Cancel", null, "tertiary")
hubDialog = DialogBlock("Switch hub", "Choose a hub", "Reload the operations desk for a different hub.", [hubForm], "outline")
hubForm = Form("hub", hubButtons, [hubField])
hubField = FormControl("Hub", hubSelect, "Dashboard reloads for the selected hub")
hubSelect = Select("hub", [hubDfw, hubOrd, hubAtl, hubLax], "Choose a hub")
hubDfw = SelectItem("dfw", "Dallas/Fort Worth (DFW)")
hubOrd = SelectItem("ord", "Chicago O'Hare (ORD)")
hubAtl = SelectItem("atl", "Atlanta (ATL)")
hubLax = SelectItem("lax", "Los Angeles (LAX)")
hubButtons = Buttons([hubSwitchBtn])
hubSwitchBtn = Button("Switch hub", null, "primary")