Compare commits

...

5 Commits

Author SHA1 Message Date
Hanan Askarim
73e3ecd305 checkbox pending 2024-06-11 10:41:34 +07:00
Hanan Askarim
ecbba051dc membuat button save checkbox 2024-06-06 10:15:32 +07:00
Hanan Askarim
94d78be39b menambahkan loading 2024-06-05 15:32:03 +07:00
Hanan Askarim
4fa87f293c ubah nama route 2024-06-05 14:40:19 +07:00
Hanan Askarim
bebe593650 md pola kelainan 2024-06-05 14:30:22 +07:00
21 changed files with 6380 additions and 12 deletions

View File

@@ -0,0 +1,31 @@
package customcheckbox
import "cpone/models"
templ MainCustomCheckboxInputV2(inp models.CustomCheckboxv1Prm) {
<div class="form-group">
<div class="checkbox-list">
<label class="checkbox">
if (inp.Status == "on") {
<input
type="checkbox"
name={ inp.Name }
id={ inp.ID }
checked
/>
} else {
<input
id={ inp.ID }
type="checkbox"
name={ inp.Name }
/>
}
<span></span>
{ inp.Text }
</label>
</div>
</div>
<div class="invalid-feedback text-danger mt-3 ml-2 mt-5">
{ inp.ErrorMsg }
</div>
}

View File

@@ -0,0 +1,130 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.663
package customcheckbox
//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"
func MainCustomCheckboxInputV2(inp models.CustomCheckboxv1Prm) 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=\"form-group\"><div class=\"checkbox-list\"><label class=\"checkbox\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if inp.Status == "on" {
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<input type=\"checkbox\" name=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var2 string
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(inp.Name)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customcheckbox\customcheckboxv2.templ`, Line: 12, 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("\" id=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(inp.ID)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customcheckbox\customcheckboxv2.templ`, Line: 13, Col: 17}
}
_, 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("\" checked> ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
} else {
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<input id=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var4 string
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(inp.ID)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customcheckbox\customcheckboxv2.templ`, Line: 18, Col: 17}
}
_, 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("\" type=\"checkbox\" name=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(inp.Name)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customcheckbox\customcheckboxv2.templ`, Line: 20, Col: 21}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\"> ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<span></span> ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var6 string
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(inp.Text)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customcheckbox\customcheckboxv2.templ`, Line: 24, Col: 14}
}
_, 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("</label></div></div><div class=\"invalid-feedback text-danger mt-3 ml-2 mt-5\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var7 string
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(inp.ErrorMsg)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customcheckbox\customcheckboxv2.templ`, Line: 29, Col: 16}
}
_, 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("</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
})
}

View File

@@ -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 {

14
config.yml Normal file
View File

@@ -0,0 +1,14 @@
# MYSQL
dbuser: cpuser
dbpass: sasone102938
dbhost: devone.aplikasi.web.id
dbport: 3306
dbname: cpone
tokenExpiration: 4049000
# dbuser:
# dbpass:
# dbhost:
# dbport:
# dbname: cpone.db
# tokenExpiration: 4049000

File diff suppressed because it is too large Load Diff

View File

@@ -321,4 +321,27 @@ func SetupRoutesDev(app *echo.Echo, appStore db.AppStore) {
dev.GET("/md/bahan/opendelete", devMdBahanHandlers.HandleOpenDeleteMdBahan)
dev.POST("/md/bahan/closedeleteform", devMdBahanHandlers.HandleCloseDeleteMdBahan)
dev.POST("/md/bahan/delete", devMdBahanHandlers.HandleDeleteMdBahan)
// md pola kelainan
devKLServices := dev_services.NewServicesMasterKelainan(appStore)
devKLhandlers := dev_handlers.NewMasterKelainanHandler(devKLServices)
dev.GET("/md/kelainan", devKLhandlers.HandlerShowMasterKelainan)
dev.GET("/md/searchkelainan", devKLhandlers.HandlerShowMasterKelainanSearch)
dev.GET("/md/kelainanpagination", devKLhandlers.HandlerShowMasterKelainanPagination)
dev.POST("/md/kelainan/closeaddform", devKLhandlers.HandleCloseFormAdd)
dev.POST("/md/kelainan/add", devKLhandlers.AddKelainan)
dev.GET("/md/kelainan/opendelete", devKLhandlers.HandleOpenDeleteForm)
dev.POST("/md/kelainan/closedeleteform", devKLhandlers.HandleCloseFormDelete)
dev.POST("/md/kelainan/delete", devKLhandlers.HandleDeleteKelainan)
dev.GET("/md/kelainan/flagaktif", devKLhandlers.HandlerUpdateStatusKelainanAktif)
dev.GET("/md/kelainan/flagnonaktif", devKLhandlers.HandlerUpdateStatusKelainanNonAktif)
dev.GET("/md/kelainan/selected", devKLhandlers.HandlerShowMasterKelainanDetail)
dev.GET("/md/searchkelainandetail", devKLhandlers.HandlerShowMdKelainanDetailSearch)
dev.GET("/md/kelainandetailpagination", devKLhandlers.HandlerShowMdKelainanDetailPagination)
dev.POST("/md/kelainandetail/closeaddform", devKLhandlers.HandlerCloseFormAddDetail)
dev.POST("/md/kelainandetail/add", devKLhandlers.HandlerAddKelainanDetail)
dev.GET("/md/kelainandetail/opendelete", devKLhandlers.HandlerOpenDeleteFormDetail)
dev.POST("/md/kelainandetail/closedeleteform", devKLhandlers.HandlerCloseDeleteFormDetail)
dev.POST("/md/kelainandetail/delete", devKLhandlers.HandlerDeleteKelainanDetail)
dev.GET("/md/kelainandetail/getcehckbox", devKLhandlers.HandlerUpdateStatusKelainanDetail)
}

View File

@@ -8,11 +8,13 @@ type CustomCheckboxv1Prm struct {
HxIndicator string `default:"hxIndicator"`
HxInclude string `default:"hxInclude"`
HxTrigger string `default:"hxTrigger"`
HxSwap string `default:"hxSwap"`
Label string `default:"Label"`
Name string `default:"name"`
Text string `default:"text"`
// Type string `default:"text"`
Value string `default:""`
Status string `default:""`
ErrorMsg string `default:""`
ID string
}

View File

@@ -0,0 +1,97 @@
package models
import "github.com/a-h/templ"
type Kelainan struct {
Nomor string `db:"nomor"`
Mcu_KelainanGroupID int `db:"Mcu_KelainanGroupID"`
Mcu_KelainanGroupName string `db:"Mcu_KelainanGroupName"`
Mcu_KelainanGroupFlagActive string `db:"Mcu_KelainanGroupFlagActive"`
Mcu_KelainanGroupIsActive string `db:"Mcu_KelainanGroupIsActive"`
Mcu_KelainanGroupCreated string `db:"Mcu_KelainanGroupCreated"`
Mcu_KelainanGroupCreatedUserID string `db:"Mcu_KelainanGroupCreatedUserID"`
Mcu_KelainanGroupLastUpdated string `db:"Mcu_KelainanGroupLastUpdated"`
Mcu_KelainanGroupLastUpdatedUserID string `db:"Mcu_KelainanGroupLastUpdatedUserID"`
Mcu_KelainanGroupDeleted string `db:"Mcu_KelainanGroupDeleted"`
Mcu_KelainanGroupDeletedUserID string `db:"Mcu_KelainanGroupDeletedUserID"`
}
type KelainanFormComponent struct {
IDComponent string
Link string
HxTarget string
HxSwap string
HxInclude string
ModalID string
ModalTitle string
InputName CustomTextFieldv2Prm
InputCode CustomTextFieldv2Prm
InputID CustomTextFieldv2Prm
DialogBody templ.Component
DialogAction templ.Component
ButtonCLose templ.Component
}
type KelainanDetail struct {
Nomor string `db:"nomor"`
Mcu_KelainanID int `db:"Mcu_KelainanID"`
Mcu_KelainanName string `db:"Mcu_KelainanName"`
Mcu_KelainanClasification string `db:"Mcu_KelainanClasification"`
Mcu_KelainanMcu_KelainanGroupID string `db:"Mcu_KelainanMcu_KelainanGroupID"`
Mcu_KelainanFlagActive string `db:"Mcu_KelainanFlagActive"`
Mcu_KelainanIsActive string `db:"Mcu_KelainanIsActive"`
Mcu_KelainanUserID string `db:"Mcu_KelainanUserID"`
Mcu_KelainanCreated string `db:"Mcu_KelainanCreated"`
Mcu_KelainanCreatedUserID string `db:"Mcu_KelainanCreatedUserID"`
Mcu_KelainanLastUpdated string `db:"Mcu_KelainanLastUpdated"`
Mcu_KelainanLastUpdatedUserID string `db:"Mcu_KelainanLastUpdatedUserID"`
Mcu_KelainanDeleted string `db:"Mcu_KelainanDeleted"`
Mcu_KelainanDeletedUserID string `db:"Mcu_KelainanDeletedUserID"`
}
type CustomTextFieldSelected struct {
SwapOob string `default:"swapOob"`
Label string `default:"Label"`
Name string `default:"name"`
Placeholder string `default:"Placeholder"`
Type string `default:"text"`
Value string `default:""`
ErrorMsg string `default:""`
ID string
}
type KelainanDetailFormComponent struct {
IDComponent string
Link string
HxTarget string
HxSwap string
HxInclude string
ModalID string
ModalTitle string
InputName CustomTextFieldv2Prm
InputClassification CustomTextFieldv2Prm
InputID CustomTextFieldv2Prm
DialogBody templ.Component
DialogAction templ.Component
ButtonCLose templ.Component
}
type SwitchclassPrm struct {
Label string `default:"label"`
Type string `default:"type"`
Checked string `default:"Checked"`
Name string `default:"name"`
ID string
}
type ButtonPrm struct {
ID string
Label string `default:"default"`
Type string `default:"type"`
Class string `default:"class"`
Color string `default:"color"`
HxGet string
HxTarget string
HxSwap string
HxInclude string
}

View File

@@ -0,0 +1,399 @@
package dev_services
import (
"cpone/db"
"cpone/models"
dbx "cpone/package/database"
"fmt"
"math"
"strconv"
"strings"
"go.uber.org/zap"
)
func NewServicesMasterKelainan(uStore db.AppStore) *ServicesMasterKelainan {
return &ServicesMasterKelainan{
MasterKelainanStore: uStore,
}
}
type ServicesMasterKelainan struct {
MasterKelainanStore db.AppStore
}
func (su *ServicesMasterKelainan) GetListBreadCrumb(title string) (models.BreadCrumbV1, error) {
var ret models.BreadCrumbV1
dummyBreadcrumb := []models.BreadCrumbV1{
{
Title: "Master Pola Kelainan",
Item: []models.ItemBreadCrumbV1{
{
Item: "Dashboard",
Url: "/dev/dashboard",
},
{
Item: "Master",
Url: "/dev/master",
},
{
Item: "Pola Kelainan",
Url: "",
},
},
},
{
Title: "Master User",
Item: []models.ItemBreadCrumbV1{
{
Item: "Dashboard",
Url: "/dev/dashboard",
},
{
Item: "Master",
Url: "/dev/master",
},
{
Item: "User",
Url: "",
},
},
},
}
for _, breadcrumb := range dummyBreadcrumb {
// if utils.Contains(breadcrumb.Title, title) {
// ret = breadcrumb
// return ret, nil
// }
if breadcrumb.Title == title {
ret = breadcrumb
return ret, nil
}
}
return ret, nil
}
// master group kelainan
func (su *ServicesMasterKelainan) GetListMasterKelainan(search string, currentPage int, rowPerPage int) ([]models.Kelainan, int, error) {
var kelainanList []models.Kelainan
var totalData int
offset := (currentPage - 1) * rowPerPage
prm := "%" + strings.TrimSpace(search) + "%"
querytotal := `
SELECT COUNT(*)
FROM mcu_kelainangroup
WHERE Mcu_KelainanGroupIsActive = 'Y'
AND (Mcu_KelainanGroupName LIKE ?)
`
if err := dbx.Handlex.Get(&totalData, querytotal, prm); err != nil {
return nil, 0, fmt.Errorf("error query database: %v", err)
}
query := `
SELECT
ROW_NUMBER() OVER (ORDER BY Mcu_KelainanGroupID DESC) AS nomor,
Mcu_KelainanGroupID,
Mcu_KelainanGroupName,
Mcu_KelainanGroupFlagActive,
Mcu_KelainanGroupIsActive,
Mcu_KelainanGroupCreated,
Mcu_KelainanGroupLastUpdated
FROM mcu_kelainangroup
WHERE Mcu_KelainanGroupIsActive = 'Y'
AND (Mcu_KelainanGroupName LIKE ?)
order by Mcu_KelainanGroupID DESC
LIMIT ? OFFSET ?
`
if err := dbx.Handlex.Select(&kelainanList, query, prm, rowPerPage, offset); err != nil {
return nil, 0, fmt.Errorf("error query database: %v", err)
}
totalPage := int(math.Ceil(float64(totalData) / float64(rowPerPage)))
return kelainanList, totalPage, nil
}
func (su *ServicesMasterKelainan) GetKelainanByID(id string) (models.Kelainan, error) {
logger, _ := zap.NewProduction()
var data models.Kelainan
err := dbx.Handlex.Get(&data, `SELECT * FROM mcu_kelainangroup
WHERE Mcu_KelainanGroupID = ?`, id)
if err != nil {
defer logger.Sync()
logger.Error("Error get data by id",
zap.String("ID", id),
)
return data, fmt.Errorf("QUERY_FAILED")
}
return data, nil
}
func (su *ServicesMasterKelainan) AddKelainan(name string) (models.Kelainan, error) {
logger, _ := zap.NewProduction()
var data models.Kelainan
var datacek []models.Kelainan
qryCek := `SELECT Mcu_KelainanGroupName FROM mcu_kelainangroup
WHERE Mcu_KelainanGroupName = ? AND Mcu_KelainanGroupIsActive = 'Y'`
err := dbx.Handlex.Select(&datacek, qryCek, name)
if err != nil {
defer logger.Sync()
logger.Error("Error cek data by name",
zap.Any("datacek", datacek),
)
return data, fmt.Errorf("QUERY_FAILED")
}
if len(datacek) > 0 {
defer logger.Sync()
logger.Error("Name already taken by another data",
zap.String("name", name),
)
return data, fmt.Errorf("name sudah dipakai")
}
qry := `INSERT INTO mcu_kelainangroup(
Mcu_KelainanGroupName,
Mcu_KelainanGroupCreated,
Mcu_KelainanGroupLastUpdated) VALUES(?,NOW(),NOW())`
rst := dbx.Handlex.MustExec(qry, name)
insertedID, err := rst.LastInsertId()
if err != nil {
defer logger.Sync()
logger.Error("Error Insert kelainan",
zap.String("name", name),
)
return data, fmt.Errorf("QUERY_FAILED")
}
s := strconv.Itoa(int(insertedID))
data, err = su.GetKelainanByID(s)
if err != nil {
defer logger.Sync()
logger.Error("Error get kelainan by id",
zap.String("name", name),
)
return data, fmt.Errorf("QUERY_FAILED")
}
return data, nil
}
func (su *ServicesMasterKelainan) DeleteKelainan(id string) (models.Kelainan, error) {
logger, _ := zap.NewProduction()
var data models.Kelainan
qry := `UPDATE mcu_kelainangroup
SET Mcu_KelainanGroupIsActive = 'N',
Mcu_KelainanGroupLastUpdated = NOW()
WHERE Mcu_KelainanGroupID = ?`
rst := dbx.Handlex.MustExec(qry, id)
_, err := rst.RowsAffected()
if err != nil {
defer logger.Sync()
logger.Error("Error delete kelainan grup",
zap.String("id", id),
)
return data, fmt.Errorf("QUERY_FAILED")
}
data, err = su.GetKelainanByID(id)
if err != nil {
defer logger.Sync()
logger.Error("Error get kelainan by id",
zap.String("id", id),
)
return data, fmt.Errorf("QUERY_FAILED")
}
return data, nil
}
func (su *ServicesMasterKelainan) UpdateFlagStatusKelainan(id string, status string) (models.Kelainan, error) {
logger, _ := zap.NewProduction()
var data models.Kelainan
if status == "N" {
qry := `UPDATE mcu_kelainangroup
SET Mcu_KelainanGroupFlagActive = 'Y',
Mcu_KelainanGroupLastUpdated = NOW()
WHERE Mcu_KelainanGroupID = ?`
rst := dbx.Handlex.MustExec(qry, id)
_, err := rst.RowsAffected()
if err != nil {
defer logger.Sync()
logger.Error("Error update status",
zap.String("id", id),
zap.String("status", status),
)
return data, fmt.Errorf("QUERY_FAILED")
}
} else {
qry := `UPDATE mcu_kelainangroup
SET Mcu_KelainanGroupFlagActive = 'N',
Mcu_KelainanGroupLastUpdated = NOW()
WHERE Mcu_KelainanGroupID = ?`
rst := dbx.Handlex.MustExec(qry, id)
_, err := rst.RowsAffected()
if err != nil {
defer logger.Sync()
logger.Error("Error update status",
zap.String("id", id),
zap.String("status", status),
)
return data, fmt.Errorf("QUERY_FAILED")
}
}
return data, nil
}
// end master group kelainan
// master kelainan detail
func (su *ServicesMasterKelainan) GetListMasterKelainanDetail(id string, searchdetail string, currentPage int, rowPerPage int) ([]models.KelainanDetail, int, error) {
var KelainanDetailList []models.KelainanDetail
var totalData int
offset := (currentPage - 1) * rowPerPage
prm := "%" + strings.TrimSpace(searchdetail) + "%"
querytotal := `SELECT COUNT(*)
FROM mcu_kelainan
WHERE Mcu_KelainanIsActive = 'Y'
AND Mcu_KelainanMcu_KelainanGroupID = ?
AND (Mcu_KelainanName LIKE ? OR Mcu_KelainanClasification LIKE ?)`
if err := dbx.Handlex.Get(&totalData, querytotal, id, prm, prm); err != nil {
return nil, 0, fmt.Errorf("error query database: %v", err)
}
query := `SELECT
ROW_NUMBER() OVER (ORDER BY Mcu_KelainanID DESC) AS nomor,
Mcu_KelainanID,
Mcu_KelainanName,
Mcu_KelainanClasification,
Mcu_KelainanMcu_KelainanGroupID,
CASE
WHEN Mcu_KelainanFlagActive = 'Y' THEN 'on'
ELSE Mcu_KelainanFlagActive
END AS Mcu_KelainanFlagActive,
Mcu_KelainanUserID,
Mcu_KelainanCreated,
Mcu_KelainanLastUpdated
FROM mcu_kelainan
WHERE Mcu_KelainanIsActive = 'Y'
AND Mcu_KelainanMcu_KelainanGroupID = ?
AND (Mcu_KelainanName LIKE ? OR Mcu_KelainanClasification LIKE ?)
ORDER BY Mcu_KelainanID DESC
LIMIT ? OFFSET ?`
if err := dbx.Handlex.Select(&KelainanDetailList, query, id, prm, prm, rowPerPage, offset); err != nil {
return nil, 0, fmt.Errorf("error query database: %v", err)
}
totalPage := int(math.Ceil(float64(totalData) / float64(rowPerPage)))
return KelainanDetailList, totalPage, nil
}
func (su *ServicesMasterKelainan) GetKelainanDetailByID(id string) (models.KelainanDetail, error) {
logger, _ := zap.NewProduction()
var data models.KelainanDetail
err := dbx.Handlex.Get(&data, `SELECT * FROM mcu_kelainan
WHERE Mcu_KelainanID = ?`, id)
if err != nil {
defer logger.Sync()
logger.Error("Error get data by id",
zap.String("ID", id),
)
return data, fmt.Errorf("QUERY_FAILED")
}
return data, nil
}
func (su *ServicesMasterKelainan) AddKelainanDetail(name string, nameclassification string, selectedid string) (models.KelainanDetail, error) {
logger, _ := zap.NewProduction()
var data models.KelainanDetail
qry := `INSERT INTO mcu_kelainan(
Mcu_KelainanName,
Mcu_KelainanClasification,
Mcu_KelainanMcu_KelainanGroupID,
Mcu_KelainanCreated,
Mcu_KelainanLastUpdated) VALUES(?,?,?,NOW(),NOW())`
rst := dbx.Handlex.MustExec(qry, name, nameclassification, selectedid)
_, err := rst.LastInsertId()
if err != nil {
defer logger.Sync()
logger.Error("Error Insert Kelainan Detail",
zap.String("name", name),
zap.String("nameclasification", nameclassification),
zap.Any("selectedid", selectedid),
)
return data, fmt.Errorf("QUERY_FAILED")
}
return data, nil
}
func (su *ServicesMasterKelainan) DeleteKelainanDetail(id string) (models.KelainanDetail, error) {
logger, _ := zap.NewProduction()
var data models.KelainanDetail
qry := `UPDATE mcu_kelainan
SET Mcu_KelainanIsActive = 'N',
Mcu_KelainanLastUpdated = NOW()
WHERE Mcu_KelainanID = ?`
rst := dbx.Handlex.MustExec(qry, id)
_, err := rst.RowsAffected()
if err != nil {
defer logger.Sync()
logger.Error("Error delete kelainan",
zap.String("id", id),
)
return data, fmt.Errorf("QUERY_FAILED")
}
data, err = su.GetKelainanDetailByID(id)
if err != nil {
defer logger.Sync()
logger.Error("Error get kelainan by id",
zap.String("id", id),
)
return data, fmt.Errorf("QUERY_FAILED")
}
return data, nil
}
func (su *ServicesMasterKelainan) UpdateFlagStatusKelainanDetail(selectedCheck []string) (models.KelainanDetail, error) {
logger, _ := zap.NewProduction()
var data models.KelainanDetail
defer logger.Sync()
logger.Info("CEK PARAMETER",
zap.Any("selectedCheck", selectedCheck))
return data, nil
}

View File

@@ -0,0 +1,32 @@
package masterkelainan
import "cpone/models"
templ CustomTextFieldSelected(inp models.CustomTextFieldSelected) {
<div class="form-group">
<label
if inp.Type == "hidden" {
class="text-black d-none"
} else {
class="text-black"
}
style="font-family: Poppins; font-weight: 600;"
>{ inp.Label } </label>
<input
id={ inp.Name }
hx-swap-oob="true"
name={ inp.Name }
type={ inp.Type }
placeholder={ inp.Placeholder }
value={ inp.Value }
if inp.ErrorMsg =="" {
class="form-control bg-field border-0 h-auto py-6 px-6 rounded-lg"
} else {
class="form-control bg-field border-1 h-auto py-6 px-6 rounded-lg is-invalid"
}
/>
<div class="invalid-feedback text-danger mt-3 ml-2">
{ inp.ErrorMsg }
</div>
</div>
}

View File

@@ -0,0 +1,158 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.663
package masterkelainan
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
import "context"
import "io"
import "bytes"
import "cpone/models"
func CustomTextFieldSelected(inp models.CustomTextFieldSelected) 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=\"form-group\"><label")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if inp.Type == "hidden" {
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" class=\"text-black d-none\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
} else {
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" class=\"text-black\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" style=\"font-family: Poppins; font-weight: 600;\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var2 string
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(inp.Label)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\custometextfieldselected.templ`, Line: 14, Col: 14}
}
_, 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("</label> <input id=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(inp.Name)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\custometextfieldselected.templ`, Line: 16, Col: 16}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-swap-oob=\"true\" name=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var4 string
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(inp.Name)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\custometextfieldselected.templ`, Line: 18, Col: 18}
}
_, 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("\" type=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(inp.Type)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\custometextfieldselected.templ`, Line: 19, Col: 18}
}
_, 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("\" placeholder=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var6 string
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(inp.Placeholder)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\custometextfieldselected.templ`, Line: 20, Col: 32}
}
_, 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("\" value=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var7 string
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(inp.Value)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\custometextfieldselected.templ`, Line: 21, Col: 20}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if inp.ErrorMsg == "" {
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" class=\"form-control bg-field border-0 h-auto py-6 px-6 rounded-lg\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
} else {
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" class=\"form-control bg-field border-1 h-auto py-6 px-6 rounded-lg is-invalid\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("><div class=\"invalid-feedback text-danger mt-3 ml-2\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var8 string
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(inp.ErrorMsg)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\custometextfieldselected.templ`, Line: 29, Col: 17}
}
_, 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("</div></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
})
}

View File

@@ -0,0 +1,360 @@
package masterkelainan
import (
"cpone/layout"
"cpone/models"
"cpone/component/customtextfield"
)
templ ContentMasterKelainan(
tableID string,
paginationID string,
searchID string,
dialogAddID string,
dialogAddBodyID string,
dialogDeleteID string,
dialogDeleteBodyID string,
tableDetailID string,
paginationDetailID string,
searchDetailID string,
dialogDetailAddID string,
dialogDetailAddBodyID string,
dialogDetailDeleteID string,
dialogDetailDeleteBodyID string,
buttonCheckboxID string,
breadcrumb templ.Component,
tablecontent templ.Component,
filterComponent templ.Component,
paginationComponent templ.Component,
modalAddform templ.Component,
modalDeleteForm templ.Component,
tabledetailcontent templ.Component,
filterDetailComponent templ.Component,
paginationDetailComponent templ.Component,
buttonDetailCheckbox templ.Component,
modalDetailAddForm templ.Component,
modalDetailForm 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: "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: "paginationDetailID",
Name: "paginationDetailID",
Type: "hidden",
Value: paginationDetailID})
@customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "searchDetailID",
Name: "searchDetailID",
Type: "hidden",
Value: searchDetailID})
@CustomTextFieldSelected(models.CustomTextFieldSelected{
ID: "selectedID",
Name: "selectedID",
Type: "hidden",
Value: "0"})
@customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "dialogDetailAddID",
Name: "dialogDetailAddID",
Type: "hidden",
Value: dialogDetailAddID})
@customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "dialogDetailAddBodyID",
Name: "dialogDetailAddBodyID",
Type: "hidden",
Value: dialogDetailAddBodyID})
@customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "dialogDetailDeleteID",
Name: "dialogDetailDeleteID",
Type: "hidden",
Value: dialogDetailDeleteID})
@customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "dialogDetailDeleteBodyID",
Name: "dialogDetailDeleteBodyID",
Type: "hidden",
Value: dialogDetailDeleteBodyID})
@customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "buttonCheckboxID",
Name: "buttonCheckboxID",
Type: "hidden",
Value: buttonCheckboxID})
<div class="row align-items-center mb-10">
<div class="col-md-10 col-sm-12 p-0 ">
@breadcrumb
</div>
</div>
<div class="row">
<div class="col-lg-6">
<div class="row">
<div class="col-lg-10">
@filterComponent
</div>
<div class="col-md-2 mt-3 d-none d-lg-block d-xl-block d-md-block d-sm-none">
<div class="d-flex">
<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">
@tablecontent
@paginationComponent
@modalAddform
@modalDeleteForm
<div id="loading-child" class=" rounded bg-transparent">
// <div class="spinner spinner-lg spinner-primary"></div>
<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>
</div>
<div class="col-lg-6" style="border-left: 1px dashed #ddd">
<div class="row">
<div class="col-lg-10">
@filterDetailComponent
</div>
<div class="col-md-2 mt-3 d-none d-lg-block d-xl-block d-md-block d-sm-none">
<div class="d-flex">
<button
type="button"
class="btn btn-primary"
data-toggle="modal"
data-target={ "#" + dialogDetailAddID }
>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={ "#" + dialogDetailAddID }
>Add New</button>
</div>
</div>
<div id="loading-parent-detail" class=" rounded">
<form hx-get="/dev/md/kelainandetail/getcehckbox">
@tabledetailcontent
@paginationDetailComponent
@buttonDetailCheckbox
</form>
@modalDetailAddForm
@modalDetailForm
<div id="loading-child-detail" class=" rounded bg-transparent">
// <div class="spinner spinner-lg spinner-primary"></div>
<div id="loading-spinner-detail" 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="loadingcontentdetail"></div>
</div>
</div>
</div>
}
templ CssKelainan() {
<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;
}
.selected {
background-color: #dfe3e8;
}
.dot-text {
position: relative;
padding-left: 1.5em; /* Menambahkan padding untuk memberi ruang pada titik */
}
.dot-text::before {
content: '•'; /* Menambahkan titik di depan teks */
position: absolute;
left: 1em; /* Atur posisi titik */
top: 0;
transform: translateX(-100%);
}
</style>
}
templ JsMdKelainan() {
<script>
function onLoadingStart() {
// 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");
// Additional logic when loading starts
}
function onLoadingEnd() {
console.log('Loading ended');
// 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");
}
document.addEventListener('htmx:beforeRequest', function(event) {
var indicator = document.querySelector('#loadingcontent');
console.log(event.detail.xhr)
console.log(event.detail.elt)
if (indicator) {
onLoadingStart();
}
});
document.addEventListener('htmx:afterRequest', function(event) {
var indicator = document.querySelector('#loadingcontent');
if (indicator) {
onLoadingEnd();
}
});
// detail
document.addEventListener('htmx:beforeRequest', function(event) {
var indicator = document.querySelector('#loadingcontentdetail');
console.log(event.detail.xhr)
console.log(event.detail.elt)
if (indicator) {
onLoadingStart();
}
});
document.addEventListener('htmx:afterRequest', function(event) {
var indicator = document.querySelector('#loadingcontentdetail');
if (indicator) {
onLoadingEnd();
}
});
</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");
}
// kelainan detail
script BeforeRequestContentDetail() {
const loadingParentDetail = document.getElementById("loading-parent-detail");
const loadingChildDetail = document.getElementById("loading-child-detail");
const loadingSpinnerDetail = document.getElementById("loading-spinner-detail");
loadingParentDetail.classList.add("overlay");
loadingParentDetail.classList.add("overlay-block");
loadingChildDetail.classList.add("overlay-layer");
loadingSpinnerDetail.classList.remove("d-none");
}
script AfterRequestContentDetail() {
const loadingParentDetail = document.getElementById("loading-parent-detail");
const loadingChildDetail = document.getElementById("loading-child-detail");
const loadingSpinnerDetail = document.getElementById("loading-spinner-detail");
loadingParentDetail.classList.remove("overlay");
loadingParentDetail.classList.remove("overlay-block");
loadingChildDetail.classList.remove("overlay-layer");
loadingSpinnerDetail.classList.add("d-none");
}
templ ShowKelainan(
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
}
}

View File

@@ -0,0 +1,473 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.663
package masterkelainan
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
import "context"
import "io"
import "bytes"
import (
"cpone/component/customtextfield"
"cpone/layout"
"cpone/models"
)
func ContentMasterKelainan(
tableID string,
paginationID string,
searchID string,
dialogAddID string,
dialogAddBodyID string,
dialogDeleteID string,
dialogDeleteBodyID string,
tableDetailID string,
paginationDetailID string,
searchDetailID string,
dialogDetailAddID string,
dialogDetailAddBodyID string,
dialogDetailDeleteID string,
dialogDetailDeleteBodyID string,
buttonCheckboxID string,
breadcrumb templ.Component,
tablecontent templ.Component,
filterComponent templ.Component,
paginationComponent templ.Component,
modalAddform templ.Component,
modalDeleteForm templ.Component,
tabledetailcontent templ.Component,
filterDetailComponent templ.Component,
paginationDetailComponent templ.Component,
buttonDetailCheckbox templ.Component,
modalDetailAddForm templ.Component,
modalDetailForm 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: "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: "paginationDetailID",
Name: "paginationDetailID",
Type: "hidden",
Value: paginationDetailID}).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "searchDetailID",
Name: "searchDetailID",
Type: "hidden",
Value: searchDetailID}).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = CustomTextFieldSelected(models.CustomTextFieldSelected{
ID: "selectedID",
Name: "selectedID",
Type: "hidden",
Value: "0"}).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "dialogDetailAddID",
Name: "dialogDetailAddID",
Type: "hidden",
Value: dialogDetailAddID}).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "dialogDetailAddBodyID",
Name: "dialogDetailAddBodyID",
Type: "hidden",
Value: dialogDetailAddBodyID}).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "dialogDetailDeleteID",
Name: "dialogDetailDeleteID",
Type: "hidden",
Value: dialogDetailDeleteID}).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "dialogDetailDeleteBodyID",
Name: "dialogDetailDeleteBodyID",
Type: "hidden",
Value: dialogDetailDeleteBodyID}).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "buttonCheckboxID",
Name: "buttonCheckboxID",
Type: "hidden",
Value: buttonCheckboxID}).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><div class=\"row\"><div class=\"col-lg-6\"><div class=\"row\"><div class=\"col-lg-10\">")
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 = templ_7745c5c3_Buffer.WriteString("</div><div class=\"col-md-2 mt-3 d-none d-lg-block d-xl-block d-md-block d-sm-none\"><div class=\"d-flex\"><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\mdpolakelainan\masterkelainan.templ`, Line: 121, Col: 39}
}
_, 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</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\mdpolakelainan\masterkelainan.templ`, Line: 130, Col: 38}
}
_, 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</button></div></div><div id=\"loading-parent\" class=\" rounded\">")
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 = paginationComponent.Render(ctx, templ_7745c5c3_Buffer)
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 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></div><div class=\"col-lg-6\" style=\"border-left: 1px dashed #ddd\"><div class=\"row\"><div class=\"col-lg-10\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = filterDetailComponent.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 mt-3 d-none d-lg-block d-xl-block d-md-block d-sm-none\"><div class=\"d-flex\"><button type=\"button\" class=\"btn btn-primary\" data-toggle=\"modal\" data-target=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var4 string
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs("#" + dialogDetailAddID)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\masterkelainan.templ`, Line: 159, 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("\">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=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs("#" + dialogDetailAddID)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\masterkelainan.templ`, Line: 168, Col: 44}
}
_, 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("\">Add New</button></div></div><div id=\"loading-parent-detail\" class=\" rounded\"><form hx-get=\"/dev/md/kelainandetail/getcehckbox\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = tabledetailcontent.Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = paginationDetailComponent.Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = buttonDetailCheckbox.Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</form>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = modalDetailAddForm.Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = modalDetailForm.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-detail\" class=\" rounded bg-transparent\"><div id=\"loading-spinner-detail\" 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=\"loadingcontentdetail\"></div></div></div></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 CssKelainan() templ.Component {
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
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("<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\t.selected {\r\n\t\tbackground-color: #dfe3e8;\r\n\t}\r\n\t.dot-text {\r\n\t\tposition: relative;\r\n\t\tpadding-left: 1.5em; /* Menambahkan padding untuk memberi ruang pada titik */\r\n\t}\r\n\r\n\t.dot-text::before {\r\n\t\tcontent: '•'; /* Menambahkan titik di depan teks */\r\n\t\tposition: absolute;\r\n\t\tleft: 1em; /* Atur posisi titik */\r\n\t\ttop: 0;\r\n\t\ttransform: translateX(-100%);\r\n\t}\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 JsMdKelainan() templ.Component {
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
if !templ_7745c5c3_IsBuffer {
templ_7745c5c3_Buffer = templ.GetBuffer()
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_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("<script>\r\n function onLoadingStart() {\r\n // const loadingParent = document.getElementById(\"loading-parent\");\r\n\t\t\t// const loadingChild = document.getElementById(\"loading-child\");\r\n\t\t\t// const loadingSpinner = document.getElementById(\"loading-spinner\");\r\n\r\n\t\t\t// loadingParent.classList.add(\"overlay\");\r\n\t\t\t// loadingParent.classList.add(\"overlay-block\");\r\n\t\t\t// loadingChild.classList.add(\"overlay-layer\");\r\n\t\t\t// loadingSpinner.classList.remove(\"d-none\");\r\n\r\n // Additional logic when loading starts\r\n }\r\n\r\n function onLoadingEnd() {\r\n console.log('Loading ended');\r\n // const loadingParent = document.getElementById(\"loading-parent\");\r\n\t\t\t// const loadingChild = document.getElementById(\"loading-child\");\r\n\t\t\t// const loadingSpinner = document.getElementById(\"loading-spinner\");\r\n\r\n\t\t\t// loadingParent.classList.remove(\"overlay\");\r\n\t\t\t// loadingParent.classList.remove(\"overlay-block\");\r\n\t\t\t// loadingChild.classList.remove(\"overlay-layer\");\r\n\t\t\t// loadingSpinner.classList.add(\"d-none\");\r\n }\r\n\r\n document.addEventListener('htmx:beforeRequest', function(event) {\r\n var indicator = document.querySelector('#loadingcontent');\r\n\t\t\tconsole.log(event.detail.xhr)\r\n\t\t\tconsole.log(event.detail.elt)\r\n if (indicator) {\r\n onLoadingStart();\r\n }\r\n });\r\n\r\n document.addEventListener('htmx:afterRequest', function(event) {\r\n var indicator = document.querySelector('#loadingcontent');\r\n if (indicator) {\r\n onLoadingEnd();\r\n }\r\n });\r\n\r\n // detail\r\n document.addEventListener('htmx:beforeRequest', function(event) {\r\n var indicator = document.querySelector('#loadingcontentdetail');\r\n\t\t\tconsole.log(event.detail.xhr)\r\n\t\t\tconsole.log(event.detail.elt)\r\n if (indicator) {\r\n onLoadingStart();\r\n }\r\n });\r\n\r\n document.addEventListener('htmx:afterRequest', function(event) {\r\n var indicator = document.querySelector('#loadingcontentdetail');\r\n if (indicator) {\r\n onLoadingEnd();\r\n }\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_911f`,
Function: `function __templ_BeforeRequestContent_911f(){const loadingParent = document.getElementById("loading-parent");
const loadingChild = document.getElementById("loading-child");
const loadingSpinner = document.getElementById("loading-spinner");
loadingParent.classList.add("overlay");
loadingParent.classList.add("overlay-block");
loadingChild.classList.add("overlay-layer");
loadingSpinner.classList.remove("d-none");
}`,
Call: templ.SafeScript(`__templ_BeforeRequestContent_911f`),
CallInline: templ.SafeScriptInline(`__templ_BeforeRequestContent_911f`),
}
}
func AfterRequestContent() templ.ComponentScript {
return templ.ComponentScript{
Name: `__templ_AfterRequestContent_b16e`,
Function: `function __templ_AfterRequestContent_b16e(){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_b16e`),
CallInline: templ.SafeScriptInline(`__templ_AfterRequestContent_b16e`),
}
}
// kelainan detail
func BeforeRequestContentDetail() templ.ComponentScript {
return templ.ComponentScript{
Name: `__templ_BeforeRequestContentDetail_74e6`,
Function: `function __templ_BeforeRequestContentDetail_74e6(){const loadingParentDetail = document.getElementById("loading-parent-detail");
const loadingChildDetail = document.getElementById("loading-child-detail");
const loadingSpinnerDetail = document.getElementById("loading-spinner-detail");
loadingParentDetail.classList.add("overlay");
loadingParentDetail.classList.add("overlay-block");
loadingChildDetail.classList.add("overlay-layer");
loadingSpinnerDetail.classList.remove("d-none");
}`,
Call: templ.SafeScript(`__templ_BeforeRequestContentDetail_74e6`),
CallInline: templ.SafeScriptInline(`__templ_BeforeRequestContentDetail_74e6`),
}
}
func AfterRequestContentDetail() templ.ComponentScript {
return templ.ComponentScript{
Name: `__templ_AfterRequestContentDetail_0b0a`,
Function: `function __templ_AfterRequestContentDetail_0b0a(){const loadingParentDetail = document.getElementById("loading-parent-detail");
const loadingChildDetail = document.getElementById("loading-child-detail");
const loadingSpinnerDetail = document.getElementById("loading-spinner-detail");
loadingParentDetail.classList.remove("overlay");
loadingParentDetail.classList.remove("overlay-block");
loadingChildDetail.classList.remove("overlay-layer");
loadingSpinnerDetail.classList.add("d-none");
}`,
Call: templ.SafeScript(`__templ_AfterRequestContentDetail_0b0a`),
CallInline: templ.SafeScriptInline(`__templ_AfterRequestContentDetail_0b0a`),
}
}
func ShowKelainan(
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_Var8 := templ.GetChildren(ctx)
if templ_7745c5c3_Var8 == nil {
templ_7745c5c3_Var8 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Var9 := 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_Var9), 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
})
}

View File

@@ -0,0 +1,195 @@
package masterkelainan
import (
"cpone/models"
"cpone/component/modal"
"cpone/component/customtextfield"
)
templ KelainanDetailForm(data models.KelainanDetailFormComponent) {
<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-on::before-request={ HandleFormDetailBeforeRequest() }
hx-on::after-request={ HandleFormDetailAfterRequest() }
>
@modalcomponent.Modal(data.ModalID,
data.ModalTitle,
data.DialogBody,
data.DialogAction,
data.ButtonCLose)
</form>
</div>
}
script HandleFormDetailBeforeRequest() {
// console.log("handle disable btn add");
const boxes = document.querySelectorAll('.btnaddact');
for (let i = 0; i < boxes.length; i++) {
boxes[i].setAttribute('disabled', 'true');
}
}
script HandleFormDetailAfterRequest() {
// console.log("handle enable btn add");
const boxes = document.querySelectorAll('.btnaddact');
for (let i = 0; i < boxes.length; i++) {
boxes[i].removeAttribute('disabled');
}
}
templ BodyFormKelainanDetail(inputId models.CustomTextFieldv2Prm,
inputName models.CustomTextFieldv2Prm,
inputSwitch models.SwitchclassPrm,
inputClassification models.CustomTextFieldv2Prm,
componentID string,
hxOnLoad templ.ComponentScript) {
<div id={ componentID } hx-on::load={ hxOnLoad }>
@customtextfield.CustomTextFieldv2(
inputId)
@customtextfield.CustomTextFieldv2(
inputName)
@MainSwitch(inputSwitch)
<div id="classificationField">
@customtextfield.CustomTextFieldv2(
inputClassification)
</div>
</div>
}
templ MainSwitch(inp models.SwitchclassPrm) {
<div class="form-group">
<label class="text-black" style="font-family: Poppins; font-weight: 600;">{ inp.Label }</label>
<span class="switch switch-sm switch-success">
<label>
<input
id={ inp.Name }
type={ inp.Type }
checked={ inp.Checked }
name={ inp.Name }
hx-on:change={ toggleClassification(inp.Name) }
/>
<span></span>
</label>
</span>
</div>
}
script toggleClassification(idswitch string) {
var checkbox = document.getElementById(idswitch);
// console.log(checkbox)
var classificationField = document.getElementById("classificationField");
var classificationInput = document.getElementById("classificationname");
// console.log(classificationField)
if (checkbox.checked) {
classificationField.style.display = "block";
} else {
classificationField.style.display = "none";
classificationInput.value = "";
}
}
script JsHideModalDetail(modalID string) {
$(modalID).modal('hide')
}
script JsShowModalDetail(modalID string) {
$(modalID).modal('show')
}
templ ActionFormKelainanDetail(LinkClose string, targetClose string, hxSwapClose string, modalID string) {
<div>
<button
hx-on::after-request={ JsHideModalDetail(modalID) }
hx-post={ LinkClose }
hx-target={ targetClose }
hx-swap={ hxSwapClose }
type="button"
class="btn btn-outline-secondary font-weight-bolder rounded-lg mr-4 btnaddact"
data-dismiss="modal"
>
Batal
</button>
<button
type="submit"
class="btn btn-primary btn-shadow font-weight-bold rounded-lg btnaddact"
>
Simpan
</button>
</div>
}
templ BtnCloseFormKelainanDetail(LinkClose string, targetClose string, hxSwapClose string, modalID string) {
<button
hx-post={ LinkClose }
hx-target={ targetClose }
hx-swap={ hxSwapClose }
type="button"
hx-on::after-request={ JsHideModalDetail(modalID) }
class="close btnaddact"
data-dismiss="modal"
aria-label="Close"
>
<i aria-hidden="true" class="ki ki-close"></i>
</button>
}
templ DeleteConfirmationBodyDetail(inputId models.CustomTextFieldv2Prm,
componentID string,
message string,
datHeader []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 datHeader {
<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 ActionFormKelainanDetailDelete(LinkClose string, targetClose string, hxSwapClose string, modalID string) {
<div>
<button
hx-on::after-request={ JsHideModalDetail(modalID) }
hx-post={ LinkClose }
hx-target={ targetClose }
hx-swap={ hxSwapClose }
type="button"
class="btn btn-outline-secondary font-weight-bolder rounded-lg mr-4 btnaddact"
data-dismiss="modal"
>
Batal
</button>
<button
type="submit"
class="btn btn-primary btn-shadow font-weight-bold rounded-lg btnaddact"
>
Yakin
</button>
</div>
}

View File

@@ -0,0 +1,763 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.663
package masterkelainan
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
import "context"
import "io"
import "bytes"
import (
"cpone/component/customtextfield"
"cpone/component/modal"
"cpone/models"
)
func KelainanDetailForm(data models.KelainanDetailFormComponent) 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, HandleFormDetailBeforeRequest(), HandleFormDetailAfterRequest())
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\mdpolakelainan\mdkelainandetailformmodal.templ`, Line: 12, Col: 24}
}
_, 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\mdpolakelainan\mdkelainandetailformmodal.templ`, Line: 13, Col: 22}
}
_, 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\mdpolakelainan\mdkelainandetailformmodal.templ`, Line: 15, Col: 28}
}
_, 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\mdpolakelainan\mdkelainandetailformmodal.templ`, Line: 16, Col: 24}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" 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\mdpolakelainan\mdkelainandetailformmodal.templ`, Line: 17, Col: 30}
}
_, 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-on::before-request=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var7 templ.ComponentScript = HandleFormDetailBeforeRequest()
_, 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 = HandleFormDetailAfterRequest()
_, 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
}
templ_7745c5c3_Err = modalcomponent.Modal(data.ModalID,
data.ModalTitle,
data.DialogBody,
data.DialogAction,
data.ButtonCLose).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</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 HandleFormDetailBeforeRequest() templ.ComponentScript {
return templ.ComponentScript{
Name: `__templ_HandleFormDetailBeforeRequest_6266`,
Function: `function __templ_HandleFormDetailBeforeRequest_6266(){// console.log("handle disable btn add");
const boxes = document.querySelectorAll('.btnaddact');
for (let i = 0; i < boxes.length; i++) {
boxes[i].setAttribute('disabled', 'true');
}
}`,
Call: templ.SafeScript(`__templ_HandleFormDetailBeforeRequest_6266`),
CallInline: templ.SafeScriptInline(`__templ_HandleFormDetailBeforeRequest_6266`),
}
}
func HandleFormDetailAfterRequest() templ.ComponentScript {
return templ.ComponentScript{
Name: `__templ_HandleFormDetailAfterRequest_4cc7`,
Function: `function __templ_HandleFormDetailAfterRequest_4cc7(){// console.log("handle enable btn add");
const boxes = document.querySelectorAll('.btnaddact');
for (let i = 0; i < boxes.length; i++) {
boxes[i].removeAttribute('disabled');
}
}`,
Call: templ.SafeScript(`__templ_HandleFormDetailAfterRequest_4cc7`),
CallInline: templ.SafeScriptInline(`__templ_HandleFormDetailAfterRequest_4cc7`),
}
}
func BodyFormKelainanDetail(inputId models.CustomTextFieldv2Prm,
inputName models.CustomTextFieldv2Prm,
inputSwitch models.SwitchclassPrm,
inputClassification models.CustomTextFieldv2Prm,
componentID string,
hxOnLoad templ.ComponentScript) templ.Component {
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
if !templ_7745c5c3_IsBuffer {
templ_7745c5c3_Buffer = templ.GetBuffer()
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var9 := templ.GetChildren(ctx)
if templ_7745c5c3_Var9 == nil {
templ_7745c5c3_Var9 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Err = templ.RenderScriptItems(ctx, templ_7745c5c3_Buffer, hxOnLoad)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<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\mdpolakelainan\mdkelainandetailformmodal.templ`, Line: 57, Col: 22}
}
_, 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 = customtextfield.CustomTextFieldv2(
inputName).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = MainSwitch(inputSwitch).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div id=\"classificationField\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = customtextfield.CustomTextFieldv2(
inputClassification).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
}
if !templ_7745c5c3_IsBuffer {
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
}
return templ_7745c5c3_Err
})
}
func MainSwitch(inp models.SwitchclassPrm) 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 class=\"form-group\"><label class=\"text-black\" style=\"font-family: Poppins; font-weight: 600;\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var13 string
templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(inp.Label)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainandetailformmodal.templ`, Line: 72, Col: 87}
}
_, 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("</label> <span class=\"switch switch-sm switch-success\"><label>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templ.RenderScriptItems(ctx, templ_7745c5c3_Buffer, toggleClassification(inp.Name))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<input id=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var14 string
templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(inp.Name)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainandetailformmodal.templ`, Line: 76, Col: 18}
}
_, 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("\" type=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var15 string
templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(inp.Type)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainandetailformmodal.templ`, Line: 77, Col: 20}
}
_, 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("\" checked=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var16 string
templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(inp.Checked)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainandetailformmodal.templ`, Line: 78, Col: 26}
}
_, 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("\" name=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var17 string
templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(inp.Name)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainandetailformmodal.templ`, Line: 79, Col: 20}
}
_, 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-on:change=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var18 templ.ComponentScript = toggleClassification(inp.Name)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var18.Call)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\"> <span></span></label></span></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 toggleClassification(idswitch string) templ.ComponentScript {
return templ.ComponentScript{
Name: `__templ_toggleClassification_069f`,
Function: `function __templ_toggleClassification_069f(idswitch){var checkbox = document.getElementById(idswitch);
// console.log(checkbox)
var classificationField = document.getElementById("classificationField");
var classificationInput = document.getElementById("classificationname");
// console.log(classificationField)
if (checkbox.checked) {
classificationField.style.display = "block";
} else {
classificationField.style.display = "none";
classificationInput.value = "";
}
}`,
Call: templ.SafeScript(`__templ_toggleClassification_069f`, idswitch),
CallInline: templ.SafeScriptInline(`__templ_toggleClassification_069f`, idswitch),
}
}
func JsHideModalDetail(modalID string) templ.ComponentScript {
return templ.ComponentScript{
Name: `__templ_JsHideModalDetail_da6c`,
Function: `function __templ_JsHideModalDetail_da6c(modalID){$(modalID).modal('hide')
}`,
Call: templ.SafeScript(`__templ_JsHideModalDetail_da6c`, modalID),
CallInline: templ.SafeScriptInline(`__templ_JsHideModalDetail_da6c`, modalID),
}
}
func JsShowModalDetail(modalID string) templ.ComponentScript {
return templ.ComponentScript{
Name: `__templ_JsShowModalDetail_3147`,
Function: `function __templ_JsShowModalDetail_3147(modalID){$(modalID).modal('show')
}`,
Call: templ.SafeScript(`__templ_JsShowModalDetail_3147`, modalID),
CallInline: templ.SafeScriptInline(`__templ_JsShowModalDetail_3147`, modalID),
}
}
func ActionFormKelainanDetail(LinkClose string, targetClose string, hxSwapClose string, modalID string) templ.Component {
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
if !templ_7745c5c3_IsBuffer {
templ_7745c5c3_Buffer = templ.GetBuffer()
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var19 := templ.GetChildren(ctx)
if templ_7745c5c3_Var19 == nil {
templ_7745c5c3_Var19 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templ.RenderScriptItems(ctx, templ_7745c5c3_Buffer, JsHideModalDetail(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_Var20 templ.ComponentScript = JsHideModalDetail(modalID)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var20.Call)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-post=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var21 string
templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.JoinStringErrs(LinkClose)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainandetailformmodal.templ`, Line: 114, Col: 22}
}
_, 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("\" hx-target=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var22 string
templ_7745c5c3_Var22, templ_7745c5c3_Err = templ.JoinStringErrs(targetClose)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainandetailformmodal.templ`, Line: 115, Col: 26}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var22))
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_Var23 string
templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(hxSwapClose)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainandetailformmodal.templ`, Line: 116, Col: 24}
}
_, 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("\" type=\"button\" class=\"btn btn-outline-secondary font-weight-bolder rounded-lg mr-4 btnaddact\" data-dismiss=\"modal\">Batal\r</button> <button type=\"submit\" class=\"btn btn-primary btn-shadow font-weight-bold rounded-lg btnaddact\">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 BtnCloseFormKelainanDetail(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_Var24 := templ.GetChildren(ctx)
if templ_7745c5c3_Var24 == nil {
templ_7745c5c3_Var24 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Err = templ.RenderScriptItems(ctx, templ_7745c5c3_Buffer, JsHideModalDetail(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_Var25 string
templ_7745c5c3_Var25, templ_7745c5c3_Err = templ.JoinStringErrs(LinkClose)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainandetailformmodal.templ`, Line: 134, Col: 21}
}
_, 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-target=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var26 string
templ_7745c5c3_Var26, templ_7745c5c3_Err = templ.JoinStringErrs(targetClose)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainandetailformmodal.templ`, Line: 135, Col: 25}
}
_, 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("\" hx-swap=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var27 string
templ_7745c5c3_Var27, templ_7745c5c3_Err = templ.JoinStringErrs(hxSwapClose)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainandetailformmodal.templ`, Line: 136, Col: 23}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var27))
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_Var28 templ.ComponentScript = JsHideModalDetail(modalID)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var28.Call)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" class=\"close btnaddact\" data-dismiss=\"modal\" aria-label=\"Close\"><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 DeleteConfirmationBodyDetail(inputId models.CustomTextFieldv2Prm,
componentID string,
message string,
datHeader []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_Var29 := templ.GetChildren(ctx)
if templ_7745c5c3_Var29 == nil {
templ_7745c5c3_Var29 = 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_Var30 string
templ_7745c5c3_Var30, templ_7745c5c3_Err = templ.JoinStringErrs(componentID)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainandetailformmodal.templ`, Line: 153, Col: 22}
}
_, 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-on::load=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var31 templ.ComponentScript = hxOnLoad
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var31.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_Var32 string
templ_7745c5c3_Var32, templ_7745c5c3_Err = templ.JoinStringErrs(message)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainandetailformmodal.templ`, Line: 154, Col: 14}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var32))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</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 datHeader {
_, 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_Var33 string
templ_7745c5c3_Var33, templ_7745c5c3_Err = templ.JoinStringErrs(v)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainandetailformmodal.templ`, Line: 159, Col: 68}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var33))
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_Var34 string
templ_7745c5c3_Var34, templ_7745c5c3_Err = templ.JoinStringErrs(v)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainandetailformmodal.templ`, Line: 165, Col: 10}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var34))
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 ActionFormKelainanDetailDelete(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_Var35 := templ.GetChildren(ctx)
if templ_7745c5c3_Var35 == nil {
templ_7745c5c3_Var35 = 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, JsHideModalDetail(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_Var36 templ.ComponentScript = JsHideModalDetail(modalID)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var36.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_Var37 string
templ_7745c5c3_Var37, templ_7745c5c3_Err = templ.JoinStringErrs(LinkClose)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainandetailformmodal.templ`, Line: 179, Col: 22}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var37))
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_Var38 string
templ_7745c5c3_Var38, templ_7745c5c3_Err = templ.JoinStringErrs(targetClose)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainandetailformmodal.templ`, Line: 180, Col: 26}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var38))
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_Var39 string
templ_7745c5c3_Var39, templ_7745c5c3_Err = templ.JoinStringErrs(hxSwapClose)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainandetailformmodal.templ`, Line: 181, Col: 24}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var39))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" type=\"button\" class=\"btn btn-outline-secondary font-weight-bolder rounded-lg mr-4 btnaddact\" data-dismiss=\"modal\">Batal\r</button> <button type=\"submit\" class=\"btn btn-primary btn-shadow font-weight-bold rounded-lg btnaddact\">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
})
}

View File

@@ -0,0 +1,133 @@
package masterkelainan
import "cpone/models"
import "cpone/component/table"
import "strconv"
import "cpone/component/customcheckbox"
templ TableKelainanDetail(data []models.KelainanDetail,
tableDetailID string,
hxGetDelete string,
hxTargetDelete string,
hxSwapDelete string,
hxIncludeDelete string,
) {
<div id={ tableDetailID } hx-swap-oob="true">
@tablecomponent.TableV3([]string{"NO", "KELAINAN", "AKSI"},
[]string{"10%", "60%", "30%"},
TableDetailRow(data,
hxGetDelete,
hxTargetDelete,
hxSwapDelete,
hxIncludeDelete,
))
</div>
}
templ TableDetailRow(data []models.KelainanDetail,
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.Nomor }</td>
<td>
{ v.Mcu_KelainanName }
if v.Mcu_KelainanClasification != "" {
<p class="dot-text">{ v.Mcu_KelainanClasification }</p>
}
</td>
<td>
@TableDetailAction(v.Mcu_KelainanID,
v.Mcu_KelainanFlagActive,
hxGetDelete,
hxTargetDelete,
hxSwapDelete,
hxIncludeDelete,
)
</td>
</tr>
}
}
templ TableDetailAction(
id int,
flagKelainanDetail string,
hxGetDelete string,
hxTargetDelete string,
hxSwapDelete string,
hxIncludeDelete string,
) {
<div class="row px-5 d-flex justify-content-around">
@customcheckbox.MainCustomCheckboxInputV2(
models.CustomCheckboxv1Prm{
Name: "checkName",
ID: "check" + strconv.Itoa(id),
Value: strconv.Itoa(id),
Status: flagKelainanDetail,
},
)
<a
id="btndeleteug"
type="button"
class=" btndeleteug col-12 col-sm-12 col-md-12 col-lg-5 col-xl-5 col-xxl-5 btn btn-light-danger mb-2"
hx-get={ hxGetDelete + "?id=" + strconv.Itoa(id) }
hx-target={ hxTargetDelete }
hx-swap={ hxSwapDelete }
hx-include={ hxIncludeDelete }
>
Hapus
</a>
</div>
}
script JsHideButtonCheckbox(selectedID string) {
$(selectedID).hide();
console.log("hide", selectedID)
}
script JsShowButtonCheckbox(selectedID string) {
$(selectedID).show();
console.log("show", selectedID)
}
templ ButtonSaveCheckbox(
length int,
link string,
buttonCheckboxID string,
hxInclude string,
hxTarget string,
hxSwap string,
hxIndicator string,
HxSwapOobButton string,
hxAfterRequest templ.ComponentScript,
) {
<div
id={ buttonCheckboxID }
hx-on::load={ hxAfterRequest }
hx-swap-oob={ HxSwapOobButton }
class="d-flex justify-content-end"
>
if length != 0 {
<button
type="button"
class="btn btn-outline-secondary font-weight-bolder rounded-lg mr-4 btnaddact"
>
Batal
</button>
<button
type="submit"
class="btn btn-primary btn-shadow font-weight-bold rounded-lg btnaddact"
>
Simpan
</button>
}
</div>
}

View File

@@ -0,0 +1,377 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.663
package masterkelainan
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
import "context"
import "io"
import "bytes"
import "cpone/models"
import "cpone/component/table"
import "strconv"
import "cpone/component/customcheckbox"
func TableKelainanDetail(data []models.KelainanDetail,
tableDetailID 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\mdpolakelainan\mdkelainandetailtable.templ`, Line: 15, Col: 24}
}
_, 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{"NO", "KELAINAN", "AKSI"},
[]string{"10%", "60%", "30%"},
TableDetailRow(data,
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 TableDetailRow(data []models.KelainanDetail,
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.Nomor)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainandetailtable.templ`, Line: 40, Col: 16}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</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.Mcu_KelainanName)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainandetailtable.templ`, Line: 42, Col: 24}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if v.Mcu_KelainanClasification != "" {
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<p class=\"dot-text\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var6 string
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(v.Mcu_KelainanClasification)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainandetailtable.templ`, Line: 44, Col: 54}
}
_, 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("</p>")
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 = TableDetailAction(v.Mcu_KelainanID,
v.Mcu_KelainanFlagActive,
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 TableDetailAction(
id int,
flagKelainanDetail 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_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 class=\"row px-5 d-flex justify-content-around\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = customcheckbox.MainCustomCheckboxInputV2(
models.CustomCheckboxv1Prm{
Name: "checkName",
ID: "check" + strconv.Itoa(id),
Value: strconv.Itoa(id),
Status: flagKelainanDetail,
},
).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<a id=\"btndeleteug\" type=\"button\" class=\" btndeleteug col-12 col-sm-12 col-md-12 col-lg-5 col-xl-5 col-xxl-5 btn btn-light-danger mb-2\" hx-get=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var8 string
templ_7745c5c3_Var8, 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\mdpolakelainan\mdkelainandetailtable.templ`, Line: 81, Col: 51}
}
_, 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-target=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var9 string
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(hxTargetDelete)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainandetailtable.templ`, Line: 82, 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-swap=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var10 string
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(hxSwapDelete)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainandetailtable.templ`, Line: 83, 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-include=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var11 string
templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(hxIncludeDelete)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainandetailtable.templ`, Line: 84, Col: 31}
}
_, 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("\">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 JsHideButtonCheckbox(selectedID string) templ.ComponentScript {
return templ.ComponentScript{
Name: `__templ_JsHideButtonCheckbox_0f00`,
Function: `function __templ_JsHideButtonCheckbox_0f00(selectedID){$(selectedID).hide();
console.log("hide", selectedID)
}`,
Call: templ.SafeScript(`__templ_JsHideButtonCheckbox_0f00`, selectedID),
CallInline: templ.SafeScriptInline(`__templ_JsHideButtonCheckbox_0f00`, selectedID),
}
}
func JsShowButtonCheckbox(selectedID string) templ.ComponentScript {
return templ.ComponentScript{
Name: `__templ_JsShowButtonCheckbox_f46b`,
Function: `function __templ_JsShowButtonCheckbox_f46b(selectedID){$(selectedID).show();
console.log("show", selectedID)
}`,
Call: templ.SafeScript(`__templ_JsShowButtonCheckbox_f46b`, selectedID),
CallInline: templ.SafeScriptInline(`__templ_JsShowButtonCheckbox_f46b`, selectedID),
}
}
func ButtonSaveCheckbox(
length int,
link string,
buttonCheckboxID string,
hxInclude string,
hxTarget string,
hxSwap string,
hxIndicator string,
HxSwapOobButton string,
hxAfterRequest 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_Var12 := templ.GetChildren(ctx)
if templ_7745c5c3_Var12 == nil {
templ_7745c5c3_Var12 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Err = templ.RenderScriptItems(ctx, templ_7745c5c3_Buffer, hxAfterRequest)
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_Var13 string
templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(buttonCheckboxID)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainandetailtable.templ`, Line: 113, Col: 23}
}
_, 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-on::load=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var14 templ.ComponentScript = hxAfterRequest
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var14.Call)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-swap-oob=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var15 string
templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(HxSwapOobButton)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainandetailtable.templ`, Line: 115, Col: 31}
}
_, 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("\" class=\"d-flex justify-content-end\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if length != 0 {
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<button type=\"button\" class=\"btn btn-outline-secondary font-weight-bolder rounded-lg mr-4 btnaddact\">Batal\r</button> <button type=\"submit\" class=\"btn btn-primary btn-shadow font-weight-bold rounded-lg btnaddact\">Simpan\r</button>")
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
})
}

View File

@@ -0,0 +1,156 @@
package masterkelainan
import (
"cpone/models"
"cpone/component/modal"
"cpone/component/customtextfield"
)
templ KelainanForm(data models.KelainanFormComponent) {
<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-on::before-request={ HandleFormBeforeRequest() }
hx-on::after-request={ HandleFormAfterRequest() }
>
@modalcomponent.Modal(data.ModalID,
data.ModalTitle,
data.DialogBody,
data.DialogAction,
data.ButtonCLose)
</form>
</div>
}
script HandleFormBeforeRequest() {
// console.log("handle disable btn add");
const boxes = document.querySelectorAll('.btnaddact');
for (let i = 0; i < boxes.length; i++) {
boxes[i].setAttribute('disabled', 'true');
}
}
script HandleFormAfterRequest() {
// console.log("handle enable btn add");
const boxes = document.querySelectorAll('.btnaddact');
for (let i = 0; i < boxes.length; i++) {
boxes[i].removeAttribute('disabled');
}
}
templ BodyFormKelainan(inputId models.CustomTextFieldv2Prm,
inputName models.CustomTextFieldv2Prm,
componentID string,
hxOnLoad templ.ComponentScript) {
<div id={ componentID } hx-on::load={ hxOnLoad }>
@customtextfield.CustomTextFieldv2(
inputId)
@customtextfield.CustomTextFieldv2(
inputName)
</div>
}
script JsHideModal(modalID string) {
$(modalID).modal('hide')
}
script JsShowModal(modalID string) {
$(modalID).modal('show')
}
templ ActionFormKelainan(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 }
type="button"
class="btn btn-outline-secondary font-weight-bolder rounded-lg mr-4 btnaddact"
data-dismiss="modal"
>
Batal
</button>
<button
type="submit"
class="btn btn-primary btn-shadow font-weight-bold rounded-lg btnaddact"
>
Simpan
</button>
</div>
}
templ BtnCloseFormKelainan(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 btnaddact"
data-dismiss="modal"
aria-label="Close"
>
<i aria-hidden="true" class="ki ki-close"></i>
</button>
}
templ DeleteConfirmationBody(inputId models.CustomTextFieldv2Prm,
componentID string,
message string,
datHeader []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 datHeader {
<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 ActionFormKelainanDelete(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 }
type="button"
class="btn btn-outline-secondary font-weight-bolder rounded-lg mr-4 btnaddact"
data-dismiss="modal"
>
Batal
</button>
<button
type="submit"
class="btn btn-primary btn-shadow font-weight-bold rounded-lg btnaddact"
>
Yakin
</button>
</div>
}

View File

@@ -0,0 +1,622 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.663
package masterkelainan
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
import "context"
import "io"
import "bytes"
import (
"cpone/component/customtextfield"
"cpone/component/modal"
"cpone/models"
)
func KelainanForm(data models.KelainanFormComponent) templ.Component {
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
if !templ_7745c5c3_IsBuffer {
templ_7745c5c3_Buffer = templ.GetBuffer()
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
if templ_7745c5c3_Var1 == nil {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<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\mdpolakelainan\mdkelainanformmodal.templ`, Line: 12, Col: 24}
}
_, 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\mdpolakelainan\mdkelainanformmodal.templ`, Line: 13, Col: 22}
}
_, 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\mdpolakelainan\mdkelainanformmodal.templ`, Line: 15, Col: 28}
}
_, 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\mdpolakelainan\mdkelainanformmodal.templ`, Line: 16, Col: 24}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" 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\mdpolakelainan\mdkelainanformmodal.templ`, Line: 17, Col: 30}
}
_, 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-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
}
templ_7745c5c3_Err = modalcomponent.Modal(data.ModalID,
data.ModalTitle,
data.DialogBody,
data.DialogAction,
data.ButtonCLose).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</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_6266`,
Function: `function __templ_HandleFormBeforeRequest_6266(){// console.log("handle disable btn add");
const boxes = document.querySelectorAll('.btnaddact');
for (let i = 0; i < boxes.length; i++) {
boxes[i].setAttribute('disabled', 'true');
}
}`,
Call: templ.SafeScript(`__templ_HandleFormBeforeRequest_6266`),
CallInline: templ.SafeScriptInline(`__templ_HandleFormBeforeRequest_6266`),
}
}
func HandleFormAfterRequest() templ.ComponentScript {
return templ.ComponentScript{
Name: `__templ_HandleFormAfterRequest_4cc7`,
Function: `function __templ_HandleFormAfterRequest_4cc7(){// console.log("handle enable btn add");
const boxes = document.querySelectorAll('.btnaddact');
for (let i = 0; i < boxes.length; i++) {
boxes[i].removeAttribute('disabled');
}
}`,
Call: templ.SafeScript(`__templ_HandleFormAfterRequest_4cc7`),
CallInline: templ.SafeScriptInline(`__templ_HandleFormAfterRequest_4cc7`),
}
}
func BodyFormKelainan(inputId models.CustomTextFieldv2Prm,
inputName models.CustomTextFieldv2Prm,
componentID string,
hxOnLoad templ.ComponentScript) templ.Component {
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
if !templ_7745c5c3_IsBuffer {
templ_7745c5c3_Buffer = templ.GetBuffer()
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var9 := templ.GetChildren(ctx)
if templ_7745c5c3_Var9 == nil {
templ_7745c5c3_Var9 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Err = templ.RenderScriptItems(ctx, templ_7745c5c3_Buffer, hxOnLoad)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<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\mdpolakelainan\mdkelainanformmodal.templ`, Line: 55, Col: 22}
}
_, 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 = 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>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if !templ_7745c5c3_IsBuffer {
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
}
return templ_7745c5c3_Err
})
}
func JsHideModal(modalID string) templ.ComponentScript {
return templ.ComponentScript{
Name: `__templ_JsHideModal_da6c`,
Function: `function __templ_JsHideModal_da6c(modalID){$(modalID).modal('hide')
}`,
Call: templ.SafeScript(`__templ_JsHideModal_da6c`, modalID),
CallInline: templ.SafeScriptInline(`__templ_JsHideModal_da6c`, modalID),
}
}
func JsShowModal(modalID string) templ.ComponentScript {
return templ.ComponentScript{
Name: `__templ_JsShowModal_3147`,
Function: `function __templ_JsShowModal_3147(modalID){$(modalID).modal('show')
}`,
Call: templ.SafeScript(`__templ_JsShowModal_3147`, modalID),
CallInline: templ.SafeScriptInline(`__templ_JsShowModal_3147`, modalID),
}
}
func ActionFormKelainan(LinkClose string, targetClose string, hxSwapClose string, modalID string) templ.Component {
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
if !templ_7745c5c3_IsBuffer {
templ_7745c5c3_Buffer = templ.GetBuffer()
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var12 := templ.GetChildren(ctx)
if templ_7745c5c3_Var12 == nil {
templ_7745c5c3_Var12 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<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\mdpolakelainan\mdkelainanformmodal.templ`, Line: 75, Col: 22}
}
_, 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\mdpolakelainan\mdkelainanformmodal.templ`, Line: 76, Col: 26}
}
_, 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\mdpolakelainan\mdkelainanformmodal.templ`, Line: 77, Col: 24}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" type=\"button\" class=\"btn btn-outline-secondary font-weight-bolder rounded-lg mr-4 btnaddact\" data-dismiss=\"modal\">Batal\r</button> <button type=\"submit\" class=\"btn btn-primary btn-shadow font-weight-bold rounded-lg btnaddact\">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 BtnCloseFormKelainan(LinkClose string, targetClose string, hxSwapClose string, modalID string) templ.Component {
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
if !templ_7745c5c3_IsBuffer {
templ_7745c5c3_Buffer = templ.GetBuffer()
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var17 := templ.GetChildren(ctx)
if templ_7745c5c3_Var17 == nil {
templ_7745c5c3_Var17 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Err = templ.RenderScriptItems(ctx, templ_7745c5c3_Buffer, JsHideModal(modalID))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<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\mdpolakelainan\mdkelainanformmodal.templ`, Line: 95, Col: 21}
}
_, 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\mdpolakelainan\mdkelainanformmodal.templ`, Line: 96, Col: 25}
}
_, 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\mdpolakelainan\mdkelainanformmodal.templ`, Line: 97, Col: 23}
}
_, 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 btnaddact\" 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 DeleteConfirmationBody(inputId models.CustomTextFieldv2Prm,
componentID string,
message string,
datHeader []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_Var22 := templ.GetChildren(ctx)
if templ_7745c5c3_Var22 == nil {
templ_7745c5c3_Var22 = 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_Var23 string
templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(componentID)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainanformmodal.templ`, Line: 114, 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-on::load=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var24 templ.ComponentScript = hxOnLoad
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var24.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_Var25 string
templ_7745c5c3_Var25, templ_7745c5c3_Err = templ.JoinStringErrs(message)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainanformmodal.templ`, Line: 115, Col: 14}
}
_, 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("</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 datHeader {
_, 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_Var26 string
templ_7745c5c3_Var26, templ_7745c5c3_Err = templ.JoinStringErrs(v)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainanformmodal.templ`, Line: 120, Col: 68}
}
_, 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("</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_Var27 string
templ_7745c5c3_Var27, templ_7745c5c3_Err = templ.JoinStringErrs(v)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainanformmodal.templ`, Line: 126, Col: 10}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var27))
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 ActionFormKelainanDelete(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_Var28 := templ.GetChildren(ctx)
if templ_7745c5c3_Var28 == nil {
templ_7745c5c3_Var28 = 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_Var29 templ.ComponentScript = JsHideModal(modalID)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var29.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_Var30 string
templ_7745c5c3_Var30, templ_7745c5c3_Err = templ.JoinStringErrs(LinkClose)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainanformmodal.templ`, Line: 140, Col: 22}
}
_, 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-target=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var31 string
templ_7745c5c3_Var31, templ_7745c5c3_Err = templ.JoinStringErrs(targetClose)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainanformmodal.templ`, Line: 141, Col: 26}
}
_, 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("\" hx-swap=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var32 string
templ_7745c5c3_Var32, templ_7745c5c3_Err = templ.JoinStringErrs(hxSwapClose)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainanformmodal.templ`, Line: 142, Col: 24}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var32))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" type=\"button\" class=\"btn btn-outline-secondary font-weight-bolder rounded-lg mr-4 btnaddact\" data-dismiss=\"modal\">Batal\r</button> <button type=\"submit\" class=\"btn btn-primary btn-shadow font-weight-bold rounded-lg btnaddact\">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
})
}

View File

@@ -0,0 +1,171 @@
package masterkelainan
import (
"cpone/component/table"
"cpone/models"
"strconv"
)
templ TableKelainan(data []models.Kelainan,
tableID string,
hxGetActive string,
hxSwapActive string,
hxGetNonActive string,
hxSwapNonActive string,
hxGetDelete string,
hxTargetDelete string,
hxSwapDelete string,
hxIncludeDelete string,
hxGetSelected string,
hxTargetSelected string,
) {
<div id={ tableID } hx-swap-oob="true">
@tablecomponent.TableV3([]string{"NO", "GRUP KELAINAN", "AKSI"},
[]string{"10%", "60%", "30%"},
TableRow(data,
hxGetActive,
hxSwapActive,
hxGetNonActive,
hxSwapNonActive,
hxGetDelete,
hxTargetDelete,
hxSwapDelete,
hxIncludeDelete,
hxGetSelected,
hxTargetSelected,
))
</div>
}
script clickHandler(id string) {
document.getElementById("sas"+id).classList.add("selected");
console.log(id);
}
script HandleAfterRequesX(idx string) {
document.querySelectorAll("tr.selected").forEach(function(row) {
row.classList.remove("selected");
});
document.getElementById("sas"+idx).classList.add("selected");
console.log('handle after',idx);
}
templ TableRow(data []models.Kelainan,
hxGetActive string,
hxSwapActive string,
hxGetNonActive string,
hxSwapNonActive string,
hxGetDelete string,
hxTargetDelete string,
hxSwapDelete string,
hxIncludeDelete string,
hxGetSelected string,
hxTargetSelected string,
) {
if len(data) == 0 {
<tr>
<td colspan="3" class="text-center">Data Tidak Ditemukan</td>
</tr>
}
for _, v := range data {
<tr
id={ "sas" + strconv.Itoa(v.Mcu_KelainanGroupID) }
hx-get={ hxGetSelected + "?id=" + strconv.Itoa(v.Mcu_KelainanGroupID) }
hx-trigger="click"
hx-include={ "#buttonCheckboxID, #selectedID, #paginationID, #dialogDeleteBodyID, #dialogDeleteID, #tableID, #tableDetailID, #paginationDetailID, #searchDetailID, #dialogDetailDeleteBodyID, #dialogDetailDeleteID, #sas" + strconv.Itoa(v.Mcu_KelainanGroupID) }
onclick={ clickHandler(strconv.Itoa(v.Mcu_KelainanGroupID)) }
hx-target={ hxTargetSelected }
hx-on::after-request={ HandleAfterRequesX(strconv.Itoa(v.Mcu_KelainanGroupID)) }
hx-swap="none"
>
<td>{ v.Nomor }</td>
<td>{ v.Mcu_KelainanGroupName }</td>
<td>
@TableAction("#active"+strconv.Itoa(v.Mcu_KelainanGroupID),
v.Mcu_KelainanGroupID,
v.Mcu_KelainanGroupFlagActive,
hxGetActive,
hxSwapActive,
hxGetNonActive,
"#non"+strconv.Itoa(v.Mcu_KelainanGroupID),
hxSwapNonActive,
hxGetDelete,
hxTargetDelete,
hxSwapDelete,
hxIncludeDelete,
)
</td>
</tr>
}
}
templ TableAction(
idrowactive string,
id int,
flag string,
hxGetActive string,
hxSwapActive string,
hxGetNonActive string,
idrownonactive string,
hxSwapNonActive string,
hxGetDelete string,
hxTargetDelete string,
hxSwapDelete string,
hxIncludeDelete string,
) {
<div class="row px-5 d-flex justify-content-around">
switch flag {
case "Y":
<a
id={ "active" + strconv.Itoa(id) }
type="button"
class="col-12 col-sm-12 col-md-12 col-lg-5 col-xl-5 col-xxl-5 btn btn-light-tosca mb-2"
hx-get={ hxGetActive + "?id=" + strconv.Itoa(id) + "&selectedStatus=" + flag }
hx-target={ idrowactive }
hx-swap={ hxSwapActive }
hx-include={ "#paginationID, #dialogDeleteBodyID, #dialogDeleteID, #tableID, #active" + strconv.Itoa(id) }
>
Aktif
</a>
case "N":
<a
id={ "non" + strconv.Itoa(id) }
type="button"
class="col-12 col-sm-12 col-md-12 col-lg-5 col-xl-5 col-xxl-5 btn btn-light-danger mb-2"
hx-get={ hxGetNonActive + "?id=" + strconv.Itoa(id) + "&selectedStatus=" + flag }
hx-target={ idrownonactive }
hx-swap={ hxSwapNonActive }
hx-include={ "#paginationID, #dialogDeleteBodyID, #dialogDeleteID, #tableID, #non" + strconv.Itoa(id) }
>
Tidak
</a>
default:
<span>{ "Unknown Flag" }</span>
}
<a
id="btndeleteug"
type="button"
class=" btndeleteug col-12 col-sm-12 col-md-12 col-lg-5 col-xl-5 col-xxl-5 btn btn-light-danger mb-2"
hx-get={ hxGetDelete + "?id=" + strconv.Itoa(id) }
hx-target={ hxTargetDelete }
hx-swap={ hxSwapDelete }
hx-include={ hxIncludeDelete }
>
Hapus
</a>
</div>
}
templ CustomButtonTidak(inp models.ButtonPrm) {
<a
id={ inp.ID }
type="button"
class={ inp.Class }
hx-get={ inp.HxGet }
hx-target={ inp.HxTarget }
hx-swap={ inp.HxSwap }
hx-include={ inp.HxInclude }
>
{ inp.Label }
</a>
}

View File

@@ -0,0 +1,648 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.663
package masterkelainan
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
import "context"
import "io"
import "bytes"
import (
"cpone/component/table"
"cpone/models"
"strconv"
)
func TableKelainan(data []models.Kelainan,
tableID string,
hxGetActive string,
hxSwapActive string,
hxGetNonActive string,
hxSwapNonActive string,
hxGetDelete string,
hxTargetDelete string,
hxSwapDelete string,
hxIncludeDelete string,
hxGetSelected string,
hxTargetSelected 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\mdpolakelainan\mdkelainantable.templ`, Line: 22, Col: 18}
}
_, 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{"NO", "GRUP KELAINAN", "AKSI"},
[]string{"10%", "60%", "30%"},
TableRow(data,
hxGetActive,
hxSwapActive,
hxGetNonActive,
hxSwapNonActive,
hxGetDelete,
hxTargetDelete,
hxSwapDelete,
hxIncludeDelete,
hxGetSelected,
hxTargetSelected,
)).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 clickHandler(id string) templ.ComponentScript {
return templ.ComponentScript{
Name: `__templ_clickHandler_9b32`,
Function: `function __templ_clickHandler_9b32(id){document.getElementById("sas"+id).classList.add("selected");
console.log(id);
}`,
Call: templ.SafeScript(`__templ_clickHandler_9b32`, id),
CallInline: templ.SafeScriptInline(`__templ_clickHandler_9b32`, id),
}
}
func HandleAfterRequesX(idx string) templ.ComponentScript {
return templ.ComponentScript{
Name: `__templ_HandleAfterRequesX_ef3a`,
Function: `function __templ_HandleAfterRequesX_ef3a(idx){document.querySelectorAll("tr.selected").forEach(function(row) {
row.classList.remove("selected");
});
document.getElementById("sas"+idx).classList.add("selected");
console.log('handle after',idx);
}`,
Call: templ.SafeScript(`__templ_HandleAfterRequesX_ef3a`, idx),
CallInline: templ.SafeScriptInline(`__templ_HandleAfterRequesX_ef3a`, idx),
}
}
func TableRow(data []models.Kelainan,
hxGetActive string,
hxSwapActive string,
hxGetNonActive string,
hxSwapNonActive string,
hxGetDelete string,
hxTargetDelete string,
hxSwapDelete string,
hxIncludeDelete string,
hxGetSelected string,
hxTargetSelected 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.RenderScriptItems(ctx, templ_7745c5c3_Buffer, clickHandler(strconv.Itoa(v.Mcu_KelainanGroupID)), HandleAfterRequesX(strconv.Itoa(v.Mcu_KelainanGroupID)))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<tr id=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var4 string
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs("sas" + strconv.Itoa(v.Mcu_KelainanGroupID))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainantable.templ`, Line: 72, Col: 51}
}
_, 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-get=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(hxGetSelected + "?id=" + strconv.Itoa(v.Mcu_KelainanGroupID))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainantable.templ`, Line: 73, Col: 72}
}
_, 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-trigger=\"click\" hx-include=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var6 string
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs("#buttonCheckboxID, #selectedID, #paginationID, #dialogDeleteBodyID, #dialogDeleteID, #tableID, #tableDetailID, #paginationDetailID, #searchDetailID, #dialogDetailDeleteBodyID, #dialogDetailDeleteID, #sas" + strconv.Itoa(v.Mcu_KelainanGroupID))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainantable.templ`, Line: 75, Col: 259}
}
_, 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("\" onclick=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var7 templ.ComponentScript = clickHandler(strconv.Itoa(v.Mcu_KelainanGroupID))
_, 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-target=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var8 string
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(hxTargetSelected)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainantable.templ`, Line: 77, Col: 31}
}
_, 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-on::after-request=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var9 templ.ComponentScript = HandleAfterRequesX(strconv.Itoa(v.Mcu_KelainanGroupID))
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var9.Call)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-swap=\"none\"><td>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var10 string
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(v.Nomor)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainantable.templ`, Line: 81, Col: 16}
}
_, 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("</td><td>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var11 string
templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(v.Mcu_KelainanGroupName)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainantable.templ`, Line: 82, Col: 32}
}
_, 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("</td><td>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = TableAction("#active"+strconv.Itoa(v.Mcu_KelainanGroupID),
v.Mcu_KelainanGroupID,
v.Mcu_KelainanGroupFlagActive,
hxGetActive,
hxSwapActive,
hxGetNonActive,
"#non"+strconv.Itoa(v.Mcu_KelainanGroupID),
hxSwapNonActive,
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 TableAction(
idrowactive string,
id int,
flag string,
hxGetActive string,
hxSwapActive string,
hxGetNonActive string,
idrownonactive string,
hxSwapNonActive 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_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 class=\"row px-5 d-flex justify-content-around\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
switch flag {
case "Y":
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<a id=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var13 string
templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs("active" + strconv.Itoa(id))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainantable.templ`, Line: 120, Col: 37}
}
_, 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("\" type=\"button\" class=\"col-12 col-sm-12 col-md-12 col-lg-5 col-xl-5 col-xxl-5 btn btn-light-tosca mb-2\" hx-get=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var14 string
templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(hxGetActive + "?id=" + strconv.Itoa(id) + "&selectedStatus=" + flag)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainantable.templ`, Line: 123, Col: 81}
}
_, 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(idrowactive)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainantable.templ`, Line: 124, Col: 28}
}
_, 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(hxSwapActive)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainantable.templ`, Line: 125, Col: 27}
}
_, 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("#paginationID, #dialogDeleteBodyID, #dialogDeleteID, #tableID, #active" + strconv.Itoa(id))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainantable.templ`, Line: 126, Col: 109}
}
_, 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("\">Aktif\r</a> ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
case "N":
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<a id=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var18 string
templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs("non" + strconv.Itoa(id))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainantable.templ`, Line: 132, Col: 34}
}
_, 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("\" type=\"button\" class=\"col-12 col-sm-12 col-md-12 col-lg-5 col-xl-5 col-xxl-5 btn btn-light-danger mb-2\" hx-get=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var19 string
templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs(hxGetNonActive + "?id=" + strconv.Itoa(id) + "&selectedStatus=" + flag)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainantable.templ`, Line: 135, Col: 84}
}
_, 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-target=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var20 string
templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs(idrownonactive)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainantable.templ`, Line: 136, Col: 31}
}
_, 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("\" hx-swap=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var21 string
templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.JoinStringErrs(hxSwapNonActive)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainantable.templ`, Line: 137, Col: 30}
}
_, 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("\" hx-include=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var22 string
templ_7745c5c3_Var22, templ_7745c5c3_Err = templ.JoinStringErrs("#paginationID, #dialogDeleteBodyID, #dialogDeleteID, #tableID, #non" + strconv.Itoa(id))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainantable.templ`, Line: 138, Col: 106}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var22))
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
}
default:
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<span>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var23 string
templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs("Unknown Flag")
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainantable.templ`, Line: 143, Col: 26}
}
_, 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("</span> ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<a id=\"btndeleteug\" type=\"button\" class=\" btndeleteug col-12 col-sm-12 col-md-12 col-lg-5 col-xl-5 col-xxl-5 btn btn-light-danger mb-2\" hx-get=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var24 string
templ_7745c5c3_Var24, 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\mdpolakelainan\mdkelainantable.templ`, Line: 149, Col: 51}
}
_, 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-target=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var25 string
templ_7745c5c3_Var25, templ_7745c5c3_Err = templ.JoinStringErrs(hxTargetDelete)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainantable.templ`, Line: 150, Col: 29}
}
_, 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-swap=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var26 string
templ_7745c5c3_Var26, templ_7745c5c3_Err = templ.JoinStringErrs(hxSwapDelete)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainantable.templ`, Line: 151, Col: 25}
}
_, 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("\" hx-include=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var27 string
templ_7745c5c3_Var27, templ_7745c5c3_Err = templ.JoinStringErrs(hxIncludeDelete)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainantable.templ`, Line: 152, Col: 31}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var27))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\">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 CustomButtonTidak(inp models.ButtonPrm) 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_Var28 := templ.GetChildren(ctx)
if templ_7745c5c3_Var28 == nil {
templ_7745c5c3_Var28 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
var templ_7745c5c3_Var29 = []any{inp.Class}
templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var29...)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<a id=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var30 string
templ_7745c5c3_Var30, templ_7745c5c3_Err = templ.JoinStringErrs(inp.ID)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainantable.templ`, Line: 161, Col: 13}
}
_, 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("\" type=\"button\" class=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var31 string
templ_7745c5c3_Var31, templ_7745c5c3_Err = templ.JoinStringErrs(templ.CSSClasses(templ_7745c5c3_Var29).String())
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainantable.templ`, Line: 1, Col: 0}
}
_, 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("\" hx-get=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var32 string
templ_7745c5c3_Var32, templ_7745c5c3_Err = templ.JoinStringErrs(inp.HxGet)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainantable.templ`, Line: 164, Col: 20}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var32))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-target=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var33 string
templ_7745c5c3_Var33, templ_7745c5c3_Err = templ.JoinStringErrs(inp.HxTarget)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainantable.templ`, Line: 165, Col: 26}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var33))
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_Var34 string
templ_7745c5c3_Var34, templ_7745c5c3_Err = templ.JoinStringErrs(inp.HxSwap)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainantable.templ`, Line: 166, Col: 22}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var34))
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_Var35 string
templ_7745c5c3_Var35, templ_7745c5c3_Err = templ.JoinStringErrs(inp.HxInclude)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainantable.templ`, Line: 167, Col: 28}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var35))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var36 string
templ_7745c5c3_Var36, templ_7745c5c3_Err = templ.JoinStringErrs(inp.Label)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdpolakelainan\mdkelainantable.templ`, Line: 169, Col: 13}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var36))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</a>")
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
})
}