diff --git a/cmd/main.go b/cmd/main.go index 63fae66..bc8de23 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -29,6 +29,7 @@ func main() { // SETUP ROUT CORPORATE handlers.SetupRoutesCorporate(app, appStore) // SETUP ROUT CLIENT + handlers.SetupRoutesClient(app, appStore) // SETUP ROUT DEV app.Logger.Fatal(app.Start(":5000")) diff --git a/handlers/client/mdbahan.handlers.go b/handlers/client/mdbahan.handlers.go new file mode 100644 index 0000000..133fbdb --- /dev/null +++ b/handlers/client/mdbahan.handlers.go @@ -0,0 +1,27 @@ +package client_handlers + +import ( + "cpone/utils" + + client_mdbahan "cpone/views/client/mdbahan" + + "github.com/labstack/echo/v4" +) + +type MdBahanService interface { +} + +func NewMdBahanHandler(us MdBahanService) *MdBahanHandler { + return &MdBahanHandler{ + MdBahanService: us, + } +} + +type MdBahanHandler struct { + MdBahanService MdBahanService +} + +func (uh *MdBahanHandler) ShowMdBahan(c echo.Context) error { + helo := client_mdbahan.Show() + return utils.View(c, helo) +} diff --git a/handlers/routes.go b/handlers/routes.go index f1a01d7..d2851b3 100644 --- a/handlers/routes.go +++ b/handlers/routes.go @@ -1,9 +1,11 @@ package handlers import ( + client_handlers "cpone/handlers/client" corporate_handlers "cpone/handlers/corporate" dev_handlers "cpone/handlers/dev" public_handlers "cpone/handlers/public" + client_services "cpone/services/client" corporate_services "cpone/services/corporate" public_services "cpone/services/public" @@ -72,3 +74,10 @@ func SetupRoutesCorporate(app *echo.Echo, appStore db.AppStore) { lh := corporate_handlers.NewCompanyHandler(l) public.GET("/company", lh.ShowCompany) } + +func SetupRoutesClient(app *echo.Echo, appStore db.AppStore) { + public := app.Group("/client") + l := client_services.NewServicesMdBahan(appStore) + lh := client_handlers.NewMdBahanHandler(l) + public.GET("/md/bahan", lh.ShowMdBahan) +} diff --git a/services/client/mdbahan.services.go b/services/client/mdbahan.services.go new file mode 100644 index 0000000..c2e3a5c --- /dev/null +++ b/services/client/mdbahan.services.go @@ -0,0 +1,15 @@ +package client_services + +import "cpone/db" + +type ServicesMdBahan struct { + CompanyStore db.AppStore +} + +func NewServicesMdBahan(uStore db.AppStore) *ServicesMdBahan { + + return &ServicesMdBahan{ + + CompanyStore: uStore, + } +} diff --git a/utils/contains.utils.go b/utils/contains.utils.go index 656f370..59e1271 100644 --- a/utils/contains.utils.go +++ b/utils/contains.utils.go @@ -1,5 +1,7 @@ package utils +import "strings" + func Contains(s, substr string) bool { - return s != "" && substr != "" && len(s) >= len(substr) && s[:len(substr)] == substr + return strings.Contains(strings.ToLower(s), strings.ToLower(substr)) } diff --git a/views/client/mdbahan/mdbahan.templ b/views/client/mdbahan/mdbahan.templ new file mode 100644 index 0000000..b2830d5 --- /dev/null +++ b/views/client/mdbahan/mdbahan.templ @@ -0,0 +1,40 @@ +package client_mdbahan + +import ( + "cpone/component/under_development" + "cpone/layout" +) + +templ Content() { +
+ @under_development.UnderDevelopment() +
+} + +templ Css() { + +} + +templ Js() { +} + +templ Show() { + @layout.PlaygroundLayout("Client Md Bahan", Css(), Js()) { + @Content() + } +} diff --git a/views/client/mdbahan/mdbahan_templ.go b/views/client/mdbahan/mdbahan_templ.go new file mode 100644 index 0000000..6173b36 --- /dev/null +++ b/views/client/mdbahan/mdbahan_templ.go @@ -0,0 +1,131 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.2.663 +package client_mdbahan + +//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 Bahan", 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 + }) +}