diff --git a/cmd/main.go b/cmd/main.go index 6ff246f..63fae66 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -27,6 +27,7 @@ func main() { // SETUP ROUT PUBLIC handlers.SetupRoutesPublic(app, appStore) // SETUP ROUT CORPORATE + handlers.SetupRoutesCorporate(app, appStore) // SETUP ROUT CLIENT // SETUP ROUT DEV diff --git a/views/dev/under_development/under_development.templ b/component/under_development/under_development.templ similarity index 100% rename from views/dev/under_development/under_development.templ rename to component/under_development/under_development.templ diff --git a/views/dev/under_development/under_development_templ.go b/component/under_development/under_development_templ.go similarity index 100% rename from views/dev/under_development/under_development_templ.go rename to component/under_development/under_development_templ.go diff --git a/handlers/corporate/company.handlers.go b/handlers/corporate/company.handlers.go new file mode 100644 index 0000000..b2231ed --- /dev/null +++ b/handlers/corporate/company.handlers.go @@ -0,0 +1,26 @@ +package corporate_handlers + +import ( + "cpone/utils" + corporate_company "cpone/views/corporate/company" + + "github.com/labstack/echo/v4" +) + +type CompanyService interface { +} + +func NewCompanyHandler(us CompanyService) *CompanyHandler { + return &CompanyHandler{ + CompanyService: us, + } +} + +type CompanyHandler struct { + CompanyService CompanyService +} + +func (uh *CompanyHandler) ShowCompany(c echo.Context) error { + helo := corporate_company.Show() + return utils.View(c, helo) +} diff --git a/handlers/routes.go b/handlers/routes.go index 3387f84..f1a01d7 100644 --- a/handlers/routes.go +++ b/handlers/routes.go @@ -1,8 +1,10 @@ package handlers import ( + corporate_handlers "cpone/handlers/corporate" dev_handlers "cpone/handlers/dev" public_handlers "cpone/handlers/public" + corporate_services "cpone/services/corporate" public_services "cpone/services/public" "cpone/db" @@ -64,3 +66,9 @@ func SetupRoutesPublic(app *echo.Echo, appStore db.AppStore) { lh := public_handlers.NewLandingPageHandler(l) public.GET("landingpage", lh.ShowLandingPage) } +func SetupRoutesCorporate(app *echo.Echo, appStore db.AppStore) { + public := app.Group("/corp") + l := corporate_services.NewServicesCompany(appStore) + lh := corporate_handlers.NewCompanyHandler(l) + public.GET("/company", lh.ShowCompany) +} diff --git a/layout/canvas_layout.templ b/layout/canvas_layout.templ index 5aeaf2a..fdc512f 100644 --- a/layout/canvas_layout.templ +++ b/layout/canvas_layout.templ @@ -83,6 +83,25 @@ templ CanvasLayout(title string, css templ.Component, js templ.Component) { rel="stylesheet" type="text/css" /> + + + + + @css diff --git a/layout/canvas_layout_templ.go b/layout/canvas_layout_templ.go index 6580463..d11ccaf 100644 --- a/layout/canvas_layout_templ.go +++ b/layout/canvas_layout_templ.go @@ -36,7 +36,7 @@ func CanvasLayout(title string, css templ.Component, js templ.Component) templ.C if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/layout/layout_corporate.templ b/layout/layout_corporate.templ index a99c0f2..46be17f 100644 --- a/layout/layout_corporate.templ +++ b/layout/layout_corporate.templ @@ -91,6 +91,25 @@ templ CorporateLayout(title string, css templ.Component, js templ.Component, dat rel="stylesheet" type="text/css" /> + + + + + @css diff --git a/layout/layout_corporate_templ.go b/layout/layout_corporate_templ.go index de68ea2..e42f034 100644 --- a/layout/layout_corporate_templ.go +++ b/layout/layout_corporate_templ.go @@ -44,7 +44,7 @@ func CorporateLayout(title string, css templ.Component, js templ.Component, data if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/layout/playground_layout.templ b/layout/playground_layout.templ index 80354d2..891d448 100644 --- a/layout/playground_layout.templ +++ b/layout/playground_layout.templ @@ -84,6 +84,25 @@ templ PlaygroundLayout(title string, css templ.Component, js templ.Component) { rel="stylesheet" type="text/css" /> + + + + + @css diff --git a/layout/playground_layout_templ.go b/layout/playground_layout_templ.go index d425de4..43b92d9 100644 --- a/layout/playground_layout_templ.go +++ b/layout/playground_layout_templ.go @@ -37,7 +37,7 @@ func PlaygroundLayout(title string, css templ.Component, js templ.Component) tem if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/services/corporate/company.services.go b/services/corporate/company.services.go new file mode 100644 index 0000000..bcd9068 --- /dev/null +++ b/services/corporate/company.services.go @@ -0,0 +1,15 @@ +package corporate_services + +import "cpone/db" + +type ServicesCompany struct { + CompanyStore db.AppStore +} + +func NewServicesCompany(uStore db.AppStore) *ServicesCompany { + + return &ServicesCompany{ + + CompanyStore: uStore, + } +} diff --git a/utils/view.utils.go b/utils/view.utils.go new file mode 100644 index 0000000..ef4e5ac --- /dev/null +++ b/utils/view.utils.go @@ -0,0 +1,12 @@ +package utils + +import ( + "github.com/a-h/templ" + "github.com/labstack/echo/v4" +) + +func View(c echo.Context, cmp templ.Component) error { + c.Response().Header().Set(echo.HeaderContentType, echo.MIMETextHTML) + + return cmp.Render(c.Request().Context(), c.Response().Writer) +} diff --git a/views/corporate/company/company.templ b/views/corporate/company/company.templ new file mode 100644 index 0000000..49e151c --- /dev/null +++ b/views/corporate/company/company.templ @@ -0,0 +1,40 @@ +package corporate_company + +import ( + "cpone/component/under_development" + "cpone/layout" +) + +templ Content() { +
+ @under_development.UnderDevelopment() +
+} + +templ Css() { + +} + +templ Js() { +} + +templ Show() { + @layout.PlaygroundLayout("Corp Company", Css(), Js()) { + @Content() + } +} diff --git a/views/corporate/company/company_templ.go b/views/corporate/company/company_templ.go new file mode 100644 index 0000000..11c04eb --- /dev/null +++ b/views/corporate/company/company_templ.go @@ -0,0 +1,131 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.2.663 +package corporate_company + +//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("Corp Company", 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 + }) +} diff --git a/views/dev/employee/employee.templ b/views/dev/employee/employee.templ index b0f0c6f..b4a9b0a 100644 --- a/views/dev/employee/employee.templ +++ b/views/dev/employee/employee.templ @@ -2,7 +2,7 @@ package employee import ( "cpone/layout" - "cpone/views/dev/under_development" + "cpone/component/under_development" ) templ MainEmployee(cardServiceComponent templ.Component) { diff --git a/views/dev/employee/employee_templ.go b/views/dev/employee/employee_templ.go index 304b540..14bff8b 100644 --- a/views/dev/employee/employee_templ.go +++ b/views/dev/employee/employee_templ.go @@ -11,8 +11,8 @@ import "io" import "bytes" import ( + "cpone/component/under_development" "cpone/layout" - "cpone/views/dev/under_development" ) func MainEmployee(cardServiceComponent templ.Component) templ.Component { diff --git a/views/dev/landingpage/landingpage.templ b/views/dev/landingpage/landingpage.templ index 20697a6..a977368 100644 --- a/views/dev/landingpage/landingpage.templ +++ b/views/dev/landingpage/landingpage.templ @@ -57,29 +57,6 @@ templ MainLandingPage(medicalServiceComponent templ.Component, listAdvantageComp } templ CssLandingPage() { - - - - - - ") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err }