diff --git a/handlers/chart.handlers.go b/handlers/chart.handlers.go index 3a0e382..5193e38 100644 --- a/handlers/chart.handlers.go +++ b/handlers/chart.handlers.go @@ -10,9 +10,9 @@ import ( "github.com/a-h/templ" "github.com/emarifer/go-templ-project-structure/services" + mcupeserta "github.com/emarifer/go-templ-project-structure/views/mcu/peserta" "github.com/emarifer/go-templ-project-structure/views/piechart" "github.com/emarifer/go-templ-project-structure/views/xsample" - "github.com/labstack/echo/v4" ) @@ -35,6 +35,7 @@ func (uh *PiechartHandler) Hello(c echo.Context) error { return uh.View(c, helo) } +// example pie chart func (uh *PiechartHandler) ShowPieChart(c echo.Context) error { // helo := piechart.MainPieChart("main_001") var code = "mcu006" @@ -61,6 +62,75 @@ func (uh *PiechartHandler) ShowPieChart(c echo.Context) error { return uh.View(c, helo) } +// mcu peserta +func (uh *PiechartHandler) ShowMcuPeserta(c echo.Context) error { + + // 1 + var code001 = "mcu001" + title001, udata001, err001 := uh.PiechartService.GetPieChart(code001, 1) + if err001 != nil { + return err001 + } + + jsonData001, err001 := json.MarshalIndent(udata001, "", " ") + if err001 != nil { + fmt.Println("Error:", err001) + return err001 + } + + seed001 := title001 + time.Now().String() + hash001 := md5.Sum([]byte(seed001)) + randomID001 := hex.EncodeToString(hash001[:]) + randomID001 = strings.ReplaceAll(randomID001, "-", "") + + // 2 + var code002 = "mcu002" + title002, udata002, err002 := uh.PiechartService.GetPieChart(code002, 1) + if err002 != nil { + return err002 + } + + jsonData002, err002 := json.MarshalIndent(udata002, "", " ") + if err002 != nil { + fmt.Println("Error:", err002) + return err002 + } + + seed002 := title002 + time.Now().String() + hash002 := md5.Sum([]byte(seed002)) + randomID002 := hex.EncodeToString(hash002[:]) + randomID002 = strings.ReplaceAll(randomID002, "-", "") + + // 3 + var code003 = "mcu003" + title003, udata003, err003 := uh.PiechartService.GetPieChart(code003, 1) + if err003 != nil { + return err003 + } + + jsonData003, err003 := json.MarshalIndent(udata003, "", " ") + if err003 != nil { + fmt.Println("Error:", err003) + return err003 + } + + seed003 := title003 + time.Now().String() + hash003 := md5.Sum([]byte(seed003)) + randomID003 := hex.EncodeToString(hash003[:]) + randomID003 = strings.ReplaceAll(randomID003, "-", "") + + helo := mcupeserta.ShowMcuPeserta("Peserta", mcupeserta.MainMcuPeserta( + randomID001, string(jsonData001), + randomID002, string(jsonData002), + randomID003, string(jsonData003), + ), + mcupeserta.CssMcuPeserta(), + mcupeserta.JsMcuPeserta(), + ) + + return uh.View(c, helo) +} + func (uh *PiechartHandler) View(c echo.Context, cmp templ.Component) error { c.Response().Header().Set(echo.HeaderContentType, echo.MIMETextHTML) diff --git a/handlers/routes.go b/handlers/routes.go index f6d2762..db0226f 100644 --- a/handlers/routes.go +++ b/handlers/routes.go @@ -26,6 +26,7 @@ func SetupRoutesLandingPage(app *echo.Echo, h *LandingPageHandler) { func SetupRoutesPieChart(app *echo.Echo, h *PiechartHandler) { Lp := app.Group("/pie_chart") Lp.GET("/", h.ShowPieChart) + Lp.GET("/peserta", h.ShowMcuPeserta) } func SetupRoutesProject(app *echo.Echo) { diff --git a/services/chart.services.go b/services/chart.services.go index 2c0b74b..e15b4c6 100644 --- a/services/chart.services.go +++ b/services/chart.services.go @@ -106,8 +106,9 @@ type Piechart struct { // CreatedAt time.Time `json:"created_at,omitempty"` Title struct { - Text string `json:"text"` - Left string `json:"left"` + Text string `json:"text"` + SubText string `json:"subtext"` + Left string `json:"left"` } `json:"title"` Tooltip struct { Trigger string `json:"trigger"` @@ -180,14 +181,16 @@ type ServicesPiechart struct { // Peserta MCU -- MCU001 func GetPieChartMcu001(code string, id int) (string, Piechart, error) { - var title = "Status Index Masa Tubuh (BMI)" + var title = "Peserta MCU" option := Piechart{ Title: struct { - Text string `json:"text"` - Left string `json:"left"` + Text string `json:"text"` + SubText string `json:"subtext"` + Left string `json:"left"` }{ - Text: title, - Left: "center", + Text: title, + SubText: "Total Peserta 506", + Left: "center", }, Tooltip: struct { Trigger string `json:"trigger"` @@ -202,6 +205,11 @@ func GetPieChartMcu001(code string, id int) (string, Piechart, error) { Top: "bottom", Left: "center", Orient: "vertical", + + // KALAU BERTABRAKAN DGN ATASNYA SETTING PAKE DIBAWAH INI + // Top: "bottom", + // Left: "center", + // Orient: "horizontal", }, Series: []Series{ { @@ -252,17 +260,17 @@ func GetPieChartMcu001(code string, id int) (string, Piechart, error) { } // Kepersertaan MCU Berdasarkan Jenis Kelamin -- MCU002 - -// Status Index Masa Tubuh (BMI) -- MCU006 -func GetPieChartMcu006(code string, id int) (string, Piechart, error) { - var title = "Status Index Masa Tubuh (BMI)" +func GetPieChartMcu002(code string, id int) (string, Piechart, error) { + var title = "Kepesertaan MCU" option := Piechart{ Title: struct { - Text string `json:"text"` - Left string `json:"left"` + Text string `json:"text"` + SubText string `json:"subtext"` + Left string `json:"left"` }{ - Text: title, - Left: "center", + Text: title, + SubText: "Berdasarkan Jenis Kelamin", + Left: "center", }, Tooltip: struct { Trigger string `json:"trigger"` @@ -277,6 +285,173 @@ func GetPieChartMcu006(code string, id int) (string, Piechart, error) { Top: "bottom", Left: "center", Orient: "vertical", + + // KALAU BERTABRAKAN DGN ATASNYA SETTING PAKE DIBAWAH INI + // Top: "bottom", + // Left: "center", + // Orient: "horizontal", + }, + Series: []Series{ + { + Label: struct { + Position string `json:"position"` + Formatter string `json:"formatter"` + }{ + Position: "inner", + Formatter: "{d}%", + }, + Name: "Access From", + Type: "pie", + Radius: []string{"20%", "50%"}, + ItemStyle: struct { + BorderRadius int `json:"borderRadius"` + BorderColor string `json:"borderColor"` + BorderWidth int `json:"borderWidth"` + }{ + BorderRadius: 10, + BorderColor: "#fff", + BorderWidth: 2, + }, + Data: []SeriesData{ + {Value: 143, Name: "Laki-laki : 143 Peserta"}, + {Value: 114, Name: "Perempuan : 114 Peserta"}, + }, + Emphasis: struct { + ItemStyle struct { + ShadowBlur int `json:"shadowBlur"` + ShadowOffsetX int `json:"shadowOffsetX"` + ShadowColor string `json:"shadowColor"` + } `json:"itemStyle"` + }{ + ItemStyle: struct { + ShadowBlur int `json:"shadowBlur"` + ShadowOffsetX int `json:"shadowOffsetX"` + ShadowColor string `json:"shadowColor"` + }{ + ShadowBlur: 10, + ShadowOffsetX: 0, + ShadowColor: "rgba(0, 0, 0, 0.5)", + }, + }, + }, + }, + } + return title, option, nil +} + +// Peserta MCU berdasarkan umur +func GetPieChartMcu003(code string, id int) (string, Piechart, error) { + var title = "Peserta MCU" + option := Piechart{ + Title: struct { + Text string `json:"text"` + SubText string `json:"subtext"` + Left string `json:"left"` + }{ + Text: title, + SubText: "Berdasarkan Umur", + Left: "center", + }, + Tooltip: struct { + Trigger string `json:"trigger"` + }{ + Trigger: "item", + }, + Legend: struct { + Top string `json:"top"` + Left string `json:"left"` + Orient string `json:"orient"` + }{ + Top: "bottom", + Left: "center", + Orient: "vertical", + + // KALAU BERTABRAKAN DGN ATASNYA SETTING PAKE DIBAWAH INI + // Top: "bottom", + // Left: "center", + // Orient: "horizontal", + }, + Series: []Series{ + { + Label: struct { + Position string `json:"position"` + Formatter string `json:"formatter"` + }{ + Position: "inner", + Formatter: "{d}%", + }, + Name: "Access From", + Type: "pie", + Radius: []string{"20%", "50%"}, + ItemStyle: struct { + BorderRadius int `json:"borderRadius"` + BorderColor string `json:"borderColor"` + BorderWidth int `json:"borderWidth"` + }{ + BorderRadius: 10, + BorderColor: "#fff", + BorderWidth: 2, + }, + Data: []SeriesData{ + {Value: 188, Name: "< 30 Tahun : 188 Peserta"}, + {Value: 194, Name: "30 - < 40 Tahun : 194 Peserta"}, + {Value: 123, Name: "40 - < 50 Tahun : 123 Peserta"}, + {Value: 55, Name: "≥ 50 Tahun : 55 Peserta"}, + }, + Emphasis: struct { + ItemStyle struct { + ShadowBlur int `json:"shadowBlur"` + ShadowOffsetX int `json:"shadowOffsetX"` + ShadowColor string `json:"shadowColor"` + } `json:"itemStyle"` + }{ + ItemStyle: struct { + ShadowBlur int `json:"shadowBlur"` + ShadowOffsetX int `json:"shadowOffsetX"` + ShadowColor string `json:"shadowColor"` + }{ + ShadowBlur: 10, + ShadowOffsetX: 0, + ShadowColor: "rgba(0, 0, 0, 0.5)", + }, + }, + }, + }, + } + return title, option, nil +} + +// Status Index Masa Tubuh (BMI) -- MCU006 +func GetPieChartMcu006(code string, id int) (string, Piechart, error) { + var title = "Status Index Masa Tubuh (BMI)" + option := Piechart{ + Title: struct { + Text string `json:"text"` + SubText string `json:"subtext"` + Left string `json:"left"` + }{ + Text: title, + SubText: "", + Left: "center", + }, + Tooltip: struct { + Trigger string `json:"trigger"` + }{ + Trigger: "item", + }, + Legend: struct { + Top string `json:"top"` + Left string `json:"left"` + Orient string `json:"orient"` + }{ + Top: "bottom", + Left: "center", + Orient: "vertical", + + // KALAU BERTABRAKAN DGN ATASNYA SETTING PAKE DIBAWAH INI + // Top: "bottom", + // Left: "center", + // Orient: "horizontal", }, Series: []Series{ { @@ -329,14 +504,196 @@ func GetPieChartMcu006(code string, id int) (string, Piechart, error) { return title, option, nil } +// Kriteria Hipertensi -- MCU007 +func GetPieChartMcu007(code string, id int) (string, Piechart, error) { + var title = "Kriteria Hipertensi" + option := Piechart{ + Title: struct { + Text string `json:"text"` + SubText string `json:"subtext"` + Left string `json:"left"` + }{ + Text: title, + SubText: "", + Left: "center", + }, + Tooltip: struct { + Trigger string `json:"trigger"` + }{ + Trigger: "item", + }, + Legend: struct { + Top string `json:"top"` + Left string `json:"left"` + Orient string `json:"orient"` + }{ + Top: "bottom", + Left: "center", + Orient: "vertical", + + // KALAU BERTABRAKAN DGN ATASNYA SETTING PAKE DIBAWAH INI + // Top: "bottom", + // Left: "center", + // Orient: "horizontal", + }, + Series: []Series{ + { + Label: struct { + Position string `json:"position"` + Formatter string `json:"formatter"` + }{ + Position: "inner", + Formatter: "{d}%", + }, + Name: "Access From", + Type: "pie", + Radius: []string{"20%", "50%"}, + ItemStyle: struct { + BorderRadius int `json:"borderRadius"` + BorderColor string `json:"borderColor"` + BorderWidth int `json:"borderWidth"` + }{ + BorderRadius: 10, + BorderColor: "#fff", + BorderWidth: 2, + }, + Data: []SeriesData{ + {Value: 237, Name: "Normal : 237 Peserta"}, + {Value: 215, Name: "Prehipertensi : 215 Peserta"}, + {Value: 66, Name: "Hipertensi Grade I : 66 Peserta"}, + {Value: 33, Name: "Hipertensi Grade II : 33 Peserta"}, + }, + Emphasis: struct { + ItemStyle struct { + ShadowBlur int `json:"shadowBlur"` + ShadowOffsetX int `json:"shadowOffsetX"` + ShadowColor string `json:"shadowColor"` + } `json:"itemStyle"` + }{ + ItemStyle: struct { + ShadowBlur int `json:"shadowBlur"` + ShadowOffsetX int `json:"shadowOffsetX"` + ShadowColor string `json:"shadowColor"` + }{ + ShadowBlur: 10, + ShadowOffsetX: 0, + ShadowColor: "rgba(0, 0, 0, 0.5)", + }, + }, + }, + }, + } + + return title, option, nil +} + +// Visus Jauh -- MCU008 +func GetPieChartMcu008(code string, id int) (string, Piechart, error) { + var title = "Visus Jauh" + option := Piechart{ + Title: struct { + Text string `json:"text"` + SubText string `json:"subtext"` + Left string `json:"left"` + }{ + Text: title, + SubText: "", + Left: "center", + }, + Tooltip: struct { + Trigger string `json:"trigger"` + }{ + Trigger: "item", + }, + Legend: struct { + Top string `json:"top"` + Left string `json:"left"` + Orient string `json:"orient"` + }{ + Top: "bottom", + Left: "center", + Orient: "vertical", + + // KALAU BERTABRAKAN DGN ATASNYA SETTING PAKE DIBAWAH INI + // Top: "bottom", + // Left: "center", + // Orient: "horizontal", + }, + Series: []Series{ + { + Label: struct { + Position string `json:"position"` + Formatter string `json:"formatter"` + }{ + Position: "inner", + Formatter: "{d}%", + }, + Name: "Access From", + Type: "pie", + Radius: []string{"20%", "50%"}, + ItemStyle: struct { + BorderRadius int `json:"borderRadius"` + BorderColor string `json:"borderColor"` + BorderWidth int `json:"borderWidth"` + }{ + BorderRadius: 10, + BorderColor: "#fff", + BorderWidth: 2, + }, + Data: []SeriesData{ + {Value: 237, Name: "Normal : 237 Peserta"}, + {Value: 194, Name: "Kelainan Refraksi : 194 Peserta"}, + {Value: 64, Name: "Kelainan Refraksi terkoreksi : 64 Peserta"}, + {Value: 56, Name: "Kelainan Refraksi tidak terkoreksi : 56 Peserta"}, + }, + Emphasis: struct { + ItemStyle struct { + ShadowBlur int `json:"shadowBlur"` + ShadowOffsetX int `json:"shadowOffsetX"` + ShadowColor string `json:"shadowColor"` + } `json:"itemStyle"` + }{ + ItemStyle: struct { + ShadowBlur int `json:"shadowBlur"` + ShadowOffsetX int `json:"shadowOffsetX"` + ShadowColor string `json:"shadowColor"` + }{ + ShadowBlur: 10, + ShadowOffsetX: 0, + ShadowColor: "rgba(0, 0, 0, 0.5)", + }, + }, + }, + }, + } + + return title, option, nil +} + func (su *ServicesPiechart) GetPieChart(code string, id int) (string, Piechart, error) { if code == "mcu001" { return GetPieChartMcu001(code, id) } + if code == "mcu002" { + return GetPieChartMcu002(code, id) + } + + if code == "mcu003" { + return GetPieChartMcu003(code, id) + } + if code == "mcu006" { return GetPieChartMcu006(code, id) } + if code == "mcu007" { + return GetPieChartMcu007(code, id) + } + + if code == "mcu008" { + return GetPieChartMcu008(code, id) + } + return "", Piechart{}, fmt.Errorf("code " + code + " not found") } diff --git a/views/mcu/peserta/mcupeserta.templ b/views/mcu/peserta/mcupeserta.templ new file mode 100644 index 0000000..729859c --- /dev/null +++ b/views/mcu/peserta/mcupeserta.templ @@ -0,0 +1,132 @@ +package mcupeserta + +import ( + "github.com/emarifer/go-templ-project-structure/views/layout" + chart "github.com/emarifer/go-templ-project-structure/views/component/chart" +) + +templ MainMcuPeserta(divPesertaMcu string, dataPesertaMcu string, divKepesertaanMcu string, dataKepesertaanMcu string, divPesertaMcuUmur string, dataPesertaMcuUmur string) { +
+ @HeaderMcuPeserta() +
+
+

Data Kepesertaan MCU

+
+
+
+ @chart.ShowChart(divPesertaMcu, dataPesertaMcu) +
+
+ @chart.ShowChart(divKepesertaanMcu, dataKepesertaanMcu) +
+
+ @chart.ShowChart(divPesertaMcuUmur, dataPesertaMcuUmur) +
+
+
+
+} + +templ CssMcuPeserta() { + + + + +} + +templ JsMcuPeserta() { + // echart + +} + +templ HeaderMcuPeserta() { + +
+
+

+ PT. Sadhana Abiyasa Sampoerna +

+ +
+
+ +
+ + + +
+
+
+ +
+ +
+} + +templ ShowMcuPeserta(title string, cmp templ.Component, css templ.Component, js templ.Component) { + @layout.PlaygroundLayout(title, css, js) { + @cmp + } +} diff --git a/views/mcu/peserta/mcupeserta_templ.go b/views/mcu/peserta/mcupeserta_templ.go new file mode 100644 index 0000000..1ec87e5 --- /dev/null +++ b/views/mcu/peserta/mcupeserta_templ.go @@ -0,0 +1,183 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.2.663 +package mcupeserta + +//lint:file-ignore SA4006 This context is only used if a nested component is present. + +import "github.com/a-h/templ" +import "context" +import "io" +import "bytes" + +import ( + chart "github.com/emarifer/go-templ-project-structure/views/component/chart" + "github.com/emarifer/go-templ-project-structure/views/layout" +) + +func MainMcuPeserta(divPesertaMcu string, dataPesertaMcu string, divKepesertaanMcu string, dataKepesertaanMcu string, divPesertaMcuUmur string, dataPesertaMcuUmur string) templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var1 := templ.GetChildren(ctx) + if templ_7745c5c3_Var1 == nil { + templ_7745c5c3_Var1 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = HeaderMcuPeserta().Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

Data Kepesertaan MCU

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = chart.ShowChart(divPesertaMcu, dataPesertaMcu).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = chart.ShowChart(divKepesertaanMcu, dataKepesertaanMcu).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = chart.ShowChart(divPesertaMcuUmur, dataPesertaMcuUmur).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) + } + return templ_7745c5c3_Err + }) +} + +func CssMcuPeserta() templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var2 := templ.GetChildren(ctx) + if templ_7745c5c3_Var2 == nil { + templ_7745c5c3_Var2 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) + } + return templ_7745c5c3_Err + }) +} + +func JsMcuPeserta() templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var3 := templ.GetChildren(ctx) + if templ_7745c5c3_Var3 == nil { + templ_7745c5c3_Var3 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) + } + return templ_7745c5c3_Err + }) +} + +func HeaderMcuPeserta() templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var4 := templ.GetChildren(ctx) + if templ_7745c5c3_Var4 == nil { + templ_7745c5c3_Var4 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

PT. Sadhana Abiyasa Sampoerna\r

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) + } + return templ_7745c5c3_Err + }) +} + +func ShowMcuPeserta(title string, cmp templ.Component, css templ.Component, js templ.Component) templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var5 := templ.GetChildren(ctx) + if templ_7745c5c3_Var5 == nil { + templ_7745c5c3_Var5 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + templ_7745c5c3_Var6 := templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + templ_7745c5c3_Err = cmp.Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = io.Copy(templ_7745c5c3_W, templ_7745c5c3_Buffer) + } + return templ_7745c5c3_Err + }) + templ_7745c5c3_Err = layout.PlaygroundLayout(title, css, js).Render(templ.WithChildren(ctx, templ_7745c5c3_Var6), templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) + } + return templ_7745c5c3_Err + }) +}