selected warna kuning

This commit is contained in:
sindhu
2024-05-28 18:24:46 +07:00
parent 09bcbdcd59
commit c4b17e4503
3 changed files with 120 additions and 87 deletions

View File

@@ -910,7 +910,7 @@ func (lh *MasterKelainanHandler) HandleSelected(c echo.Context) error {
id := c.QueryParam("id")
search := c.QueryParam("search")
searchID := c.QueryParam("searchID")
tableID := c.QueryParam("tableID")
tableID := c.QueryParam("tableID") + "1ppp"
paginationID := c.QueryParam("paginationID")
dialogEditBodyID := c.QueryParam("dialogEditBodyID")
dialogDeleteBodyID := c.QueryParam("dialogDeleteBodyID")

View File

@@ -38,22 +38,17 @@ templ TableKelainan(data []models.Kelainan,
</div>
}
// func concatIDx(id string) string {
// return "changeColor(" + id + ")"
// }
script clickHandler(id string) {
document.getElementById("sas"+id).classList.add("selected");
// console.log(id);
}
// templ component(contact model.Contact) {
// <div hx-get={ string(templ.URL(fmt.Sprintf("/contacts/%s/email", contact.ID))) }>
// { contact.Name }
// </div>
// }
// templ buttonTempl(id int) {
// <button onclick={ clickHandler(id) }>Click me!</button>
// }
script clickHandler(id int) {
// document.getElementById(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,
@@ -74,11 +69,13 @@ templ TableRow(data []models.Kelainan,
}
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-target="this"
hx-include="#tableID"
onclick={ clickHandler(v.Mcu_KelainanGroupID) }
hx-include={ "#paginationID, #dialogEditBodyID, #dialogEditID, #dialogDeleteBodyID, #dialogDeleteID,#tableID, #sas" + strconv.Itoa(v.Mcu_KelainanGroupID) }
onclick={ clickHandler(strconv.Itoa(v.Mcu_KelainanGroupID)) }
hx-on::after-request={ HandleAfterRequesX(strconv.Itoa(v.Mcu_KelainanGroupID)) }
hx-swap="none"
>
<td>{ v.Nomor }</td>
<td>{ v.Mcu_KelainanGroupName }</td>

View File

@@ -84,27 +84,28 @@ func TableKelainan(data []models.Kelainan,
})
}
// func concatIDx(id string) string {
// return "changeColor(" + id + ")"
// }
// templ component(contact model.Contact) {
// <div hx-get={ string(templ.URL(fmt.Sprintf("/contacts/%s/email", contact.ID))) }>
// { contact.Name }
// </div>
// }
//
// templ buttonTempl(id int) {
// <button onclick={ clickHandler(id) }>Click me!</button>
// }
func clickHandler(id int) templ.ComponentScript {
func clickHandler(id string) templ.ComponentScript {
return templ.ComponentScript{
Name: `__templ_clickHandler_4d2c`,
Function: `function __templ_clickHandler_4d2c(id){// document.getElementById(id).classList.add("selected");
console.log(id);
Name: `__templ_clickHandler_c9e6`,
Function: `function __templ_clickHandler_c9e6(id){document.getElementById("sas"+id).classList.add("selected");
// console.log(id);
}`,
Call: templ.SafeScript(`__templ_clickHandler_4d2c`, id),
CallInline: templ.SafeScriptInline(`__templ_clickHandler_4d2c`, id),
Call: templ.SafeScript(`__templ_clickHandler_c9e6`, id),
CallInline: templ.SafeScriptInline(`__templ_clickHandler_c9e6`, 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),
}
}
@@ -138,55 +139,90 @@ func TableRow(data []models.Kelainan,
}
}
for _, v := range data {
templ_7745c5c3_Err = templ.RenderScriptItems(ctx, templ_7745c5c3_Buffer, clickHandler(v.Mcu_KelainanGroupID))
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 hx-get=\"")
_, 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(hxGetSelected + "?id=" + strconv.Itoa(v.Mcu_KelainanGroupID))
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\masterkelainan\mdkelainantable.templ`, Line: 77, Col: 72}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\masterkelainan\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-trigger=\"click\" hx-target=\"this\" hx-include=\"#tableID\" onclick=\"")
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-get=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var5 templ.ComponentScript = clickHandler(v.Mcu_KelainanGroupID)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var5.Call)
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\masterkelainan\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("\"><td>")
_, 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(v.Nomor)
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs("#paginationID, #dialogEditBodyID, #dialogEditID, #dialogDeleteBodyID, #dialogDeleteID,#tableID, #sas" + strconv.Itoa(v.Mcu_KelainanGroupID))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\masterkelainan\mdkelainantable.templ`, Line: 83, Col: 16}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\masterkelainan\mdkelainantable.templ`, Line: 75, Col: 156}
}
_, 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-on::after-request=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var8 templ.ComponentScript = HandleAfterRequesX(strconv.Itoa(v.Mcu_KelainanGroupID))
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var8.Call)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-swap=\"none\"><td>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var9 string
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(v.Nomor)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\masterkelainan\mdkelainantable.templ`, Line: 80, Col: 16}
}
_, 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("</td><td>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var7 string
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(v.Mcu_KelainanGroupName)
var templ_7745c5c3_Var10 string
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(v.Mcu_KelainanGroupName)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\masterkelainan\mdkelainantable.templ`, Line: 84, Col: 32}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\masterkelainan\mdkelainantable.templ`, Line: 81, Col: 32}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -237,21 +273,21 @@ func TableAction(
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var8 := templ.GetChildren(ctx)
if templ_7745c5c3_Var8 == nil {
templ_7745c5c3_Var8 = templ.NopComponent
templ_7745c5c3_Var11 := templ.GetChildren(ctx)
if templ_7745c5c3_Var11 == nil {
templ_7745c5c3_Var11 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"row px-5 d-flex justify-content-around\"><a id=\"btneditug\" type=\"button\" class=\"btneditug 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_Var9 string
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(hxGetEdit + "?id=" + strconv.Itoa(id))
var templ_7745c5c3_Var12 string
templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(hxGetEdit + "?id=" + strconv.Itoa(id))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\masterkelainan\mdkelainantable.templ`, Line: 117, Col: 49}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\masterkelainan\mdkelainantable.templ`, Line: 114, Col: 49}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -259,12 +295,12 @@ func TableAction(
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var10 string
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(hxTargetEdit)
var templ_7745c5c3_Var13 string
templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(hxTargetEdit)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\masterkelainan\mdkelainantable.templ`, Line: 118, Col: 27}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\masterkelainan\mdkelainantable.templ`, Line: 115, Col: 27}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -272,12 +308,12 @@ func TableAction(
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var11 string
templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(hxSwapEdit)
var templ_7745c5c3_Var14 string
templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(hxSwapEdit)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\masterkelainan\mdkelainantable.templ`, Line: 119, Col: 23}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\masterkelainan\mdkelainantable.templ`, Line: 116, Col: 23}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -285,12 +321,12 @@ func TableAction(
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var12 string
templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(hxIncludeEdit)
var templ_7745c5c3_Var15 string
templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(hxIncludeEdit)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\masterkelainan\mdkelainantable.templ`, Line: 120, Col: 29}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\masterkelainan\mdkelainantable.templ`, Line: 117, Col: 29}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12))
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -298,12 +334,12 @@ func TableAction(
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var13 string
templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(hxGetDelete + "?id=" + strconv.Itoa(id))
var templ_7745c5c3_Var16 string
templ_7745c5c3_Var16, 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\masterkelainan\mdkelainantable.templ`, Line: 128, Col: 51}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\masterkelainan\mdkelainantable.templ`, Line: 125, Col: 51}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -311,12 +347,12 @@ func TableAction(
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var14 string
templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(hxTargetDelete)
var templ_7745c5c3_Var17 string
templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(hxTargetDelete)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\masterkelainan\mdkelainantable.templ`, Line: 129, Col: 29}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\masterkelainan\mdkelainantable.templ`, Line: 126, Col: 29}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14))
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -324,12 +360,12 @@ func TableAction(
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var15 string
templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(hxSwapDelete)
var templ_7745c5c3_Var18 string
templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(hxSwapDelete)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\masterkelainan\mdkelainantable.templ`, Line: 130, Col: 25}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\masterkelainan\mdkelainantable.templ`, Line: 127, Col: 25}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15))
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -337,12 +373,12 @@ func TableAction(
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var16 string
templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(hxIncludeDelete)
var templ_7745c5c3_Var19 string
templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs(hxIncludeDelete)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\masterkelainan\mdkelainantable.templ`, Line: 131, Col: 31}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\masterkelainan\mdkelainantable.templ`, Line: 128, Col: 31}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16))
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}