root = Card([header, hubSelector, kpiBlock, weatherAlert, tabsBlock, rebookForm, followUps])
header = CardHeader("Hub Operations Desk — ORD", "Chicago O'Hare · Live Operations View · Updated 14:22 CDT")
hubSelector = FormControl("Select Hub", hubSelect, "Switch to view another hub's operations")
hubSelect = Select("hub-select", [hubOrd, hubAtl, hubDfw, hubLax, hubDen], "Choose hub", { required: true })
hubOrd = SelectItem("ORD", "ORD — Chicago O'Hare")
hubAtl = SelectItem("ATL", "ATL — Atlanta Hartsfield-Jackson")
hubDfw = SelectItem("DFW", "DFW — Dallas/Fort Worth")
hubLax = SelectItem("LAX", "LAX — Los Angeles")
hubDen = SelectItem("DEN", "DEN — Denver")
kpiBlock = SnippetCardBlock([kpiOtp, kpiLoad, kpiCancel, kpiTurn], "grid", true)
kpiOtp = SnippetCardItem("otp", kpiOtpLhs, kpiOtpRhs)
kpiOtpLhs = IconText(kpiOtpIcon, "success", "m", "On-Time Performance", "Departures within 15 min", false, "horizontal")
kpiOtpIcon = Icon("check-circle", "status")
kpiOtpRhs = BoldText("number", "84.2%", "+2.1% vs yesterday", "metric")
kpiLoad = SnippetCardItem("load", kpiLoadLhs, kpiLoadRhs)
kpiLoadLhs = IconText(kpiLoadIcon, "neutral", "m", "Avg Passenger Load", "System-wide load factor", false, "horizontal")
kpiLoadIcon = Icon("users", "people")
kpiLoadRhs = BoldText("number", "87.4%", "+0.8% vs last week", "metric")
kpiCancel = SnippetCardItem("cancel", kpiCancelLhs, kpiCancelRhs)
kpiCancelLhs = IconText(kpiCancelIcon, "danger", "m", "Cancellations Today", "Flights cancelled so far", false, "horizontal")
kpiCancelIcon = Icon("x-circle", "status")
kpiCancelRhs = BoldText("number", "12", "3 weather · 9 operational", "text")
kpiTurn = SnippetCardItem("turn", kpiTurnLhs, kpiTurnRhs)
kpiTurnLhs = IconText(kpiTurnIcon, "neutral", "m", "Avg Turnaround Time", "Gate arrival to departure", false, "horizontal")
kpiTurnIcon = Icon("rotate-ccw", "time")
kpiTurnRhs = BoldText("number", "42 min", "-3 min vs target", "metric")
weatherAlert = Callout("warning", "Weather Advisory — ORD", "Convective SIGMET active until 18:00 CDT. Scattered thunderstorms with gusts to 45 kts. Expect 30-45 min departure delays. Runway 22L/4R closed for braking action reports.", true)
tabsBlock = Tabs([tabFlights, tabDelays, tabGates, tabCrews, tabConnections, tabCancels])
tabFlights = TabItem("flights", "All Flights", [flightsTable])
flightsTable = Table([colFlight, colRoute, colGate, colStatus, colEtd, colLoad])
colFlight = Col("Flight", flightNums, "string")
colRoute = Col("Route", routes, "string")
colGate = Col("Gate", gates, "string")
colStatus = Col("Status", statuses, "string")
colEtd = Col("ETD / ATD", etdValues, "string")
colLoad = Col("Load", loadValues, "string")
flightNums = ["UA 124", "UA 305", "UA 782", "UA 156", "UA 419", "UA 228", "UA 591", "UA 87", "UA 334", "UA 612", "UA 198", "UA 450", "UA 723", "UA 289", "UA 567"]
routes = ["ORD→LAX", "ORD→JFK", "ORD→SFO", "ORD→MIA", "ORD→DEN", "ORD→SEA", "ORD→BOS", "ORD→LAS", "ORD→PHX", "ORD→IAH", "ORD→ATL", "ORD→SAN", "ORD→TPA", "ORD→MSP", "ORD→PDX"]
gates = ["B12", "C18", "B24", "C5", "B8", "C22", "B15", "C3", "B20", "C11", "B3", "C27", "B10", "C14", "B17"]
statuses = ["On Time", "On Time", "Delayed", "On Time", "Boarding", "On Time", "Delayed", "On Time", "On Time", "Boarding", "Delayed", "On Time", "On Time", "On Time", "Delayed"]
etdValues = ["14:30", "14:45", "15:20", "15:00", "15:10", "15:30", "15:55", "14:50", "16:00", "16:15", "16:30", "15:40", "16:45", "16:20", "17:00"]
loadValues = ["92%", "78%", "85%", "95%", "88%", "73%", "91%", "82%", "89%", "76%", "94%", "81%", "87%", "79%", "90%"]
tabDelays = TabItem("delays", "Delayed Flights", [delayHeader, delaysTable, delaySummary])
delayHeader = InlineHeader("Flights Currently Delayed", "7 flights delayed — 3 weather, 2 crew, 2 ATC")
delaysTable = Table([colDFlight, colDRoute, colDGate, colDReason, colDDelay, colDNewTime])
colDFlight = Col("Flight", dFlightNums, "string")
colDRoute = Col("Route", dRoutes, "string")
colDGate = Col("Gate", dGates, "string")
colDReason = Col("Reason", dReasons, "string")
colDDelay = Col("Delay", dDelays, "string")
colDNewTime = Col("New ETD", dNewTimes, "string")
dFlightNums = ["UA 782", "UA 591", "UA 334", "UA 198", "UA 567", "UA 124", "UA 450"]
dRoutes = ["ORD→SFO", "ORD→BOS", "ORD→PHX", "ORD→ATL", "ORD→PDX", "ORD→LAX", "ORD→SAN"]
dGates = ["B24", "B15", "B20", "B3", "B17", "B12", "C27"]
dReasons = ["Weather", "Crew", "ATC", "Weather", "Weather", "ATC", "Crew"]
dDelays = ["+45 min", "+30 min", "+25 min", "+60 min", "+40 min", "+20 min", "+35 min"]
dNewTimes = ["15:20", "15:55", "16:30", "16:30", "17:00", "14:50", "16:15"]
delaySummary = EntityList([ds1, ds2, ds3], "default", { left: "Category", right: "Count", rightVariant: "number" })
ds1 = { left: "Weather Delays", right: "3", rightVariant: "number" }
ds2 = { left: "Crew Delays", right: "2", rightVariant: "number" }
ds3 = { left: "ATC Delays", right: "2", rightVariant: "number" }
tabGates = TabItem("gates", "Gate Changes", [gateHeader, gateChangesList])
gateHeader = InlineHeader("Recent Gate Changes (Last 2 Hours)", "6 gate changes — 3 weather-related, 2 operational, 1 equipment")
gateChangesList = ListBlock([gc1, gc2, gc3, gc4, gc5, gc6], "number")
gc1 = ListItem("UA 305 — ORD→JFK", "Gate C18 → C22 · Reason: Weather spacing · 13:45 CDT", null, null, { type: "continue_conversation", context: "Show details for UA 305 gate change" })
gc2 = ListItem("UA 419 — ORD→DEN", "Gate B8 → B12 · Reason: Equipment swap · 13:52 CDT", null, null, { type: "continue_conversation", context: "Show details for UA 419 gate change" })
gc3 = ListItem("UA 228 — ORD→SEA", "Gate C22 → C18 · Reason: ATC flow · 14:01 CDT", null, null, { type: "continue_conversation", context: "Show details for UA 228 gate change" })
gc4 = ListItem("UA 87 — ORD→LAS", "Gate C3 → C5 · Reason: Weather spacing · 14:08 CDT", null, null, { type: "continue_conversation", context: "Show details for UA 87 gate change" })
gc5 = ListItem("UA 612 — ORD→IAH", "Gate C11 → C14 · Reason: Operational · 14:12 CDT", null, null, { type: "continue_conversation", context: "Show details for UA 612 gate change" })
gc6 = ListItem("UA 289 — ORD→MSP", "Gate C14 → C11 · Reason: Weather spacing · 14:18 CDT", null, null, { type: "continue_conversation", context: "Show details for UA 289 gate change" })
tabCrews = TabItem("crews", "Crews Available", [crewHeader, crewsTable])
crewHeader = InlineHeader("Crews Available for Reassignment", "8 crews within 2-hour call window — 4 reserve, 4 deadhead")
crewsTable = Table([colCrewId, colCrewPos, colCrewBase, colCrewAvail, colCrewDuty, colCrewQual])
colCrewId = Col("Crew ID", crewIds, "string")
colCrewPos = Col("Position", crewPositions, "string")
colCrewBase = Col("Base", crewBases, "string")
colCrewAvail = Col("Available At", crewAvail, "string")
colCrewDuty = Col("Duty Remaining", crewDuty, "string")
colCrewQual = Col("Qualified Types", crewQuals, "string")
crewIds = ["CRW-4421", "CRW-3890", "CRW-5102", "CRW-2765", "CRW-6341", "CRW-1987", "CRW-4523", "CRW-3310"]
crewPositions = ["Captain", "First Officer", "Captain", "First Officer", "Captain", "First Officer", "Captain", "First Officer"]
crewBases = ["ORD", "ORD", "ORD", "ORD", "DEN", "DEN", "ORD", "ORD"]
crewAvail = ["Now", "Now", "14:45", "15:00", "15:30", "15:30", "15:45", "16:00"]
crewDuty = ["10:30", "10:30", "9:45", "9:30", "8:15", "8:15", "7:45", "7:30"]
crewQuals = ["737/777", "737/777", "737", "737", "737/787", "737/787", "777/787", "777/787"]
tabConnections = TabItem("connections", "Connections at Risk", [connHeader, connTable, connActions])
connHeader = InlineHeader("Tight Connections at Risk", "14 passengers on 6 inbound flights with <45 min connection time")
connTable = Table([colInbound, colPax, colConnecting, colMinTime, colRisk, colAction])
colInbound = Col("Inbound Flight", inboundFlights, "string")
colPax = Col("Pax", paxCounts, "number")
colConnecting = Col("Connecting To", connectingFlights, "string")
colMinTime = Col("Min Connect", minConnect, "string")
colRisk = Col("Risk Level", riskLevels, "string")
colAction = Col("Action", connActions, "string")
inboundFlights = ["UA 245 (DEN)", "UA 512 (SFO)", "UA 189 (LAX)", "UA 376 (SEA)", "UA 421 (PHX)", "UA 298 (LAS)"]
paxCounts = [3, 2, 4, 1, 2, 2]
connectingFlights = ["UA 305→JFK", "UA 782→SFO", "UA 156→MIA", "UA 419→DEN", "UA 228→SEA", "UA 591→BOS"]
minConnect = ["38 min", "42 min", "35 min", "44 min", "39 min", "41 min"]
riskLevels = ["High", "High", "Critical", "High", "High", "High"]
connActions = ["Hold UA 305", "Rebook pax", "Hold UA 156", "Rebook pax", "Hold UA 228", "Rebook pax"]
connActionsBlock = Buttons([btnHold305, btnRebook782, btnHold156], "row")
btnHold305 = Button("Hold UA 305", { type: "continue_conversation", context: "Hold UA 305 for connecting passengers from UA 245" }, "secondary", "small")
btnRebook782 = Button("Rebook UA 782 Pax", { type: "continue_conversation", context: "Rebook 2 passengers from UA 512 to next SFO flight" }, "secondary", "small")
btnHold156 = Button("Hold UA 156", { type: "continue_conversation", context: "Hold UA 156 for connecting passengers from UA 189" }, "secondary", "small")
tabCancels = TabItem("cancels", "Cancellations", [cancelHeader, cancelsTable, cancelImpact])
cancelHeader = InlineHeader("Cancellations Today", "12 flights cancelled — 3 weather, 9 operational (crew/mechanical)")
cancelsTable = Table([colCFlight, colCRoute, colCReason, colCPax, colCRecovery, colCStatus])
colCFlight = Col("Flight", cFlightNums, "string")
colCRoute = Col("Route", cRoutes, "string")
colCReason = Col("Reason", cReasons, "string")
colCPax = Col("Pax Affected", cPax, "number")
colCRecovery = Col("Recovery Plan", cRecovery, "string")
colCStatus = Col("Status", cStatus, "string")
cFlightNums = ["UA 102", "UA 267", "UA 389", "UA 445", "UA 512", "UA 678", "UA 734", "UA 891", "UA 923", "UA 156", "UA 278", "UA 341"]
cRoutes = ["ORD→LGA", "ORD→BOS", "ORD→DCA", "ORD→EWR", "ORD→SFO", "ORD→IAH", "ORD→ATL", "ORD→MIA", "ORD→TPA", "ORD→MIA", "ORD→MSP", "ORD→PDX"]
cReasons = ["Weather", "Crew", "Mechanical", "Weather", "Crew", "Mechanical", "Crew", "Crew", "Mechanical", "Weather", "Crew", "Mechanical"]
cPax = [142, 118, 156, 98, 134, 167, 123, 89, 145, 156, 112, 138]
cRecovery = ["Next day 06:00", "Next day 07:30", "Today 18:45", "Next day 06:30", "Today 19:20", "Next day 08:00", "Today 20:10", "Next day 07:00", "Next day 09:30", "Today 19:45", "Today 18:30", "Next day 08:45"]
cStatus = ["Rebooking", "Rebooking", "Rebooking", "Rebooking", "Rebooking", "Rebooking", "Rebooking", "Rebooking", "Rebooking", "Rebooking", "Rebooking", "Rebooking"]
cancelImpact = EntityList([ci1, ci2, ci3], "default", { left: "Metric", right: "Value", rightVariant: "number" })
ci1 = { left: "Total Passengers Affected", right: "1,578", rightVariant: "number" }
ci2 = { left: "Rebooked So Far", right: "892 (56.5%)", rightVariant: "number" }
ci3 = { left: "Hotel Vouchers Issued", right: "234", rightVariant: "number" }
rebookForm = Form("rebook-passengers", rebookButtons, [fcFlight, fcPaxCount, fcNewFlight, fcNotes])
rebookButtons = Buttons([btnRebookSubmit, btnRebookSkip], "row")
btnRebookSubmit = Button("Rebook Passengers", { type: "continue_conversation", context: "Process rebooking for selected passengers" }, "primary")
btnRebookSkip = Button("Cancel", { type: "continue_conversation", context: "Cancel rebooking form" }, "tertiary")
fcFlight = FormControl("Affected Flight", rebookFlightSelect, "Select the cancelled or delayed flight")
rebookFlightSelect = Select("affected-flight", [rf1, rf2, rf3, rf4, rf5, rf6, rf7, rf8, rf9, rf10, rf11, rf12], "Choose flight", { required: true })
rf1 = SelectItem("UA 102", "UA 102 — ORD→LGA (Cancelled)")
rf2 = SelectItem("UA 267", "UA 267 — ORD→BOS (Cancelled)")
rf3 = SelectItem("UA 389", "UA 389 — ORD→DCA (Cancelled)")
rf4 = SelectItem("UA 445", "UA 445 — ORD→EWR (Cancelled)")
rf5 = SelectItem("UA 512", "UA 512 — ORD→SFO (Cancelled)")
rf6 = SelectItem("UA 678", "UA 678 — ORD→IAH (Cancelled)")
rf7 = SelectItem("UA 734", "UA 734 — ORD→ATL (Cancelled)")
rf8 = SelectItem("UA 891", "UA 891 — ORD→MIA (Cancelled)")
rf9 = SelectItem("UA 923", "UA 923 — ORD→TPA (Cancelled)")
rf10 = SelectItem("UA 156", "UA 156 — ORD→MIA (Cancelled)")
rf11 = SelectItem("UA 278", "UA 278 — ORD→MSP (Cancelled)")
rf12 = SelectItem("UA 341", "UA 341 — ORD→PDX (Cancelled)")
fcPaxCount = FormControl("Passengers to Rebook", paxInput, "Number of passengers from this flight needing rebooking")
paxInput = Input("pax-count", "e.g. 5", "number", { required: true, min: 1, max: 180 })
fcNewFlight = FormControl("Rebook Onto", newFlightSelect, "Select next available flight with capacity")
newFlightSelect = Select("new-flight", [nf1, nf2, nf3, nf4, nf5], "Choose replacement flight", { required: true })
nf1 = SelectItem("UA 305+1", "UA 305 (ORD→JFK) — Next day 06:00 · 12 seats")
nf2 = SelectItem("UA 782+1", "UA 782 (ORD→SFO) — Today 19:20 · 8 seats")
nf3 = SelectItem("UA 156+1", "UA 156 (ORD→MIA) — Today 19:45 · 15 seats")
nf4 = SelectItem("UA 419+1", "UA 419 (ORD→DEN) — Today 18:30 · 22 seats")
nf5 = SelectItem("UA 228+1", "UA 228 (ORD→SEA) — Today 20:10 · 18 seats")
fcNotes = FormControl("Special Instructions", notesArea, "Hotel, meal vouchers, ground transport, etc.")
notesArea = TextArea("rebook-notes", "e.g. Issue hotel vouchers for overnight, provide meal cards, arrange ground transport to hotel", 3)
followUps = FollowUpBlock([fu1, fu2, fu3, fu4])
fu1 = FollowUpItem("Show me the delay trend for the last 7 days at ORD")
fu2 = FollowUpItem("Which crews are approaching duty limits?")
fu3 = FollowUpItem("What's the forecast for ORD through tomorrow?")
fu4 = FollowUpItem("Generate the end-of-day operations report for ORD")