root = Card([header, hubSelector, kpiRow, flightsTable, delayedCallout, gateChanges, crewsAvailable, weatherAdvisory, connectionsAtRisk, rebookActions, followUps])
header = CardHeader("Hub Operations Desk", "Real-time flight and resource management")
hubSelector = Form("hub-select", hubButtons, [hubField])
hubField = FormControl("Select Hub", hubSelect, "Switch to view another hub's operations")
hubSelect = Select("hub", hubOptions, "Choose hub", null, "medium")
hubOptions = [optJFK, optLAX, optORD, optATL, optDFW]
optJFK = SelectItem("JFK", "New York JFK")
optLAX = SelectItem("LAX", "Los Angeles")
optORD = SelectItem("ORD", "Chicago O'Hare")
optATL = SelectItem("ATL", "Atlanta")
optDFW = SelectItem("DFW", "Dallas/Fort Worth")
hubButtons = Buttons([refreshBtn])
refreshBtn = Button("Refresh Data", null, "secondary")
kpiRow = Card([otpCard, cancelCard, loadCard, turnaroundCard], "clear", "row", "m", "stretch", "start", true)
otpCard = Card([otpLabel, otpValue], "sunk", "column", "s", "center")
otpLabel = TextContent("On-Time Performance", "small")
otpValue = TextContent("78%", "large-heavy")
cancelCard = Card([cancelLabel, cancelValue], "sunk", "column", "s", "center")
cancelLabel = TextContent("Cancellations Today", "small")
cancelValue = TextContent("12", "large-heavy")
loadCard = Card([loadLabel, loadValue], "sunk", "column", "s", "center")
loadLabel = TextContent("Avg Passenger Load", "small")
loadValue = TextContent("84%", "large-heavy")
turnaroundCard = Card([turnLabel, turnValue], "sunk", "column", "s", "center")
turnLabel = TextContent("Avg Turnaround Time", "small")
turnValue = TextContent("42 min", "large-heavy")
flightsTable = Card([flightsHeading, flightsTableComp], "card")
flightsHeading = Heading("Active Flights", "h3")
flightsTableComp = Table([colNum, colRoute, colGate, colStatus, colDep, colArr])
colNum = Col("Flight", ["AA102", "AA245", "AA310", "AA408", "AA521", "AA637", "AA714", "AA890", "AA923", "AA156"])
colRoute = Col("Route", ["JFK→LAX", "JFK→LHR", "JFK→SFO", "JFK→MIA", "JFK→ORD", "JFK→ATL", "JFK→DFW", "JFK→SEA", "JFK→LAS", "JFK→DEN"])
colGate = Col("Gate", ["B12", "B18", "C04", "A22", "B09", "C11", "A15", "B24", "C07", "A03"])
colStatus = Col("Status", ["On Time", "Delayed", "On Time", "Boarding", "Delayed", "On Time", "Gate Change", "On Time", "Delayed", "Cancelled"])
colDep = Col("Scheduled Dep", ["08:15", "09:30", "10:45", "11:20", "12:05", "13:40", "14:55", "15:30", "16:10", "17:45"])
colArr = Col("Scheduled Arr", ["11:30", "21:15", "13:55", "14:35", "14:20", "16:55", "18:10", "18:45", "19:25", "21:00"])
delayedCallout = Callout("warning", "Delayed Flights Requiring Attention", "3 flights currently delayed: AA245 (JFK→LHR, 45 min), AA521 (JFK→ORD, 28 min), AA923 (JFK→LAS, 62 min). AA156 cancelled — rebook 142 passengers.")
gateChanges = Card([gateHeading, gateList], "card")
gateHeading = Heading("Recent Gate Changes", "h3")
gateList = ListBlock([gate1, gate2, gate3, gate4], "number")
gate1 = ListItem("AA714 JFK→DFW", "Gate A15 → B24 (15 min ago)", null, "Notify Crew")
gate2 = ListItem("AA310 JFK→SFO", "Gate C04 → C09 (32 min ago)", null, "Notify Crew")
gate3 = ListItem("AA408 JFK→MIA", "Gate A22 → A18 (47 min ago)", null, "Notify Crew")
gate4 = ListItem("AA637 JFK→ATL", "Gate C11 → B14 (1 hr 12 min ago)", null, "Notify Crew")
crewsAvailable = Card([crewHeading, crewTable], "card")
crewHeading = Heading("Crews Available for Reassignment", "h3")
crewTable = Table([colCrewId, colRole, colCurrent, colHours, colQual])
colCrewId = Col("Crew ID", ["CRW-204", "CRW-311", "CRW-189", "CRW-256", "CRW-402"])
colRole = Col("Role", ["Captain", "First Officer", "Purser", "Flight Attendant", "Captain"])
colCurrent = Col("Current Assignment", ["Standby", "Standby", "AA102 (Complete)", "AA245 (Delayed)", "Standby"])
colHours = Col("Duty Hours Used", ["2.5", "3.0", "8.5", "6.0", "1.5"])
colQual = Col("Qualified Fleet", ["B777/B787", "B777/B787", "A321/B737", "A321/B737", "A320/A321"])
weatherAdvisory = Callout("info", "Weather Advisory — JFK", "Wind 280° at 18 kts gusting 25 kts. Visibility 8 SM. Light rain showers possible 14:00-18:00Z. Runway 31L/13R wet. Expect minor departure delays 15-20 min.")
connectionsAtRisk = Card([connHeading, connTable], "card")
connHeading = Heading("Connections at Risk of Missed Connection", "h3")
connTable = Table([colConnFlight, colConnPax, colConnFrom, colConnTo, colConnTime, colConnRisk])
colConnFlight = Col("Inbound Flight", ["AA245", "AA521", "AA923"])
colConnPax = Col("Connecting Pax", ["28", "15", "34"])
colConnFrom = Col("From", ["LHR", "ORD", "LAS"])
colConnTo = Col("To", ["MIA (AA408)", "ATL (AA637)", "DEN (AA156*)"])
colConnTime = Col("Connection Window", ["42 min", "35 min", "55 min"])
colConnRisk = Col("Risk Level", ["HIGH", "HIGH", "MEDIUM"])
rebookActions = Card([rebookHeading, rebookForm], "card")
rebookHeading = Heading("Rebook Affected Passengers", "h3")
rebookForm = Form("rebook", rebookButtons, [rebookFlight, rebookPax, rebookNewFlight, rebookNotify])
rebookFlight = FormControl("Affected Flight", rebookFlightSelect, "Select the delayed/cancelled flight")
rebookFlightSelect = Select("affected_flight", rebookFlightOpts, "Choose flight", null, "medium")
rebookFlightOpts = [rbOpt245, rbOpt521, rbOpt923, rbOpt156]
rbOpt245 = SelectItem("AA245", "AA245 JFK→LHR (Delayed 45 min)")
rbOpt521 = SelectItem("AA521", "AA521 JFK→ORD (Delayed 28 min)")
rbOpt923 = SelectItem("AA923", "AA923 JFK→LAS (Delayed 62 min)")
rbOpt156 = SelectItem("AA156", "AA156 JFK→DEN (Cancelled)")
rebookPax = FormControl("Passengers to Rebook", rebookPaxInput, "Number of passengers needing rebooking")
rebookPaxInput = Input("pax_count", "Enter count", "number")
rebookNewFlight = FormControl("Alternate Flight", rebookNewSelect, "Select available alternate flight")
rebookNewSelect = Select("new_flight", rebookNewOpts, "Choose alternate", null, "medium")
rebookNewOpts = [rnOpt1, rnOpt2, rnOpt3, rnOpt4]
rnOpt1 = SelectItem("AA408+1", "AA408 JFK→MIA (14:35 dep) + AA112 MIA→LHR (18:20 dep)")
rnOpt2 = SelectItem("AA637+1", "AA637 JFK→ATL (16:55 dep) + AA203 ATL→ORD (19:30 dep)")
rnOpt3 = SelectItem("AA890+1", "AA890 JFK→SEA (18:45 dep) + AA305 SEA→LAS (22:10 dep)")
rnOpt4 = SelectItem("AA923+1", "AA923 JFK→LAS (19:25 dep, delayed) — next avail AA1187 (06:00+1)")
rebookNotify = FormControl("Notification Method", rebookNotifyRadio, "How to notify passengers")
rebookNotifyRadio = RadioGroup("notify_method", [rnSMS, rnEmail, rnApp, rnAll])
rnSMS = RadioItem("SMS", "Send SMS to passenger phone", "sms")
rnEmail = RadioItem("Email", "Send email to passenger address", "email")
rnApp = RadioItem("Mobile App", "Push notification via airline app", "app")
rnAll = RadioItem("All Channels", "SMS + Email + App notification", "all")
rebookButtons = Buttons([rebookSubmit, rebookPreview])
rebookSubmit = Button("Execute Rebooking", null, "primary")
rebookPreview = Button("Preview Changes", null, "secondary")
followUps = FollowUpBlock([fu1, fu2, fu3, fu4])
fu1 = FollowUpItem("Show me the full delay cascade impact for JFK today")
fu2 = FollowUpItem("List all crew members approaching duty time limits")
fu3 = FollowUpItem("Generate the irregular operations report for the last 24 hours")
fu4 = FollowUpItem("What's the forecast for the next 6 hours at JFK?")