From e1200fae61eb9464ddfbcc84475850be46c59e2a Mon Sep 17 00:00:00 2001 From: adibwp Date: Sat, 15 Jun 2024 15:52:56 +0700 Subject: [PATCH] add dialog cetak mcu --- component/modal/modal.templ | 26 + component/modal/modal_templ.go | 66 +++ handlers/corporate/patient.handlers.go | 184 ++++++- handlers/routes.go | 12 +- models/dashboardpatient.models.go | 11 + services/corporate/patient.services.go | 86 +++- views/corporate/mcu/mcutabview.templ | 10 +- views/corporate/mcu/mcutabview_templ.go | 67 ++- views/corporate/patient/listingpatient.templ | 90 ++++ .../corporate/patient/listingpatient_templ.go | 291 ++++++++++++ views/corporate/patient/patient.templ | 138 ++++-- views/corporate/patient/patient_templ.go | 123 ++++- views/corporate/patient/patientmodal.templ | 147 ++++++ views/corporate/patient/patientmodal_templ.go | 448 ++++++++++++++++++ 14 files changed, 1644 insertions(+), 55 deletions(-) create mode 100644 models/dashboardpatient.models.go create mode 100644 views/corporate/patient/listingpatient.templ create mode 100644 views/corporate/patient/listingpatient_templ.go create mode 100644 views/corporate/patient/patientmodal.templ create mode 100644 views/corporate/patient/patientmodal_templ.go diff --git a/component/modal/modal.templ b/component/modal/modal.templ index 8a4b936..90e51b4 100644 --- a/component/modal/modal.templ +++ b/component/modal/modal.templ @@ -57,3 +57,29 @@ templ ModalXL(modalID string, modalTitle string, modalBody templ.Component, moda } + +templ ModalViewXL(modalID string, modalTitle string, modalBody templ.Component, btnClose templ.Component) { + +} \ No newline at end of file diff --git a/component/modal/modal_templ.go b/component/modal/modal_templ.go index 4af1cc3..e5f4aef 100644 --- a/component/modal/modal_templ.go +++ b/component/modal/modal_templ.go @@ -157,3 +157,69 @@ func ModalXL(modalID string, modalTitle string, modalBody templ.Component, modal return templ_7745c5c3_Err }) } + +func ModalViewXL(modalID string, modalTitle string, modalBody templ.Component, btnClose 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_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 + } + var templ_7745c5c3_Var9 string + templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(modalTitle) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\modal\modal.templ`, Line: 75, Col: 18} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9)) + 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 = btnClose.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 = modalBody.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 + }) +} diff --git a/handlers/corporate/patient.handlers.go b/handlers/corporate/patient.handlers.go index e5991f8..0365026 100644 --- a/handlers/corporate/patient.handlers.go +++ b/handlers/corporate/patient.handlers.go @@ -1,13 +1,24 @@ package corporate_handlers import ( + breadcrumadmin "cpone/component/breadcrumbadmin" + navbarmenu "cpone/component/navbar" + "cpone/component/pagination" + sidebaruserprofile "cpone/component/sidebar_user_profile" + "cpone/models" + "cpone/services" "cpone/utils" corporate_patient "cpone/views/corporate/patient" + "strconv" + "github.com/a-h/templ" "github.com/labstack/echo/v4" + "go.uber.org/zap" ) type PatientService interface { + GetDashboardPatientBreadcrumb(title string) (models.BreadCrumbV1, error) + ListingData(search string, date string, patID string, corpId string, currentpage int, rowperpage int) ([]models.DashboardPatient, int, error) } func NewPatientHandler(us PatientService) *PatientHandler { @@ -20,7 +31,174 @@ type PatientHandler struct { PatientService PatientService } -func (uh *PatientHandler) ShowPatient(c echo.Context) error { - helo := corporate_patient.Show() - return utils.View(c, helo) +func (ph *PatientHandler) HandleShowPatient(c echo.Context) error { + logger, _ := zap.NewProduction() + title := "Nanda Arisu" + + listID := utils.GenerateRandomID("listid") + paginationID := utils.GenerateRandomID("paginationid") + dialogID := utils.GenerateRandomID("dialogid") + dialogBodyID := utils.GenerateRandomID("dialogbodyid") + + user, err := services.GetUserLogin() + if err != nil { + defer logger.Sync() + logger.Info("Error get user", zap.Any("error", err)) + return err + } + + dataBreadcrumb, err := ph.PatientService.GetDashboardPatientBreadcrumb(title) + if err != nil { + defer logger.Sync() + logger.Info("Error breadcrumb", zap.Any("error", err)) + return err + } + defer logger.Sync() + + navbaruser := navbarmenu.NavbarWithLogo(user) + sidbaruser := sidebaruserprofile.Navbaruserprofile(user) + breadcrumb := breadcrumadmin.MainBreadcrumbAdminV1(dataBreadcrumb) + + listingdata, totalPage, err := ph.PatientService.ListingData("", "", "108", "40", 1, 5) + if err != nil { + defer logger.Sync() + logger.Info("error get listing data", zap.Any("error", err), zap.Any("total", totalPage)) + return err + } + listingcomponent := corporate_patient.ListingData(listingdata, + listID, + "/corp/dashboard_pat/opencetak", + "#"+dialogBodyID, + "outerHTML", + "#dialogID, #dialogBodyID", + ) + + paginationcomponent := pagination.PaginationV3( + totalPage, + 1, + "/corp/dashboard_pat/changepage", + paginationID, + "#listID, #paginationID, #dialogID, #dialogBodyID", + "#"+paginationID, + "outerHTML", "", "", + corporate_patient.BeforeRequestContent(), + corporate_patient.AfterRequestContent(), + ) + + dialogBody := corporate_patient.BodyDialogPat( + dialogBodyID, + corporate_patient.JSHideModal(""), + ) + + dialogClose := corporate_patient.BtnClosePat( + "/corp/dashboard_pat/closecetak", + "#"+dialogBodyID, + "outerHTML", + "#"+dialogID, + ) + + dialogCetak := corporate_patient.PatientDialogForm( + "cetakdialog", + "/corp/dashboard_pat/cetak", + "#"+dialogBodyID, + "outerHTML", + "#listID, #paginationID, #dialogID, #dialogBodyID", + dialogID, + "Cetak", + dialogBody, + dialogClose, + ) + + content := corporate_patient.DashboardPat( + listID, + paginationID, + dialogID, + dialogBodyID, + breadcrumb, + listingcomponent, + paginationcomponent, + dialogCetak, + ) + css := corporate_patient.CSSDashboardPat() + js := corporate_patient.JSDashboardPat() + + view := corporate_patient.ShowDashboardPat(title, content, css, js, navbaruser, sidbaruser) + return utils.View(c, view) +} + +func (ph *PatientHandler) HandleChangePage(c echo.Context) error { + logger, _ := zap.NewProduction() + + pageparam := c.QueryParam("page") + listID := c.QueryParam("listID") + paginationID := c.QueryParam("paginationID") + dialogBodyID := c.QueryParam("dialogBodyID") + + var retval []templ.Component + page, err := strconv.Atoi(pageparam) + if err != nil { + defer logger.Sync() + logger.Info("error convert page param") + return err + } + + listData, totalPage, err := ph.PatientService.ListingData("", "", "108", "40", page, 5) + if err != nil { + defer logger.Sync() + logger.Info("error get data listing") + return err + } + listcomponent := corporate_patient.ListingData(listData, + listID, + "/corp/dashboard_pat/opencetak", + "#"+dialogBodyID, + "outerHTML", + "#dialogID, #dialogBodyID", + ) + + paginationcomponent := pagination.PaginationV3( + totalPage, + page, + "/corp/dashboard_pat/changepage", + paginationID, + "#listID, #paginationID", + "#"+paginationID, + "outerHTML", "", "", + corporate_patient.BeforeRequestContent(), + corporate_patient.AfterRequestContent(), + ) + + retval = append(retval, listcomponent) + retval = append(retval, paginationcomponent) + return utils.ViewMulti(c, retval) +} + +func (ph *PatientHandler) HandleOpenDialog(c echo.Context) error { + logger, _ := zap.NewProduction() + defer logger.Sync() + + id := c.QueryParam("id") + logger.Info("params", zap.Any("id", id)) + dialogID := c.QueryParam("dialogID") + dialogBodyID := c.QueryParam("dialogBodyID") + + dialogBody := corporate_patient.BodyDialogPat( + dialogBodyID, + corporate_patient.JSShowModal("#"+dialogID), + ) + + return utils.View(c, dialogBody) +} + +func (ph *PatientHandler) HandleCloseDialog(c echo.Context) error { + // logger, _ := zap.NewProduction() + + dialogBodyID := c.QueryParam("dialogBodyID") + + dialogBody := corporate_patient.BodyDialogPat( + dialogBodyID, + corporate_patient.JSHideModal(""), + ) + + return utils.View(c, dialogBody) } diff --git a/handlers/routes.go b/handlers/routes.go index bcfd6a2..a856c0d 100644 --- a/handlers/routes.go +++ b/handlers/routes.go @@ -126,8 +126,16 @@ func SetupRoutesCorporate(app *echo.Echo, appStore db.AppStore) { corp.GET("/dashboard_pic/detail/:id/tabdaftarpeserta", daftarpesertaHandl.HandleShowTabDaftarPeserta) corp.GET("/dashboard_pic/detail/:id/tabdaftarpeserta/changepage", daftarpesertaHandl.HandlePagination) - patientHandler := corporate_handlers.NewPatientHandler(l) - corp.GET("/patient", patientHandler.ShowPatient) + patienServices := corporate_services.NewPatientServices(appStore) + patientHandler := corporate_handlers.NewPatientHandler(patienServices) + corp.GET("/dashboard_pat", patientHandler.HandleShowPatient) + corp.GET("/dashboard_pat/changepage", patientHandler.HandleChangePage) + corp.GET("/dashboard_pat/opencetak", patientHandler.HandleOpenDialog) + corp.POST("/dashboard_pat/closecetak", patientHandler.HandleCloseDialog) + + // dev.GET("/md/samplestation/openedit", devMDSampleStationHandlers.HandleOpenEditForm) + // dev.POST("/md/samplestation/edit", devMDSampleStationHandlers.HandleEditMDSS) + // dev.POST("/md/samplestation/closeeditform", devMDSampleStationHandlers.HandleCloseEditForm) } func SetupRoutesClient(app *echo.Echo, appStore db.AppStore) { diff --git a/models/dashboardpatient.models.go b/models/dashboardpatient.models.go new file mode 100644 index 0000000..c845fec --- /dev/null +++ b/models/dashboardpatient.models.go @@ -0,0 +1,11 @@ +package models + +type DashboardPatient struct { + T_OrderHeaderID int `db:"T_OrderHeaderID"` + T_OrderHeaderDate string `db:"T_OrderHeaderDate"` + T_OrderHeaderLabNumber string `db:"T_OrderHeaderLabNumber"` + T_OrderHeaderM_PatientID int `db:"T_OrderHeaderM_PatientID"` + T_OrderHeaderCorporateID int `db:"T_OrderHeaderCorporateID"` + T_OrderHeaderMgm_McuID int `db:"T_OrderHeaderMgm_McuID"` + T_OrderHeaderIsActive string `db:"T_OrderHeaderIsActive"` +} diff --git a/services/corporate/patient.services.go b/services/corporate/patient.services.go index 7d22b22..3e24623 100644 --- a/services/corporate/patient.services.go +++ b/services/corporate/patient.services.go @@ -1,15 +1,93 @@ package corporate_services -import "cpone/db" +import ( + "cpone/db" + "cpone/models" + dbx "cpone/package/database" + "fmt" + "math" -type ServicesPatient struct { + "go.uber.org/zap" +) + +type PatientServices struct { PatientStore db.AppStore } -func NewServicesPatient(uStore db.AppStore) *ServicesPatient { +func NewPatientServices(uStore db.AppStore) *PatientServices { - return &ServicesPatient{ + return &PatientServices{ PatientStore: uStore, } } + +func (sp *PatientServices) GetDashboardPatientBreadcrumb(title string) (models.BreadCrumbV1, error) { + breadcrumb := models.BreadCrumbV1{ + Title: title, + Item: []models.ItemBreadCrumbV1{ + { + Item: "Dashboard", + Url: "/corp/dashboard_pat", + }, + { + Item: "PT. ABC", + Url: "", + }, + { + Item: title, + Url: "", + }, + }, + } + + return breadcrumb, nil +} + +func (sp *PatientServices) ListingData(search string, date string, patID string, corpId string, currentpage int, rowperpage int) ([]models.DashboardPatient, int, error) { + logger, _ := zap.NewProduction() + var ret []models.DashboardPatient + var totalData int + + if len(date) == 0 { + date = "" + } + + prmSearch := "%" + search + "%" + offset := (currentpage - 1) * rowperpage + q := ` + SELECT COUNT(*) + FROM t_orderheader + WHERE T_OrderHeaderIsActive = 'Y' + AND T_OrderHeaderLabNumber LIKE ? + AND T_OrderHeaderM_PatientID = ? + AND T_OrderHeaderCorporateID = ? + ` + if err := dbx.Handlex.Get(&totalData, q, prmSearch, patID, corpId); err != nil { + return nil, 0, fmt.Errorf("error query get total data: %v", err) + } + + q = ` + SELECT + T_OrderHeaderID, + DATE_FORMAT(T_OrderHeaderDate, '%d/%m/%Y') AS T_OrderHeaderDate, + T_OrderHeaderLabNumber, + T_OrderHeaderM_PatientID, + T_OrderHeaderCorporateID, + T_OrderHeaderMgm_McuID, + T_OrderHeaderIsActive + FROM t_orderheader + WHERE T_OrderHeaderIsActive = 'Y' + AND T_OrderHeaderLabNumber LIKE ? + AND T_OrderHeaderM_PatientID = ? + AND T_OrderHeaderCorporateID = ? + LIMIT ? OFFSET ? + ` + if err := dbx.Handlex.Select(&ret, q, prmSearch, patID, corpId, rowperpage, offset); err != nil { + return nil, 0, fmt.Errorf("error query get data: %v", err) + } + logger.Info("response", zap.Any("data", ret)) + + totalPage := int(math.Ceil(float64(totalData) / float64(rowperpage))) + return ret, totalPage, nil +} diff --git a/views/corporate/mcu/mcutabview.templ b/views/corporate/mcu/mcutabview.templ index 62e7f1f..898d039 100644 --- a/views/corporate/mcu/mcutabview.templ +++ b/views/corporate/mcu/mcutabview.templ @@ -30,19 +30,19 @@ templ TabViewMcuDetail(
- +
- +
- +
- +
- +
diff --git a/views/corporate/mcu/mcutabview_templ.go b/views/corporate/mcu/mcutabview_templ.go index 1ccf847..5decf58 100644 --- a/views/corporate/mcu/mcutabview_templ.go +++ b/views/corporate/mcu/mcutabview_templ.go @@ -51,7 +51,72 @@ func TabViewMcuDetail( if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-target=\"#tabdaftarpeserta\">Daftar Peserta
") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-target=\"#tabdaftarpeserta\">Daftar Peserta
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/views/corporate/patient/listingpatient.templ b/views/corporate/patient/listingpatient.templ new file mode 100644 index 0000000..93a2702 --- /dev/null +++ b/views/corporate/patient/listingpatient.templ @@ -0,0 +1,90 @@ +package corporate_patient + +import "cpone/models" +import "strconv" + +templ ListingData( + data []models.DashboardPatient, + listID string, + hxGetCetak string, + hxTargetCetak string, + hxSwapCetak string, + hxIncludeCetak string, +) { +
+
+
+ for i, d := range data { + if i == (len(data) - 1) { +
+ @ItemCard(d, + hxGetCetak, + hxTargetCetak, + hxSwapCetak, + hxIncludeCetak, + ) +
+ } else { +
+ @ItemCard(d, + hxGetCetak, + hxTargetCetak, + hxSwapCetak, + hxIncludeCetak, + ) +
+ } + } +
+
+
+} + +templ ItemCard( + data models.DashboardPatient, + hxGetCetak string, + hxTargetCetak string, + hxSwapCetak string, + hxIncludeCetak string, +) { +
+
+

{ data.T_OrderHeaderLabNumber }

+
+
+

{ data.T_OrderHeaderDate }

+
+
+ + +
+
+} + +script HandleBeforeRequestRow(id string) { + var cusid_ele = document.getElementsByClassName('btncetak'); + 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('btncetak'); + for (var i = 0; i < cusid_ele.length; ++i) { + var item = cusid_ele[i]; + item.classList.remove('disabled'); + } + console.log(id) +} \ No newline at end of file diff --git a/views/corporate/patient/listingpatient_templ.go b/views/corporate/patient/listingpatient_templ.go new file mode 100644 index 0000000..1a66eab --- /dev/null +++ b/views/corporate/patient/listingpatient_templ.go @@ -0,0 +1,291 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.2.663 +package corporate_patient + +//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/models" +import "strconv" + +func ListingData( + data []models.DashboardPatient, + listID string, + hxGetCetak string, + hxTargetCetak string, + hxSwapCetak string, + hxIncludeCetak 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 + } + for i, d := range data { + if i == (len(data) - 1) { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = ItemCard(d, + hxGetCetak, + hxTargetCetak, + hxSwapCetak, + hxIncludeCetak, + ).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 + } + } else { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = ItemCard(d, + hxGetCetak, + hxTargetCetak, + hxSwapCetak, + hxIncludeCetak, + ).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 = 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 ItemCard( + data models.DashboardPatient, + hxGetCetak string, + hxTargetCetak string, + hxSwapCetak string, + hxIncludeCetak 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_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 + } + var templ_7745c5c3_Var6 string + templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(data.T_OrderHeaderLabNumber) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\patient\listingpatient.templ`, Line: 52, Col: 64} + } + _, 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(data.T_OrderHeaderDate) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\patient\listingpatient.templ`, Line: 55, Col: 59} + } + _, 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 = templ.RenderScriptItems(ctx, templ_7745c5c3_Buffer, HandleBeforeRequestRow(strconv.Itoa(data.T_OrderHeaderID)), HandleAfterRequestRow(strconv.Itoa(data.T_OrderHeaderID))) + 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 HandleBeforeRequestRow(id string) templ.ComponentScript { + return templ.ComponentScript{ + Name: `__templ_HandleBeforeRequestRow_24b2`, + Function: `function __templ_HandleBeforeRequestRow_24b2(id){var cusid_ele = document.getElementsByClassName('btncetak'); + 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_24b2`, id), + CallInline: templ.SafeScriptInline(`__templ_HandleBeforeRequestRow_24b2`, id), + } +} + +func HandleAfterRequestRow(id string) templ.ComponentScript { + return templ.ComponentScript{ + Name: `__templ_HandleAfterRequestRow_f077`, + Function: `function __templ_HandleAfterRequestRow_f077(id){var cusid_ele = document.getElementsByClassName('btncetak'); + 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_f077`, id), + CallInline: templ.SafeScriptInline(`__templ_HandleAfterRequestRow_f077`, id), + } +} diff --git a/views/corporate/patient/patient.templ b/views/corporate/patient/patient.templ index b2dfa42..504aacf 100644 --- a/views/corporate/patient/patient.templ +++ b/views/corporate/patient/patient.templ @@ -1,40 +1,122 @@ -package corporate_company +package corporate_patient import ( - "cpone/component/under_development" "cpone/layout" + "cpone/component/customtextfield" + "cpone/models" ) -templ Content() { -
- @under_development.UnderDevelopment() -
+ +templ DashboardPat( + listID string, + paginationID string, + dialogID string, + dialogBodyID string, + breadcrumb templ.Component, + listingcomponent templ.Component, + paginationcomponent templ.Component, + modaldialog templ.Component, +) { +
+ @customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "listID", + Name: "listID", + Type: "hidden", + Value: listID}) + @customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "paginationID", + Name: "paginationID", + Type: "hidden", + Value: paginationID}) + @customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "dialogID", + Name: "dialogID", + Type: "hidden", + Value: dialogID}) + @customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "dialogBodyID", + Name: "dialogBodyID", + Type: "hidden", + Value: dialogBodyID}) +
+
+ @breadcrumb +
+
+
+ @listingcomponent + @paginationcomponent + @modaldialog +
+
+ Loading... +
+
+
+
+
} -templ Css() { - +templ CSSDashboardPat() { + + + + } -templ Js() { +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"); } -templ Show() { - @layout.PlaygroundLayout("Corp Patient", Css(), Js()) { - @Content() - } +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 JSDashboardPat() { +} + +templ ShowDashboardPat( + title string, + cmp templ.Component, + css templ.Component, + js templ.Component, + navbaruser templ.Component, + userprofile templ.Component, +) { + @layout.EmployeeAnalyticLayout(title, css, js, navbaruser, userprofile) { + @cmp + } } diff --git a/views/corporate/patient/patient_templ.go b/views/corporate/patient/patient_templ.go index ae0cfb4..2efc8c8 100644 --- a/views/corporate/patient/patient_templ.go +++ b/views/corporate/patient/patient_templ.go @@ -1,7 +1,7 @@ // Code generated by templ - DO NOT EDIT. // templ: version: v0.2.663 -package corporate_company +package corporate_patient //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -11,11 +11,21 @@ import "io" import "bytes" import ( - "cpone/component/under_development" + "cpone/component/customtextfield" "cpone/layout" + "cpone/models" ) -func Content() templ.Component { +func DashboardPat( + listID string, + paginationID string, + dialogID string, + dialogBodyID string, + breadcrumb templ.Component, + listingcomponent templ.Component, + paginationcomponent templ.Component, + modaldialog 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 { @@ -28,15 +38,63 @@ func Content() templ.Component { templ_7745c5c3_Var1 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - _, 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 = under_development.UnderDevelopment().Render(ctx, templ_7745c5c3_Buffer) + templ_7745c5c3_Err = customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "listID", + Name: "listID", + Type: "hidden", + Value: listID}).Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + 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 = customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "dialogID", + Name: "dialogID", + Type: "hidden", + Value: dialogID}).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "dialogBodyID", + Name: "dialogBodyID", + Type: "hidden", + Value: dialogBodyID}).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 = listingcomponent.Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = paginationcomponent.Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = modaldialog.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 } @@ -47,7 +105,7 @@ func Content() templ.Component { }) } -func Css() templ.Component { +func CSSDashboardPat() 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 { @@ -60,7 +118,7 @@ func Css() templ.Component { templ_7745c5c3_Var2 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -71,7 +129,41 @@ func Css() templ.Component { }) } -func Js() templ.Component { +func BeforeRequestContent() templ.ComponentScript { + return templ.ComponentScript{ + Name: `__templ_BeforeRequestContent_5717`, + Function: `function __templ_BeforeRequestContent_5717(){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_5717`), + CallInline: templ.SafeScriptInline(`__templ_BeforeRequestContent_5717`), + } +} + +func AfterRequestContent() templ.ComponentScript { + return templ.ComponentScript{ + Name: `__templ_AfterRequestContent_077f`, + Function: `function __templ_AfterRequestContent_077f(){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_077f`), + CallInline: templ.SafeScriptInline(`__templ_AfterRequestContent_077f`), + } +} + +func JSDashboardPat() 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 { @@ -91,7 +183,14 @@ func Js() templ.Component { }) } -func Show() templ.Component { +func ShowDashboardPat( + title string, + cmp templ.Component, + css templ.Component, + js 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 { @@ -110,7 +209,7 @@ func Show() templ.Component { templ_7745c5c3_Buffer = templ.GetBuffer() defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) } - templ_7745c5c3_Err = Content().Render(ctx, templ_7745c5c3_Buffer) + templ_7745c5c3_Err = cmp.Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -119,7 +218,7 @@ func Show() templ.Component { } return templ_7745c5c3_Err }) - templ_7745c5c3_Err = layout.PlaygroundLayout("Corp Patient", Css(), Js()).Render(templ.WithChildren(ctx, templ_7745c5c3_Var5), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = layout.EmployeeAnalyticLayout(title, css, js, navbaruser, userprofile).Render(templ.WithChildren(ctx, templ_7745c5c3_Var5), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/views/corporate/patient/patientmodal.templ b/views/corporate/patient/patientmodal.templ new file mode 100644 index 0000000..5a154a0 --- /dev/null +++ b/views/corporate/patient/patientmodal.templ @@ -0,0 +1,147 @@ +package corporate_patient + +import "cpone/component/modal" + +templ PatientModal( + id string, + title string, + body templ.Component, + closebtn templ.Component, +) { +
+ @modalcomponent.ModalViewXL(id, + title, + body, + closebtn, + ) +
+} + +templ BodyModal( + hxOnLoad templ.ComponentScript, +) { +
+
+ +
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+} + +templ PatientDialogForm( + componentID string, + linkPost string, + hxTarget string, + hxSwap string, + hxInclude string, + modalID string, + modalTitle string, + dialogBody templ.Component, + dialogClose templ.Component, +) { +
+ @modalcomponent.ModalViewXL(modalID, + modalTitle, + dialogBody, + dialogClose, + ) +
+} + +script HandleFormBeforeRequest() { + const btnActCancel = document.querySelectorAll('.btnactcancel'); + + for (let i = 0; i < btnActCancel.length; i++) { + btnActCancel[i].setAttribute('disabled', 'true'); + } +} + +script HandleFormAfterRequest() { + const btnActCancel = document.querySelectorAll('.btnactcancel'); + + for (let i = 0; i < btnActCancel.length; i++) { + btnActCancel[i].removeAttribute('disabled'); + } +} + +templ BodyDialogPat( + compoenentID string, + hxOnLoad templ.ComponentScript, +) { +
+ TESTING +
+ +} + +templ BtnClosePat(linkClose string, targetClose string, hxSwapClose string, modalID string) { + +} + +script JSHideModal(modalID string) { + $(modalID).modal('hide') +} + +script JSShowModal(modalID string) { + $(modalID).modal('show') + + const btnActCancel = document.querySelectorAll('.btnactcancel'); + + for (let i = 0; i < btnActCancel.length; i++) { + btnActCancel[i].removeAttribute('disabled'); + } +} \ No newline at end of file diff --git a/views/corporate/patient/patientmodal_templ.go b/views/corporate/patient/patientmodal_templ.go new file mode 100644 index 0000000..ea41fba --- /dev/null +++ b/views/corporate/patient/patientmodal_templ.go @@ -0,0 +1,448 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.2.663 +package corporate_patient + +//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/modal" + +func PatientModal( + id string, + title string, + body templ.Component, + closebtn 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 = modalcomponent.ModalViewXL(id, + title, + body, + closebtn, + ).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 BodyModal( + 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_Var2 := templ.GetChildren(ctx) + if templ_7745c5c3_Var2 == nil { + templ_7745c5c3_Var2 = 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 + } + if !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) + } + return templ_7745c5c3_Err + }) +} + +func PatientDialogForm( + componentID string, + linkPost string, + hxTarget string, + hxSwap string, + hxInclude string, + modalID string, + modalTitle string, + dialogBody templ.Component, + dialogClose 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_Var8 := templ.GetChildren(ctx) + if templ_7745c5c3_Var8 == nil { + templ_7745c5c3_Var8 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + 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.ModalViewXL(modalID, + modalTitle, + dialogBody, + dialogClose, + ).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_7fcd`, + Function: `function __templ_HandleFormBeforeRequest_7fcd(){const btnActCancel = document.querySelectorAll('.btnactcancel'); + + for (let i = 0; i < btnActCancel.length; i++) { + btnActCancel[i].setAttribute('disabled', 'true'); + } +}`, + Call: templ.SafeScript(`__templ_HandleFormBeforeRequest_7fcd`), + CallInline: templ.SafeScriptInline(`__templ_HandleFormBeforeRequest_7fcd`), + } +} + +func HandleFormAfterRequest() templ.ComponentScript { + return templ.ComponentScript{ + Name: `__templ_HandleFormAfterRequest_b055`, + Function: `function __templ_HandleFormAfterRequest_b055(){const btnActCancel = document.querySelectorAll('.btnactcancel'); + + for (let i = 0; i < btnActCancel.length; i++) { + btnActCancel[i].removeAttribute('disabled'); + } +}`, + Call: templ.SafeScript(`__templ_HandleFormAfterRequest_b055`), + CallInline: templ.SafeScriptInline(`__templ_HandleFormAfterRequest_b055`), + } +} + +func BodyDialogPat( + compoenentID 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_Var16 := templ.GetChildren(ctx) + if templ_7745c5c3_Var16 == nil { + templ_7745c5c3_Var16 = 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("
TESTING\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 BtnClosePat(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_Var19 := templ.GetChildren(ctx) + if templ_7745c5c3_Var19 == nil { + templ_7745c5c3_Var19 = 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 + }) +} + +func JSHideModal(modalID string) templ.ComponentScript { + return templ.ComponentScript{ + Name: `__templ_JSHideModal_4530`, + Function: `function __templ_JSHideModal_4530(modalID){$(modalID).modal('hide') +}`, + Call: templ.SafeScript(`__templ_JSHideModal_4530`, modalID), + CallInline: templ.SafeScriptInline(`__templ_JSHideModal_4530`, modalID), + } +} + +func JSShowModal(modalID string) templ.ComponentScript { + return templ.ComponentScript{ + Name: `__templ_JSShowModal_c20c`, + Function: `function __templ_JSShowModal_c20c(modalID){$(modalID).modal('show') + + const btnActCancel = document.querySelectorAll('.btnactcancel'); + + for (let i = 0; i < btnActCancel.length; i++) { + btnActCancel[i].removeAttribute('disabled'); + } +}`, + Call: templ.SafeScript(`__templ_JSShowModal_c20c`, modalID), + CallInline: templ.SafeScriptInline(`__templ_JSShowModal_c20c`, modalID), + } +}