root = Card([header, summaryRow, weatherCallout, delayedCallout, flightOpsCard, opsGrid, hubSwitcherCard, rebookDrawer], "card", "column", "l")
header = CardHeader("Hub Operations Desk — ATL", "Tuesday, May 21 · All times local · Updated 14:05")
summaryRow = Card([perfCard, loadCard, turnCard, cancelCard], "clear", "row", "m", "stretch")
perfCard = Card([perfHeading, perfMetric, perfChart], "sunk", "column", "s")
perfHeading = Heading("On-time performance today", "h3")
perfMetric = TextContent("87.4% of departures", "large-heavy")
perfChart = SingleStackedBarChart(["On time", "Delayed", "Cancelled"], [264, 32, 6])
loadCard = Card([loadHeading, loadMetric, loadProgress], "sunk", "column", "s")
loadHeading = Heading("Avg passenger load today", "h3")
loadMetric = TextContent("92.3%", "large-heavy")
loadProgress = Progress(92.3, "Load factor")
turnCard = Card([turnHeading, turnMetric, turnVsTarget], "sunk", "column", "s")
turnHeading = Heading("Avg turnaround time", "h3")
turnMetric = TextContent("38 min", "large-heavy")
turnVsTarget = Tag("4 min faster than target", null, null, "success")
cancelCard = Card([cancelHeading, cancelMetric, cancelTag], "sunk", "column", "s")
cancelHeading = Heading("Cancellations today", "h3")
cancelMetric = TextContent("6", "large-heavy")
cancelTag = Tag("Weather related", null, null, "warning")
weatherCallout = Callout("warning", "Weather advisory — thunderstorms near ATL", "Heavy cells moving along the I-85 corridor from 14:30 local. Expect ground stops and holding. Inbound banks A and B may be delayed 30–60 min.")
delayedCallout = Callout("warning", "6 delayed departures right now", "Average delay 42 min. DL 118, DL 533 and DL 690 are outside their wheels-up window. Reroute crews if needed.")
flightOpsCard = Card([flightHeading, flightTable], "sunk", "column", "s")
flightHeading = Heading("Departures and arrivals", "h3")
flightTable = Table([flightNum, flightRoute, flightGate, flightStatus])
flightNum = Col("Flight", ["DL 410", "DL 722", "DL 118", "DL 209", "DL 533", "DL 864", "DL 371", "DL 225", "DL 690", "DL 517"])
flightRoute = Col("Route", ["ATL–JFK", "ATL–LAX", "ATL–ORD", "ATL–MIA", "ATL–SFO", "ATL–SEA", "ATL–LGA", "ATL–DFW", "ATL–BOS", "ATL–DEN"])
flightGate = Col("Gate", ["A12", "B7", "C19", "D4 → D6", "A3", "E22", "B14", "C9", "A8", "D17"])
flightStatus = Col("Status", ["On time", "Boarding", "Delayed 38 min", "On time", "Delayed 25 min", "On time", "Cancelled", "On time", "Delayed 52 min", "On time"])
opsGrid = Card([gateCrewCard, riskCard], "clear", "row", "m", "stretch")
gateCrewCard = Card([gateHeading, gateChanges, crewHeading, crewTable], "sunk", "column", "m")
gateHeading = Heading("Recent gate changes", "h3")
gateChanges = ListBlock([gate1, gate2, gate3], "number")
gate1 = ListItem("DL 209 — D4 to D6", "Departs 14:35 · updated 12:18")
gate2 = ListItem("DL 722 — B7 to B12", "Departs 15:00 · updated 13:02")
gate3 = ListItem("DL 864 — E22 to E18", "Departs 15:10 · updated 13:41")
crewHeading = Heading("Crews available for reassignment", "h3")
crewTable = Table([crewId, crewRole, crewBase, crewReady])
crewId = Col("Crew ID", ["CRW-118", "CRW-204", "CRW-337", "CRW-451", "CRW-529"])
crewRole = Col("Role", ["Captain", "First Officer", "Flight Attendant", "Flight Attendant", "Captain"])
crewBase = Col("Base", ["ATL", "ATL", "ATL", "MSP", "ATL"])
crewReady = Col("Available", ["Yes", "Yes", "Yes", "Yes", "Yes"])
riskCard = Card([riskHeading, riskTable, riskNote], "sunk", "column", "m")
riskHeading = Heading("Connections at risk", "h3")
riskTable = Table([riskArriving, riskConnecting, riskPax, riskBuffer])
riskArriving = Col("Arriving", ["DL 410", "DL 722", "DL 118"])
riskConnecting = Col("Connection", ["DL 209", "DL 533", "DL 864"])
riskPax = Col("Pax", [18, 12, 9])
riskBuffer = Col("Buffer", ["< 15 min", "< 20 min", "< 25 min"])
riskNote = TextCallout("warning", "Reassign gates", "Move DL 410 closer to D concourse to protect 18 connections.")
hubSwitcherCard = Card([hubHeading, hubForm], "sunk", "column", "s")
hubHeading = Heading("Switch operations hub", "h3")
hubForm = Form("hub-switch", hubButtons, [hubSelectField])
hubSelectField = FormControl("View hub", hubSelect, "Choose a different hub to monitor")
hubSelect = Select("hub", [hubAtl, hubMsp, hubLga], "Select hub")
hubAtl = SelectItem("ATL", "Atlanta — ATL")
hubMsp = SelectItem("MSP", "Minneapolis — MSP")
hubLga = SelectItem("LGA", "New York — LGA")
hubButtons = Buttons([hubSwitchBtn])
hubSwitchBtn = Button("Switch hub", null, "primary")
rebookDrawer = DrawerBlock("Rebook affected passengers", "Rebook affected passengers", "Select an affected flight and choose an alternative.", [rebookForm], "secondary")
rebookForm = Form("rebook", rebookButtons, [rebookFlightField, rebookAltField, rebookPaxField])
rebookButtons = Buttons([rebookSubmit, rebookCancel])
rebookSubmit = Button("Rebook", null, "primary")
rebookCancel = Button("Cancel", null, "tertiary")
rebookFlightField = FormControl("Affected flight", rebookFlightSelect, "Delayed or cancelled departure")
rebookFlightSelect = Select("affected_flight", [rebookOpt118, rebookOpt533, rebookOpt690], "Choose flight")
rebookOpt118 = SelectItem("DL 118", "DL 118 — ATL–ORD")
rebookOpt533 = SelectItem("DL 533", "DL 533 — ATL–SFO")
rebookOpt690 = SelectItem("DL 690", "DL 690 — ATL–BOS")
rebookAltField = FormControl("Alternate flight", rebookAltSelect, "Choose a new connection")
rebookAltSelect = Select("alternate_flight", [altOpt209, altOpt864, altOpt517], "Choose alternative")
altOpt209 = SelectItem("DL 209", "DL 209 — ATL–MIA (14:35)")
altOpt864 = SelectItem("DL 864", "DL 864 — ATL–SEA (15:10)")
altOpt517 = SelectItem("DL 517", "DL 517 — ATL–DEN (16:05)")
rebookPaxField = FormControl("Passenger count", rebookPaxInput, "Number of passengers to rebook")
rebookPaxInput = Input("pax_count", "Enter number", "number")