from stash menu sidebar

This commit is contained in:
sindhu
2024-05-03 09:21:49 +07:00
parent f5e512aa6e
commit 80ff72e3b3
11 changed files with 1989 additions and 2 deletions

View File

@@ -0,0 +1,55 @@
package handlers
import (
"fmt"
"github.com/a-h/templ"
"github.com/emarifer/go-templ-project-structure/services"
mastermenuusergroup "github.com/emarifer/go-templ-project-structure/views/mastermenuusergroup"
"github.com/labstack/echo/v4"
)
type MasterMenuUserGroupService interface {
GetMasterMenus() ([]services.MasterMenu, error)
}
func NewMasterMenuUserGroupHandler(us MasterMenuUserGroupService) *MasterMenuUserGroupHandler {
return &MasterMenuUserGroupHandler{
MasterMenuUserGroupService: us,
}
}
type MasterMenuUserGroupHandler struct {
MasterMenuUserGroupService MasterMenuUserGroupService
}
func (lh *MasterMenuUserGroupHandler) HandlerShowMasterMenuUserGroup(c echo.Context) error {
dataMenu, err := lh.MasterMenuUserGroupService.GetMasterMenus()
fmt.Println(dataMenu)
fmt.Println(err)
if err != nil {
fmt.Println(dataMenu)
return err
}
// fmt.Printf("%+v\n", dataMenu)
// si := mastermenu.ShowMasterMenu("Master Menu",
// mastermenu.MainMasterMenu(dataMenu),
// mastermenu.CssMasterMenu(),
// mastermenu.JsMasterMenu(),
// )
si := mastermenuusergroup.ShowMasterMenuUserGroup(
"Master Menu",
mastermenuusergroup.MainMasterMenuUserGroup(dataMenu),
mastermenuusergroup.CssMasterMenuUserGroup(),
mastermenuusergroup.JsMasterMenuUserGroup(),
)
return lh.View(c, si)
}
func (uh *MasterMenuUserGroupHandler) 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)
}

View File

@@ -19,9 +19,13 @@ func SetupRoutesXsample(app *echo.Echo, h *XsampleHandler) {
xSample := app.Group("/xsample")
xSample.GET("/xsample01", h.Hello)
}
func SetupRoutesLandingPage(app *echo.Echo, h *LandingPageHandler) {
func SetupRoutesLandingPage(app *echo.Echo, h *LandingPageHandler, mastermenuusergroupHandler *MasterMenuUserGroupHandler) {
Lp := app.Group("/landing_page")
Lp.GET("/", h.ShowLandingPage)
clientgroup := app.Group("/client")
// mdgroup := clientgroup.Group("/md")
// clientusergroup.GET("/md", mastermenuusergroupHandler.HandlerShowMasterMenuUserGroup)
clientgroup.GET("/usergroup", mastermenuusergroupHandler.HandlerShowMasterMenuUserGroup)
}
func SetupRoutesPieChart(app *echo.Echo, h *PiechartHandler) {
Lp := app.Group("/pie_chart")