package pages import ( "github.com/GoAdminGroup/go-admin/context" "github.com/GoAdminGroup/go-admin/modules/config" template2 "github.com/GoAdminGroup/go-admin/template" "github.com/GoAdminGroup/go-admin/template/chartjs" "github.com/GoAdminGroup/go-admin/template/types" "github.com/GoAdminGroup/themes/sword/components/card" "github.com/GoAdminGroup/themes/sword/components/chart_legend" "github.com/GoAdminGroup/themes/sword/components/description" "github.com/GoAdminGroup/themes/sword/components/progress_group" "html/template" ) func GetDashBoard(ctx *context.Context) (types.Panel, error) { components := template2.Get(config.GetTheme()) colComp := components.Col() /************************** * Info Box /**************************/ cardcard := card.New(). SetTitle("TOTAL REVENUE"). SetSubTitle("¥ 113,340"). SetAction(template.HTML(``)). SetContent(template.HTML(`
Goal Completion
` progressGroup := progress_group.New(). SetTitle("Add Products to Cart"). SetColor("#76b2d4"). SetDenominator(200). SetMolecular(160). SetPercent(80). GetContent() progressGroup1 := progress_group.New(). SetTitle("Complete Purchase"). SetColor("#f17c6e"). SetDenominator(400). SetMolecular(310). SetPercent(80). GetContent() progressGroup2 := progress_group.New(). SetTitle("Visit Premium Page"). SetColor("#ace0ae"). SetDenominator(800). SetMolecular(490). SetPercent(80). GetContent() progressGroup3 := progress_group.New(). SetTitle("Send Inquiries"). SetColor("#fdd698"). SetDenominator(500). SetMolecular(250). SetPercent(50). GetContent() boxInternalCol1 := colComp.SetContent(lineChart).SetSize(types.SizeMD(8)).GetContent() boxInternalCol2 := colComp. SetContent(template.HTML(title) + progressGroup + progressGroup1 + progressGroup2 + progressGroup3). SetSize(types.SizeMD(4)). GetContent() boxInternalRow := components.Row().SetContent(boxInternalCol1 + boxInternalCol2).GetContent() description1 := description.New(). SetPercent("17"). SetNumber("¥140,100"). SetTitle("TOTAL REVENUE"). SetArrow("up"). SetColor("green"). SetBorder("right"). GetContent() description2 := description.New(). SetPercent("2"). SetNumber("440,560"). SetTitle("TOTAL REVENUE"). SetArrow("down"). SetColor("red"). SetBorder("right"). GetContent() description3 := description.New(). SetPercent("12"). SetNumber("¥140,050"). SetTitle("TOTAL REVENUE"). SetArrow("up"). SetColor("green"). SetBorder("right"). GetContent() description4 := description.New(). SetPercent("1"). SetNumber("30943"). SetTitle("TOTAL REVENUE"). SetArrow("up"). SetColor("green"). GetContent() size2 := map[string]string{"sm": "3", "xs": "6"} boxInternalCol3 := colComp.SetContent(description1).SetSize(size2).GetContent() boxInternalCol4 := colComp.SetContent(description2).SetSize(size2).GetContent() boxInternalCol5 := colComp.SetContent(description3).SetSize(size2).GetContent() boxInternalCol6 := colComp.SetContent(description4).SetSize(size2).GetContent() boxInternalRow2 := components.Row().SetContent(boxInternalCol3 + boxInternalCol4 + boxInternalCol5 + boxInternalCol6).GetContent() box := components.Box().WithHeadBorder().SetHeader("Monthly Recap Report"). SetBody(boxInternalRow). SetFooter(boxInternalRow2). GetContent() boxcol := colComp.SetContent(box).SetSize(types.SizeMD(12)).GetContent() row2 := components.Row().SetContent(boxcol).GetContent() /************************** * Pie Chart /**************************/ pie := chartjs.Pie(). SetHeight(170). SetLabels([]string{"Navigator", "Opera", "Safari", "FireFox", "IE", "Chrome"}). SetID("pieChart"). AddDataSet("Chrome"). DSData([]float64{100, 300, 600, 400, 500, 700}). DSBackgroundColor([]chartjs.Color{ "rgb(255, 205, 86)", "rgb(54, 162, 235)", "rgb(255, 99, 132)", "rgb(255, 205, 86)", "rgb(54, 162, 235)", "rgb(255, 99, 132)", }). GetContent() legend := chart_legend.New().SetData([]map[string]string{ { "label": " Chrome", "color": "red", }, { "label": " IE", "color": "Green", }, { "label": " FireFox", "color": "yellow", }, { "label": " Sarafri", "color": "blue", }, { "label": " Opera", "color": "light-blue", }, { "label": " Navigator", "color": "gray", }, }).GetContent() boxDanger := components.Box().SetTheme("danger").WithHeadBorder().SetHeader("Browser Usage"). SetBody(components.Row(). SetContent(colComp.SetSize(types.SizeMD(8)). SetContent(pie). GetContent() + colComp.SetSize(types.SizeMD(4)). SetContent(legend). GetContent()).GetContent()). SetFooter(``). GetContent() tabs := components.Tabs().SetData([]map[string]template.HTML{ { "title": "tabs1", "content": template.HTML(`How to use:Exactly like the original bootstrap tabs except you should use
the custom wrapper .nav-tabs-custom to achieve this style.