diff --git a/component/customdropdown/customdropdown_templ.go b/component/customdropdown/customdropdown_templ.go index d6cdc73..c1be02e 100644 --- a/component/customdropdown/customdropdown_templ.go +++ b/component/customdropdown/customdropdown_templ.go @@ -376,7 +376,7 @@ func CustomDropdownFilter( var templ_7745c5c3_Var23 string templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(idCmp) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 80, Col: 12} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 81, Col: 12} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var23)) if templ_7745c5c3_Err != nil { @@ -389,7 +389,7 @@ func CustomDropdownFilter( var templ_7745c5c3_Var24 string templ_7745c5c3_Var24, templ_7745c5c3_Err = templ.JoinStringErrs(hxName) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 81, Col: 15} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 82, Col: 15} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var24)) if templ_7745c5c3_Err != nil { @@ -402,7 +402,7 @@ func CustomDropdownFilter( var templ_7745c5c3_Var25 string templ_7745c5c3_Var25, templ_7745c5c3_Err = templ.JoinStringErrs(hxInclude) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 82, Col: 24} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 83, Col: 24} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var25)) if templ_7745c5c3_Err != nil { @@ -415,7 +415,7 @@ func CustomDropdownFilter( var templ_7745c5c3_Var26 string templ_7745c5c3_Var26, templ_7745c5c3_Err = templ.JoinStringErrs(hxGet) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 83, Col: 16} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 84, Col: 16} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var26)) if templ_7745c5c3_Err != nil { @@ -428,7 +428,7 @@ func CustomDropdownFilter( var templ_7745c5c3_Var27 string templ_7745c5c3_Var27, templ_7745c5c3_Err = templ.JoinStringErrs(hxSwap) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 84, Col: 18} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 85, Col: 18} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var27)) if templ_7745c5c3_Err != nil { @@ -441,7 +441,7 @@ func CustomDropdownFilter( var templ_7745c5c3_Var28 string templ_7745c5c3_Var28, templ_7745c5c3_Err = templ.JoinStringErrs(hxTarget) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 85, Col: 22} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 86, Col: 22} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var28)) if templ_7745c5c3_Err != nil { @@ -454,7 +454,7 @@ func CustomDropdownFilter( var templ_7745c5c3_Var29 string templ_7745c5c3_Var29, templ_7745c5c3_Err = templ.JoinStringErrs(hxTrigger) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 86, Col: 24} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 87, Col: 24} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var29)) if templ_7745c5c3_Err != nil { @@ -518,7 +518,7 @@ func CustomDropdownForm( var templ_7745c5c3_Var33 string templ_7745c5c3_Var33, templ_7745c5c3_Err = templ.JoinStringErrs(inp.Label) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 97, Col: 87} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 98, Col: 87} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var33)) if templ_7745c5c3_Err != nil { @@ -546,7 +546,7 @@ func CustomDropdownForm( var templ_7745c5c3_Var34 string templ_7745c5c3_Var34, templ_7745c5c3_Err = templ.JoinStringErrs(inp.Placeholder) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 106, Col: 26} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 107, Col: 26} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var34)) if templ_7745c5c3_Err != nil { @@ -559,7 +559,7 @@ func CustomDropdownForm( var templ_7745c5c3_Var35 string templ_7745c5c3_Var35, templ_7745c5c3_Err = templ.JoinStringErrs(inp.Name) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 109, Col: 18} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 110, Col: 18} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var35)) if templ_7745c5c3_Err != nil { @@ -572,7 +572,7 @@ func CustomDropdownForm( var templ_7745c5c3_Var36 string templ_7745c5c3_Var36, templ_7745c5c3_Err = templ.JoinStringErrs(inp.ID) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 110, Col: 14} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 111, Col: 14} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var36)) if templ_7745c5c3_Err != nil { @@ -593,7 +593,7 @@ func CustomDropdownForm( var templ_7745c5c3_Var37 string templ_7745c5c3_Var37, templ_7745c5c3_Err = templ.JoinStringErrs(inp.ErrorMsg) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 115, Col: 17} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 116, Col: 17} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var37)) if templ_7745c5c3_Err != nil { diff --git a/handlers/dev/md.pasien.handlers.go b/handlers/dev/md.pasien.handlers.go new file mode 100644 index 0000000..3bb6243 --- /dev/null +++ b/handlers/dev/md.pasien.handlers.go @@ -0,0 +1,255 @@ +package dev_handlers + +import ( + breadcrumadmin "cpone/component/breadcrumbadmin" + "cpone/component/customtextfieldsearch" + navbarmenu "cpone/component/navbar" + "cpone/component/pagination" + sidebaruserprofile "cpone/component/sidebar_user_profile" + "cpone/models" + "cpone/services" + "cpone/utils" + dev_mdpasienview "cpone/views/dev/mdpasien" + "strconv" + + "github.com/a-h/templ" + "github.com/labstack/echo/v4" + "go.uber.org/zap" +) + +type MdPasienServices interface { + GetListMdPasien( + search string, + currentPage int, + rowPerPage int) ([]models.Pasien, int, error) + GetMdPasienBreadCrumb(title string) (models.BreadCrumbV1, error) +} + +func NewMdPasienHandler(us MdPasienServices) *MdPasienHandler { + return &MdPasienHandler{ + MdPasienServices: us, + } +} + +type MdPasienHandler struct { + MdPasienServices MdPasienServices +} + +func (lh *MdPasienHandler) HandleShowMdPasienScreen(c echo.Context) error { + logger, _ := zap.NewProduction() + dataMenu, err := services.GetMenu() + if err != nil { + defer logger.Sync() + logger.Info("ERROR BREADCRUMB DEV", + zap.Any("error", err), + ) + return err + } + paginationID := utils.GenerateRandomID("paginationID") + dialogAddID := utils.GenerateRandomID("dialogAdd") + dialogAddBodyID := utils.GenerateRandomID("dialogAddbody") + dialogEditID := utils.GenerateRandomID("dialogEdit") + dialogEditBodyID := utils.GenerateRandomID("dialogEditbody") + dialogDeleteID := utils.GenerateRandomID("dialogDelete") + dialogDeleteBodyID := utils.GenerateRandomID("dialogDeletebody") + tablePasienID := utils.GenerateRandomID("PasienID") + dataBreadCrumb, err := lh.MdPasienServices.GetMdPasienBreadCrumb("l") + + if err != nil { + defer logger.Sync() + logger.Info("ERROR BREADCRUMB DEV", + zap.Any("error", err), + ) + return err + } + //get user login + dataUser, err := services.GetUserLogin() + + if err != nil { + defer logger.Sync() + logger.Info("ERROR BREADCRUMB DEV", + zap.Any("error", err), + ) + return err + } + //Breadcrumb component + breadcrumbComponent := breadcrumadmin.MainBreadcrumbAdminV1(dataBreadCrumb) + // navbar menu + navbarmenuComponent := navbarmenu.NavbarMenu(dataMenu) + + // navbar user + navbaruserComponent := navbarmenu.Navbar(dataUser) + + // sidebar + sidebaruserprofileComponent := sidebaruserprofile.Navbaruserprofile(dataUser) + + //filter pasien component + filterPasien := customtextfieldsearch.MainCustomTextFieldSearchV3( + "filtersearch", + "search", + "PID/Nama", + "text", + "/dev/md/pasien/filter", + "input changed delay:500ms", + "#"+paginationID, + "indicator", + "", + "outerHTML", + "#filtersearch, #tableID, #paginationID, #dialogAddID, #dialogAddBodyID, #dialogEditID, #dialogEditBodyID, #dialogDeleteBodyID, #dialogDeleteID, #currpage"+paginationID, + dev_mdpasienview.BeforeRequestContent(), + dev_mdpasienview.AfterRequestContent(), + ) + + //table component + pasienlist, totalPage, err := lh.MdPasienServices.GetListMdPasien("", 1, 5) + if err != nil { + defer logger.Sync() + logger.Info("ERRO GET DATA PASIEN", + zap.Any("error", err), + ) + return err + } + + tablePasien := dev_mdpasienview.TablePasien(pasienlist, tablePasienID, + "getEdit", + "trgtedt", + "swpedt", + "#filtersearch, #tableID, #paginationID, #dialogAddID, #dialogAddBodyID, #dialogEditID, #dialogEditBodyID, #dialogDeleteBodyID, #dialogDeleteID, #currpage"+paginationID, + "getdlt", + "trgtdlt", + "swpdlt", + "#filtersearch, #tableID, #paginationID, #dialogAddID, #dialogAddBodyID, #dialogEditID, #dialogEditBodyID, #dialogDeleteBodyID, #dialogDeleteID, #currpage"+paginationID) + + //Pagination + paginationPasien := pagination.PaginationV3(totalPage, 1, + "/dev/md/pasien/pagination", + paginationID, + "#filtersearch, #tableID, #paginationID, #dialogAddID, #dialogAddBodyID, #dialogEditID, #dialogEditBodyID, #dialogDeleteBodyID, #dialogDeleteID, #currpage"+paginationID, + "#"+paginationID, + "outerHTML", + "", + "", + dev_mdpasienview.BeforeRequestContent(), + dev_mdpasienview.AfterRequestContent()) + + //Pasien Screen + cmpPasienContent := dev_mdpasienview.MdPasienScreen( + tablePasienID, + paginationID, + dialogAddID, + dialogAddBodyID, + dialogEditID, + dialogEditBodyID, + dialogDeleteID, + dialogDeleteBodyID, + breadcrumbComponent, + tablePasien, + filterPasien, + paginationPasien, + breadcrumbComponent, + breadcrumbComponent, + breadcrumbComponent) + jsMDpasien := dev_mdpasienview.JsMdPasien() + cssMdPasien := dev_mdpasienview.CssMdPasien() + viewMdPasienScreen := dev_mdpasienview.ShowMdPasienScreen("Master Pasien", + cmpPasienContent, + cssMdPasien, + jsMDpasien, navbarmenuComponent, navbaruserComponent, sidebaruserprofileComponent) + + return utils.View(c, viewMdPasienScreen) +} + +func (lh *MdPasienHandler) HandleSearchMdPasien(c echo.Context) error { + logger, _ := zap.NewProduction() + var retval []templ.Component + search := c.QueryParam("search") + // dialogEditBodyID := c.QueryParam("dialogEditBodyID") + // dialogDeleteBodyID := c.QueryParam("dialogDeleteBodyID") + tableID := c.QueryParam("tableID") + paginationID := c.QueryParam("paginationID") + + pasienList, totalPage, err := lh.MdPasienServices.GetListMdPasien(search, 1, 5) + defer logger.Sync() + logger.Info("GET DATA BAHAN", + zap.Any("data", pasienList), + zap.Any("err", err), + zap.Any("totalPage", totalPage), + ) + //Bahan Table + + tablePasien := dev_mdpasienview.TablePasien(pasienList, tableID, + "getEdit", + "trgtedt", + "swpedt", + "#filtersearch, #tableID, #paginationID, #dialogAddID, #dialogAddBodyID, #dialogEditID, #dialogEditBodyID, #dialogDeleteBodyID, #dialogDeleteID, #currpage"+paginationID, + "getdlt", + "trgtdlt", + "swpdlt", + "#filtersearch, #tableID, #paginationID, #dialogAddID, #dialogAddBodyID, #dialogEditID, #dialogEditBodyID, #dialogDeleteBodyID, #dialogDeleteID, #currpage"+paginationID) + + //Pagination + paginationPasien := pagination.PaginationV3(totalPage, 1, + "/dev/md/pasien/pagination", + paginationID, + "#filtersearch, #tableID, #paginationID, #dialogAddID, #dialogAddBodyID, #dialogEditID, #dialogEditBodyID, #dialogDeleteBodyID, #dialogDeleteID, #currpage"+paginationID, + "#"+paginationID, + "outerHTML", + "", + "", + dev_mdpasienview.BeforeRequestContent(), + dev_mdpasienview.AfterRequestContent()) + retval = append(retval, tablePasien) + retval = append(retval, paginationPasien) + return utils.ViewMulti(c, retval) +} +func (lh *MdPasienHandler) HandlePaginationMdPasien(c echo.Context) error { + logger, _ := zap.NewProduction() + var retval []templ.Component + search := c.QueryParam("search") + // dialogEditBodyID := c.QueryParam("dialogEditBodyID") + // dialogDeleteBodyID := c.QueryParam("dialogDeleteBodyID") + pageparam := c.QueryParam("page") + tableID := c.QueryParam("tableID") + paginationID := c.QueryParam("paginationID") + page, err := strconv.Atoi(pageparam) + if err != nil { + defer logger.Sync() + logger.Info("ERROR CONVERT PAGE PARAM", + zap.Any("page", page), + zap.Any("error ", err), + ) + return err + } + + pasienList, totalPage, err := lh.MdPasienServices.GetListMdPasien(search, page, 5) + defer logger.Sync() + logger.Info("GET DATA BAHAN", + zap.Any("data", pasienList), + zap.Any("err", err), + zap.Any("totalPage", totalPage), + ) + tablePasien := dev_mdpasienview.TablePasien(pasienList, tableID, + "getEdit", + "trgtedt", + "swpedt", + "#filtersearch, #tableID, #paginationID, #dialogAddID, #dialogAddBodyID, #dialogEditID, #dialogEditBodyID, #dialogDeleteBodyID, #dialogDeleteID, #currpage"+paginationID, + "getdlt", + "trgtdlt", + "swpdlt", + "#filtersearch, #tableID, #paginationID, #dialogAddID, #dialogAddBodyID, #dialogEditID, #dialogEditBodyID, #dialogDeleteBodyID, #dialogDeleteID, #currpage"+paginationID) + + //Pagination + paginationPasien := pagination.PaginationV3(totalPage, page, + "/dev/md/pasien/pagination", + paginationID, + "#filtersearch, #tableID, #paginationID, #dialogAddID, #dialogAddBodyID, #dialogEditID, #dialogEditBodyID, #dialogDeleteBodyID, #dialogDeleteID, #currpage"+paginationID, + "#"+paginationID, + "outerHTML", + "", + "", + dev_mdpasienview.BeforeRequestContent(), + dev_mdpasienview.AfterRequestContent()) + retval = append(retval, tablePasien) + retval = append(retval, paginationPasien) + return utils.ViewMulti(c, retval) +} diff --git a/handlers/routes.go b/handlers/routes.go index 56018e8..25805c4 100644 --- a/handlers/routes.go +++ b/handlers/routes.go @@ -321,4 +321,12 @@ func SetupRoutesDev(app *echo.Echo, appStore db.AppStore) { dev.GET("/md/bahan/opendelete", devMdBahanHandlers.HandleOpenDeleteMdBahan) dev.POST("/md/bahan/closedeleteform", devMdBahanHandlers.HandleCloseDeleteMdBahan) dev.POST("/md/bahan/delete", devMdBahanHandlers.HandleDeleteMdBahan) + + //MD Pasien + devMdPasienServices := dev_services.NewMdPasienServices(appStore) + devMdPasienHandlers := dev_handlers.NewMdPasienHandler(devMdPasienServices) + dev.GET("/md/pasien", devMdPasienHandlers.HandleShowMdPasienScreen) + dev.GET("/md/pasien/filter", devMdPasienHandlers.HandleSearchMdPasien) + dev.GET("/md/pasien/pagination", devMdPasienHandlers.HandlePaginationMdPasien) + } diff --git a/models/pasien.models.go b/models/pasien.models.go new file mode 100644 index 0000000..9547a1f --- /dev/null +++ b/models/pasien.models.go @@ -0,0 +1,47 @@ +package models + +type Pasien struct { + M_PatientID int `db:"M_PatientID"` + M_PatientNoReg string `db:"M_PatientNoReg"` + M_PatientM_TitleID string `db:"M_PatientM_TitleID"` + M_PatientPrefix string `db:"M_PatientPrefix"` + M_PatientName string `db:"M_PatientName"` + M_PatientSuffix string `db:"M_PatientSuffix"` + M_PatientGender string `db:"M_PatientGender"` + M_PatientDOB string `db:"M_PatientDOB"` + M_PatientReligionCode string `db:"M_PatientReligionCode"` + M_PatientReligionSystem string `db:"M_PatientReligionSystem"` + M_PatientBloodTypeCode string `db:"M_PatientBloodTypeCode"` + M_PatientBloodTypeSystem string `db:"M_PatientBloodTypeSystem"` + M_PatientBloodRhCode string `db:"M_PatientBloodRhCode"` + M_PatientBloodRhSystem string `db:"M_PatientBloodRhSystem"` + M_PatientEducationCode string `db:"M_PatientEducationCode"` + M_PatientEducationSystem string `db:"M_PatientEducationSystem"` + M_PatientCitizenship string `db:"M_PatientCitizenship"` + M_PatientEtnicCode string `db:"M_PatientEtnicCode"` + M_PatientEtnicSystem string `db:"M_PatientEtnicSystem"` + M_PatientIdentifierCode string `db:"M_PatientIdentifierCode"` + M_PatientIdentifierSystem string `db:"M_PatientIdentifierSystem"` + M_PatientIdentifierValue string `db:"M_PatientIdentifierValue"` + M_PatientJob string `db:"M_PatientJob"` + M_PatientPosisi string `db:"M_PatientPosisi"` + M_PatientDivisi string `db:"M_PatientDivisi"` + M_PatientHp string `db:"M_PatientHp"` + M_PatientEmail string `db:"M_PatientEmail"` + M_PatientPhoto string `db:"M_PatientPhoto"` + M_PatientPhotoLastUpdated string `db:"M_PatientPhotoLastUpdated"` + M_PatientPhotoLastUpdatedUserID string `db:"M_PatientPhotoLastUpdatedUserID"` + M_PatientAddress string `db:"M_PatientAddress"` + M_PatientAddressRegionalCd string `db:"M_PatientAddressRegionalCd"` + M_PatientAddressCity string `db:"M_PatientAddressCity"` + M_PatientAddressDistrict string `db:"M_PatientAddressDistrict"` + M_PatientAddressState string `db:"M_PatientAddressState"` + M_PatientAddressCountry string `db:"M_PatientAddressCountry"` + M_PatientIsActive string `db:"M_PatientIsActive"` + M_PatientCreated string `db:"M_PatientCreated"` + M_PatientCreatedUserID string `db:"M_PatientCreatedUserID"` + M_PatientLastUpdated string `db:"M_PatientLastUpdated"` + M_PatientLastUpdatedUserID string `db:"M_PatientLastUpdatedUserID"` + M_PatientDeletedUserID string `db:"M_PatientDeletedUserID"` + M_PatientDeleted string `db:"M_PatientDeleted"` +} diff --git a/services/dev/md.pasien.services.go b/services/dev/md.pasien.services.go new file mode 100644 index 0000000..fdf4fec --- /dev/null +++ b/services/dev/md.pasien.services.go @@ -0,0 +1,87 @@ +package dev_services + +import ( + "cpone/db" + "cpone/models" + dbx "cpone/package/database" + "fmt" + "math" + "strings" +) + +func NewMdPasienServices(uStore db.AppStore) *MdPasienServices { + + return &MdPasienServices{ + + MdPasienStore: uStore, + } +} + +type MdPasienServices struct { + MdPasienStore db.AppStore +} + +func (su *MdPasienServices) GetListMdPasien( + search string, + currentPage int, + rowPerPage int) ([]models.Pasien, int, error) { + var pasienList []models.Pasien + var totalData int + offset := (currentPage - 1) * rowPerPage + prm := "%" + strings.TrimSpace(search) + "%" + + querytotal := ` + SELECT COUNT(*) + FROM m_patient + JOIN m_title + ON M_PatientM_TitleID = M_TitleID + AND M_TitleIsActive = 'Y' + WHERE + (M_PatientNoReg LIKE ? OR M_PatientName LIKE ?) + AND M_PatientIsActive = 'Y' + ` + if err := dbx.Handlex.Get(&totalData, querytotal, prm, prm); err != nil { + return nil, 0, fmt.Errorf("error querying database: %v", err) + } + query := ` + SELECT m_patient.* + FROM m_patient + JOIN m_title + ON M_PatientM_TitleID = M_TitleID + AND M_TitleIsActive = 'Y' + WHERE + (M_PatientNoReg LIKE ? OR M_PatientName LIKE ?) + AND M_PatientIsActive = 'Y' + LIMIT ? OFFSET ? + ` + + if err := dbx.Handlex.Select(&pasienList, query, prm, prm, rowPerPage, offset); err != nil { + return nil, 0, fmt.Errorf("error querying database: %v", err) + } + totalPage := int(math.Ceil(float64(totalData) / float64(rowPerPage))) + + return pasienList, totalPage, nil + +} +func (su *MdPasienServices) GetMdPasienBreadCrumb(title string) (models.BreadCrumbV1, error) { + + ret := models.BreadCrumbV1{ + Title: "Master Pasien", + Item: []models.ItemBreadCrumbV1{ + { + Item: "Dashboard", + Url: "/dev/dashboard", + }, + { + Item: "Master", + Url: "/dev/master", + }, + { + Item: "Pasien", + Url: "", + }, + }, + } + + return ret, nil +} diff --git a/views/dev/mdpasien/mdpasien.templ b/views/dev/mdpasien/mdpasien.templ new file mode 100644 index 0000000..30e208a --- /dev/null +++ b/views/dev/mdpasien/mdpasien.templ @@ -0,0 +1,204 @@ +package dev_mdpasienview + +import "cpone/component/customtextfield" +import "cpone/layout" +import "cpone/models" + +templ MdPasienScreen(tableID string, + paginationID string, + dialogAddID string, + dialogAddBodyID string, + dialogEditID string, + dialogEditBodyID string, + dialogDeleteID string, + dialogDeleteBodyID string, + breadcrumb templ.Component, + tablecontent templ.Component, + filterComponent templ.Component, + pagination templ.Component, + dialogAddCmp templ.Component, + dialogEditCmp templ.Component, + dialogDeleteCmp templ.Component) { +
+ @customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "dialogAddID", + Name: "dialogAddID", + Type: "hidden", + Value: dialogAddID}) + @customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "dialogAddBodyID", + Name: "dialogAddBodyID", + Type: "hidden", + Value: dialogAddBodyID}) + @customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "dialogEditID", + Name: "dialogEditID", + Type: "hidden", + Value: dialogEditID}) + @customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "dialogEditBodyID", + Name: "dialogEditBodyID", + Type: "hidden", + Value: dialogEditBodyID}) + @customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "dialogDeleteID", + Name: "dialogDeleteID", + Type: "hidden", + Value: dialogDeleteID}) + @customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "dialogDeleteBodyID", + Name: "dialogDeleteBodyID", + Type: "hidden", + Value: dialogDeleteBodyID}) + @customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "tableID", + Name: "tableID", + Type: "hidden", + Value: tableID}) + @customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "paginationID", + Name: "paginationID", + Type: "hidden", + Value: paginationID}) +
+
+ @breadcrumb +
+
+ //
+
+ +
+
+
+ +
+
+
+ @filterComponent + @tablecontent + @pagination +
+ //
+
+ Loading... +
+
+
+
+ @dialogAddCmp + @dialogEditCmp + @dialogDeleteCmp +
+} + +templ CssMdPasien() { +} + +templ JsMdPasien() { + +} + +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 ShowMdPasienScreen(title string, cmp templ.Component, css templ.Component, js templ.Component, + navbarmenu templ.Component, + navbaruser templ.Component, + userprofile templ.Component) { + @layout.CorporateLayout(title, css, js, navbarmenu, navbaruser, userprofile) { + @cmp + } +} diff --git a/views/dev/mdpasien/mdpasien_templ.go b/views/dev/mdpasien/mdpasien_templ.go new file mode 100644 index 0000000..7f60ccc --- /dev/null +++ b/views/dev/mdpasien/mdpasien_templ.go @@ -0,0 +1,299 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.2.663 +package dev_mdpasienview + +//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" +import "cpone/layout" +import "cpone/models" + +func MdPasienScreen(tableID string, + paginationID string, + dialogAddID string, + dialogAddBodyID string, + dialogEditID string, + dialogEditBodyID string, + dialogDeleteID string, + dialogDeleteBodyID string, + breadcrumb templ.Component, + tablecontent templ.Component, + filterComponent templ.Component, + pagination templ.Component, + dialogAddCmp templ.Component, + dialogEditCmp templ.Component, + dialogDeleteCmp 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_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{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 = customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "dialogEditID", + Name: "dialogEditID", + Type: "hidden", + Value: dialogEditID}).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "dialogEditBodyID", + Name: "dialogEditBodyID", + Type: "hidden", + Value: dialogEditBodyID}).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "dialogDeleteID", + Name: "dialogDeleteID", + Type: "hidden", + Value: dialogDeleteID}).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "dialogDeleteBodyID", + Name: "dialogDeleteBodyID", + Type: "hidden", + Value: dialogDeleteBodyID}).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "tableID", + Name: "tableID", + Type: "hidden", + Value: tableID}).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "paginationID", + Name: "paginationID", + Type: "hidden", + Value: paginationID}).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 = breadcrumb.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 = filterComponent.Render(ctx, templ_7745c5c3_Buffer) + 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 + } + templ_7745c5c3_Err = pagination.Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
Loading...
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = dialogAddCmp.Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = dialogEditCmp.Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = dialogDeleteCmp.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 CssMdPasien() 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) + if !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) + } + return templ_7745c5c3_Err + }) +} + +func JsMdPasien() 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 + }) +} + +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 ShowMdPasienScreen(title string, cmp templ.Component, css templ.Component, js templ.Component, + navbarmenu templ.Component, + navbaruser templ.Component, + userprofile 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_Var6 := templ.GetChildren(ctx) + if templ_7745c5c3_Var6 == nil { + templ_7745c5c3_Var6 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + 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() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + templ_7745c5c3_Err = cmp.Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = io.Copy(templ_7745c5c3_W, templ_7745c5c3_Buffer) + } + return templ_7745c5c3_Err + }) + templ_7745c5c3_Err = layout.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 + } + if !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) + } + return templ_7745c5c3_Err + }) +} diff --git a/views/dev/mdpasien/mdpasientable.templ b/views/dev/mdpasien/mdpasientable.templ new file mode 100644 index 0000000..66c6cb0 --- /dev/null +++ b/views/dev/mdpasien/mdpasientable.templ @@ -0,0 +1,131 @@ +package dev_mdpasienview + +import "cpone/component/table" +import "cpone/models" +import "strconv" + +templ TablePasien(data []models.Pasien, + tableID string, + hxGetEdit string, + hxTargetEdit string, + hxSwapEdit string, + hxIncludeEdit string, + hxGetDelete string, + hxTargetDelete string, + hxSwapDelete string, + hxIncludeDelete string, +) { +
+ @tablecomponent.TableV3([]string{"PID", "NAMA", "NO HP", "JENIS KELAMIN", "AKSI"}, + []string{"20%", "30%", "10%", "20%", "20%"}, + RowPasien(data, + hxGetEdit, + hxTargetEdit, + hxSwapEdit, + hxIncludeEdit, + hxGetDelete, + hxTargetDelete, + hxSwapDelete, + hxIncludeDelete, + )) +
+} + +templ RowPasien(data []models.Pasien, + hxGetEdit string, + hxTargetEdit string, + hxSwapEdit string, + hxIncludeEdit string, + hxGetDelete string, + hxTargetDelete string, + hxSwapDelete string, + hxIncludeDelete string, +) { + if len(data) == 0 { + + Data Tidak Ditemukan + + } + for _, v := range data { + + { v.M_PatientNoReg } + { v.M_PatientName } + { v.M_PatientHp } + { v.M_PatientGender } + + @TableAction(v.M_PatientID, + hxGetEdit, + hxTargetEdit, + hxSwapEdit, + hxIncludeEdit, + hxGetDelete, + hxTargetDelete, + hxSwapDelete, + hxIncludeDelete, + ) + + + } +} + +templ TableAction( + id int, + hxGetEdit string, + hxTargetEdit string, + hxSwapEdit string, + hxIncludeEdit string, + hxGetDelete string, + hxTargetDelete string, + hxSwapDelete string, + hxIncludeDelete string, + +) { +
+ + + Edit + + + + Hapus + +
+} + +script HandleBeforeRequestRow(id string) { + var cusid_ele = document.getElementsByClassName('btnactbhn'); + 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('btnactbhn'); + 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/mdpasien/mdpasientable_templ.go b/views/dev/mdpasien/mdpasientable_templ.go new file mode 100644 index 0000000..60a4b9a --- /dev/null +++ b/views/dev/mdpasien/mdpasientable_templ.go @@ -0,0 +1,464 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.2.663 +package dev_mdpasienview + +//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" +import "cpone/models" +import "strconv" + +func TablePasien(data []models.Pasien, + tableID string, + hxGetEdit string, + hxTargetEdit string, + hxSwapEdit string, + hxIncludeEdit string, + hxGetDelete string, + hxTargetDelete string, + hxSwapDelete string, + hxIncludeDelete 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{"PID", "NAMA", "NO HP", "JENIS KELAMIN", "AKSI"}, + []string{"20%", "30%", "10%", "20%", "20%"}, + RowPasien(data, + hxGetEdit, + hxTargetEdit, + hxSwapEdit, + hxIncludeEdit, + hxGetDelete, + hxTargetDelete, + hxSwapDelete, + hxIncludeDelete, + )).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 RowPasien(data []models.Pasien, + hxGetEdit string, + hxTargetEdit string, + hxSwapEdit string, + hxIncludeEdit string, + hxGetDelete string, + hxTargetDelete string, + hxSwapDelete string, + hxIncludeDelete 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_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.M_PatientNoReg) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpasien\mdpasientable.templ`, Line: 51, Col: 25} + } + _, 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.M_PatientName) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpasien\mdpasientable.templ`, Line: 52, Col: 24} + } + _, 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("") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var6 string + templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(v.M_PatientHp) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpasien\mdpasientable.templ`, Line: 53, Col: 22} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6)) + 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_Var7 string + templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(v.M_PatientGender) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpasien\mdpasientable.templ`, Line: 54, Col: 26} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7)) + 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 = TableAction(v.M_PatientID, + hxGetEdit, + hxTargetEdit, + hxSwapEdit, + hxIncludeEdit, + hxGetDelete, + hxTargetDelete, + hxSwapDelete, + hxIncludeDelete, + ).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 TableAction( + id int, + hxGetEdit string, + hxTargetEdit string, + hxSwapEdit string, + hxIncludeEdit string, + hxGetDelete string, + hxTargetDelete string, + hxSwapDelete string, + hxIncludeDelete 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_Var8 := templ.GetChildren(ctx) + if templ_7745c5c3_Var8 == nil { + templ_7745c5c3_Var8 = 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 ") + 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
") + 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 HandleBeforeRequestRow(id string) templ.ComponentScript { + return templ.ComponentScript{ + Name: `__templ_HandleBeforeRequestRow_7d4f`, + Function: `function __templ_HandleBeforeRequestRow_7d4f(id){var cusid_ele = document.getElementsByClassName('btnactbhn'); + 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_7d4f`, id), + CallInline: templ.SafeScriptInline(`__templ_HandleBeforeRequestRow_7d4f`, id), + } +} + +func HandleAfterRequestRow(id string) templ.ComponentScript { + return templ.ComponentScript{ + Name: `__templ_HandleAfterRequestRow_ce9e`, + Function: `function __templ_HandleAfterRequestRow_ce9e(id){var cusid_ele = document.getElementsByClassName('btnactbhn'); + 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_ce9e`, id), + CallInline: templ.SafeScriptInline(`__templ_HandleAfterRequestRow_ce9e`, id), + } +}