diff --git a/handlers/dev/md.usergroup.handlers.go b/handlers/dev/md.usergroup.handlers.go index 312decf..667fb3f 100644 --- a/handlers/dev/md.usergroup.handlers.go +++ b/handlers/dev/md.usergroup.handlers.go @@ -126,15 +126,17 @@ func (lh *MdUserGroupHandler) HandleShowMdUserGroupScreen(c echo.Context) error ) //filter user group component - usergroupFilterComponent := customtextfieldsearch.MainCustomTextFieldSearchV2(searchID, + usergroupFilterComponent := customtextfieldsearch.MainCustomTextFieldSearchV3(searchID, "search", "Cari Kode/Nama", "text", "/dev/md/usergroupv2/filter", "input changed delay:500ms, search", - "#"+paginationID, "", "", "outerHTML", "#tableID, #paginationID, #searchID,#dialogEditBodyID, #dialogEditID, #dialogDeleteBodyID, #dialogDeleteID") + "#"+paginationID, "#loadingcontent", "", "outerHTML", "#tableID, #paginationID, #searchID,#dialogEditBodyID, #dialogEditID, #dialogDeleteBodyID, #dialogDeleteID", + dev_mdusergroupview.BeforeRequestContent(), + dev_mdusergroupview.AfterRequestContent()) //Pagination - userGroupPaginationComponent := pagination.PaginationV2( + userGroupPaginationComponent := pagination.PaginationV3( totalPage, 1, "/dev/md/usergroupv2/changepage", @@ -142,6 +144,8 @@ func (lh *MdUserGroupHandler) HandleShowMdUserGroupScreen(c echo.Context) error "#tableID, #searchID, #"+searchID+", #paginationID, #dialogEditBodyID, #dialogEditID, #dialogDeleteBodyID, #dialogDeleteID", "#"+paginationID, "outerHTML", "", "", + dev_mdusergroupview.BeforeRequestContent(), + dev_mdusergroupview.AfterRequestContent(), ) //modal add form @@ -331,7 +335,7 @@ func (lh *MdUserGroupHandler) HandleFilterMdUserGroup(c echo.Context) error { "#"+dialogDeleteBodyID, "outerHTML", "#dialogEditBodyID, #dialogEditID, #dialogDeleteBodyID, #dialogDeleteID") - userGroupPaginationComponent := pagination.PaginationV2( + userGroupPaginationComponent := pagination.PaginationV3( totalpage, 1, "/dev/md/usergroupv2/changepage", @@ -339,6 +343,8 @@ func (lh *MdUserGroupHandler) HandleFilterMdUserGroup(c echo.Context) error { "#tableID, #searchID, #"+searchID+", #paginationID, #dialogEditBodyID, #dialogEditID, #dialogDeleteBodyID, #dialogDeleteID", "#"+paginationID, "outerHTML", "", "", + dev_mdusergroupview.BeforeRequestContent(), + dev_mdusergroupview.AfterRequestContent(), ) retval = append(retval, tableComponent) retval = append(retval, userGroupPaginationComponent) @@ -383,7 +389,7 @@ func (lh *MdUserGroupHandler) HandleChangePageMdUserGroup(c echo.Context) error "outerHTML", "#dialogEditBodyID, #dialogEditID, #dialogDeleteBodyID, #dialogDeleteID", ) - userGroupPaginationComponent := pagination.PaginationV2( + userGroupPaginationComponent := pagination.PaginationV3( totalpage, page, "/dev/md/usergroupv2/changepage", @@ -391,6 +397,8 @@ func (lh *MdUserGroupHandler) HandleChangePageMdUserGroup(c echo.Context) error "#tableID, #searchID, #"+searchID+", #paginationID, #dialogEditBodyID, #dialogEditID, #dialogDeleteBodyID, #dialogDeleteID", "#"+paginationID, "outerHTML", "", "", + dev_mdusergroupview.BeforeRequestContent(), + dev_mdusergroupview.AfterRequestContent(), ) retval = append(retval, tableComponent) retval = append(retval, userGroupPaginationComponent) @@ -553,7 +561,7 @@ func (lh *MdUserGroupHandler) HandleAddUserGroup(c echo.Context) error { //pagination component //Pagination - userGroupPaginationComponent := pagination.PaginationV2( + userGroupPaginationComponent := pagination.PaginationV3( totalPage, currPage, "/dev/md/usergroupv2/changepage", @@ -561,6 +569,8 @@ func (lh *MdUserGroupHandler) HandleAddUserGroup(c echo.Context) error { "#tableID, #searchID, #"+searchID+", #paginationID, #dialogEditBodyID, #dialogEditID, #dialogDeleteBodyID, #dialogDeleteID", "#"+paginationID, "outerHTML", "", "true", + dev_mdusergroupview.BeforeRequestContent(), + dev_mdusergroupview.AfterRequestContent(), ) newForm := dev_mdusergroupview.BodyFormUserGroup( @@ -797,7 +807,7 @@ func (lh *MdUserGroupHandler) HandleEditUserGroup(c echo.Context) error { //pagination component //Pagination - userGroupPaginationComponent := pagination.PaginationV2( + userGroupPaginationComponent := pagination.PaginationV3( totalPage, currPage, "/dev/md/usergroupv2/changepage", @@ -805,6 +815,8 @@ func (lh *MdUserGroupHandler) HandleEditUserGroup(c echo.Context) error { "#tableID, #searchID, #"+searchID+", #paginationID, #dialogEditBodyID, #dialogEditID, #dialogDeleteBodyID, #dialogDeleteID", "#"+paginationID, "outerHTML", "", "true", + dev_mdusergroupview.BeforeRequestContent(), + dev_mdusergroupview.AfterRequestContent(), ) var retVal []templ.Component newForm := dev_mdusergroupview.BodyFormUserGroup( @@ -954,7 +966,7 @@ func (lh *MdUserGroupHandler) HandleDeleteUserGroup(c echo.Context) error { //pagination component //Pagination - userGroupPaginationComponent := pagination.PaginationV2( + userGroupPaginationComponent := pagination.PaginationV3( totalPage, currPage, "/dev/md/usergroupv2/changepage", @@ -962,6 +974,8 @@ func (lh *MdUserGroupHandler) HandleDeleteUserGroup(c echo.Context) error { "#tableID, #searchID, #"+searchID+", #paginationID, #dialogEditBodyID, #dialogEditID, #dialogDeleteBodyID, #dialogDeleteID", "#"+paginationID, "outerHTML", "", "true", + dev_mdusergroupview.BeforeRequestContent(), + dev_mdusergroupview.AfterRequestContent(), ) var retVal []templ.Component newForm := dev_mdusergroupview.DeleteConfirmationBody( diff --git a/services/dev/md.usergroup.service.go b/services/dev/md.usergroup.service.go index f21ded9..5b0e2b6 100644 --- a/services/dev/md.usergroup.service.go +++ b/services/dev/md.usergroup.service.go @@ -184,7 +184,9 @@ func (ug *MdUserGroupServices) DeleteMdUserGroup(id string) (models.UserGroupV1, logger, _ := zap.NewProduction() var data models.UserGroupV1 qry := `UPDATE m_usergroup - SET M_UserGroupIsActive = 'N' + SET M_UserGroupIsActive = 'N', + M_UserGroupDeleted = NOW(), + M_UserGroupDeletedUserID = '1' WHERE M_UserGroupID = ?;` // time.Sleep(5 * time.Second) rst := dbx.Handlex.MustExec(qry, id) diff --git a/views/dev/mdusergroup/mdusergroup.templ b/views/dev/mdusergroup/mdusergroup.templ index 5163735..4b772a2 100644 --- a/views/dev/mdusergroup/mdusergroup.templ +++ b/views/dev/mdusergroup/mdusergroup.templ @@ -85,11 +85,20 @@ templ MdUserGroupScreen( @filterComponent - @tablecontent - @paginationComponent - @modalAddForm - @modalEditForm - @modalDeleteForm +
+ @tablecontent + @paginationComponent + @modalAddForm + @modalEditForm + @modalDeleteForm +
+ //
+
+ Loading... +
+
+
+
} @@ -128,6 +137,70 @@ templ CssMdUserGroup() { } templ JsMdUserGroup() { + +} + +script BeforeRequestContent() { + const loadingParent = document.getElementById("loading-parent"); + const loadingChild = document.getElementById("loading-child"); + const loadingSpinner = document.getElementById("loading-spinner"); + + loadingParent.classList.add("overlay"); + loadingParent.classList.add("overlay-block"); + loadingChild.classList.add("overlay-layer"); + loadingSpinner.classList.remove("d-none"); +} + +script AfterRequestContent() { + const loadingParent = document.getElementById("loading-parent"); + const loadingChild = document.getElementById("loading-child"); + const loadingSpinner = document.getElementById("loading-spinner"); + + loadingParent.classList.remove("overlay"); + loadingParent.classList.remove("overlay-block"); + loadingChild.classList.remove("overlay-layer"); + loadingSpinner.classList.add("d-none"); } templ ShowMdUserGroupScreen(title string, cmp templ.Component, css templ.Component, js templ.Component, diff --git a/views/dev/mdusergroup/mdusergroup_templ.go b/views/dev/mdusergroup/mdusergroup_templ.go index e94666b..4cb6e37 100644 --- a/views/dev/mdusergroup/mdusergroup_templ.go +++ b/views/dev/mdusergroup/mdusergroup_templ.go @@ -154,6 +154,10 @@ func MdUserGroupScreen( 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 + } templ_7745c5c3_Err = tablecontent.Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err @@ -174,7 +178,7 @@ func MdUserGroupScreen( if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
Loading...
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -222,6 +226,10 @@ func JsMdUserGroup() templ.Component { templ_7745c5c3_Var5 = 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) } @@ -229,6 +237,40 @@ func JsMdUserGroup() templ.Component { }) } +func BeforeRequestContent() templ.ComponentScript { + return templ.ComponentScript{ + Name: `__templ_BeforeRequestContent_911f`, + Function: `function __templ_BeforeRequestContent_911f(){const loadingParent = document.getElementById("loading-parent"); + const loadingChild = document.getElementById("loading-child"); + const loadingSpinner = document.getElementById("loading-spinner"); + + loadingParent.classList.add("overlay"); + loadingParent.classList.add("overlay-block"); + loadingChild.classList.add("overlay-layer"); + loadingSpinner.classList.remove("d-none"); +}`, + Call: templ.SafeScript(`__templ_BeforeRequestContent_911f`), + CallInline: templ.SafeScriptInline(`__templ_BeforeRequestContent_911f`), + } +} + +func AfterRequestContent() templ.ComponentScript { + return templ.ComponentScript{ + Name: `__templ_AfterRequestContent_6cc0`, + Function: `function __templ_AfterRequestContent_6cc0(){const loadingParent = document.getElementById("loading-parent"); + const loadingChild = document.getElementById("loading-child"); + const loadingSpinner = document.getElementById("loading-spinner"); + + loadingParent.classList.remove("overlay"); + loadingParent.classList.remove("overlay-block"); + loadingChild.classList.remove("overlay-layer"); + loadingSpinner.classList.add("d-none"); +}`, + Call: templ.SafeScript(`__templ_AfterRequestContent_6cc0`), + CallInline: templ.SafeScriptInline(`__templ_AfterRequestContent_6cc0`), + } +} + func ShowMdUserGroupScreen(title string, cmp templ.Component, css templ.Component, js templ.Component, navbarmenu templ.Component, navbaruser templ.Component, diff --git a/views/dev/mdusergroup/mdusergroupformmodal.templ b/views/dev/mdusergroup/mdusergroupformmodal.templ index abcfde7..4e27854 100644 --- a/views/dev/mdusergroup/mdusergroupformmodal.templ +++ b/views/dev/mdusergroup/mdusergroupformmodal.templ @@ -13,6 +13,7 @@ templ UserGroupForm(data models.UserGroupFormComponent) { hx-target={ data.HxTarget } hx-swap={ data.HxSwap } hx-include={ data.HxInclude } + hx-indicator=".formloading" hx-on::before-request={ HandleFormBeforeRequest() } hx-on::after-request={ HandleFormAfterRequest() } > @@ -27,10 +28,15 @@ templ UserGroupForm(data models.UserGroupFormComponent) { script HandleFormBeforeRequest() { console.log("handle disable btn add"); - const boxes = document.querySelectorAll('.btnaddact'); + const btnActCancel = document.querySelectorAll('.btnactcancel'); + const btnactsavedata = document.querySelectorAll('.btnactsavedata'); - for (let i = 0; i < boxes.length; i++) { - boxes[i].setAttribute('disabled', 'true'); + for (let i = 0; i < btnActCancel.length; i++) { + btnActCancel[i].setAttribute('disabled', 'true'); + + } + for (let i = 0; i < btnactsavedata.length; i++) { + btnactsavedata[i].setAttribute('disabled', 'true'); } } @@ -38,10 +44,16 @@ script HandleFormBeforeRequest() { script HandleFormAfterRequest() { console.log("handle enable btn add"); - const boxes = document.querySelectorAll('.btnaddact'); + const btnactcancel = document.querySelectorAll('.btnactcancel'); + const btnactsavedata = document.querySelectorAll('.btnactsavedata'); - for (let i = 0; i < boxes.length; i++) { - boxes[i].removeAttribute('disabled'); + + for (let i = 0; i < btnactcancel.length; i++) { + btnactcancel[i].removeAttribute('disabled'); + + } + for (let i = 0; i < btnactsavedata.length; i++) { + btnactsavedata[i].removeAttribute('disabled'); } } @@ -67,6 +79,18 @@ script JsHideModal(modalID string) { script JsShowModal(modalID string) { $(modalID).modal('show') + const btnactcancel = document.querySelectorAll('.btnactcancel'); + const btnactsavedata = document.querySelectorAll('.btnactsavedata'); + + + for (let i = 0; i < btnactcancel.length; i++) { + btnactcancel[i].removeAttribute('disabled'); + + } + for (let i = 0; i < btnactsavedata.length; i++) { + btnactsavedata[i].removeAttribute('disabled'); + + } } templ ActionFormUserGroup(LinkClose string, targetClose string, hxSwapClose string, modalID string) { @@ -76,16 +100,19 @@ templ ActionFormUserGroup(LinkClose string, targetClose string, hxSwapClose stri hx-post={ LinkClose } hx-target={ targetClose } hx-swap={ hxSwapClose } + hx-indicator=".cancelloading" type="button" - class="btn btn-outline-secondary font-weight-bolder rounded-lg mr-4 btnaddact" + class="btn btn-outline-secondary font-weight-bolder rounded-lg mr-4 btnactcancel " data-dismiss="modal" > + Batal @@ -98,7 +125,7 @@ templ BtnCloseFormUserGroup(LinkClose string, targetClose string, hxSwapClose st hx-swap={ hxSwapClose } type="button" hx-on::after-request={ JsHideModal(modalID) } - class="close btnaddact" + class="close btnactcancel" data-dismiss="modal" aria-label="Close" > @@ -141,16 +168,19 @@ templ ActionFormUserGroupDelete(LinkClose string, targetClose string, hxSwapClos hx-post={ LinkClose } hx-target={ targetClose } hx-swap={ hxSwapClose } + hx-indicator=".cancelloading" type="button" - class="btn btn-outline-secondary font-weight-bolder rounded-lg mr-4 btnaddact" + class="btn btn-outline-secondary font-weight-bolder rounded-lg mr-4 btnactcancel" data-dismiss="modal" > + Batal diff --git a/views/dev/mdusergroup/mdusergroupformmodal_templ.go b/views/dev/mdusergroup/mdusergroupformmodal_templ.go index 9b47d79..99ce12a 100644 --- a/views/dev/mdusergroup/mdusergroupformmodal_templ.go +++ b/views/dev/mdusergroup/mdusergroupformmodal_templ.go @@ -100,7 +100,7 @@ func UserGroupForm(data models.UserGroupFormComponent) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-on::before-request=\"") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-indicator=\".formloading\" hx-on::before-request=\"") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -143,34 +143,45 @@ func UserGroupForm(data models.UserGroupFormComponent) templ.Component { func HandleFormBeforeRequest() templ.ComponentScript { return templ.ComponentScript{ - Name: `__templ_HandleFormBeforeRequest_1e3f`, - Function: `function __templ_HandleFormBeforeRequest_1e3f(){console.log("handle disable btn add"); - const boxes = document.querySelectorAll('.btnaddact'); + Name: `__templ_HandleFormBeforeRequest_2922`, + Function: `function __templ_HandleFormBeforeRequest_2922(){console.log("handle disable btn add"); + const btnActCancel = document.querySelectorAll('.btnactcancel'); + const btnactsavedata = document.querySelectorAll('.btnactsavedata'); - for (let i = 0; i < boxes.length; i++) { - boxes[i].setAttribute('disabled', 'true'); + for (let i = 0; i < btnActCancel.length; i++) { + btnActCancel[i].setAttribute('disabled', 'true'); + + } + for (let i = 0; i < btnactsavedata.length; i++) { + btnactsavedata[i].setAttribute('disabled', 'true'); } }`, - Call: templ.SafeScript(`__templ_HandleFormBeforeRequest_1e3f`), - CallInline: templ.SafeScriptInline(`__templ_HandleFormBeforeRequest_1e3f`), + Call: templ.SafeScript(`__templ_HandleFormBeforeRequest_2922`), + CallInline: templ.SafeScriptInline(`__templ_HandleFormBeforeRequest_2922`), } } func HandleFormAfterRequest() templ.ComponentScript { return templ.ComponentScript{ - Name: `__templ_HandleFormAfterRequest_ee07`, - Function: `function __templ_HandleFormAfterRequest_ee07(){console.log("handle enable btn add"); + Name: `__templ_HandleFormAfterRequest_956b`, + Function: `function __templ_HandleFormAfterRequest_956b(){console.log("handle enable btn add"); - const boxes = document.querySelectorAll('.btnaddact'); + const btnactcancel = document.querySelectorAll('.btnactcancel'); + const btnactsavedata = document.querySelectorAll('.btnactsavedata'); - for (let i = 0; i < boxes.length; i++) { - boxes[i].removeAttribute('disabled'); + + for (let i = 0; i < btnactcancel.length; i++) { + btnactcancel[i].removeAttribute('disabled'); + + } + for (let i = 0; i < btnactsavedata.length; i++) { + btnactsavedata[i].removeAttribute('disabled'); } }`, - Call: templ.SafeScript(`__templ_HandleFormAfterRequest_ee07`), - CallInline: templ.SafeScriptInline(`__templ_HandleFormAfterRequest_ee07`), + Call: templ.SafeScript(`__templ_HandleFormAfterRequest_956b`), + CallInline: templ.SafeScriptInline(`__templ_HandleFormAfterRequest_956b`), } } @@ -202,7 +213,7 @@ func BodyFormUserGroup(inputId models.CustomTextFieldv2Prm, var templ_7745c5c3_Var10 string templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(componentID) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdusergroup\mdusergroupformmodal.templ`, Line: 54, Col: 22} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdusergroup\mdusergroupformmodal.templ`, Line: 66, Col: 22} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10)) if templ_7745c5c3_Err != nil { @@ -259,11 +270,23 @@ func JsHideModal(modalID string) templ.ComponentScript { func JsShowModal(modalID string) templ.ComponentScript { return templ.ComponentScript{ - Name: `__templ_JsShowModal_3147`, - Function: `function __templ_JsShowModal_3147(modalID){$(modalID).modal('show') + Name: `__templ_JsShowModal_b74d`, + Function: `function __templ_JsShowModal_b74d(modalID){$(modalID).modal('show') + const btnactcancel = document.querySelectorAll('.btnactcancel'); + const btnactsavedata = document.querySelectorAll('.btnactsavedata'); + + + for (let i = 0; i < btnactcancel.length; i++) { + btnactcancel[i].removeAttribute('disabled'); + + } + for (let i = 0; i < btnactsavedata.length; i++) { + btnactsavedata[i].removeAttribute('disabled'); + + } }`, - Call: templ.SafeScript(`__templ_JsShowModal_3147`, modalID), - CallInline: templ.SafeScriptInline(`__templ_JsShowModal_3147`, modalID), + Call: templ.SafeScript(`__templ_JsShowModal_b74d`, modalID), + CallInline: templ.SafeScriptInline(`__templ_JsShowModal_b74d`, modalID), } } @@ -304,7 +327,7 @@ func ActionFormUserGroup(LinkClose string, targetClose string, hxSwapClose strin var templ_7745c5c3_Var14 string templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(LinkClose) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdusergroup\mdusergroupformmodal.templ`, Line: 76, Col: 22} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdusergroup\mdusergroupformmodal.templ`, Line: 100, Col: 22} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14)) if templ_7745c5c3_Err != nil { @@ -317,7 +340,7 @@ func ActionFormUserGroup(LinkClose string, targetClose string, hxSwapClose strin var templ_7745c5c3_Var15 string templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(targetClose) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdusergroup\mdusergroupformmodal.templ`, Line: 77, Col: 26} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdusergroup\mdusergroupformmodal.templ`, Line: 101, Col: 26} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15)) if templ_7745c5c3_Err != nil { @@ -330,13 +353,13 @@ func ActionFormUserGroup(LinkClose string, targetClose string, hxSwapClose strin var templ_7745c5c3_Var16 string templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(hxSwapClose) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdusergroup\mdusergroupformmodal.templ`, Line: 78, Col: 24} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdusergroup\mdusergroupformmodal.templ`, Line: 102, Col: 24} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" type=\"button\" class=\"btn btn-outline-secondary font-weight-bolder rounded-lg mr-4 btnaddact\" data-dismiss=\"modal\">Batal\r ") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-indicator=\".cancelloading\" type=\"button\" class=\"btn btn-outline-secondary font-weight-bolder rounded-lg mr-4 btnactcancel \" data-dismiss=\"modal\"> Batal\r ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -371,7 +394,7 @@ func BtnCloseFormUserGroup(LinkClose string, targetClose string, hxSwapClose str var templ_7745c5c3_Var18 string templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(LinkClose) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdusergroup\mdusergroupformmodal.templ`, Line: 96, Col: 21} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdusergroup\mdusergroupformmodal.templ`, Line: 123, Col: 21} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18)) if templ_7745c5c3_Err != nil { @@ -384,7 +407,7 @@ func BtnCloseFormUserGroup(LinkClose string, targetClose string, hxSwapClose str var templ_7745c5c3_Var19 string templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs(targetClose) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdusergroup\mdusergroupformmodal.templ`, Line: 97, Col: 25} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdusergroup\mdusergroupformmodal.templ`, Line: 124, Col: 25} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19)) if templ_7745c5c3_Err != nil { @@ -397,7 +420,7 @@ func BtnCloseFormUserGroup(LinkClose string, targetClose string, hxSwapClose str var templ_7745c5c3_Var20 string templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs(hxSwapClose) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdusergroup\mdusergroupformmodal.templ`, Line: 98, Col: 23} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdusergroup\mdusergroupformmodal.templ`, Line: 125, Col: 23} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var20)) if templ_7745c5c3_Err != nil { @@ -412,7 +435,7 @@ func BtnCloseFormUserGroup(LinkClose string, targetClose string, hxSwapClose str if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" class=\"close btnaddact\" data-dismiss=\"modal\" aria-label=\"Close\">") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" class=\"close btnactcancel\" data-dismiss=\"modal\" aria-label=\"Close\">") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -452,7 +475,7 @@ func DeleteConfirmationBody(inputId models.CustomTextFieldv2Prm, var templ_7745c5c3_Var23 string templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(componentID) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdusergroup\mdusergroupformmodal.templ`, Line: 115, Col: 22} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdusergroup\mdusergroupformmodal.templ`, Line: 142, Col: 22} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var23)) if templ_7745c5c3_Err != nil { @@ -474,7 +497,7 @@ func DeleteConfirmationBody(inputId models.CustomTextFieldv2Prm, var templ_7745c5c3_Var25 string templ_7745c5c3_Var25, templ_7745c5c3_Err = templ.JoinStringErrs(message) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdusergroup\mdusergroupformmodal.templ`, Line: 116, Col: 14} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdusergroup\mdusergroupformmodal.templ`, Line: 143, Col: 14} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var25)) if templ_7745c5c3_Err != nil { @@ -492,7 +515,7 @@ func DeleteConfirmationBody(inputId models.CustomTextFieldv2Prm, var templ_7745c5c3_Var26 string templ_7745c5c3_Var26, templ_7745c5c3_Err = templ.JoinStringErrs(v) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdusergroup\mdusergroupformmodal.templ`, Line: 121, Col: 68} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdusergroup\mdusergroupformmodal.templ`, Line: 148, Col: 68} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var26)) if templ_7745c5c3_Err != nil { @@ -515,7 +538,7 @@ func DeleteConfirmationBody(inputId models.CustomTextFieldv2Prm, var templ_7745c5c3_Var27 string templ_7745c5c3_Var27, templ_7745c5c3_Err = templ.JoinStringErrs(v) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdusergroup\mdusergroupformmodal.templ`, Line: 127, Col: 10} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdusergroup\mdusergroupformmodal.templ`, Line: 154, Col: 10} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var27)) if templ_7745c5c3_Err != nil { @@ -582,7 +605,7 @@ func ActionFormUserGroupDelete(LinkClose string, targetClose string, hxSwapClose var templ_7745c5c3_Var30 string templ_7745c5c3_Var30, templ_7745c5c3_Err = templ.JoinStringErrs(LinkClose) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdusergroup\mdusergroupformmodal.templ`, Line: 141, Col: 22} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdusergroup\mdusergroupformmodal.templ`, Line: 168, Col: 22} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var30)) if templ_7745c5c3_Err != nil { @@ -595,7 +618,7 @@ func ActionFormUserGroupDelete(LinkClose string, targetClose string, hxSwapClose var templ_7745c5c3_Var31 string templ_7745c5c3_Var31, templ_7745c5c3_Err = templ.JoinStringErrs(targetClose) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdusergroup\mdusergroupformmodal.templ`, Line: 142, Col: 26} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdusergroup\mdusergroupformmodal.templ`, Line: 169, Col: 26} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var31)) if templ_7745c5c3_Err != nil { @@ -608,13 +631,13 @@ func ActionFormUserGroupDelete(LinkClose string, targetClose string, hxSwapClose var templ_7745c5c3_Var32 string templ_7745c5c3_Var32, templ_7745c5c3_Err = templ.JoinStringErrs(hxSwapClose) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdusergroup\mdusergroupformmodal.templ`, Line: 143, Col: 24} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdusergroup\mdusergroupformmodal.templ`, Line: 170, Col: 24} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var32)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" type=\"button\" class=\"btn btn-outline-secondary font-weight-bolder rounded-lg mr-4 btnaddact\" data-dismiss=\"modal\">Batal\r ") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-indicator=\".cancelloading\" type=\"button\" class=\"btn btn-outline-secondary font-weight-bolder rounded-lg mr-4 btnactcancel\" data-dismiss=\"modal\"> Batal\r ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/views/dev/mdusergroup/mdusergrouptable.templ b/views/dev/mdusergroup/mdusergrouptable.templ index 64b2bea..a97091f 100644 --- a/views/dev/mdusergroup/mdusergrouptable.templ +++ b/views/dev/mdusergroup/mdusergrouptable.templ @@ -80,26 +80,50 @@ templ TableAction( ) {
+ Edit + Hapus
} + +script HandleBeforeRequestRow(id string) { + var cusid_ele = document.getElementsByClassName('btnactionug'); + for (var i = 0; i < cusid_ele.length; ++i) { + var item = cusid_ele[i]; + item.classList.add('disabled'); + } + console.log(id) +} + +script HandleAfterRequestRow(id string) { + var cusid_ele = document.getElementsByClassName('btnactionug'); + for (var i = 0; i < cusid_ele.length; ++i) { + var item = cusid_ele[i]; + item.classList.remove('disabled'); + } + console.log(id) +} diff --git a/views/dev/mdusergroup/mdusergrouptable_templ.go b/views/dev/mdusergroup/mdusergrouptable_templ.go index 51c21f6..14be310 100644 --- a/views/dev/mdusergroup/mdusergrouptable_templ.go +++ b/views/dev/mdusergroup/mdusergrouptable_templ.go @@ -188,14 +188,22 @@ func TableAction( templ_7745c5c3_Var6 = 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 = templ.RenderScriptItems(ctx, templ_7745c5c3_Buffer, HandleBeforeRequestRow(strconv.Itoa(id)), HandleAfterRequestRow(strconv.Itoa(id))) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("Edit\r Edit\r ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templ.RenderScriptItems(ctx, templ_7745c5c3_Buffer, HandleBeforeRequestRow(strconv.Itoa(id)), HandleAfterRequestRow(strconv.Itoa(id))) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("Hapus\r
") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-indicator=\"") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var19 string + templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs("#spnrdel" + strconv.Itoa(id)) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdusergroup\mdusergrouptable.templ`, Line: 103, Col: 47} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-on::before-request=\"") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var20 templ.ComponentScript = HandleBeforeRequestRow(strconv.Itoa(id)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var20.Call) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-on::after-request=\"") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var21 templ.ComponentScript = HandleAfterRequestRow(strconv.Itoa(id)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var21.Call) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\"> Hapus\r") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -302,3 +406,33 @@ func TableAction( return templ_7745c5c3_Err }) } + +func HandleBeforeRequestRow(id string) templ.ComponentScript { + return templ.ComponentScript{ + Name: `__templ_HandleBeforeRequestRow_ee28`, + Function: `function __templ_HandleBeforeRequestRow_ee28(id){var cusid_ele = document.getElementsByClassName('btnactionug'); + for (var i = 0; i < cusid_ele.length; ++i) { + var item = cusid_ele[i]; + item.classList.add('disabled'); + } + console.log(id) +}`, + Call: templ.SafeScript(`__templ_HandleBeforeRequestRow_ee28`, id), + CallInline: templ.SafeScriptInline(`__templ_HandleBeforeRequestRow_ee28`, id), + } +} + +func HandleAfterRequestRow(id string) templ.ComponentScript { + return templ.ComponentScript{ + Name: `__templ_HandleAfterRequestRow_2a96`, + Function: `function __templ_HandleAfterRequestRow_2a96(id){var cusid_ele = document.getElementsByClassName('btnactionug'); + for (var i = 0; i < cusid_ele.length; ++i) { + var item = cusid_ele[i]; + item.classList.remove('disabled'); + } + console.log(id) +}`, + Call: templ.SafeScript(`__templ_HandleAfterRequestRow_2a96`, id), + CallInline: templ.SafeScriptInline(`__templ_HandleAfterRequestRow_2a96`, id), + } +}