root = Card([header, kpiRow, openRolesSection, newRoleDialog, pipelineSection, headcountSection, interviewsSection, attritionSection], "card", "column", "l")
header = CardHeader("Hiring Overview", "HR Lead dashboard")
kpiRow = Card([kpiHeadcount, kpiTimeToHire, kpiOpenRoles, kpiInterviews], "clear", "row", "m")
kpiHeadcount = Card([kpiHeadcountLabel, kpiHeadcountValue], "sunk", "column", "none")
kpiHeadcountLabel = TextContent("Current headcount", "small")
kpiHeadcountValue = TextContent("248", "large-heavy")
kpiTimeToHire = Card([kpiTimeLabel, kpiTimeValue], "sunk", "column", "none")
kpiTimeLabel = TextContent("Average time to hire", "small")
kpiTimeValue = TextContent("32 days", "large-heavy")
kpiOpenRoles = Card([kpiOpenLabel, kpiOpenValue], "sunk", "column", "none")
kpiOpenLabel = TextContent("Open roles", "small")
kpiOpenValue = TextContent("12", "large-heavy")
kpiInterviews = Card([kpiIntLabel, kpiIntValue], "sunk", "column", "none")
kpiIntLabel = TextContent("Interviews this week", "small")
kpiIntValue = TextContent("18", "large-heavy")
openRolesSection = Card([openRolesHeading, openRolesTable], "sunk", "column", "m")
openRolesHeading = Heading("Open roles", "h2")
openRolesTable = Table([roleCol, deptCol, hiringCol, postedCol])
roleCol = Col("Role", ["Senior Frontend Engineer", "Product Designer", "Data Analyst", "DevOps Engineer", "Product Marketing Manager", "QA Engineer"])
deptCol = Col("Department", ["Engineering", "Design", "Data", "Infrastructure", "Marketing", "Engineering"])
hiringCol = Col("Hiring manager", ["A. Rivera", "M. Chen", "J. Novak", "S. Patel", "L. Gomez", "A. Rivera"])
postedCol = Col("Posted", ["Feb 3", "Feb 5", "Feb 6", "Jan 28", "Feb 9", "Feb 1"])
newRoleDialog = DialogBlock("New role", "Open a new role", "Fill in the details to create a new requisition", [roleForm])
roleForm = Form("new-role", roleFormButtons, [roleTitleField, roleDeptField, roleManagerField, roleTypeField])
roleTitleField = FormControl("Role title", roleTitleInput, "e.g. Senior Data Engineer")
roleTitleInput = Input("role_title", "e.g. Senior Data Engineer")
roleDeptField = FormControl("Department", roleDeptSelect)
roleDeptSelect = Select("department", [deptEng, deptDesign, deptData, deptInfra, deptMktg], "Select a department")
deptEng = SelectItem("engineering", "Engineering")
deptDesign = SelectItem("design", "Design")
deptData = SelectItem("data", "Data")
deptInfra = SelectItem("infrastructure", "Infrastructure")
deptMktg = SelectItem("marketing", "Marketing")
roleManagerField = FormControl("Hiring manager", roleManagerInput)
roleManagerInput = Input("hiring_manager", "e.g. A. Rivera")
roleTypeField = FormControl("Employment type", roleTypeRadio)
roleTypeRadio = RadioGroup("employment_type", [roleTypeFull, roleTypeContract])
roleTypeFull = RadioItem("Full-time", "Permanent position", "full-time")
roleTypeContract = RadioItem("Contract", "Fixed-term or freelance", "contract")
roleFormButtons = Buttons([roleSubmitBtn, roleCancelBtn])
roleSubmitBtn = Button("Create role", null, "primary")
roleCancelBtn = Button("Cancel", null, "tertiary")
pipelineSection = Card([pipelineHeading, pipelineChart], "sunk", "column", "m")
pipelineHeading = Heading("Candidates by pipeline stage", "h2")
pipelineChart = BarChart(stageLabels, [candidatesSeries], "grouped", "Stage", "Candidates")
stageLabels = ["Applied", "Screened", "Interview", "Offer", "Hired"]
candidatesSeries = Series("Candidates", [142, 96, 58, 21, 9])
headcountSection = Card([headcountHeading, headcountChart], "sunk", "column", "m")
headcountHeading = Heading("Headcount by department", "h2")
headcountChart = PieChart(deptLabels, deptValues, "donut")
deptLabels = ["Engineering", "Design", "Data", "Infrastructure", "Marketing", "Sales"]
deptValues = [98, 34, 28, 24, 40, 24]
interviewsSection = Card([interviewsHeading, interviewsTable], "sunk", "column", "m")
interviewsHeading = Heading("Interviews scheduled this week", "h2")
interviewsTable = Table([candidateCol, interviewRoleCol, interviewTimeCol, interviewerCol])
candidateCol = Col("Candidate", ["Priya Shah", "Tom Okafor", "Elena Rossi", "James Liu", "Amina Diallo", "Mateo Silva"])
interviewRoleCol = Col("Role", ["Senior Frontend Engineer", "Product Designer", "Data Analyst", "DevOps Engineer", "Product Marketing Manager", "QA Engineer"])
interviewTimeCol = Col("Scheduled", ["Mon 10:00", "Mon 14:30", "Tue 09:15", "Wed 11:00", "Thu 13:45", "Fri 10:30"])
interviewerCol = Col("Interviewer", ["A. Rivera", "M. Chen", "J. Novak", "S. Patel", "L. Gomez", "K. Ito"])
attritionSection = Card([attritionHeading, attritionChart], "sunk", "column", "m")
attritionHeading = Heading("Attrition over the past six months", "h2")
attritionChart = AreaChart(monthLabels, [attritionSeries], "linear", "Month", "Leavers")
monthLabels = ["Sep", "Oct", "Nov", "Dec", "Jan", "Feb"]
attritionSeries = Series("Leavers", [3, 5, 2, 4, 6, 3])