diff --git a/component/pagination/pagination.templ b/component/pagination/pagination.templ
index e99824f..72a1b7d 100644
--- a/component/pagination/pagination.templ
+++ b/component/pagination/pagination.templ
@@ -3,6 +3,8 @@ package pagination
import "strconv"
templ Pagination(length int, currentPage int, link string, contentID string) {
+ // hx-on::before-request={ HideContent(contentID) }
+ // hx-on::after-request="alert('Done making a request!')"
for i:=0; i
{ strconv.Itoa(i+1) }
}
}
@@ -31,13 +37,23 @@ templ Pagination(length int, currentPage int, link string, contentID string) {
}
script ShowContent(contentID string) {
+ console.log("Show Content");
console.log(contentID);
- document.querySelector('#'+contentID).style.display = 'block';
-
+ document.getElementById(contentID).setAttribute("visible","");
+ // document.querySelector('#'+contentID).style.display = 'block';
+ // document.querySelector('#'+contentID).setAttribute("visible","");
+
}
script HideContent(contentID string) {
- console.log(contentID);
- document.querySelector('#'+contentID).style.display = 'none';
-
+ console.log("Hide Content");
+ console.log(contentID);
+ document.getElementById(contentID).setAttribute("hidden","");
+ // document.querySelector('#'+contentID).style.display = 'none';
+ // document.querySelector('#'+contentID).setAttribute("hidden","");
+}
+
+script CobaContent(contentID string) {
+ console.log(contentID);
+
}
diff --git a/component/pagination/pagination_templ.go b/component/pagination/pagination_templ.go
index 29e5c10..19d4ece 100644
--- a/component/pagination/pagination_templ.go
+++ b/component/pagination/pagination_templ.go
@@ -42,13 +42,13 @@ func Pagination(length int, currentPage int, link string, contentID string) temp
var templ_7745c5c3_Var2 string
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(link + "?" + "currentPage=" + strconv.Itoa(i+1) + "&page=" + strconv.Itoa(length) + "&contentID=" + contentID)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\pagination\pagination.templ`, Line: 11, Col: 124}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\pagination\pagination.templ`, Line: 13, Col: 124}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" class=\"btn btn-icon btn-sm border-0 btn-light btn-hover-primary active mr-2 my-1\" hx-swap=\"innerHTML\" hx-indicator=\"#indicator\" hx-on::before-request=\"")
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" class=\"btn btn-icon btn-sm border-0 btn-light btn-hover-primary active mr-2 my-1\" hx-swap=\"outerHTML\" hx-indicator=\"#indicator\" hx-trigger=\"click\" hx-on::before-request=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -73,7 +73,7 @@ func Pagination(length int, currentPage int, link string, contentID string) temp
var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs("#" + contentID)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\pagination\pagination.templ`, Line: 17, Col: 33}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\pagination\pagination.templ`, Line: 20, Col: 33}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
if templ_7745c5c3_Err != nil {
@@ -86,7 +86,7 @@ func Pagination(length int, currentPage int, link string, contentID string) temp
var templ_7745c5c3_Var6 string
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.Itoa(i + 1))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\pagination\pagination.templ`, Line: 18, Col: 25}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\pagination\pagination.templ`, Line: 21, Col: 25}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
if templ_7745c5c3_Err != nil {
@@ -97,6 +97,10 @@ func Pagination(length int, currentPage int, link string, contentID string) temp
return templ_7745c5c3_Err
}
} else {
+ templ_7745c5c3_Err = templ.RenderScriptItems(ctx, templ_7745c5c3_Buffer, HideContent(contentID), ShowContent(contentID))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-on::after-request=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- var templ_7745c5c3_Var9 string
- templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.Itoa(i + 1))
+ var templ_7745c5c3_Var9 templ.ComponentScript = ShowContent(contentID)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var9.Call)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\pagination\pagination.templ`, Line: 26, Col: 25}
+ return templ_7745c5c3_Err
}
- _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-target=\"")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var10 string
+ templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs("#" + contentID)
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\pagination\pagination.templ`, Line: 31, Col: 33}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
+ 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
+ }
+ var templ_7745c5c3_Var11 string
+ templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.Itoa(i + 1))
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\pagination\pagination.templ`, Line: 32, Col: 25}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -155,24 +177,40 @@ func Pagination(length int, currentPage int, link string, contentID string) temp
func ShowContent(contentID string) templ.ComponentScript {
return templ.ComponentScript{
- Name: `__templ_ShowContent_beed`,
- Function: `function __templ_ShowContent_beed(contentID){console.log(contentID);
- document.querySelector('#'+contentID).style.display = 'block';
-
+ Name: `__templ_ShowContent_cf70`,
+ Function: `function __templ_ShowContent_cf70(contentID){console.log("Show Content");
+ console.log(contentID);
+ document.getElementById(contentID).setAttribute("visible","");
+ // document.querySelector('#'+contentID).style.display = 'block';
+ // document.querySelector('#'+contentID).setAttribute("visible","");
+
}`,
- Call: templ.SafeScript(`__templ_ShowContent_beed`, contentID),
- CallInline: templ.SafeScriptInline(`__templ_ShowContent_beed`, contentID),
+ Call: templ.SafeScript(`__templ_ShowContent_cf70`, contentID),
+ CallInline: templ.SafeScriptInline(`__templ_ShowContent_cf70`, contentID),
}
}
func HideContent(contentID string) templ.ComponentScript {
return templ.ComponentScript{
- Name: `__templ_HideContent_700f`,
- Function: `function __templ_HideContent_700f(contentID){console.log(contentID);
- document.querySelector('#'+contentID).style.display = 'none';
-
+ Name: `__templ_HideContent_0799`,
+ Function: `function __templ_HideContent_0799(contentID){console.log("Hide Content");
+ console.log(contentID);
+ document.getElementById(contentID).setAttribute("hidden","");
+ // document.querySelector('#'+contentID).style.display = 'none';
+ // document.querySelector('#'+contentID).setAttribute("hidden","");
}`,
- Call: templ.SafeScript(`__templ_HideContent_700f`, contentID),
- CallInline: templ.SafeScriptInline(`__templ_HideContent_700f`, contentID),
+ Call: templ.SafeScript(`__templ_HideContent_0799`, contentID),
+ CallInline: templ.SafeScriptInline(`__templ_HideContent_0799`, contentID),
+ }
+}
+
+func CobaContent(contentID string) templ.ComponentScript {
+ return templ.ComponentScript{
+ Name: `__templ_CobaContent_ef1c`,
+ Function: `function __templ_CobaContent_ef1c(contentID){console.log(contentID);
+
+}`,
+ Call: templ.SafeScript(`__templ_CobaContent_ef1c`, contentID),
+ CallInline: templ.SafeScriptInline(`__templ_CobaContent_ef1c`, contentID),
}
}
diff --git a/handlers/dev/mastermenuusergroup.handlers.go b/handlers/dev/mastermenuusergroup.handlers.go
index 3683cee..e30d152 100644
--- a/handlers/dev/mastermenuusergroup.handlers.go
+++ b/handlers/dev/mastermenuusergroup.handlers.go
@@ -17,6 +17,7 @@ import (
"github.com/a-h/templ"
"github.com/labstack/echo/v4"
+ "go.uber.org/zap"
)
type MasterMenuUserGroupService interface {
@@ -52,8 +53,7 @@ func (lh *MasterMenuUserGroupHandler) HandlerShowMasterMenuUserGroup(c echo.Cont
return err
}
dataUserGroup, err := lh.MasterMenuUserGroupService.GetUserGroup()
- fmt.Println(dataUserGroup)
- fmt.Println(err)
+
if err != nil {
fmt.Println(dataUserGroup)
return err
@@ -61,6 +61,13 @@ func (lh *MasterMenuUserGroupHandler) HandlerShowMasterMenuUserGroup(c echo.Cont
contentID := utils.GenerateRandomID("tablebody")
+ logger, _ := zap.NewProduction()
+ defer logger.Sync()
+ logger.Info("LOAD USER GROUP DEV",
+ zap.String("id", contentID),
+ zap.Any("data", dataUserGroup),
+ )
+
si := mastermenuusergroup.ShowMasterMenuUserGroup(
"Master Menu",
mastermenuusergroup.ContentMasterMenuUserGroup(dataUserGroup, contentID),
@@ -273,6 +280,12 @@ func (lh *MasterMenuUserGroupHandler) HandleChangePage(c echo.Context) error {
fmt.Println("currpage err")
return err
}
+ logger, _ := zap.NewProduction()
+ defer logger.Sync()
+ logger.Info("CHANGE PAGE USER GROUP DEV",
+ zap.String("id", contentID),
+ zap.Any("data", dataUserGroup),
+ )
time.Sleep(3 * time.Second)
// time.Sleep(5 * time.Second)
vw := tablecomponent.Table([]string{"KODE", "USERGROUP", "AKSI"},
diff --git a/handlers/routes.go b/handlers/routes.go
index 1616463..c6776e0 100644
--- a/handlers/routes.go
+++ b/handlers/routes.go
@@ -183,6 +183,8 @@ func SetupRoutesDev(app *echo.Echo, appStore db.AppStore) {
dvlpserv := dev_services.NewServicesLandingPage(appStore)
devlphan := dev_handlers.NewLandingPageHandler(dvlpserv)
dev.GET("/landingpage", devlphan.ShowLandingPage)
+
+ //DEV USERGROUP
devUGServices := dev_services.NewServicesMasterMenuUserGroup(appStore)
devUGhandlers := dev_handlers.NewMasterMenuUserGroupHandler(devUGServices)
dev.GET("/usergroup", devUGhandlers.HandlerShowMasterMenuUserGroup)