root = Card([header, row1, linesCard, row3, row4, row5, row6, row7], "clear", "column", "l")
header = CardHeader("Factory Floor Supervisor Console", "Shift A · 14:32 · Tue 7 May")
row1 = Card([oeeCard, productionCard], "card", "row", "l", "stretch", "start", true)
oeeCard = Card([oeeTitle, oeeBar, oeeAvail, oeePerf, oeeQual], "sunk", "column", "xs")
oeeTitle = Heading("Overall Equipment Effectiveness", "h3")
oeeBar = Progress(78, "78%")
oeeAvail = TextContent("Availability: 92%", "small")
oeePerf = TextContent("Performance: 85%", "small")
oeeQual = TextContent("Quality: 99.6%", "small")
productionCard = Card([prodTitle, prodChart], "sunk", "column", "xs")
prodTitle = Heading("Units Produced vs Target", "h3")
prodChart = BarChart(["Today"], [producedSeries, targetSeries], "grouped", null, "Units")
producedSeries = Series("Produced", [846])
targetSeries = Series("Target", [920])
linesCard = Card([linesTitle, linesTable], "sunk", "column", "xs")
linesTitle = Heading("Production Lines", "h3")
linesTable = Table([lineCol, rateCol, statusCol])
lineCol = Col("Line", ["Line 1", "Line 2", "Line 3", "Line 4"])
rateCol = Col("Rate (units/hr)", [120, 98, 132, 45])
statusCol = Col("Status", ["Running", "Running", "Running", "Down"])
row3 = Card([defectCard, downtimeCard], "card", "row", "l", "stretch", "start", true)
defectCard = Card([defectTitle, defectChart], "sunk", "column", "xs")
defectTitle = Heading("Defect Rate — Past Month", "h3")
defectChart = LineChart(["Apr 7", "Apr 14", "Apr 21", "Apr 28", "May 5"], [defectSeries], "linear", "Week", "Defect %")
defectSeries = Series("Defect rate", [2.1, 1.8, 1.5, 1.9, 1.4])
downtimeCard = Card([downtimeTitle, downtimeChart], "sunk", "column", "xs")
downtimeTitle = Heading("Downtime by Cause", "h3")
downtimeChart = PieChart(["Changeover", "Breakdown", "Material wait", "Cleaning"], [95, 60, 40, 25], "donut")
row4 = Card([maintCard, stockCard, supplierCard], "card", "row", "l", "stretch", "start", true)
maintCard = Card([maintTitle, maintList], "sunk", "column", "xs")
maintTitle = Heading("Machines Due for Maintenance", "h3")
maintList = ListBlock([maintItem1, maintItem2, maintItem3], "number")
maintItem1 = ListItem("Press #7", "Due today")
maintItem2 = ListItem("CNC #12", "Due 9 May")
maintItem3 = ListItem("Conveyor #3", "Due 11 May")
stockCard = Card([stockTitle, stockTable], "sunk", "column", "xs")
stockTitle = Heading("Material Stock", "h3")
stockTable = Table([stockMaterial, stockLevel, stockStockStatus])
stockMaterial = Col("Material", ["Steel coil", "Resin", "Packaging"])
stockLevel = Col("On hand", ["4.25 t", "1.18 t", "30,000 units"])
stockStockStatus = Col("Status", ["OK", "Low", "OK"])
supplierCard = Card([supplierTitle, supplierTable], "sunk", "column", "xs")
supplierTitle = Heading("Supplier Deliveries Due", "h3")
supplierTable = Table([supplierName, supplierMaterial, supplierDate, supplierStatus])
supplierName = Col("Supplier", ["MetalCo", "PolyMax", "BoxWise"])
supplierMaterial = Col("Material", ["Steel coil", "Resin", "Packaging"])
supplierDate = Col("Due", ["8 May", "9 May", "10 May"])
supplierStatus = Col("Status", ["Confirmed", "In transit", "Pending"])
row5 = Card([shiftCard, safetyCard, energyCard], "card", "row", "l", "stretch", "start", true)
shiftCard = Card([shiftTitle, shiftChart], "sunk", "column", "xs")
shiftTitle = Heading("Shift Output", "h3")
shiftChart = BarChart(["Morning", "Afternoon", "Night"], [shiftSeries], "grouped", null, "Units")
shiftSeries = Series("Output", [312, 298, 236])
safetyCard = Card([safetyTitle, safetyIncidents, safetyDays], "sunk", "column", "xs")
safetyTitle = Heading("Safety", "h3")
safetyIncidents = TextContent("**12** incidents this year", "large-heavy")
safetyDays = TextContent("128 days since last incident")
energyCard = Card([energyTitle, energyChart], "sunk", "column", "xs")
energyTitle = Heading("Energy Use Today", "h3")
energyChart = AreaChart(["06:00", "10:00", "14:00", "18:00"], [energySeries], "linear", "Hour", "kWh")
energySeries = Series("Energy", [410, 620, 580, 490])
row6 = Card([qualityCard, workOrderCard, andonCard], "card", "row", "l", "stretch", "start", true)
qualityCard = Card([qualityTitle, qualityTable], "sunk", "column", "xs")
qualityTitle = Heading("Batches on Quality Hold", "h3")
qualityTable = Table([batchIdCol, batchProduct, batchReason])
batchIdCol = Col("Batch", ["B-2041", "B-2043", "B-2047"])
batchProduct = Col("Product", ["Bracket A", "Bracket B", "Spacer C"])
batchReason = Col("Reason", ["Dimensional drift", "Surface defect", "Material suspect"])
workOrderCard = Card([woTitle, woTable], "sunk", "column", "xs")
woTitle = Heading("Open Work Orders", "h3")
woTable = Table([woIdCol, woLineCol, woPriorityCol])
woIdCol = Col("Work Order", ["WO-1188", "WO-1189", "WO-1190"])
woLineCol = Col("Line", ["Line 2", "Line 1", "Line 3"])
woPriorityCol = Col("Priority", ["High", "Medium", "Low"])
andonCard = Card([andonTitle, andonList], "sunk", "column", "xs")
andonTitle = Heading("Live Andon Alerts", "h3")
andonList = ListBlock([andon1, andon2, andon3])
andon1 = ListItem("Station 4 — Part jam", "2 min ago", null, "View")
andon2 = ListItem("Line 3 — Material low", "6 min ago", null, "View")
andon3 = ListItem("Press #7 — Overheating", "11 min ago", null, "View")
row7 = Card([scheduleCard, focusCard, exportCard], "card", "row", "l", "stretch", "start", true)
scheduleCard = Card([scheduleTitle, scheduleForm], "sunk", "column", "xs")
scheduleTitle = Heading("Schedule Maintenance", "h3")
scheduleForm = Form("maintenance-schedule", scheduleButtons, [machineField, dateField])
machineField = FormControl("Machine", machineSelect)
machineSelect = Select("machine", [machinePress7, machineCNC12, machineConv3], "Select machine")
machinePress7 = SelectItem("press-7", "Press #7")
machineCNC12 = SelectItem("cnc-12", "CNC #12")
machineConv3 = SelectItem("conveyor-3", "Conveyor #3")
dateField = FormControl("Date", datePicker)
datePicker = DatePicker("date", "single")
scheduleButtons = Buttons([scheduleBtn])
scheduleBtn = Button("Schedule", null, "primary")
focusCard = Card([focusTitle, focusForm], "sunk", "column", "xs")
focusTitle = Heading("Focus on a Line", "h3")
focusForm = Form("focus-line", focusButtons, [lineField])
lineField = FormControl("Line", lineSelect)
lineSelect = Select("line", [line1, line2, line3, line4], "Choose line")
line1 = SelectItem("line-1", "Line 1")
line2 = SelectItem("line-2", "Line 2")
line3 = SelectItem("line-3", "Line 3")
line4 = SelectItem("line-4", "Line 4")
focusButtons = Buttons([focusBtn])
focusBtn = Button("Focus", null, "secondary")
exportCard = Card([exportTitle, exportText, exportButtons], "sunk", "column", "xs")
exportTitle = Heading("Shift Report", "h3")
exportText = TextContent("Generate the current shift report")
exportButtons = Buttons([exportBtn])
exportBtn = Button("Export Shift Report", null, "primary")