root = Card([header, periodSelect, mrChart, arChart, churnBadge, newSignupsChart, customersPlanChart, topCustomersTable, atRiskTable, failedPaymentsList, featureAdoption, npsBadge, seatUtilChart, inviteForm])
header = CardHeader("Admin Overview", "Company metrics")
periodSelect = Select("report_period", [periodS, periodM, periodY], "Select period", [], "30 days", "medium")
mrChart = LineChart(["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"], mrSeries, "natural", "Month", "USD")
mrSeries = Series("Revenue", [12000,13000,12500,14000,15000,16000,15500,16500,17000,18000,19000,20000])
arChart = AreaChart(["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"], arSeries, "natural", "Month", "USD")
arSeries = Series("ARR", [120000,130000,125000,140000,150000,160000,155000,165000,170000,180000,190000,200000])
churnBadge = Tag("5% churn", null, "lg", "danger")
newSignupsChart = BarChart(["Day1","Day30","Day60","Day90"], newSignupsSeries, "grouped", "Day", "Count")
newSignupsSeries = Series("Signups", [10,25,40,60])
customersPlanChart = PieChart(["Plan A","Plan B","Plan C"], customersPlanValues, "pie", "circular")
customersPlanValues = [500,300,200]
topCustomersTable = Table([topCol, topCol2, topCol3, topCol4])
topCol = Col("Customer", ["C1","C2","C3","C4","C5","C6","C7","C8","C9","C10"], "string")
topCol2 = Col("Seats", [10,20,15,30,25,12,35,28,22,18], "number")
topCol3 = Col("Spend", [5000,8000,4500,12000,10000,3000,15000,13000,11000,9000], "number")
topCol4 = Col("Plan", ["A","B","A","B","C","A","B","C","A","B"], "string")
atRiskTable = Table([atRiskCol1, atRiskCol2, atRiskCol3])
atRiskCol1 = Col("Account", ["A1","A2","A3"], "string")
atRiskCol2 = Col("Reason", ["Inactive","Low usage","Payment issue"], "string")
atRiskCol3 = Col("Risk", ["high","medium","low"], "string")
failedPaymentsList = ListBlock([lp1, lp2, lp3], "number")
lp1 = ListItem("PAY-001", "$500", null, "Retry")
lp2 = ListItem("PAY-002", "$300", null, "Retry")
lp3 = ListItem("PAY-003", "$750", null, "Retry")
featureAdoption = Card([fa1, fa2, fa3], "clear")
fa1 = TextCallout("info", "Feature X", "High adoption")
fa2 = TextCallout("info", "Feature Y", "Medium adoption")
fa3 = TextCallout("info", "Feature Z", "Low adoption")
npsBadge = Tag("NPS 68", null, "lg", "success")
seatUtilChart = HorizontalBarChart(["Team A","Team B","Team C","Team D"], seatUtilSeries, "grouped", "Team", "Utilization %")
seatUtilSeries = Series("Utilization", [75,80,65,90])
inviteForm = Form("invite-admin", formButtons, [nameField, emailField, roleField])
formButtons = Buttons([submitBtn, cancelBtn], "row")
submitBtn = Button("Invite", null, "primary")
cancelBtn = Button("Cancel", null, "tertiary")
nameField = FormControl("Full name", nameInput)
nameInput = Input("invite_name", "John Doe", "text", [], "John Doe")
emailField = FormControl("Work email", emailInput, "We only use this to reply")
emailInput = Input("invite_email", "jane@company.com", "email", [], "jane@company.com")
roleField = FormControl("Role", roleSelect)
roleSelect = Select("invite_role", [roleAdmin, roleViewer], "Choose role", ["Admin","Viewer"], "Admin", "medium")
roleAdmin = SelectItem("Admin", "Admin")
roleViewer = SelectItem("Viewer", "Viewer")