From ff0f95a67f1ceca759a5b806c5c906a3f7c1b969 Mon Sep 17 00:00:00 2001 From: Sas Andy Date: Fri, 10 May 2024 09:32:36 +0700 Subject: [PATCH] client dashboard --- handlers/client/clientdashboard.handlers.go | 26 ++++ handlers/routes.go | 2 + services/client/clientdashboard.services.go | 15 +++ views/client/dashboard/dashboard.templ | 40 ++++++ views/client/dashboard/dashboard_templ.go | 131 ++++++++++++++++++++ 5 files changed, 214 insertions(+) create mode 100644 handlers/client/clientdashboard.handlers.go create mode 100644 services/client/clientdashboard.services.go create mode 100644 views/client/dashboard/dashboard.templ create mode 100644 views/client/dashboard/dashboard_templ.go diff --git a/handlers/client/clientdashboard.handlers.go b/handlers/client/clientdashboard.handlers.go new file mode 100644 index 0000000..b66d470 --- /dev/null +++ b/handlers/client/clientdashboard.handlers.go @@ -0,0 +1,26 @@ +package client_handlers + +import ( + "cpone/utils" + client_dashboard "cpone/views/client/dashboard" + + "github.com/labstack/echo/v4" +) + +type ClientDashboardService interface { +} + +func NewClientDashboardHandler(us ClientDashboardService) *ClientDashboardHandler { + return &ClientDashboardHandler{ + ClientDashboardService: us, + } +} + +type ClientDashboardHandler struct { + ClientDashboardService ClientDashboardService +} + +func (uh *ClientDashboardHandler) ShowClientDashboard(c echo.Context) error { + helo := client_dashboard.Show() + return utils.View(c, helo) +} diff --git a/handlers/routes.go b/handlers/routes.go index 4c328ef..79367ae 100644 --- a/handlers/routes.go +++ b/handlers/routes.go @@ -84,4 +84,6 @@ func SetupRoutesClient(app *echo.Echo, appStore db.AppStore) { l := client_services.NewServicesMdBahan(appStore) lh := client_handlers.NewMdBahanHandler(l) public.GET("/md/bahan", lh.ShowMdBahan) + clientdshbrdHandler := client_handlers.NewClientDashboardHandler(l) + public.GET("", clientdshbrdHandler.ShowClientDashboard) } diff --git a/services/client/clientdashboard.services.go b/services/client/clientdashboard.services.go new file mode 100644 index 0000000..219f9d4 --- /dev/null +++ b/services/client/clientdashboard.services.go @@ -0,0 +1,15 @@ +package client_services + +import "cpone/db" + +type ServicesClientDashboard struct { + CLientDashboardStore db.AppStore +} + +func NewServicesClientDashboard(uStore db.AppStore) *ServicesClientDashboard { + + return &ServicesClientDashboard{ + + CLientDashboardStore: uStore, + } +} diff --git a/views/client/dashboard/dashboard.templ b/views/client/dashboard/dashboard.templ new file mode 100644 index 0000000..513eac9 --- /dev/null +++ b/views/client/dashboard/dashboard.templ @@ -0,0 +1,40 @@ +package client_dashboard + +import ( + "cpone/component/under_development" + "cpone/layout" +) + +templ Content() { +
+ @under_development.UnderDevelopment() +
+} + +templ Css() { + +} + +templ Js() { +} + +templ Show() { + @layout.PlaygroundLayout("Client Dashboard", Css(), Js()) { + @Content() + } +} diff --git a/views/client/dashboard/dashboard_templ.go b/views/client/dashboard/dashboard_templ.go new file mode 100644 index 0000000..4afd476 --- /dev/null +++ b/views/client/dashboard/dashboard_templ.go @@ -0,0 +1,131 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.2.663 +package client_dashboard + +//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 ( + "cpone/component/under_development" + "cpone/layout" +) + +func Content() 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 = under_development.UnderDevelopment().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 Css() 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 Js() 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) + if !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) + } + return templ_7745c5c3_Err + }) +} + +func Show() 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_Var5 := 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 = Content().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("Client Dashboard", Css(), Js()).Render(templ.WithChildren(ctx, templ_7745c5c3_Var5), 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 + }) +}