From 904279a048e74086bbedf6aca7cbaad988a2e1da Mon Sep 17 00:00:00 2001 From: Hanan Askarim Date: Fri, 24 May 2024 08:31:10 +0700 Subject: [PATCH] feature add master kelainan --- component/pagination/paginationv2.templ | 2 - component/pagination/paginationv2_templ.go | 18 +- handlers/dev/masterkelainan.handlers.go | 249 +++++++++-- handlers/routes.go | 1 + models/kelainan.models.go | 18 + services/dev/masterkelainan.services.go | 42 +- views/dev/masterkelainan/masterkelainan.templ | 133 ++---- .../masterkelainan/masterkelainan_templ.go | 306 ++++--------- .../masterkelainan/mdkelainanformmodal.templ | 106 +++++ .../mdkelainanformmodal_templ.go | 420 ++++++++++++++++++ .../dev/masterkelainan/mdkelainantable.templ | 31 ++ .../masterkelainan/mdkelainantable_templ.go | 121 +++++ .../dev/masterkelainan/modaladdkelainan.templ | 67 --- .../masterkelainan/modaladdkelainan_templ.go | 148 ------ .../masterkelainan/modaleditkelainan.templ | 66 --- .../masterkelainan/modaleditkelainan_templ.go | 151 ------- 16 files changed, 1023 insertions(+), 856 deletions(-) create mode 100644 views/dev/masterkelainan/mdkelainanformmodal.templ create mode 100644 views/dev/masterkelainan/mdkelainanformmodal_templ.go create mode 100644 views/dev/masterkelainan/mdkelainantable.templ create mode 100644 views/dev/masterkelainan/mdkelainantable_templ.go delete mode 100644 views/dev/masterkelainan/modaladdkelainan.templ delete mode 100644 views/dev/masterkelainan/modaladdkelainan_templ.go delete mode 100644 views/dev/masterkelainan/modaleditkelainan.templ delete mode 100644 views/dev/masterkelainan/modaleditkelainan_templ.go diff --git a/component/pagination/paginationv2.templ b/component/pagination/paginationv2.templ index 926256b..d361d7c 100644 --- a/component/pagination/paginationv2.templ +++ b/component/pagination/paginationv2.templ @@ -27,7 +27,6 @@ templ PaginationV2(length int, hx-trigger="click" hx-target={ hxTarget } hx-include={ hxInclude } - hx-disabled-elt=".btneditug, .btndeleteug" >{ strconv.Itoa(i+1) } } else { { strconv.Itoa(i+1) } } } diff --git a/component/pagination/paginationv2_templ.go b/component/pagination/paginationv2_templ.go index c7d92ce..e79b9da 100644 --- a/component/pagination/paginationv2_templ.go +++ b/component/pagination/paginationv2_templ.go @@ -132,14 +132,14 @@ func PaginationV2(length int, if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-disabled-elt=\".btneditug, .btndeleteug\">") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\">") 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)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\pagination\paginationv2.templ`, Line: 31, Col: 25} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\pagination\paginationv2.templ`, Line: 30, Col: 25} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9)) if templ_7745c5c3_Err != nil { @@ -157,7 +157,7 @@ func PaginationV2(length int, var templ_7745c5c3_Var10 string templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(link + "?" + "page=" + strconv.Itoa(i+1)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\pagination\paginationv2.templ`, Line: 34, Col: 55} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\pagination\paginationv2.templ`, Line: 33, Col: 55} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10)) if templ_7745c5c3_Err != nil { @@ -170,7 +170,7 @@ func PaginationV2(length int, var templ_7745c5c3_Var11 string templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(hxSwap) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\pagination\paginationv2.templ`, Line: 36, Col: 22} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\pagination\paginationv2.templ`, Line: 35, Col: 22} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11)) if templ_7745c5c3_Err != nil { @@ -183,7 +183,7 @@ func PaginationV2(length int, var templ_7745c5c3_Var12 string templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(hxIndicator) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\pagination\paginationv2.templ`, Line: 37, Col: 32} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\pagination\paginationv2.templ`, Line: 36, Col: 32} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12)) if templ_7745c5c3_Err != nil { @@ -196,7 +196,7 @@ func PaginationV2(length int, var templ_7745c5c3_Var13 string templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(hxTarget) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\pagination\paginationv2.templ`, Line: 39, Col: 26} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\pagination\paginationv2.templ`, Line: 38, Col: 26} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13)) if templ_7745c5c3_Err != nil { @@ -209,20 +209,20 @@ func PaginationV2(length int, var templ_7745c5c3_Var14 string templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(hxInclude) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\pagination\paginationv2.templ`, Line: 40, Col: 28} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\pagination\paginationv2.templ`, Line: 39, Col: 28} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-disabled-elt=\".btneditug, .btndeleteug\">") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\">") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var15 string templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.Itoa(i + 1)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\pagination\paginationv2.templ`, Line: 42, Col: 25} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\pagination\paginationv2.templ`, Line: 40, Col: 25} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15)) if templ_7745c5c3_Err != nil { diff --git a/handlers/dev/masterkelainan.handlers.go b/handlers/dev/masterkelainan.handlers.go index c329275..ef8fa03 100644 --- a/handlers/dev/masterkelainan.handlers.go +++ b/handlers/dev/masterkelainan.handlers.go @@ -6,6 +6,7 @@ import ( navbarmenu "cpone/component/navbar" "cpone/component/pagination" sidebaruserprofile "cpone/component/sidebar_user_profile" + customtoastv2 "cpone/component/toastbootstrap" "cpone/models" globalservices "cpone/services" "cpone/utils" @@ -82,10 +83,16 @@ func (lh *MasterKelainanHandler) HandlerShowMasterKelainan(c echo.Context) error tableID := utils.GenerateRandomID("tablebody") paginationID := utils.GenerateRandomID("paginationid") searchID := utils.GenerateRandomID("searchid") + dialogAddID := utils.GenerateRandomID("dialogaddID") + dialogAddBodyID := utils.GenerateRandomID("dialogaddbodyID") + // dialogEditID := utils.GenerateRandomID("dialogEditID") + // dialogEditBodyID := utils.GenerateRandomID("dialogEditBodyID") + // dialogdeleteID := utils.GenerateRandomID("dialogdeleteID") + // dialogdeleteBodyID := utils.GenerateRandomID("dialogdeleteBodyID") - paramTitleBreadcrumbConvert := "Master Kelainan" + title := "Master Kelainan" - dataBreadCrumb, err := lh.MasterKelainanService.GetListBreadCrumb(paramTitleBreadcrumbConvert) + dataBreadCrumb, err := lh.MasterKelainanService.GetListBreadCrumb(title) fmt.Println(dataBreadCrumb) fmt.Println(err) if err != nil { @@ -102,6 +109,9 @@ func (lh *MasterKelainanHandler) HandlerShowMasterKelainan(c echo.Context) error zap.Any("data", dataBreadCrumb), ) + // breadcrumadmin + breadcrumbComponent := breadcrumadmin.MainBreadcrumbAdminV1(dataBreadCrumb) + // navbar menu navbarmenuComponent := navbarmenu.NavbarMenu(dataMenu) @@ -111,49 +121,96 @@ func (lh *MasterKelainanHandler) HandlerShowMasterKelainan(c echo.Context) error // sidebar sidebaruserprofileComponent := sidebaruserprofile.Navbaruserprofile(dataUser) + // component modal add kelainan + dialogAddBodyCmp := masterkelainan.BodyFormKelainan( + models.CustomTextFieldv2Prm{ + Label: "Nama Grup Kelainan", + Name: "kelainanname", + Placeholder: "Nama Grup Kelainan", + Type: "text", ID: "kelainaninputname"}, + models.CustomTextFieldv2Prm{ + Label: "Nama Grup Kelainan", + Name: "kelainanid", + Placeholder: "Nama Grup Kelainan", + Type: "hidden", ID: "kelainaninputid"}, + dialogAddBodyID, masterkelainan.JsHideModal("")) + dialogAddActionCmp := masterkelainan.ActionFormKelainan( + "/dev/kelainan/closeaddform", + "#"+dialogAddBodyID, + "outerHTML", + "#"+dialogAddID) + dialogAddCloseCmp := masterkelainan.BtnCloseFormKelainan( + "/dev/kelainan/closeaddform", + "#"+dialogAddBodyID, + "outerHTML", + "#"+dialogAddID) + modaladdcomponent := masterkelainan.KelainanForm(models.KelainanFormComponent{ + IDComponent: "formkelainan", + Link: "/dev/kelainan/add", + HxTarget: "#" + dialogAddBodyID, + HxSwap: "outerHTML", + HxInclude: "#tableID, #paginationID, #searchID, #dialogAddBodyID, #dialogAddID, #dialogDeleteBodyID, #dialogDeleteID, #dialogEditBodyID, #dialogEditID, #" + searchID + ", #currpage" + paginationID, + ModalID: dialogAddID, + ModalTitle: "New - Grup Kelainan", + DialogBody: dialogAddBodyCmp, + DialogAction: dialogAddActionCmp, + ButtonCLose: dialogAddCloseCmp, + }) + + // component table listing kelainan contentKelainanComponent := masterkelainan.TableKelainan( dataKelainan, tableID) + // filter kelainan component kelainanFilterComponent := customtextfieldsearch.MainCustomTextFieldSearchV2(searchID, "search", "Cari Grup Kelainan", "text", "/dev/searchkelainan", "input changed delay:500ms, search", - "#"+paginationID, "", "", "outerHTML", "#tableID, #paginationID") + "#"+paginationID, "", "", "outerHTML", "#tableID, #paginationID, #searchID, #dialogEditBodyID, #dialogEditID, #dialogDeleteBodyID, #dialogDeleteID") + // pagination kelainan component kelainanPaginationComponent := pagination.PaginationV2( totalpage, 1, "/dev/kelainanpagination", paginationID, - "#tableID, #searchID, #paginationID", "#"+paginationID, "outerHTML", "", + "#tableID, #searchID, #"+searchID+", #paginationID, #dialogEditBodyID, #dialogEditID, #dialogDeleteBodyID, #dialogDeleteID", + "#"+paginationID, + "outerHTML", "", "", ) - si := masterkelainan.ShowKelainan( - "Master Kelainan", - masterkelainan.ContentMasterKelainan( - tableID, paginationID, searchID, - breadcrumadmin.MainBreadcrumbAdminV1(dataBreadCrumb), - contentKelainanComponent, - kelainanFilterComponent, - kelainanPaginationComponent, - ), + content := masterkelainan.ContentMasterKelainan( + tableID, paginationID, searchID, dialogAddID, dialogAddBodyID, + breadcrumbComponent, + contentKelainanComponent, + kelainanFilterComponent, + kelainanPaginationComponent, + modaladdcomponent) + css := masterkelainan.CssKelainan() + js := masterkelainan.JsMdKelainan() - masterkelainan.CssKelainan(), - masterkelainan.JSku(), + // show kelainan screen + view := masterkelainan.ShowKelainan( + title, + content, + css, + js, navbarmenuComponent, navbaruserComponent, - sidebaruserprofileComponent, - ) + sidebaruserprofileComponent) - return utils.View(c, si) + return utils.View(c, view) } func (lh *MasterKelainanHandler) HandlerShowMasterKelainanSearch(c echo.Context) error { search := c.QueryParam("search") + searchID := c.QueryParam("searchID") tableID := c.QueryParam("tableID") paginationID := c.QueryParam("paginationID") + // dialogEditBodyID := c.QueryParam("dialogEditBodyID") + // dialogDeleteBodyID := c.QueryParam("dialogDeleteBodyID") logger, _ := zap.NewProduction() dataKelainan, totalpage, err := lh.MasterKelainanService.GetListMasterKelainan(search, 1, 5) @@ -173,13 +230,12 @@ func (lh *MasterKelainanHandler) HandlerShowMasterKelainanSearch(c echo.Context) 1, "/dev/kelainanpagination", paginationID, - "#tableID, #searchID, #paginationID", "#"+paginationID, "outerHTML", "") + "#tableID, #searchID, #"+searchID+", #paginationID, #dialogEditBodyID, #dialogEditID, #dialogDeleteBodyID, #dialogDeleteID", + "#"+paginationID, "outerHTML", "", "") - swapTable := masterkelainan.SwapTableKelainan(kelainanPaginationComponent, contentKelainanComponent) + retval := []templ.Component{contentKelainanComponent, kelainanPaginationComponent} - si := swapTable - - return utils.View(c, si) + return utils.ViewMulti(c, retval) } func (lh *MasterKelainanHandler) HandlerShowMasterKelainanPagination(c echo.Context) error { @@ -188,7 +244,10 @@ func (lh *MasterKelainanHandler) HandlerShowMasterKelainanPagination(c echo.Cont search := c.QueryParam("search") pageparam := c.QueryParam("page") tableID := c.QueryParam("tableID") + searchID := c.QueryParam("searchID") paginationID := c.QueryParam("paginationID") + // dialogEditBodyID := c.QueryParam("dialogEditBodyID") + // dialogDeleteBodyID := c.QueryParam("dialogDeleteBodyID") page, err := strconv.Atoi(pageparam) if err != nil { defer logger.Sync() @@ -216,13 +275,12 @@ func (lh *MasterKelainanHandler) HandlerShowMasterKelainanPagination(c echo.Cont page, "/dev/kelainanpagination", paginationID, - "#tableID, #searchID, #paginationID", "#"+paginationID, "outerHTML", "") + "#tableID, #searchID, #"+searchID+", #paginationID, #dialogEditBodyID, #dialogEditID, #dialogDeleteBodyID, #dialogDeleteID", + "#"+paginationID, "outerHTML", "", "") - swapTable := masterkelainan.SwapTableKelainan(kelainanPaginationComponent, contentKelainanComponent) + retval := []templ.Component{contentKelainanComponent, kelainanPaginationComponent} - si := swapTable - - return utils.View(c, si) + return utils.ViewMulti(c, retval) } func (lh *MasterKelainanHandler) AddKelainan(c echo.Context) error { @@ -230,15 +288,56 @@ func (lh *MasterKelainanHandler) AddKelainan(c echo.Context) error { defer logger.Sync() name := c.FormValue("kelainanname") - // if strings.TrimSpace(name) == "" { - // test := masterkelainan.KelainanSwapOOB(name, "Name cannot empty") - // return lh.View(c, test) - // } + tableID := c.FormValue("tableID") + paginationID := c.FormValue("paginationID") + searchID := c.FormValue("searchID") + search := c.FormValue("search") + currPagePrm := c.FormValue("currpage" + paginationID) + dialogAddBodyID := c.FormValue("dialogAddBodyID") + dialogAddID := c.FormValue("dialogAddID") + // dialogEditBodyID := c.FormValue("dialogEditBodyID") + // dialogDeleteBodyID := c.FormValue("dialogDeleteBodyID") + + currPage, err := strconv.Atoi(currPagePrm) + + if err != nil { + return err + } + logger.Info("ADD KELAINAN", + zap.Any("nama", name), + zap.Any("tableid", tableID), + zap.Any("search", search), + zap.Any("currpage", currPage), + ) + + // form validation + nameValidation := "" if strings.TrimSpace(name) == "" { - test := masterkelainan.DialogNewBody(name, "", "Name cannot empty") - return lh.View(c, test) + nameValidation = "Nama grup kelainan tidak boleh kosong" + } + if nameValidation != "" { + newForm := masterkelainan.BodyFormKelainan( + models.CustomTextFieldv2Prm{ + Label: "Nama Grup Kelainan", + Name: "kelainanname", + Placeholder: "Nama Grup Kelainan", + Type: "text", + Value: name, + ID: "kelainaninputname", + ErrorMsg: nameValidation}, + models.CustomTextFieldv2Prm{Label: "Nama Grup Kelainan", + Name: "kelainanid", + Placeholder: "Nama Grup Kelainan", + Type: "hidden", + ID: "kelainaninputid"}, + dialogAddBodyID, masterkelainan.JsHideModal("")) + + return utils.ViewMulti(c, []templ.Component{ + customtoastv2.CustomToastV2Show("Warning", nameValidation, "warning"), newForm}) + } + // Add kelainan service dataKelainan, err := lh.MasterKelainanService.AddKelainan(name) if err != nil { @@ -247,23 +346,89 @@ func (lh *MasterKelainanHandler) AddKelainan(c echo.Context) error { zap.Any("name", name), ) - // test := masterkelainan.KelainanSwapOOB(name, err.Error()) - // return lh.View(c, test) + newForm := masterkelainan.BodyFormKelainan( + models.CustomTextFieldv2Prm{ + Label: "Nama Grup Kelainan", + Name: "kelainanname", + Placeholder: "Nama Grup Kelainan", + Type: "text", + Value: name, + ID: "kelainaninputname", + }, + models.CustomTextFieldv2Prm{Label: "Nama Grup Kelainan", + Name: "kelainanid", + Placeholder: "Nama Grup Kelainan", + Type: "hidden", + ID: "kelainaninputid"}, + dialogAddBodyID, masterkelainan.JsHideModal("")) + return utils.ViewMulti(c, []templ.Component{ + customtoastv2.CustomToastV2Show("Error", err.Error(), "danger"), newForm}) } logger.Info("ADD KELAINAN", zap.Any("reutn", dataKelainan), zap.Any("name", name), ) - dataKelainanGet, err := lh.MasterKelainanService.GetKelainanByID("1") - fmt.Println(dataKelainan) - fmt.Println(err) + + // Get data table current page + dataKelainanList, totalpage, err := lh.MasterKelainanService.GetListMasterKelainan(search, currPage, 5) if err != nil { - fmt.Println(dataKelainan) + defer logger.Sync() + logger.Info("ERROR GET KELAINAN", + zap.Any("error", err), + ) return err } - v := masterkelainan.DialogEditForm(dataKelainanGet.Mcu_KelainanGroupName) + // New add form + newForm := masterkelainan.BodyFormKelainan( + models.CustomTextFieldv2Prm{ + Label: "Nama Grup Kelainan", + Name: "kelainanname", + Placeholder: "Nama Grup Kelainan", + Type: "text", + Value: "", + ID: "kelainaninputname", + }, + models.CustomTextFieldv2Prm{Label: "Nama Grup Kelainan", + Name: "kelainanid", + Placeholder: "Nama Grup Kelainan", + Type: "hidden", + ID: "kelainaninputid"}, + dialogAddBodyID, masterkelainan.JsHideModal("#"+dialogAddID)) - return lh.View(c, v) + // New table listing + contentKelainanComponent := masterkelainan.TableKelainan( + dataKelainanList, tableID) + // New pagination + kelainanPaginationComponent := pagination.PaginationV2(totalpage, + currPage, + "/dev/kelainanpagination", + paginationID, + "#tableID, #searchID, #"+searchID+", #paginationID, #dialogEditBodyID, #dialogEditID, #dialogDeleteBodyID, #dialogDeleteID", + "#"+paginationID, "outerHTML", "", "true") + + toastSuccess := customtoastv2.CustomToastV2Show("Success", "Success add kelainan "+name, "success") + + retval := []templ.Component{toastSuccess, contentKelainanComponent, kelainanPaginationComponent, newForm} + + return utils.ViewMulti(c, retval) +} + +func (lh *MasterKelainanHandler) HandleCloseFormAdd(c echo.Context) error { + dialogAddBodyID := c.FormValue("dialogAddBodyID") + newForm := masterkelainan.BodyFormKelainan( + models.CustomTextFieldv2Prm{ + Label: "Nama Grup Kelainan", + Name: "kelainanname", + Placeholder: "Nama Grup Kelainan", + Type: "text", + ID: "kelainaninputname"}, + models.CustomTextFieldv2Prm{Label: "Nama Grup Kelainan", + Name: "kelainanid", + Placeholder: "Nama Grup Kelainan", + Type: "hidden", + ID: "kelainaninputid"}, + dialogAddBodyID, masterkelainan.JsHideModal("")) + return utils.View(c, newForm) } diff --git a/handlers/routes.go b/handlers/routes.go index 98fc7b2..103976f 100644 --- a/handlers/routes.go +++ b/handlers/routes.go @@ -218,5 +218,6 @@ func SetupRoutesDev(app *echo.Echo, appStore db.AppStore) { dev.GET("/kelainan", devKLhandlers.HandlerShowMasterKelainan) dev.GET("/searchkelainan", devKLhandlers.HandlerShowMasterKelainanSearch) dev.GET("/kelainanpagination", devKLhandlers.HandlerShowMasterKelainanPagination) + dev.POST("/kelainan/closeaddform", devKLhandlers.HandleCloseFormAdd) dev.POST("/kelainan/add", devKLhandlers.AddKelainan) } diff --git a/models/kelainan.models.go b/models/kelainan.models.go index 67b354a..2a01040 100644 --- a/models/kelainan.models.go +++ b/models/kelainan.models.go @@ -1,5 +1,7 @@ package models +import "github.com/a-h/templ" + type Kelainan struct { Nomor string `db:"nomor"` Mcu_KelainanGroupID int `db:"Mcu_KelainanGroupID"` @@ -8,3 +10,19 @@ type Kelainan struct { Mcu_KelainanGroupCreated string `db:"Mcu_KelainanGroupCreated"` Mcu_KelainanGroupLastUpdated string `db:"Mcu_KelainanGroupLastUpdated"` } + +type KelainanFormComponent struct { + IDComponent string + Link string + HxTarget string + HxSwap string + HxInclude string + ModalID string + ModalTitle string + InputName CustomTextFieldv2Prm + InputCode CustomTextFieldv2Prm + InputID CustomTextFieldv2Prm + DialogBody templ.Component + DialogAction templ.Component + ButtonCLose templ.Component +} diff --git a/services/dev/masterkelainan.services.go b/services/dev/masterkelainan.services.go index 28d1e02..3b8567f 100644 --- a/services/dev/masterkelainan.services.go +++ b/services/dev/masterkelainan.services.go @@ -137,49 +137,21 @@ func (su *ServicesMasterKelainan) GetKelainanByID(id string) (models.Kelainan, e func (su *ServicesMasterKelainan) AddKelainan(name string) (models.Kelainan, error) { logger, _ := zap.NewProduction() var data models.Kelainan - var datacek []models.Kelainan - qryCek := `SELECT Mcu_KelainanGroupName FROM mcu_kelainangroup WHERE Mcu_KelainanGroupName = ? - AND Mcu_KelainanGroupID = 'Y'` - err := dbx.Handlex.Select(&datacek, qryCek, name) + qry := `INSERT INTO mcu_kelainangroup( + Mcu_KelainanGroupName, + Mcu_KelainanGroupCreated, + Mcu_KelainanGroupLastUpdated) VALUES(?,NOW(),NOW())` + rst := dbx.Handlex.MustExec(qry, name) + _, err := rst.LastInsertId() if err != nil { defer logger.Sync() - logger.Error("Error cek data by name", + logger.Error("Error Insert kelainan", zap.String("name", name), - zap.Any("datacek", datacek), ) return data, fmt.Errorf("QUERY_FAILED") } - if len(datacek) > 0 { - defer logger.Sync() - logger.Error("Name already taken by another data", - zap.String("name", name), - ) - return data, fmt.Errorf("name sudah dipakai") - } - fmt.Println("cek data name", name) - - // qry := `INSERT INTO mcu_kelainangroup( - // Mcu_KelainanGroupName) VALUES(?)` - // rst := dbx.Handlex.MustExec(qry, name) - // insertedID, err := rst.LastInsertId() - // if err != nil { - // defer logger.Sync() - // logger.Error("Error Insert kelainan", - // zap.String("name", name), - // ) - // return data, fmt.Errorf("QUERY_FAILED") - // } - // s := strconv.Itoa(int(insertedID)) - // data, err = su.GetKelainanByID(s) - // if err != nil { - // defer logger.Sync() - // logger.Error("Error get kelainan by id", - // zap.String("name", name), - // ) - // return data, fmt.Errorf("QUERY_FAILED") - // } return data, nil } diff --git a/views/dev/masterkelainan/masterkelainan.templ b/views/dev/masterkelainan/masterkelainan.templ index dcfb0a6..f0c0374 100644 --- a/views/dev/masterkelainan/masterkelainan.templ +++ b/views/dev/masterkelainan/masterkelainan.templ @@ -3,20 +3,20 @@ package masterkelainan import ( "cpone/layout" "cpone/models" - "cpone/component/modal" "cpone/component/customtextfield" - "strconv" - "cpone/component/table" ) templ ContentMasterKelainan( tableID string, paginationID string, searchID string, + dialogAddID string, + dialogAddBodyID string, breadcrumb templ.Component, tablecontent templ.Component, - filterKelainan templ.Component, - paginationKelainan templ.Component, + filterComponent templ.Component, + paginationComponent templ.Component, + modalAddform templ.Component, ) {
@customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "tableID", @@ -31,6 +31,14 @@ templ ContentMasterKelainan( Name: "searchID", Type: "hidden", Value: searchID}) + @customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "dialogAddID", + Name: "dialogAddID", + Type: "hidden", + Value: dialogAddID}) + @customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "dialogAddBodyID", + Name: "dialogAddBodyID", + Type: "hidden", + Value: dialogAddBodyID})
@breadcrumb @@ -41,105 +49,26 @@ templ ContentMasterKelainan( type="button" class="btn btn-primary" data-toggle="modal" - data-target="#dialogNew" + data-target={ "#" + dialogAddID } >Add New
- +
- @filterKelainan - // table content + @filterComponent @tablecontent - @paginationKelainan -
-
- -
-
-
- @modalcomponent.Modal("dialogNew", - "New - Grup Kelainan", - DialogNewBody("", "New", ""), - DialogNewAction(), - BtnCloseNew()) -
- @JSku() + @paginationComponent + @modalAddform } -templ TableRowV1(data []models.Kelainan) { - if len(data) == 0 { - - Data Tidak Ditemukan - - } - for _, v := range data { - - { v.Nomor } - { v.Mcu_KelainanGroupName } - -
- - Edit - - Hapus - // @modalcomponent.Modal("dialogEdit"+strconv.Itoa(v.Mcu_KelainanGroupID), - // "Edit - User Group", - // DialogEditBody(v.M_UserGroupCode, v.M_UserGroupName), - // DialogEditAction(), - // BtnCloseNew()) - // @modalcomponent.ModalConfirmation( - // "dialogDelete"+strconv.Itoa(v.Mcu_KelainanGroupID), - // "Konfirmasi", - // "Apakah anda yakin menghapus user group berikut ?", BtnCloseDelete(), - // []string{"Kode", "User Group"}, []string{v.M_UserGroupCode, v.M_UserGroupName}, DialogDeleteAction()) -
- - - } -} - -templ JSku() { - -} - templ CssKelainan() { } +templ JsMdKelainan() { +} + templ ShowKelainan( title string, cmp templ.Component, @@ -186,16 +118,3 @@ templ ShowKelainan( @cmp } } - -templ TableKelainan(data []models.Kelainan, tableID string) { -
- @tablecomponent.TableV3([]string{"NO", "GRUP KELAINAN", "AKSI"}, - []string{"10%", "70%", "20%"}, - TableRowV1(data)) -
-} - -templ SwapTableKelainan(pagination templ.Component, table templ.Component) { - @pagination - @table -} diff --git a/views/dev/masterkelainan/masterkelainan_templ.go b/views/dev/masterkelainan/masterkelainan_templ.go index b8c0ec9..277c318 100644 --- a/views/dev/masterkelainan/masterkelainan_templ.go +++ b/views/dev/masterkelainan/masterkelainan_templ.go @@ -12,21 +12,21 @@ import "bytes" import ( "cpone/component/customtextfield" - "cpone/component/modal" - "cpone/component/table" "cpone/layout" "cpone/models" - "strconv" ) func ContentMasterKelainan( tableID string, paginationID string, searchID string, + dialogAddID string, + dialogAddBodyID string, breadcrumb templ.Component, tablecontent templ.Component, - filterKelainan templ.Component, - paginationKelainan templ.Component, + filterComponent templ.Component, + paginationComponent templ.Component, + modalAddform templ.Component, ) 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) @@ -65,6 +65,20 @@ func ContentMasterKelainan( if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } + templ_7745c5c3_Err = customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "dialogAddID", + Name: "dialogAddID", + Type: "hidden", + Value: dialogAddID}).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "dialogAddBodyID", + Name: "dialogAddBodyID", + Type: "hidden", + Value: dialogAddBodyID}).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 @@ -73,11 +87,37 @@ func ContentMasterKelainan( 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 + } + templ_7745c5c3_Err = filterComponent.Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -85,27 +125,11 @@ func ContentMasterKelainan( if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = paginationKelainan.Render(ctx, templ_7745c5c3_Buffer) + templ_7745c5c3_Err = paginationComponent.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 - } - templ_7745c5c3_Err = modalcomponent.Modal("dialogNew", - "New - Grup Kelainan", - DialogNewBody("", "New", ""), - DialogNewAction(), - BtnCloseNew()).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 - } - templ_7745c5c3_Err = JSku().Render(ctx, templ_7745c5c3_Buffer) + templ_7745c5c3_Err = modalAddform.Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -120,114 +144,6 @@ func ContentMasterKelainan( }) } -func TableRowV1(data []models.Kelainan) 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) - if len(data) == 0 { - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("Data Tidak Ditemukan") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - for _, v := range data { - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var3 string - templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(v.Nomor) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\masterkelainan\masterkelainan.templ`, Line: 85, Col: 16} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) - 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_Var4 string - templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(v.Mcu_KelainanGroupName) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\masterkelainan\masterkelainan.templ`, Line: 86, Col: 32} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
Edit\r Hapus
") - 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 JSku() 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_Var7 := templ.GetChildren(ctx) - if templ_7745c5c3_Var7 == nil { - templ_7745c5c3_Var7 = 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 CssKelainan() 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) @@ -236,9 +152,9 @@ func CssKelainan() templ.Component { defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var8 := templ.GetChildren(ctx) - if templ_7745c5c3_Var8 == nil { - templ_7745c5c3_Var8 = templ.NopComponent + templ_7745c5c3_Var4 := templ.GetChildren(ctx) + if templ_7745c5c3_Var4 == nil { + templ_7745c5c3_Var4 = templ.NopComponent } ctx = templ.ClearChildren(ctx) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") @@ -252,6 +168,26 @@ func CssKelainan() templ.Component { }) } +func JsMdKelainan() 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_Var5 := templ.GetChildren(ctx) + if templ_7745c5c3_Var5 == nil { + templ_7745c5c3_Var5 = 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 ShowKelainan( title string, cmp templ.Component, @@ -267,12 +203,12 @@ func ShowKelainan( defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var9 := templ.GetChildren(ctx) - if templ_7745c5c3_Var9 == nil { - templ_7745c5c3_Var9 = templ.NopComponent + templ_7745c5c3_Var6 := templ.GetChildren(ctx) + if templ_7745c5c3_Var6 == nil { + templ_7745c5c3_Var6 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Var10 := templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Var7 := 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() @@ -287,95 +223,7 @@ func ShowKelainan( } return templ_7745c5c3_Err }) - templ_7745c5c3_Err = layout.CorporateLayout(title, css, js, navbarmenu, navbaruser, userprofile).Render(templ.WithChildren(ctx, templ_7745c5c3_Var10), 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 - }) -} - -func TableKelainan(data []models.Kelainan, tableID string) 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_Var11 := templ.GetChildren(ctx) - if templ_7745c5c3_Var11 == nil { - templ_7745c5c3_Var11 = 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 = tablecomponent.TableV3([]string{"NO", "GRUP KELAINAN", "AKSI"}, - []string{"10%", "70%", "20%"}, - TableRowV1(data)).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 SwapTableKelainan(pagination templ.Component, table templ.Component) 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_Var14 := templ.GetChildren(ctx) - if templ_7745c5c3_Var14 == nil { - templ_7745c5c3_Var14 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = pagination.Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = table.Render(ctx, templ_7745c5c3_Buffer) + templ_7745c5c3_Err = layout.CorporateLayout(title, css, js, navbarmenu, navbaruser, userprofile).Render(templ.WithChildren(ctx, templ_7745c5c3_Var7), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/views/dev/masterkelainan/mdkelainanformmodal.templ b/views/dev/masterkelainan/mdkelainanformmodal.templ new file mode 100644 index 0000000..0085622 --- /dev/null +++ b/views/dev/masterkelainan/mdkelainanformmodal.templ @@ -0,0 +1,106 @@ +package masterkelainan + +import ( + "cpone/models" + "cpone/component/modal" + "cpone/component/customtextfield" +) + +templ KelainanForm(data models.KelainanFormComponent) { +
+
+ @modalcomponent.Modal(data.ModalID, + data.ModalTitle, + data.DialogBody, + data.DialogAction, + data.ButtonCLose) +
+
+} + +script HandleFormBeforeRequest() { + // console.log("handle disable btn add"); + const boxes = document.querySelectorAll('.btnaddact'); + + for (let i = 0; i < boxes.length; i++) { + boxes[i].setAttribute('disabled', 'true'); + + } +} + +script HandleFormAfterRequest() { + // console.log("handle enable btn add"); + + const boxes = document.querySelectorAll('.btnaddact'); + + for (let i = 0; i < boxes.length; i++) { + boxes[i].removeAttribute('disabled'); + + } +} + +templ BodyFormKelainan(inputId models.CustomTextFieldv2Prm, + inputName models.CustomTextFieldv2Prm, + componentID string, + hxOnLoad templ.ComponentScript) { +
+ @customtextfield.CustomTextFieldv2( + inputId) + @customtextfield.CustomTextFieldv2( + inputName) +
+} + +script JsHideModal(modalID string) { + $(modalID).modal('hide') +} + +script JsShowModal(modalID string) { + $(modalID).modal('show') +} + +templ ActionFormKelainan(LinkClose string, targetClose string, hxSwapClose string, modalID string) { +
+ + +
+} + +templ BtnCloseFormKelainan(LinkClose string, targetClose string, hxSwapClose string, modalID string) { + +} diff --git a/views/dev/masterkelainan/mdkelainanformmodal_templ.go b/views/dev/masterkelainan/mdkelainanformmodal_templ.go new file mode 100644 index 0000000..857e0a2 --- /dev/null +++ b/views/dev/masterkelainan/mdkelainanformmodal_templ.go @@ -0,0 +1,420 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.2.663 +package masterkelainan + +//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/customtextfield" + "cpone/component/modal" + "cpone/models" +) + +func KelainanForm(data models.KelainanFormComponent) 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 = templ.RenderScriptItems(ctx, templ_7745c5c3_Buffer, HandleFormBeforeRequest(), HandleFormAfterRequest()) + 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 = modalcomponent.Modal(data.ModalID, + data.ModalTitle, + data.DialogBody, + data.DialogAction, + data.ButtonCLose).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 HandleFormBeforeRequest() templ.ComponentScript { + return templ.ComponentScript{ + Name: `__templ_HandleFormBeforeRequest_6266`, + Function: `function __templ_HandleFormBeforeRequest_6266(){// console.log("handle disable btn add"); + const boxes = document.querySelectorAll('.btnaddact'); + + for (let i = 0; i < boxes.length; i++) { + boxes[i].setAttribute('disabled', 'true'); + + } +}`, + Call: templ.SafeScript(`__templ_HandleFormBeforeRequest_6266`), + CallInline: templ.SafeScriptInline(`__templ_HandleFormBeforeRequest_6266`), + } +} + +func HandleFormAfterRequest() templ.ComponentScript { + return templ.ComponentScript{ + Name: `__templ_HandleFormAfterRequest_4cc7`, + Function: `function __templ_HandleFormAfterRequest_4cc7(){// console.log("handle enable btn add"); + + const boxes = document.querySelectorAll('.btnaddact'); + + for (let i = 0; i < boxes.length; i++) { + boxes[i].removeAttribute('disabled'); + + } +}`, + Call: templ.SafeScript(`__templ_HandleFormAfterRequest_4cc7`), + CallInline: templ.SafeScriptInline(`__templ_HandleFormAfterRequest_4cc7`), + } +} + +func BodyFormKelainan(inputId models.CustomTextFieldv2Prm, + inputName models.CustomTextFieldv2Prm, + componentID string, + hxOnLoad templ.ComponentScript) 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_Var9 := templ.GetChildren(ctx) + if templ_7745c5c3_Var9 == nil { + templ_7745c5c3_Var9 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + templ_7745c5c3_Err = templ.RenderScriptItems(ctx, templ_7745c5c3_Buffer, hxOnLoad) + 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 = customtextfield.CustomTextFieldv2( + inputId).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = customtextfield.CustomTextFieldv2( + inputName).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 JsHideModal(modalID string) templ.ComponentScript { + return templ.ComponentScript{ + Name: `__templ_JsHideModal_da6c`, + Function: `function __templ_JsHideModal_da6c(modalID){$(modalID).modal('hide') +}`, + Call: templ.SafeScript(`__templ_JsHideModal_da6c`, modalID), + CallInline: templ.SafeScriptInline(`__templ_JsHideModal_da6c`, modalID), + } +} + +func JsShowModal(modalID string) templ.ComponentScript { + return templ.ComponentScript{ + Name: `__templ_JsShowModal_3147`, + Function: `function __templ_JsShowModal_3147(modalID){$(modalID).modal('show') +}`, + Call: templ.SafeScript(`__templ_JsShowModal_3147`, modalID), + CallInline: templ.SafeScriptInline(`__templ_JsShowModal_3147`, modalID), + } +} + +func ActionFormKelainan(LinkClose string, targetClose string, hxSwapClose string, modalID string) 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_Var12 := templ.GetChildren(ctx) + if templ_7745c5c3_Var12 == nil { + templ_7745c5c3_Var12 = 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, JsHideModal(modalID)) + 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 BtnCloseFormKelainan(LinkClose string, targetClose string, hxSwapClose string, modalID string) 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_Var17 := templ.GetChildren(ctx) + if templ_7745c5c3_Var17 == nil { + templ_7745c5c3_Var17 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + templ_7745c5c3_Err = templ.RenderScriptItems(ctx, templ_7745c5c3_Buffer, JsHideModal(modalID)) + 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 + }) +} diff --git a/views/dev/masterkelainan/mdkelainantable.templ b/views/dev/masterkelainan/mdkelainantable.templ new file mode 100644 index 0000000..a24cb32 --- /dev/null +++ b/views/dev/masterkelainan/mdkelainantable.templ @@ -0,0 +1,31 @@ +package masterkelainan + +import ( + "cpone/component/table" + "cpone/models" +) + +templ TableKelainan(data []models.Kelainan, tableID string) { +
+ @tablecomponent.TableV3([]string{"NO", "GRUP KELAINAN", "AKSI"}, + []string{"10%", "70%", "20%"}, + TableRow(data)) +
+} + +templ TableRow(data []models.Kelainan) { + if len(data) == 0 { + + Data Tidak Ditemukan + + } + for _, v := range data { + + { v.Nomor } + { v.Mcu_KelainanGroupName } + + action + + + } +} diff --git a/views/dev/masterkelainan/mdkelainantable_templ.go b/views/dev/masterkelainan/mdkelainantable_templ.go new file mode 100644 index 0000000..ff966df --- /dev/null +++ b/views/dev/masterkelainan/mdkelainantable_templ.go @@ -0,0 +1,121 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.2.663 +package masterkelainan + +//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/table" + "cpone/models" +) + +func TableKelainan(data []models.Kelainan, tableID string) 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 = tablecomponent.TableV3([]string{"NO", "GRUP KELAINAN", "AKSI"}, + []string{"10%", "70%", "20%"}, + TableRow(data)).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 TableRow(data []models.Kelainan) 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 len(data) == 0 { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("Data Tidak Ditemukan") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + for _, v := range data { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var4 string + templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(v.Nomor) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\masterkelainan\mdkelainantable.templ`, Line: 24, Col: 16} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) + 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_Var5 string + templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(v.Mcu_KelainanGroupName) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\masterkelainan\mdkelainantable.templ`, Line: 25, Col: 32} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("action\r") + 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/masterkelainan/modaladdkelainan.templ b/views/dev/masterkelainan/modaladdkelainan.templ deleted file mode 100644 index edb1561..0000000 --- a/views/dev/masterkelainan/modaladdkelainan.templ +++ /dev/null @@ -1,67 +0,0 @@ -package masterkelainan - -import ( - "cpone/models" - "cpone/component/customtextfield" -) - -templ DialogNewBody(name string, id string, nameErrorMsg string) { -
- @customtextfield.CustomTextFieldv2( - models.CustomTextFieldv2Prm{ - Label: "Nama Grup Kelainan", - Name: "kelainanname", - Placeholder: "Nama Grup Kelainan", - Type: "text", - Value: name, - ErrorMsg: nameErrorMsg, - }) -
-} - -templ DialogErrorBody(name string) { -
- @customtextfield.CustomTextFieldv2( - models.CustomTextFieldv2Prm{ - Label: "Nama Grup Kelainan", - Name: "kelainanname", - Placeholder: "Nama Grup Kelainan", - Type: "text", - Value: name, - }) -
-} - -templ DialogNewAction() { -
- - -
-} - -templ BtnCloseNew() { - -} - -// templ KelainanSwapOOB(name string, errorName string) { -// @DialogNewBody(name, errorName) -// @DialogErrorBody(name) -// } diff --git a/views/dev/masterkelainan/modaladdkelainan_templ.go b/views/dev/masterkelainan/modaladdkelainan_templ.go deleted file mode 100644 index 1e7fd48..0000000 --- a/views/dev/masterkelainan/modaladdkelainan_templ.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.2.663 -package masterkelainan - -//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/customtextfield" - "cpone/models" -) - -func DialogNewBody(name string, id string, nameErrorMsg string) 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 = customtextfield.CustomTextFieldv2( - models.CustomTextFieldv2Prm{ - Label: "Nama Grup Kelainan", - Name: "kelainanname", - Placeholder: "Nama Grup Kelainan", - Type: "text", - Value: name, - ErrorMsg: nameErrorMsg, - }).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 DialogErrorBody(name string) 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 - } - templ_7745c5c3_Err = customtextfield.CustomTextFieldv2( - models.CustomTextFieldv2Prm{ - Label: "Nama Grup Kelainan", - Name: "kelainanname", - Placeholder: "Nama Grup Kelainan", - Type: "text", - Value: name, - }).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 DialogNewAction() 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) - _, 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 BtnCloseNew() 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_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 - }) -} - -// templ KelainanSwapOOB(name string, errorName string) { -// @DialogNewBody(name, errorName) -// @DialogErrorBody(name) -// } diff --git a/views/dev/masterkelainan/modaleditkelainan.templ b/views/dev/masterkelainan/modaleditkelainan.templ deleted file mode 100644 index dfafc69..0000000 --- a/views/dev/masterkelainan/modaleditkelainan.templ +++ /dev/null @@ -1,66 +0,0 @@ -package masterkelainan - -import ( - "cpone/models" - "cpone/component/customtextfield" -) - -templ DialogEditForm(name string) { - @customtextfield.CustomTextFieldv2( - models.CustomTextFieldv2Prm{ - Label: "Nama Grup Kelainan", - Name: "kelainanname", - Placeholder: "Nama Grup Kelainan", - Type: "text", - Value: name, - }) -} - -templ DialogEditBody(name string) { -
- @DialogEditForm(name) -
-} - -templ LoadingSpinner() { -
-
-
-
-
-} - -templ DialogEditAction() { -
- - -
-} - -templ BtnCloseEdit() { - -} diff --git a/views/dev/masterkelainan/modaleditkelainan_templ.go b/views/dev/masterkelainan/modaleditkelainan_templ.go deleted file mode 100644 index 558cf14..0000000 --- a/views/dev/masterkelainan/modaleditkelainan_templ.go +++ /dev/null @@ -1,151 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.2.663 -package masterkelainan - -//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/customtextfield" - "cpone/models" -) - -func DialogEditForm(name string) 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 = customtextfield.CustomTextFieldv2( - models.CustomTextFieldv2Prm{ - Label: "Nama Grup Kelainan", - Name: "kelainanname", - Placeholder: "Nama Grup Kelainan", - Type: "text", - Value: name, - }).Render(ctx, 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 - }) -} - -func DialogEditBody(name string) 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 - } - templ_7745c5c3_Err = DialogEditForm(name).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 LoadingSpinner() 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) - _, 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 DialogEditAction() 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_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 BtnCloseEdit() 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_Var5 := templ.GetChildren(ctx) - if templ_7745c5c3_Var5 == nil { - 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) - } - return templ_7745c5c3_Err - }) -}