root = Card([header, oeeSection, productionTarget, lineFocusTabs, defectRateChart, downtimeChart, maintenanceDue, materialsStock, supplierDeliveries, shiftComparison, safetyMetrics, qualityHold, energyUse, workOrders, scheduleMaintenanceForm, andonAlerts, exportButton], "clear", "column", "l")
header = CardHeader("Factory Floor Supervisor Console", "Live production monitoring · Shift 2 · 2025-01-15 14:32")
oeeSection = Card([oeeTitle, oeeMetrics], "sunk", "row", "l", "center", "between")
oeeTitle = Heading("Overall Equipment Effectiveness (OEE)", "h3")
oeeMetrics = Card([oeeValue, availability, performance, quality], "clear", "row", "m", "center", "around")
oeeValue = Card([Tag("87.3%", null, "lg", "success"), TextContent("OEE Score", "small")], "clear", "column", "xs", "center")
availability = Card([Tag("92.1%", null, "md", "info"), TextContent("Availability", "small")], "clear", "column", "xs", "center")
performance = Card([Tag("94.8%", null, "md", "info"), TextContent("Performance", "small")], "clear", "column", "xs", "center")
quality = Card([Tag("99.2%", null, "md", "info"), TextContent("Quality", "small")], "clear", "column", "xs", "center")
productionTarget = Card([targetTitle, targetProgress, targetDetails], "sunk", "column", "m")
targetTitle = Heading("Units Produced vs Today's Target", "h3")
targetProgress = Progress(8470, "8,470 / 10,000 units (84.7%)")
targetDetails = Card([targetRate, targetETA], "clear", "row", "l", "center", "between")
targetRate = TextContent("Current rate: 420 units/hr", "small")
targetETA = TextContent("Projected completion: 18:45", "small")
lineFocusTabs = Tabs([lineTabA, lineTabB, lineTabC, lineTabD])
lineTabA = TabItem("line-a", "Line A", [lineADetail])
lineTabB = TabItem("line-b", "Line B", [lineBDetail])
lineTabC = TabItem("line-c", "Line C", [lineCDetail])
lineTabD = TabItem("line-d", "Line D", [lineDDetail])
lineADetail = Card([lineAHeader, lineAMetrics, lineAStatus], "clear", "column", "m")
lineAHeader = Heading("Line A — Injection Molding", "h4")
lineAMetrics = Card([lineARate, lineAOutput, lineAOEE], "clear", "row", "l", "center", "around")
lineARate = Card([Tag("420 u/hr", null, "md", "success"), TextContent("Rate", "small")], "clear", "column", "xs", "center")
lineAOutput = Card([Tag("3,360", null, "md", "neutral"), TextContent("Shift Output", "small")], "clear", "column", "xs", "center")
lineAOEE = Card([Tag("89.1%", null, "md", "success"), TextContent("Line OEE", "small")], "clear", "column", "xs", "center")
lineAStatus = TagBlock(["Running", "No Alarms", "Next PM: 2025-01-20"])
lineBDetail = Card([lineBHeader, lineBMetrics, lineBStatus], "clear", "column", "m")
lineBHeader = Heading("Line B — Assembly", "h4")
lineBMetrics = Card([lineBRate, lineBOutput, lineBOEE], "clear", "row", "l", "center", "around")
lineBRate = Card([Tag("380 u/hr", null, "md", "success"), TextContent("Rate", "small")], "clear", "column", "xs", "center")
lineBOutput = Card([Tag("3,040", null, "md", "neutral"), TextContent("Shift Output", "small")], "clear", "column", "xs", "center")
lineBOEE = Card([Tag("85.4%", null, "md", "info"), TextContent("Line OEE", "small")], "clear", "column", "xs", "center")
lineBStatus = TagBlock(["Running", "Minor Alarm", "Next PM: 2025-01-18"])
lineCDetail = Card([lineCHeader, lineCMetrics, lineCStatus], "clear", "column", "m")
lineCHeader = Heading("Line C — Packaging", "h4")
lineCMetrics = Card([lineCRate, lineCOutput, lineCOEE], "clear", "row", "l", "center", "around")
lineCRate = Card([Tag("0 u/hr", null, "md", "danger"), TextContent("Rate", "small")], "clear", "column", "xs", "center")
lineCOutput = Card([Tag("1,200", null, "md", "neutral"), TextContent("Shift Output", "small")], "clear", "column", "xs", "center")
lineCOEE = Card([Tag("62.3%", null, "md", "warning"), TextContent("Line OEE", "small")], "clear", "column", "xs", "center")
lineCStatus = TagBlock(["DOWN — Jam at Station 3", "Critical", "Next PM: 2025-01-16"])
lineDDetail = Card([lineDHeader, lineDMetrics, lineDStatus], "clear", "column", "m")
lineDHeader = Heading("Line D — Finishing", "h4")
lineDMetrics = Card([lineDRate, lineDOutput, lineDOEE], "clear", "row", "l", "center", "around")
lineDRate = Card([Tag("310 u/hr", null, "md", "success"), TextContent("Rate", "small")], "clear", "column", "xs", "center")
lineDOutput = Card([Tag("2,480", null, "md", "neutral"), TextContent("Shift Output", "small")], "clear", "column", "xs", "center")
lineDOEE = Card([Tag("91.2%", null, "md", "success"), TextContent("Line OEE", "small")], "clear", "column", "xs", "center")
lineDStatus = TagBlock(["Running", "No Alarms", "Next PM: 2025-01-22"])
defectRateChart = Card([defectTitle, defectChart], "sunk", "column", "m")
defectTitle = Heading("Defect Rate — Past 30 Days", "h3")
defectChart = LineChart(["Jan 1", "Jan 4", "Jan 7", "Jan 10", "Jan 13", "Jan 16", "Jan 19", "Jan 22", "Jan 25", "Jan 28", "Jan 31", "Feb 3", "Feb 6", "Feb 9", "Feb 12"], [defectSeries], "natural", "Date", "Defect Rate (%)")
defectSeries = Series("Defect Rate %", [2.1, 1.8, 2.3, 1.9, 2.0, 1.7, 2.2, 1.6, 1.8, 1.5, 1.9, 1.4, 1.7, 1.6, 1.5])
downtimeChart = Card([downtimeTitle, downtimePie], "sunk", "column", "m")
downtimeTitle = Heading("Downtime Split by Cause — This Month", "h3")
downtimePie = PieChart(["Mechanical", "Electrical", "Material", "Changeover", "Quality", "Planned PM", "Other"], [42, 18, 15, 12, 8, 3, 2], "donut")
maintenanceDue = Card([maintTitle, maintTable], "sunk", "column", "m")
maintTitle = Heading("Machines Due for Maintenance (Next 7 Days)", "h3")
maintTable = Table([maintMachine, maintType, maintDueDate, maintPriority])
maintMachine = Col("Machine", ["INJ-03", "ASM-01", "PKG-02", "FIN-04", "INJ-01"])
maintType = Col("Type", ["Preventive", "Corrective", "Preventive", "Preventive", "Predictive"])
maintDueDate = Col("Due Date", ["2025-01-16", "2025-01-17", "2025-01-18", "2025-01-19", "2025-01-20"])
maintPriority = Col("Priority", ["High", "Critical", "Medium", "Medium", "Low"])
materialsStock = Card([stockTitle, stockTable], "sunk", "column", "m")
stockTitle = Heading("Raw Material Stock Levels", "h3")
stockTable = Table([stockMaterial, stockCurrent, stockMin, stockDays, stockStatus])
stockMaterial = Col("Material", ["Steel (tons)", "Resin (kg)", "Packaging (units)"])
stockCurrent = Col("Current", [42.5, 18500, 240000])
stockMin = Col("Minimum", [15.0, 8000, 100000])
stockDays = Col("Days Cover", [14, 18, 22])
stockStatus = Col("Status", ["OK", "OK", "OK"])
supplierDeliveries = Card([deliveryTitle, deliveryTable], "sunk", "column", "m")
deliveryTitle = Heading("Supplier Deliveries Due This Week", "h3")
deliveryTable = Table([deliverySupplier, deliveryMaterial, deliveryDate, deliveryQty, deliveryStatus])
deliverySupplier = Col("Supplier", ["Apex Metals", "PolyChem", "BoxCo", "Apex Metals", "PolyChem"])
deliveryMaterial = Col("Material", ["Steel", "Resin", "Packaging", "Steel", "Resin"])
deliveryDate = Col("Due Date", ["2025-01-15", "2025-01-16", "2025-01-17", "2025-01-19", "2025-01-20"])
deliveryQty = Col("Quantity", ["25 tons", "12,000 kg", "150,000", "20 tons", "10,000 kg"])
deliveryStatus = Col("Status", ["In Transit", "Scheduled", "Scheduled", "Confirmed", "Confirmed"])
shiftComparison = Card([shiftTitle, shiftChart], "sunk", "column", "m")
shiftTitle = Heading("Shift Output Comparison — Last 7 Days", "h3")
shiftChart = BarChart(["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], [shift1Series, shift2Series, shift3Series], "grouped", "Day", "Units Produced")
shift1Series = Series("Shift 1", [2800, 2950, 2780, 3100, 3050, 2600, 2400])
shift2Series = Series("Shift 2", [3200, 3350, 3100, 3400, 3280, 2900, 2700])
shift3Series = Series("Shift 3", [1800, 1950, 1750, 2000, 1900, 1600, 1500])
safetyMetrics = Card([safetyTitle, safetyCards], "sunk", "column", "m")
safetyTitle = Heading("Safety Metrics", "h3")
safetyCards = Card([incidentsCard, daysSinceCard, ltirCard], "clear", "row", "l", "center", "around")
incidentsCard = Card([Tag("3", null, "lg", "danger"), TextContent("Incidents YTD", "small")], "clear", "column", "xs", "center")
daysSinceCard = Card([Tag("47", null, "lg", "success"), TextContent("Days Since Last Incident", "small")], "clear", "column", "xs", "center")
ltirCard = Card([Tag("0.42", null, "lg", "info"), TextContent("LTIR (Year)", "small")], "clear", "column", "xs", "center")
qualityHold = Card([holdTitle, holdTable], "sunk", "column", "m")
holdTitle = Heading("Batches on Quality Hold", "h3")
holdTable = Table([holdBatch, holdLine, holdReason, holdSince, holdQty])
holdBatch = Col("Batch ID", ["B-20250115-003", "B-20250114-012", "B-20250113-008"])
holdLine = Col("Line", ["Line C", "Line A", "Line B"])
holdReason = Col("Reason", ["Dimensional variance", "Surface finish", "Weight deviation"])
holdSince = Col("Since", ["2025-01-15 08:20", "2025-01-14 14:45", "2025-01-13 22:10"])
holdQty = Col("Units", [420, 180, 350])
energyUse = Card([energyTitle, energyMetrics, energyChart], "sunk", "column", "m")
energyTitle = Heading("Energy Use — Today", "h3")
energyMetrics = Card([energyTotal, energyCost, energyIntensity], "clear", "row", "l", "center", "around")
energyTotal = Card([Tag("1,847 kWh", null, "md", "neutral"), TextContent("Total Consumed", "small")], "clear", "column", "xs", "center")
energyCost = Card([Tag("$221.64", null, "md", "neutral"), TextContent("Est. Cost", "small")], "clear", "column", "xs", "center")
energyIntensity = Card([Tag("0.218 kWh/unit", null, "md", "info"), TextContent("Energy/Unit", "small")], "clear", "column", "xs", "center")
energyChart = AreaChart(["06:00", "08:00", "10:00", "12:00", "14:00", "16:00", "18:00", "20:00", "22:00"], [energySeries], "natural", "Time", "kWh")
energySeries = Series("Power (kW)", [180, 210, 245, 260, 255, 240, 220, 190, 160])
workOrders = Card([woTitle, woTable], "sunk", "column", "m")
woTitle = Heading("Open Work Orders", "h3")
woTable = Table([woID, woMachine, woType, woPriority, woAssigned, woDue])
woID = Col("WO #", ["WO-20250115-001", "WO-20250115-002", "WO-20250114-018", "WO-20250114-015", "WO-20250113-022"])
woMachine = Col("Machine", ["INJ-03", "CNV-07", "ASM-01", "PKG-02", "FIN-04"])
woType = Col("Type", ["Preventive", "Corrective", "Corrective", "Preventive", "Predictive"])
woPriority = Col("Priority", ["High", "Critical", "High", "Medium", "Low"])
woAssigned = Col("Assigned", ["J. Martinez", "T. Chen", "R. Patel", "A. Brooks", "M. Rivera"])
woDue = Col("Due", ["2025-01-16", "2025-01-15", "2025-01-17", "2025-01-18", "2025-01-20"])
scheduleMaintenanceForm = Card([schedTitle, schedForm], "sunk", "column", "m")
schedTitle = Heading("Schedule Maintenance", "h3")
schedForm = Form("schedule-maintenance", schedButtons, [machineField, dateField, typeField, descField])
machineField = FormControl("Machine", machineSelect, "Select equipment")
machineSelect = Select("machine", [machINJ01, machINJ02, machINJ03, machASM01, machASM02, machPKG01, machPKG02, machFIN01, machFIN02, machCNV01], "Choose machine")
machINJ01 = SelectItem("INJ-01", "INJ-01 — Injection Molding")
machINJ02 = SelectItem("INJ-02", "INJ-02 — Injection Molding")
machINJ03 = SelectItem("INJ-03", "INJ-03 — Injection Molding")
machASM01 = SelectItem("ASM-01", "ASM-01 — Assembly")
machASM02 = SelectItem("ASM-02", "ASM-02 — Assembly")
machPKG01 = SelectItem("PKG-01", "PKG-01 — Packaging")
machPKG02 = SelectItem("PKG-02", "PKG-02 — Packaging")
machFIN01 = SelectItem("FIN-01", "FIN-01 — Finishing")
machFIN02 = SelectItem("FIN-02", "FIN-02 — Finishing")
machCNV01 = SelectItem("CNV-07", "CNV-07 — Conveyor")
dateField = FormControl("Date & Time", datePicker, "When to perform maintenance")
datePicker = DatePicker("maint_date", "single", [], [])
typeField = FormControl("Maintenance Type", typeSelect)
typeSelect = Select("maint_type", [typePrev, typeCorr, typePred], "Select type")
typePrev = SelectItem("preventive", "Preventive")
typeCorr = SelectItem("corrective", "Corrective")
typePred = SelectItem("predictive", "Predictive")
descField = FormControl("Description", descArea, "Work details, parts needed, etc.")
descArea = TextArea("description", "Describe the maintenance work...", 3, [], "")
schedButtons = Buttons([schedSubmit, schedCancel], "row")
schedSubmit = Button("Schedule", null, "primary")
schedCancel = Button("Cancel", null, "tertiary")
andonAlerts = Card([andonTitle, andonList], "sunk", "column", "m")
andonTitle = Heading("Live Andon Alerts", "h3")
andonList = ListBlock([andon1, andon2, andon3, andon4], "number")
andon1 = ListItem("Line C — Station 3 Jam", "CRITICAL · 2025-01-15 14:18 · Operator: M. Torres", [], "Acknowledge")
andon2 = ListItem("INJ-03 — Temperature Deviation", "WARNING · 2025-01-15 14:05 · Auto-detected", [], "View")
andon3 = ListItem("ASM-01 — Low Feeder Stock", "INFO · 2025-01-15 13:52 · Sensor: FEED-04", [], "Refill")
andon4 = ListItem("PKG-02 — Label Printer Error", "WARNING · 2025-01-15 13:30 · Operator: K. Nguyen", [], "Resolve")
exportButton = Buttons([exportBtn], "row")
exportBtn = Button("Export Shift Report (PDF)", null, "primary")