From 0ba409ab739da480d48e6159d677ca7b179f851b Mon Sep 17 00:00:00 2001 From: sindhu Date: Wed, 8 May 2024 16:27:30 +0700 Subject: [PATCH] client md panel --- handlers/client/mdpanel.handlers.go | 26 +++++ handlers/routes.go | 4 + services/client/mdbahan.services.go | 4 +- services/client/mdpanel.services.go | 15 +++ views/client/mdpanel/mdpanel.templ | 40 ++++++++ views/client/mdpanel/mdpanel_templ.go | 131 ++++++++++++++++++++++++++ 6 files changed, 218 insertions(+), 2 deletions(-) create mode 100644 handlers/client/mdpanel.handlers.go create mode 100644 services/client/mdpanel.services.go create mode 100644 views/client/mdpanel/mdpanel.templ create mode 100644 views/client/mdpanel/mdpanel_templ.go diff --git a/handlers/client/mdpanel.handlers.go b/handlers/client/mdpanel.handlers.go new file mode 100644 index 0000000..badb78e --- /dev/null +++ b/handlers/client/mdpanel.handlers.go @@ -0,0 +1,26 @@ +package client_handlers + +import ( + "cpone/utils" + client_mdpanel "cpone/views/client/mdpanel" + + "github.com/labstack/echo/v4" +) + +type MdPanelService interface { +} + +func NewMdPanelHandler(us MdPanelService) *MdPanelHandler { + return &MdPanelHandler{ + MdPanelService: us, + } +} + +type MdPanelHandler struct { + MdPanelService MdPanelService +} + +func (uh *MdPanelHandler) ShowMdPanel(c echo.Context) error { + helo := client_mdpanel.Show() + return utils.View(c, helo) +} diff --git a/handlers/routes.go b/handlers/routes.go index d2851b3..55fbd3e 100644 --- a/handlers/routes.go +++ b/handlers/routes.go @@ -80,4 +80,8 @@ func SetupRoutesClient(app *echo.Echo, appStore db.AppStore) { l := client_services.NewServicesMdBahan(appStore) lh := client_handlers.NewMdBahanHandler(l) public.GET("/md/bahan", lh.ShowMdBahan) + + lpanel := client_services.NewServicesMdPanel(appStore) + lhpanel := client_handlers.NewMdPanelHandler(lpanel) + public.GET("/md/panel", lhpanel.ShowMdPanel) } diff --git a/services/client/mdbahan.services.go b/services/client/mdbahan.services.go index c2e3a5c..25ebfaa 100644 --- a/services/client/mdbahan.services.go +++ b/services/client/mdbahan.services.go @@ -3,13 +3,13 @@ package client_services import "cpone/db" type ServicesMdBahan struct { - CompanyStore db.AppStore + MdBahanStore db.AppStore } func NewServicesMdBahan(uStore db.AppStore) *ServicesMdBahan { return &ServicesMdBahan{ - CompanyStore: uStore, + MdBahanStore: uStore, } } diff --git a/services/client/mdpanel.services.go b/services/client/mdpanel.services.go new file mode 100644 index 0000000..5d93069 --- /dev/null +++ b/services/client/mdpanel.services.go @@ -0,0 +1,15 @@ +package client_services + +import "cpone/db" + +type ServicesMdPanel struct { + MdPanelStore db.AppStore +} + +func NewServicesMdPanel(uStore db.AppStore) *ServicesMdPanel { + + return &ServicesMdPanel{ + + MdPanelStore: uStore, + } +} diff --git a/views/client/mdpanel/mdpanel.templ b/views/client/mdpanel/mdpanel.templ new file mode 100644 index 0000000..96ebb35 --- /dev/null +++ b/views/client/mdpanel/mdpanel.templ @@ -0,0 +1,40 @@ +package client_mdpanel + +import ( + "cpone/component/under_development" + "cpone/layout" +) + +templ Content() { +
+ @under_development.UnderDevelopment() +
+} + +templ Css() { + +} + +templ Js() { +} + +templ Show() { + @layout.PlaygroundLayout("Client Md Panel", Css(), Js()) { + @Content() + } +} diff --git a/views/client/mdpanel/mdpanel_templ.go b/views/client/mdpanel/mdpanel_templ.go new file mode 100644 index 0000000..c42abd4 --- /dev/null +++ b/views/client/mdpanel/mdpanel_templ.go @@ -0,0 +1,131 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.2.663 +package client_mdpanel + +//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 Md Panel", 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 + }) +}