Compare commits
6 Commits
master-pak
...
adib/md-no
| Author | SHA1 | Date | |
|---|---|---|---|
| 7f32ac1c1c | |||
| 709fcb316d | |||
| 897bdc176c | |||
| 466aa0d9cf | |||
| c9a6b21aae | |||
| 70d0ce5383 |
@@ -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 {
|
||||
|
||||
1195
handlers/dev/md.nonlabtemplate.handlers.go
Normal file
1195
handlers/dev/md.nonlabtemplate.handlers.go
Normal file
File diff suppressed because it is too large
Load Diff
@@ -278,6 +278,20 @@ func SetupRoutesDev(app *echo.Echo, appStore db.AppStore) {
|
||||
dev.POST("/md/samplestation/edit", devMDSampleStationHandlers.HandleEditMDSS)
|
||||
dev.POST("/md/samplestation/closeeditform", devMDSampleStationHandlers.HandleCloseEditForm)
|
||||
|
||||
// md nonlab template
|
||||
devMDNonlabTemplateServices := dev_services.NewMDNonlabTemplateServices(appStore)
|
||||
devMDNonlabTemplateHandlers := dev_handlers.NewMDNonLabTemplateHandler(devMDNonlabTemplateServices)
|
||||
dev.GET("/md/nonlabtemplate", devMDNonlabTemplateHandlers.HandleShowNonlabTemplateScreen)
|
||||
dev.GET("/md/nonlabtemplate/filter", devMDNonlabTemplateHandlers.HandleFilterNonlabTemplate)
|
||||
dev.GET("/md/nonlabtemplate/changepage", devMDNonlabTemplateHandlers.HandleNonlabTempltPagination)
|
||||
dev.GET("/md/nonlabtemplate/opendelete", devMDNonlabTemplateHandlers.HandleOpenFormDelete)
|
||||
dev.POST("/md/nonlabtemplate/closedeleteform", devMDNonlabTemplateHandlers.HandleCloseFormDelete)
|
||||
dev.POST("/md/nonlabtemplate/delete", devMDNonlabTemplateHandlers.HandleDelete)
|
||||
dev.POST("/md/nonlabtemplate/simpanama", devMDNonlabTemplateHandlers.HandleSimpanNama)
|
||||
dev.POST("/md/nonlabtemplate/closeaddform", devMDNonlabTemplateHandlers.HandleCloseFormAdd)
|
||||
dev.POST("/md/nonlabtemplate/adddetail", devMDNonlabTemplateHandlers.HandleAddDetail)
|
||||
dev.POST("/md/nonlabtemplate/deletedetail", devMDNonlabTemplateHandlers.HandleDeleteDetail)
|
||||
|
||||
// masterdata nat unit
|
||||
devMdNatUnitServices := dev_services.NewMdNatUnitServices(appStore)
|
||||
devMdNatUnitHandlers := dev_handlers.NeWMdNatUnitHandler(devMdNatUnitServices)
|
||||
|
||||
43
models/nonlabtemplate.models.go
Normal file
43
models/nonlabtemplate.models.go
Normal file
@@ -0,0 +1,43 @@
|
||||
package models
|
||||
|
||||
import "github.com/a-h/templ"
|
||||
|
||||
type MDNonlabTemplate struct {
|
||||
NonlabTemplateID int `db:"NonlabTemplateID"`
|
||||
NonlabTemplateName string `db:"NonlabTemplateName"`
|
||||
NonlabTemplateFlagFisik string `db:"NonlabTemplateFlagFisik"`
|
||||
NonlabTemplateIsActive string `db:"NonlabTemplateIsActive"`
|
||||
NonlabTemplateCreated string `db:"NonlabTemplateCreated"`
|
||||
NonlabTemplateCreatedUserID string `db:"NonlabTemplateUserID"`
|
||||
NonlabTemplateLastUpdated string `db:"NonlabTemplateLastUpdated"`
|
||||
NonlabTemplateLastUpdatedUserID string `db:"NonlabTemplateLastUpdatedUserID"`
|
||||
NonlabTemplateDelete string `db:"NonlabTemplateDelete"`
|
||||
NonlabTemplateDeleteUserID string `db:"NonlabTemplateDeleteUserID"`
|
||||
}
|
||||
|
||||
type NonlabTemplateDetail struct {
|
||||
NonlabTemplateDetailID int `db:"NonlabTemplateDetailID"`
|
||||
NonlabTemplateDetailNonlabTemplateID int `db:"NonlabTemplateDetailNonlabTemplateID"`
|
||||
NonlabTemplateDetailCode string `db:"NonlabTemplateDetailCode"`
|
||||
NonlabTemplateDetailName string `db:"NonlabTemplateDetailName"`
|
||||
NonlabTemplateDetaiNat_UnitID string `db:"NonlabTemplateDetaiNat_UnitID"`
|
||||
NonlabTemplateDetailFlagActive string `db:"NonlabTemplateDetailFlagActive"`
|
||||
NonlabTemplateDetaiM_LangID string `db:"NonlabTemplateDetaiM_LangID"`
|
||||
NonlabTemplateDetailIsActive string `db:"NonlabTemplateDetailIsActive"`
|
||||
}
|
||||
|
||||
type MDNonlabTemplateForm struct {
|
||||
IDComponent string
|
||||
Link string
|
||||
HxTarget string
|
||||
HxSwap string
|
||||
HxInclude string
|
||||
ModalID string
|
||||
ModalTitle string
|
||||
InputID CustomTextFieldv2Prm
|
||||
InputName CustomTextFieldv2Prm
|
||||
InputFlag CustomCheckboxv1Prm
|
||||
DialogBody templ.Component
|
||||
DialogAction templ.Component
|
||||
ButtonClose templ.Component
|
||||
}
|
||||
430
services/dev/md.nonlabtemplate.services.go
Normal file
430
services/dev/md.nonlabtemplate.services.go
Normal file
@@ -0,0 +1,430 @@
|
||||
package dev_services
|
||||
|
||||
import (
|
||||
"cpone/db"
|
||||
"cpone/models"
|
||||
dbx "cpone/package/database"
|
||||
"fmt"
|
||||
"math"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
type MDNonlabTemplateServices struct {
|
||||
MDNonlabTemplateStore db.AppStore
|
||||
}
|
||||
|
||||
func NewMDNonlabTemplateServices(uStore db.AppStore) *MDNonlabTemplateServices {
|
||||
return &MDNonlabTemplateServices{
|
||||
MDNonlabTemplateStore: uStore,
|
||||
}
|
||||
}
|
||||
|
||||
func (nlt *MDNonlabTemplateServices) GetMDNonLabTemplateBreadcrumb() (models.BreadCrumbV1, error) {
|
||||
var ret models.BreadCrumbV1
|
||||
|
||||
breadcrumb := models.BreadCrumbV1{
|
||||
Title: "Master Non-lab Template",
|
||||
Item: []models.ItemBreadCrumbV1{
|
||||
{
|
||||
Item: "Dashboard",
|
||||
Url: "/dev/dashboard",
|
||||
},
|
||||
{
|
||||
Item: "Master",
|
||||
Url: "/dev/master",
|
||||
},
|
||||
{
|
||||
Item: "Non-lab Template",
|
||||
Url: "",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
ret = breadcrumb
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
func (nlt *MDNonlabTemplateServices) GetListNonlabTemplate(search string, currPage int, rowPerPage int) ([]models.MDNonlabTemplate, int, error) {
|
||||
var ret []models.MDNonlabTemplate
|
||||
var totalData int
|
||||
|
||||
offset := (currPage - 1) * rowPerPage
|
||||
prm := "%" + strings.TrimSpace(search) + "%"
|
||||
query := `
|
||||
SELECT COUNT(*)
|
||||
FROM nonlab_template
|
||||
WHERE NonlabTemplateIsActive = 'Y'
|
||||
AND (NonlabTemplateName LIKE ?)
|
||||
`
|
||||
if err := dbx.Handlex.Get(&totalData, query, prm); err != nil {
|
||||
return nil, 0, fmt.Errorf("error querying databases: %v", err)
|
||||
}
|
||||
|
||||
query = `
|
||||
SELECT
|
||||
NonlabTemplateID,
|
||||
NonlabTemplateName,
|
||||
NonlabTemplateFlagFisik,
|
||||
NonlabTemplateIsActive,
|
||||
NonlabTemplateCreated,
|
||||
NonlabTemplateLastUpdated
|
||||
FROM nonlab_template
|
||||
WHERE NonlabTemplateIsActive = 'Y'
|
||||
AND (NonlabTemplateName LIKE ?)
|
||||
ORDER BY NonlabTemplateID ASC
|
||||
LIMIT ? OFFSET ?
|
||||
`
|
||||
if err := dbx.Handlex.Select(&ret, query, prm, rowPerPage, offset); err != nil {
|
||||
return nil, 0, fmt.Errorf("error querying database: %v", err)
|
||||
}
|
||||
|
||||
totalPage := int(math.Ceil(float64(totalData) / float64(rowPerPage)))
|
||||
|
||||
return ret, totalPage, nil
|
||||
}
|
||||
|
||||
func (nlt *MDNonlabTemplateServices) GetMDNonlabTemplateByID(id string) (models.MDNonlabTemplate, error) {
|
||||
logger, _ := zap.NewProduction()
|
||||
var ret models.MDNonlabTemplate
|
||||
|
||||
q := `
|
||||
SELECT
|
||||
NonlabTemplateID,
|
||||
NonlabTemplateName,
|
||||
NonlabTemplateFlagFisik,
|
||||
NonlabTemplateIsActive,
|
||||
NonlabTemplateCreated,
|
||||
NonlabTemplateLastUpdated
|
||||
FROM nonlab_template
|
||||
WHERE NonlabTemplateID = ?
|
||||
`
|
||||
err := dbx.Handlex.Get(&ret, q, id)
|
||||
if err != nil {
|
||||
defer logger.Sync()
|
||||
logger.Error("Error get data non lab template by id vs",
|
||||
zap.String("ID", id),
|
||||
zap.Error(err),
|
||||
)
|
||||
return ret, fmt.Errorf("QUERY FAILED GET DATA BY ID")
|
||||
}
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
func (nlt *MDNonlabTemplateServices) DeleteDataNonlabTemplate(id string) (models.MDNonlabTemplate, error) {
|
||||
logger, _ := zap.NewProduction()
|
||||
var ret models.MDNonlabTemplate
|
||||
|
||||
q := `
|
||||
UPDATE nonlab_template
|
||||
SET
|
||||
NonlabTemplateIsActive = 'N',
|
||||
NonlabTemplateLastUpdated = NOW()
|
||||
WHERE NonlabTemplateID = ?
|
||||
`
|
||||
dlt := dbx.Handlex.MustExec(q, id)
|
||||
_, err := dlt.RowsAffected()
|
||||
if err != nil {
|
||||
defer logger.Sync()
|
||||
logger.Error("Error delete nonlab template", zap.String("id", id))
|
||||
return ret, fmt.Errorf("query failed delete non lab template")
|
||||
}
|
||||
|
||||
return nlt.GetMDNonlabTemplateByID(id)
|
||||
}
|
||||
|
||||
func (nlt *MDNonlabTemplateServices) AddNonlabTemplate(nama string, fisik string) (models.MDNonlabTemplate, error) {
|
||||
logger, _ := zap.NewProduction()
|
||||
var ret models.MDNonlabTemplate
|
||||
|
||||
var count int
|
||||
var prmName = "%" + nama + "%"
|
||||
q := `
|
||||
SELECT COUNT(*)
|
||||
FROM nonlab_template
|
||||
WHERE NonlabTemplateName LIKE ?
|
||||
AND NonlabTemplateIsActive = 'Y'
|
||||
`
|
||||
err := dbx.Handlex.Get(&count, q, prmName)
|
||||
if err != nil {
|
||||
defer logger.Sync()
|
||||
logger.Error("cek duplicate", zap.Any("nama", prmName))
|
||||
return ret, fmt.Errorf("query failed to cek duplicate: %v", err)
|
||||
}
|
||||
if count > 0 {
|
||||
defer logger.Sync()
|
||||
logger.Error("duplicate data", zap.Any("nama", nama))
|
||||
return ret, fmt.Errorf("duplicate nama")
|
||||
}
|
||||
|
||||
q = `
|
||||
INSERT INTO nonlab_template (
|
||||
NonlabTemplateName,
|
||||
NonlabTemplateFlagFisik,
|
||||
NonlabTemplateCreated,
|
||||
NonlabTemplateCreatedUserID
|
||||
) VALUES (?,?,NOW(),1);
|
||||
`
|
||||
rsp := dbx.Handlex.MustExec(q, nama, fisik)
|
||||
insertedID, err := rsp.LastInsertId()
|
||||
if err != nil {
|
||||
defer logger.Sync()
|
||||
logger.Error("error insert data", zap.Any("nama", nama))
|
||||
return ret, fmt.Errorf("failed insert data: %v", err)
|
||||
}
|
||||
|
||||
s := strconv.Itoa(int(insertedID))
|
||||
return nlt.GetMDNonlabTemplateByID(s)
|
||||
}
|
||||
|
||||
func (nlt *MDNonlabTemplateServices) UpdateNonlabTemplate(id string, nama string, fisik string) (models.MDNonlabTemplate, error) {
|
||||
logger, _ := zap.NewProduction()
|
||||
var ret models.MDNonlabTemplate
|
||||
|
||||
var count int
|
||||
var prmNama = "%" + nama + "%"
|
||||
q := `
|
||||
SELECT COUNT(*)
|
||||
FROM nonlab_template
|
||||
WHERE NonlabTemplateName LIKE ?
|
||||
AND NonlabTemplateIsActive = 'Y'
|
||||
AND NonlabTemplateID <> ?
|
||||
`
|
||||
err := dbx.Handlex.Get(&count, q, prmNama, id)
|
||||
if err != nil {
|
||||
defer logger.Sync()
|
||||
logger.Error("cek duplicate", zap.Any("nama", prmNama))
|
||||
return ret, fmt.Errorf("query failed to cek duplicate: %v", err)
|
||||
}
|
||||
if count > 0 {
|
||||
defer logger.Sync()
|
||||
logger.Error("duplicate data", zap.Any("nama", nama))
|
||||
return ret, fmt.Errorf("duplicate nama")
|
||||
}
|
||||
|
||||
q = `
|
||||
UPDATE nonlab_template SET
|
||||
NonlabTemplateName = ?,
|
||||
NonlabTemplateFlagFisik = ?,
|
||||
NonlabTemplateLastUpdated = NOW(),
|
||||
NonlabTemplateLastUpdatedUserID = 1
|
||||
WHERE NonlabTemplateID = ?;
|
||||
`
|
||||
respUpdt := dbx.Handlex.MustExec(q, nama, fisik, id)
|
||||
_, err = respUpdt.RowsAffected()
|
||||
if err != nil {
|
||||
defer logger.Sync()
|
||||
logger.Error("error update data", zap.Any("name", nama))
|
||||
return ret, fmt.Errorf("query failed to update data")
|
||||
}
|
||||
|
||||
return nlt.GetMDNonlabTemplateByID(id)
|
||||
}
|
||||
|
||||
func (nlt *MDNonlabTemplateServices) GetIDNonlabTemplate(name string) (int, error) {
|
||||
logger, _ := zap.NewProduction()
|
||||
var ret int
|
||||
|
||||
prmName := "%" + name + "%"
|
||||
q := `
|
||||
SELECT
|
||||
NonlabTemplateID
|
||||
FROM nonlab_template
|
||||
WHERE NonlabTemplateName LIKE ?
|
||||
AND NonlabTemplateIsActive = 'Y'
|
||||
`
|
||||
err := dbx.Handlex.Get(&ret, q, prmName)
|
||||
if err != nil {
|
||||
defer logger.Sync()
|
||||
logger.Error("Error get data non lab template by id vs",
|
||||
zap.String("name", prmName),
|
||||
zap.Error(err),
|
||||
)
|
||||
return ret, fmt.Errorf("QUERY FAILED GET DATA BY NAME")
|
||||
}
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
func (nlt *MDNonlabTemplateServices) GetDetailByID(id string) (models.NonlabTemplateDetail, error) {
|
||||
logger, _ := zap.NewProduction()
|
||||
var ret models.NonlabTemplateDetail
|
||||
|
||||
q := `
|
||||
SELECT
|
||||
NonlabTemplateDetailID,
|
||||
NonlabTemplateDetailNonlabTemplateID,
|
||||
NonlabTemplateDetailCode,
|
||||
NonlabTemplateDetailName,
|
||||
NonlabTemplateDetaiNat_UnitID,
|
||||
NonlabTemplateDetailFlagActive,
|
||||
NonlabTemplateDetaiM_LangID,
|
||||
NonlabTemplateDetailIsActive
|
||||
FROM nonlab_template_detail
|
||||
WHERE NonlabTemplateDetailID = ?
|
||||
AND NonlabTemplateDetailIsActive = 'Y'
|
||||
`
|
||||
err := dbx.Handlex.Get(&ret, q, id)
|
||||
if err != nil {
|
||||
defer logger.Sync()
|
||||
logger.Error("Error get data detail nonlab template", zap.Any("ID", id))
|
||||
return ret, fmt.Errorf("query failed, error get data by id : %v", err)
|
||||
}
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
func (nlt *MDNonlabTemplateServices) ListDetailByIDNonlabTemplate(id string) ([]models.NonlabTemplateDetail, error) {
|
||||
var ret []models.NonlabTemplateDetail
|
||||
var totalData int
|
||||
|
||||
query := `
|
||||
SELECT COUNT(*)
|
||||
FROM nonlab_template_detail
|
||||
WHERE NonlabTemplateDetailNonlabTemplateID = ?
|
||||
AND NonlabTemplateDetailIsActive = 'Y'
|
||||
`
|
||||
if err := dbx.Handlex.Get(&totalData, query, id); err != nil {
|
||||
return ret, fmt.Errorf("error querying databases: %v", err)
|
||||
}
|
||||
|
||||
query = `
|
||||
SELECT
|
||||
NonlabTemplateDetailID,
|
||||
NonlabTemplateDetailNonlabTemplateID,
|
||||
NonlabTemplateDetailCode,
|
||||
NonlabTemplateDetailName,
|
||||
NonlabTemplateDetaiNat_UnitID,
|
||||
NonlabTemplateDetailFlagActive,
|
||||
NonlabTemplateDetaiM_LangID,
|
||||
NonlabTemplateDetailIsActive
|
||||
FROM nonlab_template_detail
|
||||
WHERE NonlabTemplateDetailNonlabTemplateID = ?
|
||||
AND NonlabTemplateDetailIsActive = 'Y'
|
||||
`
|
||||
if err := dbx.Handlex.Select(&ret, query, id); err != nil {
|
||||
return ret, fmt.Errorf("error querying database: %v", err)
|
||||
}
|
||||
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
func (nlt *MDNonlabTemplateServices) AddDetailNonlabTemplate(idnonlab string, kode string, name string, flagActive string) ([]models.NonlabTemplateDetail, error) {
|
||||
logger, _ := zap.NewProduction()
|
||||
var ret []models.NonlabTemplateDetail
|
||||
|
||||
var count int
|
||||
prmKode := "%" + kode + "%"
|
||||
prmName := "%" + name + "%"
|
||||
q := `
|
||||
SELECT COUNT(*)
|
||||
FROM nonlab_template_detail
|
||||
WHERE (NonlabTemplateDetailCode LIKE ? OR NonlabTemplateDetailName LIKE ?)
|
||||
AND NonlabTemplateDetailNonlabTemplateID = ?
|
||||
AND NonlabTemplateDetailIsActive = 'Y'
|
||||
`
|
||||
err := dbx.Handlex.Get(&count, q, prmKode, prmName, idnonlab)
|
||||
if err != nil {
|
||||
defer logger.Sync()
|
||||
logger.Error("cek duplicate", zap.Any("kode", prmKode), zap.Any("nama", prmName))
|
||||
return ret, fmt.Errorf("query failed to cek duplicate: %v", err)
|
||||
}
|
||||
if count > 0 {
|
||||
defer logger.Sync()
|
||||
logger.Error("data duplicate", zap.Any("kode", prmKode), zap.Any("nama", prmName))
|
||||
return ret, fmt.Errorf("terdapat data duplikat")
|
||||
}
|
||||
|
||||
q = `
|
||||
INSERT INTO nonlab_template_detail (
|
||||
NonlabTemplateDetailNonlabTemplateID,
|
||||
NonlabTemplateDetailCode,
|
||||
NonlabTemplateDetailName,
|
||||
NonlabTemplateDetailFlagActive,
|
||||
NonlabTemplateDetailCreated
|
||||
) VALUES(?,?,?,?,NOW())
|
||||
`
|
||||
rsp := dbx.Handlex.MustExec(q, idnonlab, kode, name, flagActive)
|
||||
insertedID, err := rsp.LastInsertId()
|
||||
if err != nil {
|
||||
defer logger.Sync()
|
||||
logger.Error("error insert data", zap.Any("kode", prmKode), zap.Any("nama", prmName))
|
||||
return ret, fmt.Errorf("query failed to insert data: %v", err)
|
||||
}
|
||||
logger.Info("Success Insert data", zap.Any("id", insertedID))
|
||||
|
||||
return nlt.ListDetailByIDNonlabTemplate(idnonlab)
|
||||
}
|
||||
|
||||
func (nlt *MDNonlabTemplateServices) DeleteDetailNonlabTemplate(id string) ([]models.NonlabTemplateDetail, error) {
|
||||
logger, _ := zap.NewProduction()
|
||||
var temp models.NonlabTemplateDetail
|
||||
var ret []models.NonlabTemplateDetail
|
||||
|
||||
temp, err := nlt.GetDetailByID(id)
|
||||
if err != nil {
|
||||
defer logger.Sync()
|
||||
logger.Error("Error get current detail nonlab template", zap.Any("id", id))
|
||||
return ret, fmt.Errorf("query failed get current detail nonlab template")
|
||||
}
|
||||
|
||||
q := `
|
||||
UPDATE nonlab_template_detail
|
||||
SET
|
||||
NonlabTemplateDetailIsActive = 'N',
|
||||
NonlabTemplateDetailLastUpdated = NOW()
|
||||
WHERE NonlabTemplateDetailID = ?
|
||||
AND NonlabTemplateDetailNonlabTemplateID = ?
|
||||
`
|
||||
dlt := dbx.Handlex.MustExec(q, id, temp.NonlabTemplateDetailNonlabTemplateID)
|
||||
_, err = dlt.RowsAffected()
|
||||
if err != nil {
|
||||
defer logger.Sync()
|
||||
logger.Error("Error delete detail nonlab template", zap.Any("id", id))
|
||||
return ret, fmt.Errorf("query failed delete detail nonlab template")
|
||||
}
|
||||
|
||||
s := strconv.Itoa(int(temp.NonlabTemplateDetailNonlabTemplateID))
|
||||
|
||||
return nlt.ListDetailByIDNonlabTemplate(s)
|
||||
}
|
||||
|
||||
func (nlt *MDNonlabTemplateServices) PilihDetailNonlabTemplate(id string) ([]models.NonlabTemplateDetail, error) {
|
||||
logger, _ := zap.NewProduction()
|
||||
var cek models.NonlabTemplateDetail
|
||||
var ret []models.NonlabTemplateDetail
|
||||
var flag string
|
||||
|
||||
cek, err := nlt.GetDetailByID(id)
|
||||
if err != nil {
|
||||
defer logger.Sync()
|
||||
logger.Error("Error cek current detail nonlab template", zap.Any("ID", id))
|
||||
return ret, fmt.Errorf("query failed cek current detail nonlab template")
|
||||
}
|
||||
|
||||
if cek.NonlabTemplateDetailFlagActive == "Y" {
|
||||
flag = "N"
|
||||
} else {
|
||||
flag = "Y"
|
||||
}
|
||||
|
||||
q := `
|
||||
UPDATE nonlab_template_detail
|
||||
SET
|
||||
NonlabTemplateDetailFlagActive = ?,
|
||||
NonlabTemplateDetailLastUpdated = NOW()
|
||||
WHERE NonlabTemplateDetailID = ?
|
||||
AND NonlabTemplateDetailNonlabTemplateID = ?
|
||||
`
|
||||
updt := dbx.Handlex.MustExec(q, flag, id, cek.NonlabTemplateDetailNonlabTemplateID)
|
||||
_, err = updt.RowsAffected()
|
||||
if err != nil {
|
||||
defer logger.Sync()
|
||||
logger.Error("Error update detail nonlab template", zap.Any("id", id), zap.Any("flag", flag))
|
||||
return ret, fmt.Errorf("query failed update detail nonlab template")
|
||||
}
|
||||
|
||||
s := strconv.Itoa(int(cek.NonlabTemplateDetailNonlabTemplateID))
|
||||
|
||||
return nlt.ListDetailByIDNonlabTemplate(s)
|
||||
}
|
||||
263
views/dev/mdnonlabtemplate/mdnonlabtemplate.templ
Normal file
263
views/dev/mdnonlabtemplate/mdnonlabtemplate.templ
Normal file
@@ -0,0 +1,263 @@
|
||||
package dev_mdnonlabtemplateview
|
||||
|
||||
import "cpone/layout"
|
||||
import "cpone/models"
|
||||
import "cpone/component/customtextfield"
|
||||
|
||||
templ MdNonlabTemplateScreen(
|
||||
tableID string,
|
||||
paginationID string,
|
||||
searchID string,
|
||||
dialogAddID string,
|
||||
dialogAddBodyID string,
|
||||
dialogEditID string,
|
||||
dialogEditBodyID string,
|
||||
dialogDeleteID string,
|
||||
dialogDeleteBodyID string,
|
||||
tableDetailID string,
|
||||
detailEditID string,
|
||||
detailDeleteID string,
|
||||
breadcrumb templ.Component,
|
||||
filtercomponent templ.Component,
|
||||
tablecontent templ.Component,
|
||||
paginationtable templ.Component,
|
||||
modalAddForm templ.Component,
|
||||
// modalEditForm templ.Component,
|
||||
modalDeleteForm templ.Component,
|
||||
) {
|
||||
<div class="container-fluid">
|
||||
@customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "tableID",
|
||||
Name: "tableID",
|
||||
Type: "hidden",
|
||||
Value: tableID})
|
||||
@customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "paginationID",
|
||||
Name: "paginationID",
|
||||
Type: "hidden",
|
||||
Value: paginationID})
|
||||
@customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "searchID",
|
||||
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})
|
||||
@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: "tableDetailID",
|
||||
Name: "tableDetailID",
|
||||
Type: "hidden",
|
||||
Value: tableDetailID})
|
||||
@customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "detailEditID",
|
||||
Name: "detailEditID",
|
||||
Type: "hidden",
|
||||
Value: detailEditID})
|
||||
@customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "detailDeleteID",
|
||||
Name: "detailDeleteID",
|
||||
Type: "hidden",
|
||||
Value: detailDeleteID})
|
||||
<div class="row align-items-center mb-10">
|
||||
<div class="col-md-10 col-sm-12 p-0">
|
||||
@breadcrumb
|
||||
</div>
|
||||
<div class="col-md-2 d-none d-lg-block d-xl-block d-md-block d-sm-none">
|
||||
<div class="d-flex justify-content-end">
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-primary"
|
||||
data-toggle="modal"
|
||||
data-target={ "#" + dialogAddID }
|
||||
>
|
||||
Add New
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2 d-block d-lg-none d-xl-none d-md-none d-sm-block justify-content-center px-5">
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-primary btn-block"
|
||||
data-toggle="modal"
|
||||
data-target={ "#" + dialogAddID }
|
||||
>
|
||||
Add New
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="loading-parent" class=" rounded">
|
||||
@filtercomponent
|
||||
@tablecontent
|
||||
@paginationtable
|
||||
<div id="loading-child" class=" rounded bg-transparent">
|
||||
<div id="loading-spinner" class="spinner-border text-primary d-none" style="width: 3rem; height: 3rem" role="status">
|
||||
<span class="sr-only">Loading...</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="loadingcontent"></div>
|
||||
@modalAddForm
|
||||
// @modalEditForm
|
||||
@modalDeleteForm
|
||||
</div>
|
||||
}
|
||||
|
||||
templ CSSmdnontemplate() {
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="assets/css/googlefont/poppins.css"
|
||||
/>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="assets/css/googlefont/publicsans.css"
|
||||
/>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="assets/css/googlefont/roboto.css"
|
||||
/>
|
||||
<style>
|
||||
body {
|
||||
background-color: white;
|
||||
/* padding-right: 100px;
|
||||
padding-left: 100px; */
|
||||
}
|
||||
#div-chart {
|
||||
/* overflow-x: scroll; */
|
||||
margin: 40px 10vw 40px 10vw;
|
||||
}
|
||||
.title {
|
||||
font-size:20px;
|
||||
font-weight: bold;
|
||||
}
|
||||
#title {
|
||||
font-weight: 600;
|
||||
}
|
||||
</style>
|
||||
}
|
||||
|
||||
templ JSmdnontemplate() {
|
||||
<script>
|
||||
document.addEventListener('htmx:afterSwap', function(event) {
|
||||
// Reinitialize selectpicker after HTMX content swap
|
||||
$('.selectpicker').selectpicker('refresh');
|
||||
});
|
||||
|
||||
document.addEventListener('htmx:beforeRequest', function(event) {
|
||||
console.log("Before Request")
|
||||
console.log(event.detail.xhr)
|
||||
console.log(event.detail.target)
|
||||
|
||||
});
|
||||
|
||||
document.addEventListener('htmx:afterRequest', function(event) {
|
||||
console.log("After Request")
|
||||
console.log(event.detail.xhr)
|
||||
console.log(event.detail.target)
|
||||
});
|
||||
document.addEventListener('htmx:historyCacheError', function(event) {
|
||||
console.log("Error History Cache Error")
|
||||
console.log(event.detail.cause)
|
||||
|
||||
});
|
||||
document.addEventListener('htmx:historyCacheMissError', function(event) {
|
||||
console.log("Error History Cache Miss Error")
|
||||
console.log(event.detail.xhr)
|
||||
console.log(event.detail.path)
|
||||
|
||||
});
|
||||
document.addEventListener('htmx:oobErrorNoTarget', function(event) {
|
||||
console.log("Error OOB No Target")
|
||||
console.log(event.detail.content)
|
||||
});
|
||||
document.addEventListener('htmx:onLoadError', function(event) {
|
||||
console.log("Error On Load")
|
||||
console.log(event.detail.xhr)
|
||||
console.log(event.detail.elt)
|
||||
console.log(event.detail.target)
|
||||
console.log(event.detail.exception)
|
||||
console.log(event.detail.requestConfig)
|
||||
});
|
||||
document.addEventListener('htmx:responseError', function(event) {
|
||||
console.log("Error Response")
|
||||
console.log(event.detail.xhr)
|
||||
console.log(event.detail.elt)
|
||||
console.log(event.detail.requestConfig)
|
||||
});
|
||||
document.addEventListener('htmx:sendError', function(event) {
|
||||
console.log("Error Send Error")
|
||||
console.log(event.detail.xhr)
|
||||
console.log(event.detail.elt)
|
||||
console.log(event.detail.requestConfig)
|
||||
});
|
||||
document.addEventListener('htmx:sseError', function(event) {
|
||||
console.log("Error Sse ")
|
||||
console.log(event.detail.xhr)
|
||||
console.log(event.detail.error)
|
||||
console.log(event.detail.source)
|
||||
});
|
||||
document.addEventListener('htmx:swapError', function(event) {
|
||||
console.log("Error Swap Error")
|
||||
console.log(event.detail.xhr)
|
||||
console.log(event.detail.elt)
|
||||
console.log("Target Swap: "+event.detail.target)
|
||||
console.log(event.detail.requestConfig)
|
||||
});
|
||||
document.addEventListener('htmx:targetError', function(event) {
|
||||
console.log("Error target")
|
||||
console.log(event.detail.elt)
|
||||
console.log("Target ID: "+event.detail.target)
|
||||
});
|
||||
</script>
|
||||
}
|
||||
|
||||
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 ShowMdNonlabTemplateScreen(
|
||||
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
|
||||
}
|
||||
}
|
||||
338
views/dev/mdnonlabtemplate/mdnonlabtemplate_templ.go
Normal file
338
views/dev/mdnonlabtemplate/mdnonlabtemplate_templ.go
Normal file
@@ -0,0 +1,338 @@
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.663
|
||||
package dev_mdnonlabtemplateview
|
||||
|
||||
//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/layout"
|
||||
import "cpone/models"
|
||||
import "cpone/component/customtextfield"
|
||||
|
||||
func MdNonlabTemplateScreen(
|
||||
tableID string,
|
||||
paginationID string,
|
||||
searchID string,
|
||||
dialogAddID string,
|
||||
dialogAddBodyID string,
|
||||
dialogEditID string,
|
||||
dialogEditBodyID string,
|
||||
dialogDeleteID string,
|
||||
dialogDeleteBodyID string,
|
||||
tableDetailID string,
|
||||
detailEditID string,
|
||||
detailDeleteID string,
|
||||
breadcrumb templ.Component,
|
||||
filtercomponent templ.Component,
|
||||
tablecontent templ.Component,
|
||||
paginationtable templ.Component,
|
||||
modalAddForm templ.Component,
|
||||
// modalEditForm templ.Component,
|
||||
modalDeleteForm 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("<div class=\"container-fluid\">")
|
||||
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 = customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "searchID",
|
||||
Name: "searchID",
|
||||
Type: "hidden",
|
||||
Value: searchID}).Render(ctx, templ_7745c5c3_Buffer)
|
||||
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: "tableDetailID",
|
||||
Name: "tableDetailID",
|
||||
Type: "hidden",
|
||||
Value: tableDetailID}).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "detailEditID",
|
||||
Name: "detailEditID",
|
||||
Type: "hidden",
|
||||
Value: detailEditID}).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "detailDeleteID",
|
||||
Name: "detailDeleteID",
|
||||
Type: "hidden",
|
||||
Value: detailDeleteID}).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"row align-items-center mb-10\"><div class=\"col-md-10 col-sm-12 p-0\">")
|
||||
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("</div><div class=\"col-md-2 d-none d-lg-block d-xl-block d-md-block d-sm-none\"><div class=\"d-flex justify-content-end\"><button type=\"button\" class=\"btn btn-primary\" data-toggle=\"modal\" data-target=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var2 string
|
||||
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs("#" + dialogAddID)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\mdnonlabtemplate.templ`, Line: 87, Col: 55}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\">Add New\r</button></div></div><div class=\"col-md-2 d-block d-lg-none d-xl-none d-md-none d-sm-block justify-content-center px-5\"><button type=\"button\" class=\"btn btn-primary btn-block\" data-toggle=\"modal\" data-target=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var3 string
|
||||
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs("#" + dialogAddID)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\mdnonlabtemplate.templ`, Line: 98, Col: 51}
|
||||
}
|
||||
_, 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("\">Add New\r</button></div></div><div id=\"loading-parent\" class=\" rounded\">")
|
||||
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 = paginationtable.Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div id=\"loading-child\" class=\" rounded bg-transparent\"><div id=\"loading-spinner\" class=\"spinner-border text-primary d-none\" style=\"width: 3rem; height: 3rem\" role=\"status\"><span class=\"sr-only\">Loading...</span></div></div></div><div id=\"loadingcontent\"></div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = modalAddForm.Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = modalDeleteForm.Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div>")
|
||||
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 CSSmdnontemplate() 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("<link rel=\"stylesheet\" href=\"assets/css/googlefont/poppins.css\"><link rel=\"stylesheet\" href=\"assets/css/googlefont/publicsans.css\"><link rel=\"stylesheet\" href=\"assets/css/googlefont/roboto.css\"><style>\r\n body {\r\n background-color: white;\r\n /* padding-right: 100px;\r\n padding-left: 100px; */\r\n }\r\n #div-chart {\r\n /* overflow-x: scroll; */\r\n margin: 40px 10vw 40px 10vw;\r\n }\r\n .title {\r\n font-size:20px;\r\n font-weight: bold;\r\n }\r\n #title {\r\n font-weight: 600;\r\n }\r\n </style>")
|
||||
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 JSmdnontemplate() 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("<script>\r\n\t\tdocument.addEventListener('htmx:afterSwap', function(event) {\r\n\t\t\t// Reinitialize selectpicker after HTMX content swap\r\n\t\t\t$('.selectpicker').selectpicker('refresh');\r\n\t\t});\r\n \r\n document.addEventListener('htmx:beforeRequest', function(event) {\r\n console.log(\"Before Request\")\r\n\t\t\tconsole.log(event.detail.xhr)\r\n\t\t\tconsole.log(event.detail.target)\r\n \r\n });\r\n\r\n document.addEventListener('htmx:afterRequest', function(event) {\r\n console.log(\"After Request\")\r\n console.log(event.detail.xhr)\r\n\t\t\tconsole.log(event.detail.target)\r\n });\r\n document.addEventListener('htmx:historyCacheError', function(event) {\r\n console.log(\"Error History Cache Error\")\r\n console.log(event.detail.cause)\r\n\t\t\t\r\n });\r\n document.addEventListener('htmx:historyCacheMissError', function(event) {\r\n console.log(\"Error History Cache Miss Error\")\r\n console.log(event.detail.xhr)\r\n console.log(event.detail.path)\r\n\t\t\t\r\n });\r\n document.addEventListener('htmx:oobErrorNoTarget', function(event) {\r\n console.log(\"Error OOB No Target\")\r\n console.log(event.detail.content)\r\n });\r\n document.addEventListener('htmx:onLoadError', function(event) {\r\n console.log(\"Error On Load\")\r\n console.log(event.detail.xhr)\r\n console.log(event.detail.elt)\r\n console.log(event.detail.target)\r\n console.log(event.detail.exception)\r\n console.log(event.detail.requestConfig)\r\n });\r\n document.addEventListener('htmx:responseError', function(event) {\r\n console.log(\"Error Response\")\r\n console.log(event.detail.xhr)\r\n console.log(event.detail.elt)\r\n console.log(event.detail.requestConfig)\r\n });\r\n document.addEventListener('htmx:sendError', function(event) {\r\n console.log(\"Error Send Error\")\r\n console.log(event.detail.xhr)\r\n console.log(event.detail.elt)\r\n console.log(event.detail.requestConfig)\r\n });\r\n document.addEventListener('htmx:sseError', function(event) {\r\n console.log(\"Error Sse \")\r\n console.log(event.detail.xhr)\r\n console.log(event.detail.error)\r\n console.log(event.detail.source)\r\n });\r\n\t\tdocument.addEventListener('htmx:swapError', function(event) {\r\n console.log(\"Error Swap Error\")\r\n console.log(event.detail.xhr)\r\n console.log(event.detail.elt)\r\n console.log(\"Target Swap: \"+event.detail.target)\r\n console.log(event.detail.requestConfig)\r\n });\r\n\t\tdocument.addEventListener('htmx:targetError', function(event) {\r\n console.log(\"Error target\")\r\n console.log(event.detail.elt)\r\n console.log(\"Target ID: \"+event.detail.target)\r\n });\r\n </script>")
|
||||
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_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 ShowMdNonlabTemplateScreen(
|
||||
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
|
||||
})
|
||||
}
|
||||
198
views/dev/mdnonlabtemplate/mdnonlabtmptmodal.templ
Normal file
198
views/dev/mdnonlabtemplate/mdnonlabtmptmodal.templ
Normal file
@@ -0,0 +1,198 @@
|
||||
package dev_mdnonlabtemplateview
|
||||
|
||||
import "cpone/models"
|
||||
import "cpone/component/modal"
|
||||
import "cpone/component/customtextfield"
|
||||
import "cpone/component/customcheckbox"
|
||||
|
||||
templ MDNonlabTmpltForm(data models.MDNonlabTemplateForm) {
|
||||
<div class="">
|
||||
<form
|
||||
id={ data.IDComponent }
|
||||
hx-post={ data.Link }
|
||||
class="form"
|
||||
hx-target={ data.HxTarget }
|
||||
hx-swap={ data.HxSwap }
|
||||
hx-include={ data.HxInclude }
|
||||
hx-indicator=".formloading"
|
||||
hx-on::before-request={ HandleFormBeforeRequest() }
|
||||
hx-on::after-request={ HandleFormAfterRequest() }
|
||||
>
|
||||
if data.ModalTitle == "Delete - Nonlab Template" {
|
||||
@modalcomponent.Modal(data.ModalID,
|
||||
data.ModalTitle,
|
||||
data.DialogBody,
|
||||
data.DialogAction,
|
||||
data.ButtonClose,
|
||||
)
|
||||
}
|
||||
@modalcomponent.ModalXL(data.ModalID,
|
||||
data.ModalTitle,
|
||||
data.DialogBody,
|
||||
data.DialogAction,
|
||||
data.ButtonClose,
|
||||
)
|
||||
</form>
|
||||
</div>
|
||||
}
|
||||
|
||||
script HandleFormBeforeRequest() {
|
||||
const btnActCancel = document.querySelectorAll('.btnactcancel');
|
||||
const btnActSaveData = document.querySelectorAll('.btnactsavedata');
|
||||
|
||||
console.log("here test")
|
||||
for (let i = 0; i < btnActCancel.length; i++) {
|
||||
btnActCancel[i].setAttribute('disabled', 'true');
|
||||
}
|
||||
for (let i = 0; i < btnActSaveData.length; i++) {
|
||||
btnActSaveData[i].setAttribute('disabled', 'true');
|
||||
}
|
||||
}
|
||||
|
||||
script HandleFormAfterRequest() {
|
||||
const btnActCancel = document.querySelectorAll('.btnactcancel');
|
||||
const btnActSaveData = document.querySelectorAll('.btnactsavedata');
|
||||
|
||||
console.log("here test#2")
|
||||
for (let i = 0; i < btnActCancel.length; i++) {
|
||||
btnActCancel[i].removeAttribute('disabled');
|
||||
}
|
||||
for (let i = 0; i < btnActSaveData.length; i++) {
|
||||
btnActSaveData[i].removeAttribute('disabled');
|
||||
}
|
||||
}
|
||||
|
||||
templ BodyFormMDNonlabTemplate(
|
||||
componentID string,
|
||||
inputID models.CustomTextFieldv2Prm,
|
||||
inputName models.CustomTextFieldv2Prm,
|
||||
inputFlag models.CustomCheckboxv1Prm,
|
||||
detailKode models.CustomTextFieldv2Prm,
|
||||
detailNama models.CustomTextFieldv2Prm,
|
||||
btnSimpan templ.Component,
|
||||
btnAddDetail templ.Component,
|
||||
tableDetail templ.Component,
|
||||
hxOnLoad templ.ComponentScript,
|
||||
) {
|
||||
<div id={ componentID } hx-on::load={ hxOnLoad }>
|
||||
@customtextfield.CustomTextFieldv2(inputID)
|
||||
<h6 class="font-weight-bold">Nama Template</h6>
|
||||
<div class="row">
|
||||
<div class="col-8">
|
||||
@customtextfield.CustomTextFieldv2(inputName)
|
||||
</div>
|
||||
<div class="col-4">
|
||||
@customcheckbox.MainCustomCheckboxInput(inputFlag)
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 d-flex justify-content-end mt-4">
|
||||
@btnSimpan
|
||||
</div>
|
||||
<h6 class="font-weight-bold">Detail Hasil</h6>
|
||||
<div class="row align-items-center">
|
||||
<div class="col-2">
|
||||
@customtextfield.CustomTextFieldv2(detailKode)
|
||||
</div>
|
||||
<div class="col-8">
|
||||
@customtextfield.CustomTextFieldv2(detailNama)
|
||||
</div>
|
||||
<div class="col-2 d-flex justify-content-center">
|
||||
@btnAddDetail
|
||||
</div>
|
||||
</div>
|
||||
@tableDetail
|
||||
</div>
|
||||
<script>
|
||||
document.addEventListener('htmx:afterSwap', function(event) {
|
||||
$('.selectpicker').selectpicker('refresh');
|
||||
})
|
||||
</script>
|
||||
}
|
||||
|
||||
script JSHideModal(modalID string) {
|
||||
$(modalID).modal('hide')
|
||||
}
|
||||
|
||||
script JSShowModal(modalID string) {
|
||||
$(modalID).modal('show')
|
||||
const btnActCancel = document.querySelectorAll('.btnactcancel');
|
||||
const btnActSaveData = document.querySelectorAll('.btnactsavedata');
|
||||
|
||||
for (let i = 0; i < btnActCancel.length; i++) {
|
||||
btnActCancel[i].removeAttribute('disabled');
|
||||
}
|
||||
for (let i = 0; i < btnActSaveData.length; i++) {
|
||||
btnActSaveData[i].removeAttribute('disabled');
|
||||
}
|
||||
}
|
||||
|
||||
templ ActionFormMDNonlabTmplt(LinkClose string, targetClose string, hxSwapClose string, modalID string) {
|
||||
<div>
|
||||
<button
|
||||
hx-on::after-request={ JSHideModal(modalID) }
|
||||
hx-post={ LinkClose }
|
||||
hx-target={ targetClose }
|
||||
hx-swap={ hxSwapClose }
|
||||
hx-indicator=".cancelloading"
|
||||
type="button"
|
||||
class="btn btn-outline-secondary font-weight-bolder rounded-lg mr-4 btnactcancel"
|
||||
data-dismiss="modal"
|
||||
>
|
||||
<span class="htmx-indicator spinner-border spinner-border-sm cancelloading" role="status" aria-hidden="true"></span>
|
||||
Batal
|
||||
</button>
|
||||
<button
|
||||
type="submit"
|
||||
class="btn btn-primary btn-shadow font-weight-bold rounded-lg btnactsavedata"
|
||||
>
|
||||
<span class="htmx-indicator spinner-border spinner-border-sm formloading" role="status" aria-hidden="true"></span>
|
||||
Simpan
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
|
||||
templ BtnCloseFormMDNonlabTmplt(LinkClose string, targetClose string, hxSwapClose string, modalID string) {
|
||||
<button
|
||||
hx-post={ LinkClose }
|
||||
hx-target={ targetClose }
|
||||
hx-swap={ hxSwapClose }
|
||||
type="button"
|
||||
hx-on::after-request={ JSHideModal(modalID) }
|
||||
class="close btnactcancel"
|
||||
data-dismiss="modal"
|
||||
aria-label="Close"
|
||||
>
|
||||
<i aria-hidden="true" class="ki ki-close"></i>
|
||||
</button>
|
||||
}
|
||||
|
||||
templ BtnSimpanNama(Link string, target string, hxSwap string, disable bool, hxInclude string) {
|
||||
<button
|
||||
hx-post={ Link }
|
||||
hx-target={ target }
|
||||
hx-swap={ hxSwap }
|
||||
hx-include={ hxInclude }
|
||||
type="button"
|
||||
class="btn btntmplt btn-outline-secondary font-weight-bolder rounded-lg"
|
||||
aria-label="Simpan Nama"
|
||||
if disable {
|
||||
disabled
|
||||
}
|
||||
>
|
||||
Simpan
|
||||
</button>
|
||||
}
|
||||
|
||||
templ BtnAddDetail(Link string, target string, hxSwap string, modalID string, hxInclude string) {
|
||||
<button
|
||||
hx-post={ Link }
|
||||
hx-target={ target }
|
||||
hx-swap={ hxSwap }
|
||||
hx-include={ hxInclude }
|
||||
type="button"
|
||||
class="btn"
|
||||
aria-label="Add Detail Hasil"
|
||||
>
|
||||
<i aria-hidden="true" class="ki ki-solid-plus icon-2x text-primary"></i>
|
||||
</button>
|
||||
}
|
||||
665
views/dev/mdnonlabtemplate/mdnonlabtmptmodal_templ.go
Normal file
665
views/dev/mdnonlabtemplate/mdnonlabtmptmodal_templ.go
Normal file
@@ -0,0 +1,665 @@
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.663
|
||||
package dev_mdnonlabtemplateview
|
||||
|
||||
//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 "cpone/component/modal"
|
||||
import "cpone/component/customtextfield"
|
||||
import "cpone/component/customcheckbox"
|
||||
|
||||
func MDNonlabTmpltForm(data models.MDNonlabTemplateForm) 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("<div class=\"\">")
|
||||
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("<form id=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var2 string
|
||||
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(data.IDComponent)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\mdnonlabtmptmodal.templ`, Line: 11, Col: 33}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-post=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var3 string
|
||||
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(data.Link)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\mdnonlabtmptmodal.templ`, Line: 12, Col: 31}
|
||||
}
|
||||
_, 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("\" class=\"form\" hx-target=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var4 string
|
||||
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(data.HxTarget)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\mdnonlabtmptmodal.templ`, Line: 14, Col: 37}
|
||||
}
|
||||
_, 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("\" hx-swap=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var5 string
|
||||
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(data.HxSwap)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\mdnonlabtmptmodal.templ`, Line: 15, Col: 33}
|
||||
}
|
||||
_, 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("\" hx-include=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var6 string
|
||||
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(data.HxInclude)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\mdnonlabtmptmodal.templ`, Line: 16, Col: 39}
|
||||
}
|
||||
_, 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("\" hx-indicator=\".formloading\" hx-on::before-request=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var7 templ.ComponentScript = HandleFormBeforeRequest()
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var7.Call)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-on::after-request=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var8 templ.ComponentScript = HandleFormAfterRequest()
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var8.Call)
|
||||
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 data.ModalTitle == "Delete - Nonlab Template" {
|
||||
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 = modalcomponent.ModalXL(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("</form></div>")
|
||||
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_8f9d`,
|
||||
Function: `function __templ_HandleFormBeforeRequest_8f9d(){const btnActCancel = document.querySelectorAll('.btnactcancel');
|
||||
const btnActSaveData = document.querySelectorAll('.btnactsavedata');
|
||||
|
||||
console.log("here test")
|
||||
for (let i = 0; i < btnActCancel.length; i++) {
|
||||
btnActCancel[i].setAttribute('disabled', 'true');
|
||||
}
|
||||
for (let i = 0; i < btnActSaveData.length; i++) {
|
||||
btnActSaveData[i].setAttribute('disabled', 'true');
|
||||
}
|
||||
}`,
|
||||
Call: templ.SafeScript(`__templ_HandleFormBeforeRequest_8f9d`),
|
||||
CallInline: templ.SafeScriptInline(`__templ_HandleFormBeforeRequest_8f9d`),
|
||||
}
|
||||
}
|
||||
|
||||
func HandleFormAfterRequest() templ.ComponentScript {
|
||||
return templ.ComponentScript{
|
||||
Name: `__templ_HandleFormAfterRequest_7066`,
|
||||
Function: `function __templ_HandleFormAfterRequest_7066(){const btnActCancel = document.querySelectorAll('.btnactcancel');
|
||||
const btnActSaveData = document.querySelectorAll('.btnactsavedata');
|
||||
|
||||
console.log("here test#2")
|
||||
for (let i = 0; i < btnActCancel.length; i++) {
|
||||
btnActCancel[i].removeAttribute('disabled');
|
||||
}
|
||||
for (let i = 0; i < btnActSaveData.length; i++) {
|
||||
btnActSaveData[i].removeAttribute('disabled');
|
||||
}
|
||||
}`,
|
||||
Call: templ.SafeScript(`__templ_HandleFormAfterRequest_7066`),
|
||||
CallInline: templ.SafeScriptInline(`__templ_HandleFormAfterRequest_7066`),
|
||||
}
|
||||
}
|
||||
|
||||
func BodyFormMDNonlabTemplate(
|
||||
componentID string,
|
||||
inputID models.CustomTextFieldv2Prm,
|
||||
inputName models.CustomTextFieldv2Prm,
|
||||
inputFlag models.CustomCheckboxv1Prm,
|
||||
detailKode models.CustomTextFieldv2Prm,
|
||||
detailNama models.CustomTextFieldv2Prm,
|
||||
btnSimpan templ.Component,
|
||||
btnAddDetail templ.Component,
|
||||
tableDetail templ.Component,
|
||||
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("<div id=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var10 string
|
||||
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(componentID)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\mdnonlabtmptmodal.templ`, Line: 77, Col: 25}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-on::load=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var11 templ.ComponentScript = hxOnLoad
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var11.Call)
|
||||
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 = templ_7745c5c3_Buffer.WriteString("<h6 class=\"font-weight-bold\">Nama Template</h6><div class=\"row\"><div class=\"col-8\">")
|
||||
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("</div><div class=\"col-4\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = customcheckbox.MainCustomCheckboxInput(inputFlag).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div></div><div class=\"col-12 d-flex justify-content-end mt-4\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = btnSimpan.Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div><h6 class=\"font-weight-bold\">Detail Hasil</h6><div class=\"row align-items-center\"><div class=\"col-2\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = customtextfield.CustomTextFieldv2(detailKode).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div><div class=\"col-8\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = customtextfield.CustomTextFieldv2(detailNama).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div><div class=\"col-2 d-flex justify-content-center\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = btnAddDetail.Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div></div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = tableDetail.Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div><script>\r\n document.addEventListener('htmx:afterSwap', function(event) {\r\n $('.selectpicker').selectpicker('refresh');\r\n })\r\n </script>")
|
||||
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_658d`,
|
||||
Function: `function __templ_JSShowModal_658d(modalID){$(modalID).modal('show')
|
||||
const btnActCancel = document.querySelectorAll('.btnactcancel');
|
||||
const btnActSaveData = document.querySelectorAll('.btnactsavedata');
|
||||
|
||||
for (let i = 0; i < btnActCancel.length; i++) {
|
||||
btnActCancel[i].removeAttribute('disabled');
|
||||
}
|
||||
for (let i = 0; i < btnActSaveData.length; i++) {
|
||||
btnActSaveData[i].removeAttribute('disabled');
|
||||
}
|
||||
}`,
|
||||
Call: templ.SafeScript(`__templ_JSShowModal_658d`, modalID),
|
||||
CallInline: templ.SafeScriptInline(`__templ_JSShowModal_658d`, modalID),
|
||||
}
|
||||
}
|
||||
|
||||
func ActionFormMDNonlabTmplt(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("<div>")
|
||||
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("<button hx-on::after-request=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var13 templ.ComponentScript = JSHideModal(modalID)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var13.Call)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-post=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var14 string
|
||||
templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(LinkClose)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\mdnonlabtmptmodal.templ`, Line: 133, Col: 31}
|
||||
}
|
||||
_, 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-target=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var15 string
|
||||
templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(targetClose)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\mdnonlabtmptmodal.templ`, Line: 134, Col: 35}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-swap=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var16 string
|
||||
templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(hxSwapClose)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\mdnonlabtmptmodal.templ`, Line: 135, Col: 33}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-indicator=\".cancelloading\" type=\"button\" class=\"btn btn-outline-secondary font-weight-bolder rounded-lg mr-4 btnactcancel\" data-dismiss=\"modal\"><span class=\"htmx-indicator spinner-border spinner-border-sm cancelloading\" role=\"status\" aria-hidden=\"true\"></span> Batal\r</button> <button type=\"submit\" class=\"btn btn-primary btn-shadow font-weight-bold rounded-lg btnactsavedata\"><span class=\"htmx-indicator spinner-border spinner-border-sm formloading\" role=\"status\" aria-hidden=\"true\"></span> Simpan\r</button></div>")
|
||||
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 BtnCloseFormMDNonlabTmplt(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("<button hx-post=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var18 string
|
||||
templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(LinkClose)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\mdnonlabtmptmodal.templ`, Line: 156, Col: 27}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-target=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var19 string
|
||||
templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs(targetClose)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\mdnonlabtmptmodal.templ`, Line: 157, Col: 31}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-swap=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var20 string
|
||||
templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs(hxSwapClose)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\mdnonlabtmptmodal.templ`, Line: 158, Col: 29}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var20))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" type=\"button\" hx-on::after-request=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var21 templ.ComponentScript = JSHideModal(modalID)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var21.Call)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" class=\"close btnactcancel\" data-dismiss=\"modal\" aria-label=\"Close\"><i aria-hidden=\"true\" class=\"ki ki-close\"></i></button>")
|
||||
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 BtnSimpanNama(Link string, target string, hxSwap string, disable bool, hxInclude 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_Var22 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var22 == nil {
|
||||
templ_7745c5c3_Var22 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<button hx-post=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var23 string
|
||||
templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(Link)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\mdnonlabtmptmodal.templ`, Line: 171, Col: 22}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var23))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-target=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var24 string
|
||||
templ_7745c5c3_Var24, templ_7745c5c3_Err = templ.JoinStringErrs(target)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\mdnonlabtmptmodal.templ`, Line: 172, Col: 26}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var24))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-swap=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var25 string
|
||||
templ_7745c5c3_Var25, templ_7745c5c3_Err = templ.JoinStringErrs(hxSwap)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\mdnonlabtmptmodal.templ`, Line: 173, Col: 24}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var25))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-include=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var26 string
|
||||
templ_7745c5c3_Var26, templ_7745c5c3_Err = templ.JoinStringErrs(hxInclude)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\mdnonlabtmptmodal.templ`, Line: 174, Col: 30}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var26))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" type=\"button\" class=\"btn btntmplt btn-outline-secondary font-weight-bolder rounded-lg\" aria-label=\"Simpan Nama\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if disable {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" disabled")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(">Simpan\r</button>")
|
||||
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 BtnAddDetail(Link string, target string, hxSwap string, modalID string, hxInclude 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_Var27 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var27 == nil {
|
||||
templ_7745c5c3_Var27 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<button hx-post=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var28 string
|
||||
templ_7745c5c3_Var28, templ_7745c5c3_Err = templ.JoinStringErrs(Link)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\mdnonlabtmptmodal.templ`, Line: 188, Col: 22}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var28))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-target=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var29 string
|
||||
templ_7745c5c3_Var29, templ_7745c5c3_Err = templ.JoinStringErrs(target)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\mdnonlabtmptmodal.templ`, Line: 189, Col: 26}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var29))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-swap=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var30 string
|
||||
templ_7745c5c3_Var30, templ_7745c5c3_Err = templ.JoinStringErrs(hxSwap)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\mdnonlabtmptmodal.templ`, Line: 190, Col: 24}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var30))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-include=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var31 string
|
||||
templ_7745c5c3_Var31, templ_7745c5c3_Err = templ.JoinStringErrs(hxInclude)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\mdnonlabtmptmodal.templ`, Line: 191, Col: 30}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var31))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" type=\"button\" class=\"btn\" aria-label=\"Add Detail Hasil\"><i aria-hidden=\"true\" class=\"ki ki-solid-plus icon-2x text-primary\"></i></button>")
|
||||
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
|
||||
})
|
||||
}
|
||||
57
views/dev/mdnonlabtemplate/mdnonlabtmptmodaldel.templ
Normal file
57
views/dev/mdnonlabtemplate/mdnonlabtmptmodaldel.templ
Normal file
@@ -0,0 +1,57 @@
|
||||
package dev_mdnonlabtemplateview
|
||||
|
||||
import "cpone/models"
|
||||
import "cpone/component/customtextfield"
|
||||
|
||||
templ DeleteKonfirmasiBody(
|
||||
inputID models.CustomTextFieldv2Prm,
|
||||
componentID string,
|
||||
message string,
|
||||
dataHeader []string,
|
||||
dataText []string,
|
||||
hxOnLoad templ.ComponentScript,
|
||||
) {
|
||||
<div id={ componentID } hx-on::load={ hxOnLoad }>
|
||||
<p>{ message }</p>
|
||||
<div class="card rounded-lg">
|
||||
<div class="card-body d-flex flex-row">
|
||||
<div class="d-flex flex-column">
|
||||
for _, v := range dataHeader {
|
||||
<div class="mb-1 mt-1 text-disabled font-weight-bold mr-5">{ v }</div>
|
||||
}
|
||||
</div>
|
||||
<div class="d-flex flex-column">
|
||||
for _, v := range dataText {
|
||||
<div class="mb-1 mt-1 font-weight-bold">{ v }</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@customtextfield.CustomTextFieldv2(inputID)
|
||||
</div>
|
||||
}
|
||||
|
||||
templ ActionFormNonlabTemplateDelete(LinkClose string, targetClose string, hxSwapClose string, modalID string) {
|
||||
<div>
|
||||
<button
|
||||
hx-on::after-request={ JSHideModal(modalID) }
|
||||
hx-post={ LinkClose }
|
||||
hx-target={ targetClose }
|
||||
hx-swap={ hxSwapClose }
|
||||
hx-indicator=".cancelloading"
|
||||
type="button"
|
||||
class="btn btn-outline-secondary font-weight-bolder rounded-lg mr-4 btnactcancel"
|
||||
data-dismiss="modal"
|
||||
>
|
||||
<span class="htmx-indicator spinner-border spinner-border-sm cancelloading" role="status" aria-hidden="true"></span>
|
||||
Batal
|
||||
</button>
|
||||
<button
|
||||
type="submit"
|
||||
class="btn btn-primary btn-shadow font-weight-bold rounded-lg btnactsavedata"
|
||||
>
|
||||
<span class="htmx-indicator spinner-border spinner-border-sm formloading" role="status" aria-hidden="true"></span>
|
||||
Yakin
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
218
views/dev/mdnonlabtemplate/mdnonlabtmptmodaldel_templ.go
Normal file
218
views/dev/mdnonlabtemplate/mdnonlabtmptmodaldel_templ.go
Normal file
@@ -0,0 +1,218 @@
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.663
|
||||
package dev_mdnonlabtemplateview
|
||||
|
||||
//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 "cpone/component/customtextfield"
|
||||
|
||||
func DeleteKonfirmasiBody(
|
||||
inputID models.CustomTextFieldv2Prm,
|
||||
componentID string,
|
||||
message string,
|
||||
dataHeader []string,
|
||||
dataText []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_Var1 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var1 == nil {
|
||||
templ_7745c5c3_Var1 = 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("<div id=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var2 string
|
||||
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(componentID)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\mdnonlabtmptmodaldel.templ`, Line: 14, Col: 25}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-on::load=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var3 templ.ComponentScript = hxOnLoad
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var3.Call)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\"><p>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var4 string
|
||||
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(message)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\mdnonlabtmptmodaldel.templ`, Line: 15, Col: 20}
|
||||
}
|
||||
_, 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("</p><div class=\"card rounded-lg\"><div class=\"card-body d-flex flex-row\"><div class=\"d-flex flex-column\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
for _, v := range dataHeader {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"mb-1 mt-1 text-disabled font-weight-bold mr-5\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var5 string
|
||||
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(v)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\mdnonlabtmptmodaldel.templ`, Line: 20, Col: 86}
|
||||
}
|
||||
_, 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("</div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div><div class=\"d-flex flex-column\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
for _, v := range dataText {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"mb-1 mt-1 font-weight-bold\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var6 string
|
||||
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(v)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\mdnonlabtmptmodaldel.templ`, Line: 25, Col: 67}
|
||||
}
|
||||
_, 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("</div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div></div></div>")
|
||||
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 = templ_7745c5c3_Buffer.WriteString("</div>")
|
||||
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 ActionFormNonlabTemplateDelete(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_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("<div>")
|
||||
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("<button hx-on::after-request=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var8 templ.ComponentScript = JSHideModal(modalID)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var8.Call)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-post=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var9 string
|
||||
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(LinkClose)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\mdnonlabtmptmodaldel.templ`, Line: 38, Col: 31}
|
||||
}
|
||||
_, 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("\" hx-target=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var10 string
|
||||
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(targetClose)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\mdnonlabtmptmodaldel.templ`, Line: 39, Col: 35}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-swap=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var11 string
|
||||
templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(hxSwapClose)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\mdnonlabtmptmodaldel.templ`, Line: 40, Col: 33}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-indicator=\".cancelloading\" type=\"button\" class=\"btn btn-outline-secondary font-weight-bolder rounded-lg mr-4 btnactcancel\" data-dismiss=\"modal\"><span class=\"htmx-indicator spinner-border spinner-border-sm cancelloading\" role=\"status\" aria-hidden=\"true\"></span> Batal\r</button> <button type=\"submit\" class=\"btn btn-primary btn-shadow font-weight-bold rounded-lg btnactsavedata\"><span class=\"htmx-indicator spinner-border spinner-border-sm formloading\" role=\"status\" aria-hidden=\"true\"></span> Yakin\r</button></div>")
|
||||
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
|
||||
})
|
||||
}
|
||||
131
views/dev/mdnonlabtemplate/nonlabtemplatetable.templ
Normal file
131
views/dev/mdnonlabtemplate/nonlabtemplatetable.templ
Normal file
@@ -0,0 +1,131 @@
|
||||
package dev_mdnonlabtemplateview
|
||||
|
||||
import "cpone/component/table"
|
||||
import "cpone/models"
|
||||
import "strconv"
|
||||
|
||||
templ TableNonlabTmplt(
|
||||
data []models.MDNonlabTemplate,
|
||||
tableID string,
|
||||
hxGetEdit string,
|
||||
hxTargetEdit string,
|
||||
hxSwapEdit string,
|
||||
hxIncludeEdit string,
|
||||
hxGetDelete string,
|
||||
hxTargetDelete string,
|
||||
hxSwapDelete string,
|
||||
hxIncludeDelete string,
|
||||
) {
|
||||
<div id={ tableID } hx-swap-oob="true" >
|
||||
@tablecomponent.TableV3([]string{"NAMA", "AKSI"},
|
||||
[]string{"80%","20%"},
|
||||
RowNonlabTmplt(data,
|
||||
tableID,
|
||||
hxGetEdit,
|
||||
hxTargetEdit,
|
||||
hxSwapEdit,
|
||||
hxIncludeEdit,
|
||||
hxGetDelete,
|
||||
hxTargetDelete,
|
||||
hxSwapDelete,
|
||||
hxIncludeDelete,
|
||||
))
|
||||
</div>
|
||||
}
|
||||
|
||||
templ RowNonlabTmplt(
|
||||
data []models.MDNonlabTemplate,
|
||||
tableID string,
|
||||
hxGetEdit string,
|
||||
hxTargetEdit string,
|
||||
hxSwapEdit string,
|
||||
hxIncludeEdit string,
|
||||
hxGetDelete string,
|
||||
hxTargetDelete string,
|
||||
hxSwapDelete string,
|
||||
hxIncludeDelete string,
|
||||
) {
|
||||
if len(data) == 0 {
|
||||
<tr>
|
||||
<td colspan="2" class="text-center">Data Tidak Ditemukan</td>
|
||||
</tr>
|
||||
}
|
||||
for _, v := range data {
|
||||
<tr>
|
||||
<td>{ v.NonlabTemplateName }</td>
|
||||
<td>
|
||||
@RowAction(v.NonlabTemplateID,
|
||||
hxGetEdit,
|
||||
hxTargetEdit,
|
||||
hxSwapEdit,
|
||||
hxIncludeEdit,
|
||||
hxGetDelete,
|
||||
hxTargetDelete,
|
||||
hxSwapDelete,
|
||||
hxIncludeDelete,
|
||||
)
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
|
||||
templ RowAction(
|
||||
id int,
|
||||
hxGetEdit string,
|
||||
hxTargetEdit string,
|
||||
hxSwapEdit string,
|
||||
hxIncludeEdit string,
|
||||
hxGetDelete string,
|
||||
hxTargetDelete string,
|
||||
hxSwapDelete string,
|
||||
hxIncludeDelete string,
|
||||
) {
|
||||
<div class="row px-5 d-flex justify-content-around">
|
||||
<a
|
||||
type="button"
|
||||
class="btnactnlt col-12 col-12 col-sm-12 col-md-12 col-lg-5 col-xl-5 col-xxl-5 btn btn-light-tosca mb-2 btn-sm"
|
||||
hx-get={ hxGetEdit + "?id=" + strconv.Itoa(id) }
|
||||
hx-target={ hxTargetEdit }
|
||||
hx-swap={ hxSwapEdit }
|
||||
hx-include={ hxIncludeEdit }
|
||||
hx-indicator={ "#spnredt" + strconv.Itoa(id) }
|
||||
hx-on::before-request={ HandleBeforeRequestRow(strconv.Itoa(id)) }
|
||||
hx-on::after-request={ HandleAfterRequestRow(strconv.Itoa(id)) }
|
||||
>
|
||||
<span id={ "spnredt" + strconv.Itoa(id) } class="htmx-indicator spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
|
||||
Edit
|
||||
</a>
|
||||
<a
|
||||
type="button"
|
||||
class="btnactnlt col-12 col-12 col-sm-12 col-md-12 col-lg-5 col-xl-5 col-xxl-5 btn btn-light-danger mb-2 btn-sm"
|
||||
hx-get={ hxGetDelete + "?id=" + strconv.Itoa(id) }
|
||||
hx-target={ hxTargetDelete }
|
||||
hx-swap={ hxSwapDelete }
|
||||
hx-include={ hxIncludeDelete }
|
||||
hx-indicator={ "#spnrdel" + strconv.Itoa(id) }
|
||||
hx-on::before-request={ HandleBeforeRequestRow(strconv.Itoa(id)) }
|
||||
hx-on::after-request={ HandleAfterRequestRow(strconv.Itoa(id)) }
|
||||
>
|
||||
<span id={ "spnrdel" + strconv.Itoa(id) } class="htmx-indicator spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
|
||||
Hapus
|
||||
</a>
|
||||
</div>
|
||||
}
|
||||
|
||||
script HandleBeforeRequestRow(id string) {
|
||||
var cusid_ele = document.getElementsByClassName('btnactnlt');
|
||||
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('btnactnlt');
|
||||
for (var i = 0; i < cusid_ele.length; ++i) {
|
||||
var item = cusid_ele[i];
|
||||
item.classList.remove('disabled');
|
||||
}
|
||||
console.log(id)
|
||||
}
|
||||
428
views/dev/mdnonlabtemplate/nonlabtemplatetable_templ.go
Normal file
428
views/dev/mdnonlabtemplate/nonlabtemplatetable_templ.go
Normal file
@@ -0,0 +1,428 @@
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.663
|
||||
package dev_mdnonlabtemplateview
|
||||
|
||||
//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 TableNonlabTmplt(
|
||||
data []models.MDNonlabTemplate,
|
||||
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("<div id=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var2 string
|
||||
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(tableID)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\nonlabtemplatetable.templ`, Line: 19, Col: 21}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-swap-oob=\"true\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = tablecomponent.TableV3([]string{"NAMA", "AKSI"},
|
||||
[]string{"80%", "20%"},
|
||||
RowNonlabTmplt(data,
|
||||
tableID,
|
||||
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("</div>")
|
||||
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 RowNonlabTmplt(
|
||||
data []models.MDNonlabTemplate,
|
||||
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_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("<tr><td colspan=\"2\" class=\"text-center\">Data Tidak Ditemukan</td></tr>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
for _, v := range data {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<tr><td>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var4 string
|
||||
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(v.NonlabTemplateName)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\nonlabtemplatetable.templ`, Line: 55, Col: 38}
|
||||
}
|
||||
_, 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("</td><td>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = RowAction(v.NonlabTemplateID,
|
||||
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("</td></tr>")
|
||||
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 RowAction(
|
||||
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_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("<div class=\"row px-5 d-flex justify-content-around\">")
|
||||
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("<a type=\"button\" class=\"btnactnlt col-12 col-12 col-sm-12 col-md-12 col-lg-5 col-xl-5 col-xxl-5 btn btn-light-tosca mb-2 btn-sm\" hx-get=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var6 string
|
||||
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(hxGetEdit + "?id=" + strconv.Itoa(id))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\nonlabtemplatetable.templ`, Line: 87, Col: 49}
|
||||
}
|
||||
_, 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("\" hx-target=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var7 string
|
||||
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(hxTargetEdit)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\nonlabtemplatetable.templ`, Line: 88, Col: 27}
|
||||
}
|
||||
_, 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("\" hx-swap=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var8 string
|
||||
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(hxSwapEdit)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\nonlabtemplatetable.templ`, Line: 89, Col: 23}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-include=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var9 string
|
||||
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(hxIncludeEdit)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\nonlabtemplatetable.templ`, Line: 90, Col: 29}
|
||||
}
|
||||
_, 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("\" hx-indicator=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var10 string
|
||||
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs("#spnredt" + strconv.Itoa(id))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\nonlabtemplatetable.templ`, Line: 91, Col: 47}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-on::before-request=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var11 templ.ComponentScript = HandleBeforeRequestRow(strconv.Itoa(id))
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var11.Call)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-on::after-request=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var12 templ.ComponentScript = HandleAfterRequestRow(strconv.Itoa(id))
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var12.Call)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\"><span id=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var13 string
|
||||
templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs("spnredt" + strconv.Itoa(id))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\nonlabtemplatetable.templ`, Line: 95, Col: 50}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" class=\"htmx-indicator spinner-border spinner-border-sm\" role=\"status\" aria-hidden=\"true\"></span> Edit\r</a> ")
|
||||
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("<a type=\"button\" class=\"btnactnlt col-12 col-12 col-sm-12 col-md-12 col-lg-5 col-xl-5 col-xxl-5 btn btn-light-danger mb-2 btn-sm\" hx-get=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var14 string
|
||||
templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(hxGetDelete + "?id=" + strconv.Itoa(id))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\nonlabtemplatetable.templ`, Line: 101, Col: 51}
|
||||
}
|
||||
_, 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-target=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var15 string
|
||||
templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(hxTargetDelete)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\nonlabtemplatetable.templ`, Line: 102, Col: 29}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-swap=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var16 string
|
||||
templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(hxSwapDelete)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\nonlabtemplatetable.templ`, Line: 103, Col: 25}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-include=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var17 string
|
||||
templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(hxIncludeDelete)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\nonlabtemplatetable.templ`, Line: 104, Col: 31}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-indicator=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var18 string
|
||||
templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs("#spnrdel" + strconv.Itoa(id))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\nonlabtemplatetable.templ`, Line: 105, Col: 47}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-on::before-request=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var19 templ.ComponentScript = HandleBeforeRequestRow(strconv.Itoa(id))
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var19.Call)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-on::after-request=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var20 templ.ComponentScript = HandleAfterRequestRow(strconv.Itoa(id))
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var20.Call)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\"><span id=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var21 string
|
||||
templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.JoinStringErrs("spnrdel" + strconv.Itoa(id))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\nonlabtemplatetable.templ`, Line: 109, Col: 50}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var21))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" class=\"htmx-indicator spinner-border spinner-border-sm\" role=\"status\" aria-hidden=\"true\"></span> Hapus\r</a></div>")
|
||||
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_9ad2`,
|
||||
Function: `function __templ_HandleBeforeRequestRow_9ad2(id){var cusid_ele = document.getElementsByClassName('btnactnlt');
|
||||
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_9ad2`, id),
|
||||
CallInline: templ.SafeScriptInline(`__templ_HandleBeforeRequestRow_9ad2`, id),
|
||||
}
|
||||
}
|
||||
|
||||
func HandleAfterRequestRow(id string) templ.ComponentScript {
|
||||
return templ.ComponentScript{
|
||||
Name: `__templ_HandleAfterRequestRow_840a`,
|
||||
Function: `function __templ_HandleAfterRequestRow_840a(id){var cusid_ele = document.getElementsByClassName('btnactnlt');
|
||||
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_840a`, id),
|
||||
CallInline: templ.SafeScriptInline(`__templ_HandleAfterRequestRow_840a`, id),
|
||||
}
|
||||
}
|
||||
119
views/dev/mdnonlabtemplate/tabledetail.templ
Normal file
119
views/dev/mdnonlabtemplate/tabledetail.templ
Normal file
@@ -0,0 +1,119 @@
|
||||
package dev_mdnonlabtemplateview
|
||||
|
||||
import "cpone/models"
|
||||
import "strconv"
|
||||
import "cpone/component/table"
|
||||
|
||||
templ TableDetail(data []models.NonlabTemplateDetail,
|
||||
tableDetailID string,
|
||||
hxGetEdit string,
|
||||
hxTargetEdit string,
|
||||
hxSwapEdit string,
|
||||
hxIncludeEdit string,
|
||||
hxGetDelete string,
|
||||
hxTargetDelete string,
|
||||
hxSwapDelete string,
|
||||
hxIncludeDelete string,
|
||||
) {
|
||||
<div id={ tableDetailID }>
|
||||
@tablecomponent.TableV3([]string{"KODE", "TEST", "AKSI"},
|
||||
[]string{"20%","50%","30%"},
|
||||
RowDetail(data,
|
||||
hxGetEdit,
|
||||
hxTargetEdit,
|
||||
hxSwapEdit,
|
||||
hxIncludeEdit,
|
||||
hxGetDelete,
|
||||
hxTargetDelete,
|
||||
hxSwapDelete,
|
||||
hxIncludeDelete,
|
||||
))
|
||||
</div>
|
||||
}
|
||||
|
||||
templ RowDetail(
|
||||
data []models.NonlabTemplateDetail,
|
||||
hxGetEdit string,
|
||||
hxTargetEdit string,
|
||||
hxSwapEdit string,
|
||||
hxIncludeEdit string,
|
||||
hxGetDelete string,
|
||||
hxTargetDelete string,
|
||||
hxSwapDelete string,
|
||||
hxIncludeDelete string,
|
||||
) {
|
||||
if len(data) == 0 {
|
||||
<tr>
|
||||
<td colspan="3" class="text-center">Data Tidak Ditemukan</td>
|
||||
</tr>
|
||||
}
|
||||
for _, v := range data {
|
||||
<tr>
|
||||
<td>{ v.NonlabTemplateDetailCode }</td>
|
||||
<td>{ v.NonlabTemplateDetailName }</td>
|
||||
<td>
|
||||
@ActionRow(v.NonlabTemplateDetailID,
|
||||
v.NonlabTemplateDetailFlagActive,
|
||||
hxGetEdit,
|
||||
hxTargetEdit,
|
||||
hxSwapEdit,
|
||||
hxIncludeEdit,
|
||||
hxGetDelete,
|
||||
hxTargetDelete,
|
||||
hxSwapDelete,
|
||||
hxIncludeDelete,
|
||||
)
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
templ ActionRow(
|
||||
id int,
|
||||
flagActive string,
|
||||
hxGetEdit string,
|
||||
hxTargetEdit string,
|
||||
hxSwapEdit string,
|
||||
hxIncludeEdit string,
|
||||
hxGetDelete string,
|
||||
hxTargetDelete string,
|
||||
hxSwapDelete string,
|
||||
hxIncludeDelete string,
|
||||
) {
|
||||
<div class="row px-5 d-flex justify-content-around">
|
||||
<a
|
||||
type="button"
|
||||
class="btn mb-2 btn-sm col-12 col-sm-12 col-md-12 col-lg-5 col-xl-5 col-xxl-5"
|
||||
hx-get={ hxGetDelete + "?id=" + strconv.Itoa(id) }
|
||||
hx-target={ hxTargetDelete }
|
||||
hx-swap={ hxSwapDelete }
|
||||
hx-include={ hxIncludeDelete }
|
||||
>
|
||||
<i aria-hidden="true" class="flaticon2-trash text-danger"></i>
|
||||
</a>
|
||||
if flagActive == "Y" {
|
||||
<a
|
||||
type="button"
|
||||
class="btn btn-light-danger mb-2 btn-sm col-12 col-sm-12 col-md-12 col-lg-5 col-xl-5 col-xxl-5 mb-2 btn-sm"
|
||||
hx-get={ hxGetEdit + "?id=" + strconv.Itoa(id) }
|
||||
hx-target={ hxTargetEdit }
|
||||
hx-swap={ hxSwapEdit }
|
||||
hx-include={ hxIncludeEdit }
|
||||
>
|
||||
Tidak
|
||||
</a>
|
||||
} else {
|
||||
<a
|
||||
type="button"
|
||||
class="btn btn-light-tosca mb-2 btn-sm col-12 col-sm-12 col-md-12 col-lg-5 col-xl-5 col-xxl-5 mb-2 btn-sm"
|
||||
hx-get={ hxGetEdit + "?id=" + strconv.Itoa(id) }
|
||||
hx-target={ hxTargetEdit }
|
||||
hx-swap={ hxSwapEdit }
|
||||
hx-include={ hxIncludeEdit }
|
||||
>
|
||||
Pilih
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
373
views/dev/mdnonlabtemplate/tabledetail_templ.go
Normal file
373
views/dev/mdnonlabtemplate/tabledetail_templ.go
Normal file
@@ -0,0 +1,373 @@
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.663
|
||||
package dev_mdnonlabtemplateview
|
||||
|
||||
//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"
|
||||
import "cpone/component/table"
|
||||
|
||||
func TableDetail(data []models.NonlabTemplateDetail,
|
||||
tableDetailID 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("<div id=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var2 string
|
||||
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(tableDetailID)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\tabledetail.templ`, Line: 18, Col: 27}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = tablecomponent.TableV3([]string{"KODE", "TEST", "AKSI"},
|
||||
[]string{"20%", "50%", "30%"},
|
||||
RowDetail(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("</div>")
|
||||
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 RowDetail(
|
||||
data []models.NonlabTemplateDetail,
|
||||
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("<tr><td colspan=\"3\" class=\"text-center\">Data Tidak Ditemukan</td></tr>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
for _, v := range data {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<tr><td>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var4 string
|
||||
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(v.NonlabTemplateDetailCode)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\tabledetail.templ`, Line: 52, Col: 45}
|
||||
}
|
||||
_, 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("</td><td>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var5 string
|
||||
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(v.NonlabTemplateDetailName)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\tabledetail.templ`, Line: 53, Col: 45}
|
||||
}
|
||||
_, 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("</td><td>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = ActionRow(v.NonlabTemplateDetailID,
|
||||
v.NonlabTemplateDetailFlagActive,
|
||||
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("</td></tr>")
|
||||
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 ActionRow(
|
||||
id int,
|
||||
flagActive 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_Var6 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var6 == nil {
|
||||
templ_7745c5c3_Var6 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"row px-5 d-flex justify-content-around\"><a type=\"button\" class=\"btn mb-2 btn-sm col-12 col-sm-12 col-md-12 col-lg-5 col-xl-5 col-xxl-5\" hx-get=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var7 string
|
||||
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(hxGetDelete + "?id=" + strconv.Itoa(id))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\tabledetail.templ`, Line: 88, Col: 60}
|
||||
}
|
||||
_, 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("\" hx-target=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var8 string
|
||||
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(hxTargetDelete)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\tabledetail.templ`, Line: 89, Col: 38}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-swap=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var9 string
|
||||
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(hxSwapDelete)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\tabledetail.templ`, Line: 90, Col: 34}
|
||||
}
|
||||
_, 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("\" hx-include=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var10 string
|
||||
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(hxIncludeDelete)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\tabledetail.templ`, Line: 91, Col: 40}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\"><i aria-hidden=\"true\" class=\"flaticon2-trash text-danger\"></i></a> ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if flagActive == "Y" {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<a type=\"button\" class=\"btn btn-light-danger mb-2 btn-sm col-12 col-sm-12 col-md-12 col-lg-5 col-xl-5 col-xxl-5 mb-2 btn-sm\" hx-get=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var11 string
|
||||
templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(hxGetEdit + "?id=" + strconv.Itoa(id))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\tabledetail.templ`, Line: 99, Col: 62}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-target=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var12 string
|
||||
templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(hxTargetEdit)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\tabledetail.templ`, Line: 100, Col: 40}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-swap=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var13 string
|
||||
templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(hxSwapEdit)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\tabledetail.templ`, Line: 101, Col: 36}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-include=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var14 string
|
||||
templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(hxIncludeEdit)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\tabledetail.templ`, Line: 102, Col: 42}
|
||||
}
|
||||
_, 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("\">Tidak\r</a>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
} else {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<a type=\"button\" class=\"btn btn-light-tosca mb-2 btn-sm col-12 col-sm-12 col-md-12 col-lg-5 col-xl-5 col-xxl-5 mb-2 btn-sm\" hx-get=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var15 string
|
||||
templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(hxGetEdit + "?id=" + strconv.Itoa(id))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\tabledetail.templ`, Line: 110, Col: 62}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-target=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var16 string
|
||||
templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(hxTargetEdit)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\tabledetail.templ`, Line: 111, Col: 40}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-swap=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var17 string
|
||||
templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(hxSwapEdit)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\tabledetail.templ`, Line: 112, Col: 36}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-include=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var18 string
|
||||
templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(hxIncludeEdit)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnonlabtemplate\tabledetail.templ`, Line: 113, Col: 42}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\">Pilih\r</a>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div>")
|
||||
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
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user