root = Card([header, kpis, andonSection, productionSection, focusSection, qualitySection, downtimeSection, maintenanceSection, inventorySection, suppliersSection, energySection, workOrdersSection, incidentsSection, exportSection])
header = CardHeader("Factory Floor Console", "Live production overview — Shift A")
kpis = Card([kpiHeader, kpiTable], "sunk")
kpiHeader = Heading("Overall Equipment Effectiveness", "h3")
kpiTable = Table([kpiMetric, kpiValue])
kpiMetric = Col("Metric", ["OEE", "Units Produced", "Today's Target", "Defect Rate (Month)", "Energy Use (Today)"])
kpiValue = Col("Value", ["82.4%", "12,480", "14,000", "1.8%", "38.6 MWh"])
andonSection = Card([andonTitle, andonList])
andonTitle = Heading("Live Andon Alerts", "h3")
andonList = ListBlock([andon1, andon2, andon3])
andon1 = ListItem("Line 3 — Press jam", "Operator requested assistance · 2 min ago", null, "View")
andon2 = ListItem("Line 1 — Material shortage", "Steel feed low · 5 min ago", null, "View")
andon3 = ListItem("Line 5 — Quality check", "Batch 4012 on hold · 8 min ago", null, "View")
productionSection = Card([productionTitle, productionChart])
productionTitle = Heading("Units Produced vs Today's Target", "h3")
productionChart = BarChart(["06:00", "08:00", "10:00", "12:00", "14:00", "16:00", "18:00"], [producedSeries, targetSeries], "grouped", "Hour", "Units")
producedSeries = Series("Produced", [1200, 1800, 2100, 2400, 2200, 1500, 1280])
targetSeries = Series("Target", [1500, 1500, 1500, 1500, 1500, 1500, 1500])
focusSection = Card([focusTitle, lineTable])
focusTitle = Heading("Production Lines", "h3")
lineTable = Table([lineName, lineRate, lineStatus])
lineName = Col("Line", ["Line 1", "Line 2", "Line 3", "Line 4", "Line 5"])
lineRate = Col("Rate (units/hr)", [420, 385, 210, 460, 340])
lineStatus = Col("Status", ["Running", "Running", "Andon", "Running", "Idle"])
qualitySection = Card([qualityTitle, qualityChart, holdList])
qualityTitle = Heading("Defect Rate — Past Month", "h3")
qualityChart = LineChart(["W1", "W2", "W3", "W4"], [defectSeries], "natural", "Week", "Defect %")
defectSeries = Series("Defect Rate", [2.1, 1.9, 1.6, 1.8])
holdList = ListBlock([hold1, hold2])
hold1 = ListItem("Batch 4012 — Line 5", "Dimensional tolerance exceeded · 120 units", null, "Review")
hold2 = ListItem("Batch 3988 — Line 2", "Material verification pending · 85 units", null, "Review")
downtimeSection = Card([downtimeTitle, downtimeChart])
downtimeTitle = Heading("Downtime by Cause", "h3")
downtimeChart = PieChart(["Maintenance", "Material Shortage", "Setup", "Quality", "Other"], [38, 24, 18, 12, 8], "donut")
maintenanceSection = Card([maintenanceTitle, maintenanceTable, scheduleForm])
maintenanceTitle = Heading("Machines Due for Maintenance", "h3")
maintenanceTable = Table([machineCol, dueCol, lastCol])
machineCol = Col("Machine", ["Press 3", "Injection 7", "Welder 2", "Conveyor 4"])
dueCol = Col("Due", ["Today", "Tomorrow", "Fri", "Mon"])
lastCol = Col("Last Service", ["12 Aug", "28 Jul", "19 Aug", "02 Aug"])
scheduleForm = Form("schedule-maintenance", scheduleButtons, [machineField, dateField])
machineField = FormControl("Machine", machineSelect)
machineSelect = Select("machine", [machineP3, machineI7, machineW2, machineC4], "Select machine")
machineP3 = SelectItem("press3", "Press 3")
machineI7 = SelectItem("inject7", "Injection 7")
machineW2 = SelectItem("welder2", "Welder 2")
machineC4 = SelectItem("conveyor4", "Conveyor 4")
dateField = FormControl("Date", dateInput)
dateInput = DatePicker("maintenance-date", "single")
scheduleButtons = Buttons([scheduleBtn])
scheduleBtn = Button("Schedule Maintenance", null, "primary")
inventorySection = Card([inventoryTitle, inventoryTable])
inventoryTitle = Heading("Stock Levels", "h3")
inventoryTable = Table([materialCol, stockCol, statusCol])
materialCol = Col("Material", ["Steel", "Resin", "Packaging"])
stockCol = Col("Stock (kg/units)", ["12,400 kg", "3,800 kg", "22,500 units"])
statusCol = Col("Status", ["OK", "Low", "OK"])
suppliersSection = Card([suppliersTitle, suppliersTable])
suppliersTitle = Heading("Supplier Deliveries Due This Week", "h3")
suppliersTable = Table([supplierCol, itemCol, dayCol])
supplierCol = Col("Supplier", ["MetalsCo", "PolyResin Ltd", "PackRight"])
itemCol = Col("Item", ["Steel coils", "Resin pellets", "Cartons"])
dayCol = Col("Due", ["Wed", "Thu", "Fri"])
energySection = Card([energyTitle, energyChart])
energyTitle = Heading("Energy Use Today", "h3")
energyChart = AreaChart(["06:00", "08:00", "10:00", "12:00", "14:00", "16:00", "18:00"], [energySeries], "natural", "Hour", "MWh")
energySeries = Series("Energy", [2.1, 3.4, 3.8, 3.6, 3.9, 2.8, 2.2])
workOrdersSection = Card([woTitle, woTable])
woTitle = Heading("Open Work Orders", "h3")
woTable = Table([woId, woLine, woPriority, woDue])
woId = Col("Order", ["WO-1042", "WO-1041", "WO-1040", "WO-1039"])
woLine = Col("Line", ["Line 2", "Line 4", "Line 1", "Line 3"])
woPriority = Col("Priority", ["High", "Medium", "High", "Low"])
woDue = Col("Due", ["14:00", "16:00", "17:00", "Tomorrow"])
incidentsSection = Card([incidentsTitle, incidentsTable])
incidentsTitle = Heading("Safety Incidents", "h3")
incidentsTable = Table([incidentCol, countCol])
incidentCol = Col("Metric", ["Incidents this year", "Days since last incident"])
countCol = Col("Value", ["3", "47"])
exportSection = Card([exportButtons])
exportButtons = Buttons([exportBtn])
exportBtn = Button("Export Shift Report")