root = Card([header, oeeMetric, unitsProducedCard, productionLines, defectChart, downtimeChart, machinesList, stockCard, deliveriesList, shiftChart, safetyCard, qualityBatchesList, energyProgress, openWorkOrdersTable, scheduleForm, focusButton, andonAlerts, exportBtn])
header = CardHeader("Factory Floor Supervisor Console", null)
oeeMetric = TextContent("OEE: 85%", "large")
unitsProducedTxt = TextContent("Units Produced: 12,340", "large")
targetTxt = TextContent("Target: 10,000", "large")
unitsProducedCard = Card([unitsProducedTxt, targetTxt])
lineAItem = ListItem("Line A", "120 units/h", null, "Running")
lineBItem = ListItem("Line B", "95 units/h", null, "Paused")
lineCItem = ListItem("Line C", "150 units/h", null, "Running")
productionLines = ListBlock([lineAItem, lineBItem, lineCItem], "number")
defectLabels = ["Sep 1", "Sep 5", "Sep 10", "Sep 15", "Sep 20", "Sep 25", "Sep 30"]
defectSeries = Series("DefectRate", [2.5, 2.0, 1.8, 2.2, 2.5, 2.0, 1.5])
defectChart = LineChart(defectLabels, defectSeries, "natural", "Day", "Defect Rate (%)")
downtimeLabels = ["Mechanical", "Electrical", "Material", "Software"]
downtimeValues = [120, 80, 50, 30]
downtimeChart = PieChart(downtimeLabels, downtimeValues, "pie", "circular")
maintItem1 = ListItem("Machine 1", "2023-10-01", null, null)
maintItem2 = ListItem("Machine 3", "2023-10-05", null, null)
maintItem3 = ListItem("Machine 7", "2023-10-10", null, null)
machinesList = ListBlock([maintItem1, maintItem2, maintItem3], "number")
steelStock = Badge("150 tons", "secondary")
resinStock = Badge("80 tons", "secondary")
packagingStock = Badge("5000 units", "secondary")
stockCard = Card([steelStock, resinStock, packagingStock])
deliveryA = ListItem("Supplier A", "Oct 2", "Steel", "View")
deliveryB = ListItem("Supplier B", "Oct 4", "Resin", "View")
deliveryC = ListItem("Supplier C", "Oct 6", "Packaging", "View")
deliveriesList = ListBlock([deliveryA, deliveryB, deliveryC], "number")
shiftLabels = ["Day", "Swing", "Night"]
shiftSeries = Series("Output", [1200, 950, 1100])
shiftChart = BarChart(shiftLabels, shiftSeries, "grouped", "Shift", "Units")
incidentsTxt = TextContent("Safety Incidents: 4", "large")
daysSinceTxt = TextContent("Days since last incident: 45", "large")
safetyCard = Card([incidentsTxt, daysSinceTxt])
batch1 = ListItem("Batch 101", "Pending QC", null, null)
batch2 = ListItem("Batch 102", "Pending QC", null, null)
batch3 = ListItem("Batch 103", "Released", null, null)
qualityBatchesList = ListBlock([batch1, batch2, batch3], "number")
energyProgress = Progress(75, "Energy Use (%)")
workOrderIDs = ["WO-001", "WO-002", "WO-003"]
workOrderPriorities = ["High", "Medium", "Low"]
workOrderStatuses = ["Open", "In Progress", "Closed"]
colID = Col("ID", workOrderIDs, "string")
colPriority = Col("Priority", workOrderPriorities, "string")
colStatus = Col("Status", workOrderStatuses, "string")
openWorkOrdersTable = Table([colID, colPriority, colStatus])
machineField = FormControl("Machine", machineSelect, "Choose a machine")
machineSelect = Select("machine", [machineOption1, machineOption2, machineOption3], "Select machine", null, "machine")
machineOption1 = SelectItem("Machine 1", "Machine 1")
machineOption2 = SelectItem("Machine 2", "Machine 2")
machineOption3 = SelectItem("Machine 3", "Machine 3")
dateField = FormControl("Date", datePicker, "Select date")
datePicker = DatePicker("due_date", "single", null, "2023-10-01")
scheduleButtons = Buttons([submitBtn, cancelBtn])
submitBtn = Button("Submit", null, "primary")
cancelBtn = Button("Cancel", null, "tertiary")
scheduleForm = Form("schedule-maintenance", scheduleButtons, [machineField, dateField])
focusButton = Button("Focus on Line", null, "secondary")
alert1 = Alert("Overheat detected on Line A", "Temperature rising", "warning")
alert2 = Alert("Low material stock", "Resin below threshold", "info")
andonAlerts = ListBlock([alert1, alert2], "number")
exportBtn = Button("Export Shift Report", null, "secondary")