root = Card([header, hubForm, kpiSection, alertsSection, flightsSection, gateSection, crewSection, connSection, rebookSection], "card", "column", "l")
header = CardHeader("Hub Operations Desk", "JFK International · Live operations")
hubForm = Form("hub-selector", hubButtons, [hubField])
hubField = FormControl("Active hub", hubSelect, "Switching updates the whole desk")
hubSelect = Select("hub", [hubJFK, hubATL, hubDFW], "Choose hub", null, "jfk")
hubJFK = SelectItem("jfk", "JFK — New York")
hubATL = SelectItem("atl", "ATL — Atlanta")
hubDFW = SelectItem("dfw", "DFW — Dallas/Fort Worth")
hubButtons = Buttons([switchHubBtn])
switchHubBtn = Button("Switch hub", null, "primary")
kpiSection = Card([kpiTitle, kpiTable], "sunk")
kpiTitle = Heading("Key metrics today", "h3")
kpiTable = Table([kpiMetric, kpiValue])
kpiMetric = Col("Metric", ["On-time performance", "Avg passenger load", "Cancellations today", "Avg turnaround time"])
kpiValue = Col("Value", ["87.4%", "82%", "6", "41 min"])
alertsSection = Card([delayedCallout, cancellationCallout, weatherCallout], "sunk")
delayedCallout = Callout("warning", "Delayed flights", "5 flights delayed — DL 214 +45 min, UA 118 +38 min, AA 92 +35 min, AF 88 +20 min, KL 612 +15 min.")
cancellationCallout = Callout("error", "Cancellations today", "6 cancelled — DL 317 (ATL), UA 88 (ORD), AA 141 (DFW), BA 178 (LHR), LH 405 (FRA), EK 203 (DXB). Rebooking in progress.")
weatherCallout = Callout("info", "Weather advisory", "Thunderstorm cells within 30 nm of JFK until 17:00 ET. Arrivals holding 20–40 min; possible ground stop for general aviation.")
flightsSection = Card([flightsTitle, flightsTable], "sunk")
flightsTitle = Heading("Flights", "h3")
flightsTable = Table([flightNum, flightRoute, flightGate, flightStatus])
flightNum = Col("Flight", ["DL 214", "UA 118", "AA 92", "AF 88", "KL 612", "AC 731", "QF 12", "BA 178", "LH 405", "EK 203"])
flightRoute = Col("Route", ["JFK → LAX", "JFK → SFO", "JFK → MIA", "JFK → CDG", "JFK → AMS", "JFK → YYZ", "JFK → SYD", "JFK → LHR", "JFK → FRA", "JFK → DXB"])
flightGate = Col("Gate", ["B22", "C14", "A7", "B8", "C3", "A15", "B11", "B4", "C19", "A12"])
flightStatus = Col("Status", ["Delayed 45m", "Delayed 38m", "Delayed 35m", "Delayed 20m", "Delayed 15m", "Boarding", "On time", "Cancelled", "Cancelled", "Cancelled"])
gateSection = Card([gateTitle, gateChangeList], "sunk")
gateTitle = Heading("Recent gate changes", "h3")
gateChangeList = ListBlock([gc1, gc2, gc3, gc4], "number")
gc1 = ListItem("DL 214", "B12 → B22 · 14:05")
gc2 = ListItem("UA 118", "D5 → C14 · 13:55")
gc3 = ListItem("AA 92", "A3 → A7 · 13:50")
gc4 = ListItem("KL 612", "C8 → C3 · 13:42")
crewSection = Card([crewTitle, crewTable], "sunk")
crewTitle = Heading("Crews available for reassignment", "h3")
crewTable = Table([crewId, crewRole, crewBase, crewReady])
crewId = Col("Crew", ["CRW-07", "CRW-12", "CRW-03", "CRW-19"])
crewRole = Col("Crew type", ["Cabin (6)", "Flight deck (2)", "Cabin (8)", "Flight deck (2)"])
crewBase = Col("Base", ["JFK", "JFK", "JFK", "JFK"])
crewReady = Col("Available", ["14:30", "15:00", "Immediate", "16:00"])
connSection = Card([connTitle, connectionsTable], "sunk")
connTitle = Heading("Connections at risk", "h3")
connectionsTable = Table([connFrom, connTo, connTime, connPax, connRisk])
connFrom = Col("Inbound", ["DL 214", "UA 118", "AA 92", "AF 88"])
connTo = Col("Connecting to", ["DL 400 → LAX", "UA 227 → SFO", "AA 111 → MIA", "AF 6 → CDG"])
connTime = Col("Time to departure", ["35 min", "28 min", "52 min", "22 min"])
connPax = Col("Pax", ["14", "9", "18", "7"])
connRisk = Col("Risk", ["High", "High", "Medium", "High"])
rebookSection = Card([rebookTitle, rebookDialog], "sunk")
rebookTitle = Heading("Rebook affected passengers", "h3")
rebookDialog = DialogBlock("Open rebooking", "Rebook affected passengers", "Find an alternate itinerary for passengers at risk of missing their connection.", [rebookForm])
rebookForm = Form("rebook-form", rebookButtons, [paxField, altField])
paxField = FormControl("Passenger or booking", paxInput, "Enter confirmation code or name")
paxInput = Input("booking_ref", "e.g. CONF-8342")
altField = FormControl("Alternate flight", altSelect)
altSelect = Select("alt_flight", [alt1, alt2, alt3], "Choose an alternate flight")
alt1 = SelectItem("dl402", "DL 402 · JFK → LAX · 16:20")
alt2 = SelectItem("ua227", "UA 227 · JFK → SFO · 15:45")
alt3 = SelectItem("aa117", "AA 117 · JFK → MIA · 17:10")
rebookButtons = Buttons([rebookBtn, cancelRebookBtn])
rebookBtn = Button("Confirm rebooking", null, "primary")
cancelRebookBtn = Button("Cancel", null, "tertiary")