root = Card([header, kpiRow, lineFocusTabs, andonAlerts, oeeCard, unitsTargetCard, energyCard, safetyCard, productionLinesTable, shiftComparisonChart, defectRateChart, downtimeCauseChart, maintenanceDueTable, qualityHoldsTable, workOrdersTable, stockCards, deliveriesTable, scheduleMaintenanceForm, exportButton], "card", "column", "l")
header = CardHeader("Factory Floor Supervisor Console", "Live production overview — Line 1 selected")
lineFocusTabs = Tabs([line1Tab, line2Tab, line3Tab, line4Tab])
line1Tab = TabItem("line-1", "Line 1", [TextContent("**Line 1** — Injection Molding • Status: Running • Rate: 1,240 units/hr • OEE: 87% • Active alerts: 0")])
line2Tab = TabItem("line-2", "Line 2", [TextContent("**Line 2** — Assembly • Status: Running • Rate: 980 units/hr • OEE: 91% • Active alerts: 1")])
line3Tab = TabItem("line-3", "Line 3", [TextContent("**Line 3** — Packaging • Status: Warning • Rate: 1,100 units/hr • OEE: 82% • Active alerts: 2")])
line4Tab = TabItem("line-4", "Line 4", [TextContent("**Line 4** — CNC Machining • Status: Stopped • Rate: 0 units/hr • OEE: 0% • Active alerts: 3")])
andonAlerts = Card([andonHeader, andonList], "sunk", "column", "m")
andonHeader = Heading("Live Andon Alerts", "h3")
andonList = Card([alert1, alert2, alert3], "clear", "column", "s")
alert1 = Callout("warning", "Line 3: Cycle time deviation", "Cycle time exceeded threshold by 12% — Operator acknowledged")
alert2 = Callout("error", "Line 4: Emergency stop", "E-stop triggered at Station 4 — Maintenance dispatched")
alert3 = Callout("info", "Line 2: Material low", "Resin hopper at 15% — Reorder triggered automatically")
kpiRow = Card([oeeCard, unitsTargetCard, energyCard, safetyCard], "clear", "row", "m", "stretch", "start", true)
oeeCard = Card([oeeTitle, oeeValue, oeeBreakdown], "card", "column", "s")
oeeTitle = Heading("Overall Equipment Effectiveness", "h4")
oeeValue = TextContent("**87%**", "large-heavy")
oeeBreakdown = TextContent("Availability: 92% • Performance: 95% • Quality: 99%")
unitsTargetCard = Card([unitsTitle, unitsProgress, unitsDetail], "card", "column", "s")
unitsTitle = Heading("Units Produced vs Target", "h4")
unitsProgress = Progress(78, "78% of daily target")
unitsDetail = TextContent("9,840 / 12,500 units • 2.3 hrs remaining")
energyCard = Card([energyTitle, energyValue, energyDetail], "card", "column", "s")
energyTitle = Heading("Energy Use Today", "h4")
energyValue = TextContent("**1,847 kWh**", "large-heavy")
energyDetail = TextContent("vs 1,620 kWh avg • +14% • Cost: $221.64")
safetyCard = Card([safetyTitle, safetyIncidents, safetyDays], "card", "column", "s")
safetyTitle = Heading("Safety", "h4")
safetyIncidents = TextContent("**3 incidents** this year", "large")
safetyDays = TextContent("**127 days** since last recordable incident")
productionLinesTable = Card([prodLinesHeader, prodLinesTable], "card", "column", "m")
prodLinesHeader = Heading("Production Lines", "h3")
prodLinesTable = Table([lineCol, statusCol, rateCol, oeeCol, targetCol, actualCol, alertsCol])
lineCol = Col("Line", ["Line 1", "Line 2", "Line 3", "Line 4"])
statusCol = Col("Status", ["Running", "Running", "Warning", "Stopped"])
rateCol = Col("Rate (units/hr)", [1240, 980, 1100, 0])
oeeCol = Col("OEE", ["87%", "91%", "82%", "0%"])
targetCol = Col("Daily Target", [12500, 9500, 11000, 8000])
actualCol = Col("Actual", [9840, 8920, 7650, 0])
alertsCol = Col("Active Alerts", [0, 1, 2, 3])
shiftComparisonChart = Card([shiftHeader, shiftChart], "card", "column", "m")
shiftHeader = Heading("Shift Output Comparison", "h3")
shiftChart = BarChart(["Day Shift", "Swing Shift", "Night Shift"], [shiftSeries1, shiftSeries2, shiftSeries3], "grouped", "Shift", "Units Produced")
shiftSeries1 = Series("Line 1", [4200, 3800, 1840])
shiftSeries2 = Series("Line 2", [3400, 3200, 2320])
shiftSeries3 = Series("Line 3", [2900, 2800, 1950])
defectRateChart = Card([defectHeader, defectChart], "card", "column", "m")
defectHeader = Heading("Defect Rate — Past 30 Days", "h3")
defectChart = LineChart(["W1", "W2", "W3", "W4", "W5"], [defectSeries], "natural", "Week", "Defect Rate (%)")
defectSeries = Series("Defect Rate", [1.2, 1.0, 1.4, 0.9, 1.1])
downtimeCauseChart = Card([downtimeHeader, downtimeChart], "card", "column", "m")
downtimeHeader = Heading("Downtime by Cause — This Month", "h3")
downtimeChart = PieChart(["Mechanical", "Electrical", "Material", "Changeover", "Planned", "Other"], [42, 18, 15, 12, 8, 5], "donut")
maintenanceDueTable = Card([maintHeader, maintTable], "card", "column", "m")
maintHeader = Heading("Machines Due for Maintenance", "h3")
maintTable = Table([mMachineCol, mTypeCol, mDueCol, mPriorityCol])
mMachineCol = Col("Machine", ["INJ-03", "ASM-07", "PKG-02", "CNC-05", "INJ-01"])
mTypeCol = Col("Type", ["Preventive", "Corrective", "Preventive", "Predictive", "Preventive"])
mDueCol = Col("Due Date", ["2025-01-20", "2025-01-18", "2025-01-22", "2025-01-19", "2025-01-25"])
mPriorityCol = Col("Priority", ["High", "Critical", "Medium", "High", "Low"])
qualityHoldsTable = Card([qualityHeader, qualityTable], "card", "column", "m")
qualityHeader = Heading("Batches on Quality Hold", "h3")
qualityTable = Table([qBatchCol, qLineCol, qReasonCol, qQtyCol, qSinceCol])
qBatchCol = Col("Batch ID", ["B-20250115-004", "B-20250114-022", "B-20250113-018"])
qLineCol = Col("Line", ["Line 3", "Line 1", "Line 4"])
qReasonCol = Col("Reason", ["Dimensional variance", "Surface finish", "Material contamination"])
qQtyCol = Col("Qty Held", [1200, 850, 2100])
qSinceCol = Col("Held Since", ["2025-01-15", "2025-01-14", "2025-01-13"])
workOrdersTable = Card([woHeader, woTable], "card", "column", "m")
woHeader = Heading("Open Work Orders", "h3")
woTable = Table([woIdCol, woMachineCol, woDescCol, woPriorityCol, woAssignedCol, woStatusCol])
woIdCol = Col("WO #", ["WO-2025-0412", "WO-2025-0411", "WO-2025-0410", "WO-2025-0409", "WO-2025-0408"])
woMachineCol = Col("Machine", ["INJ-03", "ASM-07", "CNC-05", "PKG-02", "INJ-01"])
woDescCol = Col("Description", ["Replace heating element", "Calibrate torque driver", "Spindle bearing replacement", "Seal kit replacement", "Nozzle cleaning"])
woPriorityCol = Col("Priority", ["High", "Critical", "High", "Medium", "Low"])
woAssignedCol = Col("Assigned To", ["M. Torres", "J. Chen", "R. Patel", "A. Kim", "M. Torres"])
woStatusCol = Col("Status", ["Scheduled", "In Progress", "Pending Parts", "Scheduled", "Scheduled"])
stockCards = Card([stockHeader, steelCard, resinCard, packagingCard], "card", "column", "m")
stockHeader = Heading("Raw Material Stock", "h3")
steelCard = Card([steelTitle, steelValue, steelDetail], "sunk", "column", "s")
steelTitle = Heading("Steel Coil", "h4")
steelValue = TextContent("**18.2 tons**", "large-heavy")
steelDetail = TextContent("Reorder at 5t • 12 days supply • Next delivery: Jan 22")
resinCard = Card([resinTitle, resinValue, resinDetail], "sunk", "column", "s")
resinTitle = Heading("Resin Pellets", "h4")
resinValue = TextContent("**4.7 tons**", "large-heavy")
resinDetail = TextContent("Reorder at 2t • 8 days supply • Next delivery: Jan 20")
packagingCard = Card([packTitle, packValue, packDetail], "sunk", "column", "s")
packTitle = Heading("Packaging Film", "h4")
packValue = TextContent("**12,400 rolls**", "large-heavy")
packDetail = TextContent("Reorder at 3,000 • 15 days supply • Next delivery: Jan 24")
deliveriesTable = Card([delHeader, delTable], "card", "column", "m")
delHeader = Heading("Supplier Deliveries This Week", "h3")
delTable = Table([delDateCol, delSupplierCol, delMaterialCol, delQtyCol, delStatusCol])
delDateCol = Col("Date", ["2025-01-20", "2025-01-20", "2025-01-22", "2025-01-24", "2025-01-24"])
delSupplierCol = Col("Supplier", ["Apex Metals", "PolySource", "Apex Metals", "FilmCo", "PolySource"])
delMaterialCol = Col("Material", ["Steel coil", "Resin pellets", "Steel coil", "Packaging film", "Resin pellets"])
delQtyCol = Col("Quantity", ["5 tons", "3 tons", "5 tons", "8,000 rolls", "2 tons"])
delStatusCol = Col("Status", ["Confirmed", "Confirmed", "Pending", "Confirmed", "Pending"])
scheduleMaintenanceForm = Card([schedHeader, schedForm], "card", "column", "m")
schedHeader = Heading("Schedule Maintenance", "h3")
schedForm = Form("schedule-maintenance", schedButtons, [machineField, typeField, dateField, priorityField, notesField])
machineField = FormControl("Machine", machineSelect, "Select equipment")
machineSelect = Select("machine", [mach1, mach2, mach3, mach4, mach5], "Choose machine")
mach1 = SelectItem("INJ-01", "INJ-01 — Injection Molding Line 1")
mach2 = SelectItem("INJ-02", "INJ-02 — Injection Molding Line 2")
mach3 = SelectItem("INJ-03", "INJ-03 — Injection Molding Line 3")
mach4 = SelectItem("ASM-07", "ASM-07 — Assembly Line 2")
mach5 = SelectItem("CNC-05", "CNC-05 — CNC Machining Line 4")
typeField = FormControl("Maintenance Type", typeSelect)
typeSelect = Select("type", [typePrev, typeCorr, typePred], "Select type")
typePrev = SelectItem("preventive", "Preventive")
typeCorr = SelectItem("corrective", "Corrective")
typePred = SelectItem("predictive", "Predictive")
dateField = FormControl("Scheduled Date", datePicker)
datePicker = DatePicker("scheduled_date", "single")
priorityField = FormControl("Priority", prioritySelect)
prioritySelect = Select("priority", [priLow, priMed, priHigh, priCrit], "Select priority")
priLow = SelectItem("low", "Low")
priMed = SelectItem("medium", "Medium")
priHigh = SelectItem("high", "High")
priCrit = SelectItem("critical", "Critical")
notesField = FormControl("Notes", notesArea, "Additional details for technicians")
notesArea = TextArea("notes", "Describe work required...", 3)
schedButtons = Buttons([schedSubmit, schedCancel])
schedSubmit = Button("Schedule Maintenance", null, "primary")
schedCancel = Button("Cancel", null, "tertiary")
exportButton = Buttons([exportBtn])
exportBtn = Button("Export Shift Report", null, "primary")