search inputan + dropdown serta pagination
This commit is contained in:
@@ -1,28 +1,16 @@
|
||||
package customdropdown;
|
||||
|
||||
templ MainCustomDropdown(label string, name string, id string, hxTarget string, hxGet string, hxIndicator string, listItem templ.Component) {
|
||||
<div class="form-group">
|
||||
<label for="exampleSelect1">{ label }</label>
|
||||
<select
|
||||
name={ name }
|
||||
class="form-control bg-field"
|
||||
templ MainCustomDropdown(name string, id string, hxTarget string, hxGet string, hxIndicator string, hxTrigger string, hxInclude string, listItem templ.Component) {
|
||||
<div class="form-control bg-field border-0 h-auto py-6 px-6 rounded-lg">
|
||||
<select
|
||||
name={ name }
|
||||
class="form-control bg-field"
|
||||
id={ id }
|
||||
hx-get={ hxGet }
|
||||
hx-target={ hxTarget }
|
||||
hx-indicator={ hxIndicator }
|
||||
>
|
||||
@listItem
|
||||
</select>
|
||||
</div>
|
||||
}
|
||||
|
||||
templ MainCustomDropdownV2(label string, name string, id string, listItem templ.Component) {
|
||||
<div class="form-group">
|
||||
<label for="exampleSelect1">{ label }</label>
|
||||
<select
|
||||
name={ name }
|
||||
class="form-control bg-field"
|
||||
id={ id }
|
||||
hx-trigger={ hxTrigger }
|
||||
hx-include={ hxInclude }
|
||||
>
|
||||
@listItem
|
||||
</select>
|
||||
|
||||
@@ -10,7 +10,7 @@ import "context"
|
||||
import "io"
|
||||
import "bytes"
|
||||
|
||||
func MainCustomDropdown(label string, name string, id string, hxTarget string, hxGet string, hxIndicator string, listItem templ.Component) templ.Component {
|
||||
func MainCustomDropdown(name string, id string, hxTarget string, hxGet string, hxIndicator string, hxTrigger string, hxInclude string, listItem 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 {
|
||||
@@ -23,42 +23,29 @@ func MainCustomDropdown(label string, name string, id string, hxTarget string, h
|
||||
templ_7745c5c3_Var1 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"form-group\"><label for=\"exampleSelect1\">")
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"form-control bg-field border-0 h-auto py-6 px-6 rounded-lg\"><select name=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var2 string
|
||||
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(label)
|
||||
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(name)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 5, Col: 37}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 6, 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> <select name=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var3 string
|
||||
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(name)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 7, Col: 14}
|
||||
}
|
||||
_, 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-control bg-field\" id=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var4 string
|
||||
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(id)
|
||||
var templ_7745c5c3_Var3 string
|
||||
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(id)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 9, Col: 10}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 8, Col: 10}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
@@ -66,12 +53,12 @@ func MainCustomDropdown(label string, name string, id string, hxTarget string, h
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var5 string
|
||||
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(hxGet)
|
||||
var templ_7745c5c3_Var4 string
|
||||
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(hxGet)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 10, Col: 17}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 9, Col: 17}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
@@ -79,12 +66,12 @@ func MainCustomDropdown(label string, name string, id string, hxTarget string, h
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var6 string
|
||||
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(hxTarget)
|
||||
var templ_7745c5c3_Var5 string
|
||||
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(hxTarget)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 11, Col: 23}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 10, Col: 23}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
@@ -92,83 +79,38 @@ func MainCustomDropdown(label string, name string, id string, hxTarget string, h
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var7 string
|
||||
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(hxIndicator)
|
||||
var templ_7745c5c3_Var6 string
|
||||
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(hxIndicator)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 12, Col: 29}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 11, Col: 29}
|
||||
}
|
||||
_, 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-trigger=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var7 string
|
||||
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(hxTrigger)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 12, Col: 25}
|
||||
}
|
||||
_, 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("\">")
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-include=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = listItem.Render(ctx, templ_7745c5c3_Buffer)
|
||||
var templ_7745c5c3_Var8 string
|
||||
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(hxInclude)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 13, Col: 25}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</select></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 MainCustomDropdownV2(label string, name string, id string, listItem templ.Component) templ.Component {
|
||||
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
templ_7745c5c3_Buffer = templ.GetBuffer()
|
||||
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var8 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var8 == nil {
|
||||
templ_7745c5c3_Var8 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"form-group\"><label for=\"exampleSelect1\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var9 string
|
||||
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(label)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 21, Col: 37}
|
||||
}
|
||||
_, 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("</label> <select name=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var10 string
|
||||
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(name)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 23, Col: 14}
|
||||
}
|
||||
_, 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("\" class=\"form-control bg-field\" id=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var11 string
|
||||
templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(id)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 25, Col: 10}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
||||
@@ -32,7 +32,8 @@ templ MainCustomTextFieldSearchV1(
|
||||
hxTarget,
|
||||
hxIndicator,
|
||||
value,
|
||||
hxExt string) {
|
||||
hxExt,
|
||||
hxInclude string) {
|
||||
<input
|
||||
class="form-control bg-field border-0 h-auto py-6 px-6 rounded-lg"
|
||||
type={ inpType }
|
||||
@@ -45,6 +46,7 @@ templ MainCustomTextFieldSearchV1(
|
||||
hx-indicator={ hxIndicator }
|
||||
value={ value }
|
||||
hx-ext={ hxExt }
|
||||
autocomplete="off"
|
||||
hx-include={ hxInclude }
|
||||
autocomplete="off"
|
||||
/>
|
||||
}
|
||||
|
||||
@@ -155,7 +155,8 @@ func MainCustomTextFieldSearchV1(
|
||||
hxTarget,
|
||||
hxIndicator,
|
||||
value,
|
||||
hxExt string) templ.Component {
|
||||
hxExt,
|
||||
hxInclude string) templ.Component {
|
||||
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
@@ -175,7 +176,7 @@ func MainCustomTextFieldSearchV1(
|
||||
var templ_7745c5c3_Var11 string
|
||||
templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(inpType)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfieldsearch\customtextfieldsearch.templ`, Line: 38, Col: 16}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfieldsearch\customtextfieldsearch.templ`, Line: 39, Col: 16}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@@ -188,7 +189,7 @@ func MainCustomTextFieldSearchV1(
|
||||
var templ_7745c5c3_Var12 string
|
||||
templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(inpName)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfieldsearch\customtextfieldsearch.templ`, Line: 39, Col: 16}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfieldsearch\customtextfieldsearch.templ`, Line: 40, Col: 16}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@@ -201,7 +202,7 @@ func MainCustomTextFieldSearchV1(
|
||||
var templ_7745c5c3_Var13 string
|
||||
templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(inpId)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfieldsearch\customtextfieldsearch.templ`, Line: 40, Col: 12}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfieldsearch\customtextfieldsearch.templ`, Line: 41, Col: 12}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@@ -214,7 +215,7 @@ func MainCustomTextFieldSearchV1(
|
||||
var templ_7745c5c3_Var14 string
|
||||
templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(inpPlaceHolder)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfieldsearch\customtextfieldsearch.templ`, Line: 41, Col: 30}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfieldsearch\customtextfieldsearch.templ`, Line: 42, Col: 30}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@@ -227,7 +228,7 @@ func MainCustomTextFieldSearchV1(
|
||||
var templ_7745c5c3_Var15 string
|
||||
templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(hxGet)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfieldsearch\customtextfieldsearch.templ`, Line: 42, Col: 16}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfieldsearch\customtextfieldsearch.templ`, Line: 43, Col: 16}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@@ -240,7 +241,7 @@ func MainCustomTextFieldSearchV1(
|
||||
var templ_7745c5c3_Var16 string
|
||||
templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(hxTrigger)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfieldsearch\customtextfieldsearch.templ`, Line: 43, Col: 24}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfieldsearch\customtextfieldsearch.templ`, Line: 44, Col: 24}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@@ -253,7 +254,7 @@ func MainCustomTextFieldSearchV1(
|
||||
var templ_7745c5c3_Var17 string
|
||||
templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(hxTarget)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfieldsearch\customtextfieldsearch.templ`, Line: 44, Col: 22}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfieldsearch\customtextfieldsearch.templ`, Line: 45, Col: 22}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@@ -266,7 +267,7 @@ func MainCustomTextFieldSearchV1(
|
||||
var templ_7745c5c3_Var18 string
|
||||
templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(hxIndicator)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfieldsearch\customtextfieldsearch.templ`, Line: 45, Col: 28}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfieldsearch\customtextfieldsearch.templ`, Line: 46, Col: 28}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@@ -279,7 +280,7 @@ func MainCustomTextFieldSearchV1(
|
||||
var templ_7745c5c3_Var19 string
|
||||
templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs(value)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfieldsearch\customtextfieldsearch.templ`, Line: 46, Col: 15}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfieldsearch\customtextfieldsearch.templ`, Line: 47, Col: 15}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@@ -292,12 +293,25 @@ func MainCustomTextFieldSearchV1(
|
||||
var templ_7745c5c3_Var20 string
|
||||
templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs(hxExt)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfieldsearch\customtextfieldsearch.templ`, Line: 47, Col: 16}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfieldsearch\customtextfieldsearch.templ`, Line: 48, Col: 16}
|
||||
}
|
||||
_, 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-include=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var21 string
|
||||
templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.JoinStringErrs(hxInclude)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfieldsearch\customtextfieldsearch.templ`, Line: 49, Col: 24}
|
||||
}
|
||||
_, 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("\" autocomplete=\"off\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
|
||||
@@ -30,12 +30,11 @@ type MasterMenuUserService interface {
|
||||
GetMasterMenus() ([]services.MasterMenu, error)
|
||||
GetUserGroup() ([]models.UserGroup, error)
|
||||
// try
|
||||
GetListMasterUser() ([]models.MasterUser, error)
|
||||
GetListMasterUser(searchDropdown string) ([]models.MasterUser, error)
|
||||
GetListBreadCrumb(title string) (models.BreadCrumbV1, error)
|
||||
|
||||
GetListMasterUserBySearch(search string) ([]models.MasterUser, error)
|
||||
GetListMasterUserPagination(search string, currentPage int, rowPerPage int) ([]models.MasterUser, error)
|
||||
GetListMasterUserFilteredBySearch(search string) ([]models.MasterUser, error)
|
||||
GetListMasterUserPagination(search string, searchDropdown string, currentPage int, rowPerPage int) ([]models.MasterUser, error)
|
||||
GetListMasterUserFilteredBySearch(search string, searchDropdown string) ([]models.MasterUser, error)
|
||||
GetListMasterUserGroupSearch() ([]models.UserGroupV1, error)
|
||||
}
|
||||
|
||||
@@ -113,7 +112,7 @@ func (lh *MasterMenuUserHandler) HandlerShowMasterMenuUserV1(c echo.Context) err
|
||||
}
|
||||
|
||||
rowPerPage := 2
|
||||
dataMasterUser, err := lh.MasterMenuUserService.GetListMasterUserPagination("", 1, rowPerPage)
|
||||
dataMasterUser, err := lh.MasterMenuUserService.GetListMasterUserPagination("", "1", 1, rowPerPage)
|
||||
fmt.Println(dataMasterUser)
|
||||
fmt.Println(err)
|
||||
if err != nil {
|
||||
@@ -125,7 +124,7 @@ func (lh *MasterMenuUserHandler) HandlerShowMasterMenuUserV1(c echo.Context) err
|
||||
return err
|
||||
}
|
||||
|
||||
dataUserMasterAll, err := lh.MasterMenuUserService.GetListMasterUser()
|
||||
dataUserMasterAll, err := lh.MasterMenuUserService.GetListMasterUser("1")
|
||||
fmt.Println(dataUserMasterAll)
|
||||
fmt.Println(err)
|
||||
if err != nil {
|
||||
@@ -201,13 +200,14 @@ func (lh *MasterMenuUserHandler) HandlerShowMasterMenuUserV1(c echo.Context) err
|
||||
// inputansearchComponent := customtextfieldsearch.MainCustomTextFieldSearchV1("q", "Cari User Group", "text", "/dev/searchuserv1", "input changed delay:500ms, search", "#idbaru", "#indicator")
|
||||
|
||||
contentIDSearch := utils.GenerateRandomID("qsearch")
|
||||
contentIDDropdown := utils.GenerateRandomID("qdropdown")
|
||||
totalPages := int(math.Ceil(float64(len(dataUserMasterAll)) / float64(rowPerPage)))
|
||||
link := "currentPage=1&page=" + strconv.Itoa(totalPages) + "&contentID=" + contentID
|
||||
|
||||
inputansearchComponent := customtextfieldsearch.MainCustomTextFieldSearchV1("#"+contentIDSearch, "q", "Cari User Group", "text", "/dev/searchuserv1?"+link, "input changed delay:500ms, search", "#"+contentID, "#indicator", "", contentIDHtmxExtension)
|
||||
inputansearchComponent := customtextfieldsearch.MainCustomTextFieldSearchV1("#"+contentIDSearch, "q", "Cari User Group", "text", "/dev/searchuserv1?"+link, "input changed delay:500ms, search", "#"+contentID, "#indicator", "", contentIDHtmxExtension, "[name='usergroup']")
|
||||
|
||||
listItemComponent := mastermenuuser.ItemDropdownV2(contentID, "#indicator", dataUserGroupAll)
|
||||
dropdownComponent := customdropdown.MainCustomDropdownV2("User Group", "usergroup", "idusergroup", listItemComponent)
|
||||
listItemComponent := mastermenuuser.ItemDropdown(dataUserGroupAll)
|
||||
dropdownComponent := customdropdown.MainCustomDropdown("usergroup", "#"+contentIDDropdown, "#"+contentID, "/dev/searchuserv1?"+link, "#indicator", "change from:select[name='usergroup']", "[name='q']", listItemComponent)
|
||||
|
||||
// toast
|
||||
// contentIDToast := utils.GenerateRandomID("toastmgu")
|
||||
@@ -217,7 +217,7 @@ func (lh *MasterMenuUserHandler) HandlerShowMasterMenuUserV1(c echo.Context) err
|
||||
|
||||
searchQueryParam := "&q="
|
||||
tabelusergroupComponent := tablecomponent.TableV2(
|
||||
[]string{"USERNAME", "NAMA STAFF", "USER GROUP", "AKSI"},
|
||||
[]string{"EMAIL", "NAMA STAFF", "USER GROUP", "AKSI"},
|
||||
[]string{"20%", "40%", "20%", "20%"},
|
||||
mastermenuuser.TableRowMasterUserV1(dataMasterUser),
|
||||
pagination.PaginationV1(totalPages, 1, "/dev/userv1pagination", contentID, searchQueryParam),
|
||||
@@ -249,6 +249,12 @@ func (lh *MasterMenuUserHandler) HandlerShowMasterMenuUserV1(c echo.Context) err
|
||||
|
||||
func (lh *MasterMenuUserHandler) HandlerShowMasterMenuUserSearchV1(c echo.Context) error {
|
||||
search := c.QueryParam("q")
|
||||
searchDropdownParam := c.QueryParam("usergroup")
|
||||
var searchDropdown string = ""
|
||||
if searchDropdownParam != "0" {
|
||||
searchDropdown = searchDropdownParam
|
||||
}
|
||||
|
||||
logger, _ := zap.NewProduction()
|
||||
|
||||
// dataUserMaster, err := lh.MasterMenuUserService.GetListMasterUserBySearch(search)
|
||||
@@ -275,7 +281,7 @@ func (lh *MasterMenuUserHandler) HandlerShowMasterMenuUserSearchV1(c echo.Contex
|
||||
return err
|
||||
}
|
||||
|
||||
dataUserMaster, err := lh.MasterMenuUserService.GetListMasterUserPagination(search, currentPage, rowPerPage)
|
||||
dataUserMaster, err := lh.MasterMenuUserService.GetListMasterUserPagination(search, searchDropdown, currentPage, rowPerPage)
|
||||
fmt.Println(dataUserMaster)
|
||||
fmt.Println(err)
|
||||
if err != nil {
|
||||
@@ -294,7 +300,7 @@ func (lh *MasterMenuUserHandler) HandlerShowMasterMenuUserSearchV1(c echo.Contex
|
||||
)
|
||||
|
||||
// data user filtered
|
||||
dataUserMasterFiltered, err := lh.MasterMenuUserService.GetListMasterUserFilteredBySearch(search)
|
||||
dataUserMasterFiltered, err := lh.MasterMenuUserService.GetListMasterUserFilteredBySearch(search, searchDropdown)
|
||||
fmt.Println(dataUserMasterFiltered)
|
||||
fmt.Println(err)
|
||||
if err != nil {
|
||||
@@ -317,7 +323,7 @@ func (lh *MasterMenuUserHandler) HandlerShowMasterMenuUserSearchV1(c echo.Contex
|
||||
|
||||
// tabelusergroupComponent := mastermenuusergroup.TableRowV1(dataUserMaster)
|
||||
totalPages := int(math.Ceil(float64(len(dataUserMasterFiltered)) / float64(rowPerPage)))
|
||||
searchQueryParam := "&q=" + search
|
||||
searchQueryParam := "&q=" + search + "&usergroup=" + searchDropdown
|
||||
|
||||
// contentIDSearch := utils.GenerateRandomID("qsearch")
|
||||
// link := "currentPage=1&page=" + strconv.Itoa(totalPages) + "&contentID=" + contentID
|
||||
@@ -327,7 +333,7 @@ func (lh *MasterMenuUserHandler) HandlerShowMasterMenuUserSearchV1(c echo.Contex
|
||||
|
||||
inputansearchComponent := tablecomponent.DivEmpty()
|
||||
tabelusergroupComponent := tablecomponent.TableV2(
|
||||
[]string{"USERNAME", "NAMA STAFF", "USER GROUP", "AKSI"},
|
||||
[]string{"EMAIL", "NAMA STAFF", "USER GROUP", "AKSI"},
|
||||
[]string{"20%", "40%", "20%", "20%"},
|
||||
mastermenuuser.TableRowMasterUserV1(dataUserMaster),
|
||||
pagination.PaginationV1(totalPages, 1, "/dev/userv1pagination", contentID, searchQueryParam),
|
||||
@@ -345,6 +351,12 @@ func (lh *MasterMenuUserHandler) HandlerShowMasterMenuUserPaginationV1(c echo.Co
|
||||
logger, _ := zap.NewProduction()
|
||||
|
||||
search := c.QueryParam("q")
|
||||
searchDropdownParam := c.QueryParam("usergroup")
|
||||
var searchDropdown string = ""
|
||||
if searchDropdownParam != "0" {
|
||||
searchDropdown = searchDropdownParam
|
||||
}
|
||||
|
||||
pageparam := c.QueryParam("page")
|
||||
page, err := strconv.Atoi(pageparam)
|
||||
if err != nil {
|
||||
@@ -356,7 +368,7 @@ func (lh *MasterMenuUserHandler) HandlerShowMasterMenuUserPaginationV1(c echo.Co
|
||||
return err
|
||||
}
|
||||
|
||||
dataUserMasterAll, err := lh.MasterMenuUserService.GetListMasterUser()
|
||||
dataUserMasterAll, err := lh.MasterMenuUserService.GetListMasterUser(searchDropdown)
|
||||
fmt.Println(dataUserMasterAll)
|
||||
fmt.Println(err)
|
||||
if err != nil {
|
||||
@@ -380,7 +392,7 @@ func (lh *MasterMenuUserHandler) HandlerShowMasterMenuUserPaginationV1(c echo.Co
|
||||
}
|
||||
|
||||
rowPerPage := 2
|
||||
dataUserMaster, err := lh.MasterMenuUserService.GetListMasterUserPagination(search, currentPage, rowPerPage)
|
||||
dataUserMaster, err := lh.MasterMenuUserService.GetListMasterUserPagination(search, searchDropdown, currentPage, rowPerPage)
|
||||
fmt.Println(dataUserMaster)
|
||||
fmt.Println(err)
|
||||
if err != nil {
|
||||
@@ -401,7 +413,7 @@ func (lh *MasterMenuUserHandler) HandlerShowMasterMenuUserPaginationV1(c echo.Co
|
||||
)
|
||||
|
||||
// data user filtered
|
||||
dataUserMasterFiltered, err := lh.MasterMenuUserService.GetListMasterUserFilteredBySearch(search)
|
||||
dataUserMasterFiltered, err := lh.MasterMenuUserService.GetListMasterUserFilteredBySearch(search, searchDropdown)
|
||||
fmt.Println(dataUserMasterFiltered)
|
||||
fmt.Println(err)
|
||||
if err != nil {
|
||||
@@ -422,7 +434,7 @@ func (lh *MasterMenuUserHandler) HandlerShowMasterMenuUserPaginationV1(c echo.Co
|
||||
contentID := utils.GenerateRandomID("tablebody")
|
||||
|
||||
// table user group
|
||||
searchQueryParam := "&q=" + search
|
||||
searchQueryParam := "&q=" + search + "&usergroup=" + searchDropdown
|
||||
totalPages := int(math.Ceil(float64(len(dataUserMasterFiltered)) / float64(rowPerPage)))
|
||||
// contentIDSearch := utils.GenerateRandomID("qsearch")
|
||||
// link := "currentPage=1&page=" + strconv.Itoa(totalPages) + "&contentID=" + contentID
|
||||
@@ -432,8 +444,8 @@ func (lh *MasterMenuUserHandler) HandlerShowMasterMenuUserPaginationV1(c echo.Co
|
||||
|
||||
inputansearchComponent := tablecomponent.DivEmpty()
|
||||
tabelusergroupComponent := tablecomponent.TableV2(
|
||||
[]string{"KODE", "USERGROUP", "AKSI"},
|
||||
[]string{"40%", "40%", "20%"},
|
||||
[]string{"EMAIL", "NAMA STAFF", "USER GROUP", "AKSI"},
|
||||
[]string{"20%", "40%", "20%", "20%"},
|
||||
mastermenuuser.TableRowMasterUserV1(dataUserMaster),
|
||||
pagination.PaginationV1(totalPages, currentPage, "/dev/userv1pagination", contentID, searchQueryParam),
|
||||
contentID,
|
||||
|
||||
@@ -255,7 +255,7 @@ func (lh *MasterMenuUserGroupHandler) HandlerShowMasterMenuUserGroupV1(c echo.Co
|
||||
totalPages := int(math.Ceil(float64(len(dataUserGroupAll)) / float64(rowPerPage)))
|
||||
link := "currentPage=1&page=" + strconv.Itoa(totalPages) + "&contentID=" + contentID
|
||||
|
||||
inputansearchComponent := customtextfieldsearch.MainCustomTextFieldSearchV1("#"+contentIDSearch, "q", "Cari User Group", "text", "/dev/searchusergroupv1?"+link, "input changed delay:500ms, search", "#"+contentID, "#indicator", "", contentIDHtmxExtension)
|
||||
inputansearchComponent := customtextfieldsearch.MainCustomTextFieldSearchV1("#"+contentIDSearch, "q", "Cari User Group", "text", "/dev/searchusergroupv1?"+link, "input changed delay:500ms, search", "#"+contentID, "#indicator", "", contentIDHtmxExtension, "")
|
||||
// toast
|
||||
// contentIDToast := utils.GenerateRandomID("toastmgu")
|
||||
// toastComponent = customtoast.CustomToastV1("", contentIDHtmxExtension)
|
||||
|
||||
@@ -210,6 +210,6 @@ func SetupRoutesDev(app *echo.Echo, appStore db.AppStore) {
|
||||
devUserhandlers := dev_handlers.NewMasterMenuUserHandler(devUserServices)
|
||||
dev.GET("/userv1", devUserhandlers.HandlerShowMasterMenuUserV1)
|
||||
dev.GET("/searchuserv1", devUserhandlers.HandlerShowMasterMenuUserSearchV1)
|
||||
dev.GET("/userv1pagination/:idUserGroup", devUserhandlers.HandlerShowMasterMenuUserPaginationV1)
|
||||
dev.GET("/userv1pagination", devUserhandlers.HandlerShowMasterMenuUserPaginationV1)
|
||||
// dev.GET("/dropdownusergroupselected", )
|
||||
}
|
||||
|
||||
@@ -589,7 +589,7 @@ func (su *ServicesMasterMenuUser) GetListBreadCrumb(title string) (models.BreadC
|
||||
}
|
||||
|
||||
// try
|
||||
func (su *ServicesMasterMenuUser) GetListMasterUser() ([]models.MasterUser, error) {
|
||||
func (su *ServicesMasterMenuUser) GetListMasterUser(searchDropdown string) ([]models.MasterUser, error) {
|
||||
var userList []models.MasterUser
|
||||
|
||||
query := `
|
||||
@@ -618,9 +618,14 @@ func (su *ServicesMasterMenuUser) GetListMasterUser() ([]models.MasterUser, erro
|
||||
ON M_UserM_UserGroupID = M_UserGroupID
|
||||
AND M_UserIsActive = 'Y'
|
||||
AND M_UserGroupIsActive = 'Y'
|
||||
ORDER BY M_UserGroupID ASC
|
||||
`
|
||||
|
||||
if searchDropdown != "0" && searchDropdown != "" {
|
||||
query += fmt.Sprintf("AND M_UserGroupID = '%s'", searchDropdown)
|
||||
}
|
||||
|
||||
query += " ORDER BY M_UserID ASC"
|
||||
|
||||
if err := dbx.Handlex.Select(&userList, query); err != nil {
|
||||
return nil, fmt.Errorf("error querying database: %v", err)
|
||||
}
|
||||
@@ -628,7 +633,7 @@ func (su *ServicesMasterMenuUser) GetListMasterUser() ([]models.MasterUser, erro
|
||||
return userList, nil
|
||||
}
|
||||
|
||||
func (su *ServicesMasterMenuUser) GetListMasterUserFilteredBySearch(search string) ([]models.MasterUser, error) {
|
||||
func (su *ServicesMasterMenuUser) GetListMasterUserFilteredBySearch(search string, searchDropdown string) ([]models.MasterUser, error) {
|
||||
var userList []models.MasterUser
|
||||
|
||||
query := `
|
||||
@@ -661,13 +666,13 @@ func (su *ServicesMasterMenuUser) GetListMasterUserFilteredBySearch(search strin
|
||||
`
|
||||
|
||||
// check jika parameter search nya tidak kosong
|
||||
if search != "" {
|
||||
query += fmt.Sprintf(" AND (M_UserFullName LIKE '%%%s%%' OR M_UserEmail LIKE '%%%s%%')", search, search)
|
||||
if search != "" || (searchDropdown != "0" && searchDropdown != "") {
|
||||
query += fmt.Sprintf(" AND (M_UserFullName LIKE '%%%s%%' OR M_UserEmail LIKE '%%%s%%') AND M_UserGroupID = '%s'", search, search, searchDropdown)
|
||||
} else {
|
||||
search = "%%"
|
||||
}
|
||||
|
||||
query += fmt.Sprintf(" ORDER BY M_UserGroupID ASC")
|
||||
query += " ORDER BY M_UserID ASC"
|
||||
|
||||
logger, _ := zap.NewProduction()
|
||||
defer logger.Sync()
|
||||
@@ -682,66 +687,7 @@ func (su *ServicesMasterMenuUser) GetListMasterUserFilteredBySearch(search strin
|
||||
return userList, nil
|
||||
}
|
||||
|
||||
func (su *ServicesMasterMenuUser) GetListMasterUserBySearch(search string) ([]models.MasterUser, error) {
|
||||
var userList []models.MasterUser
|
||||
|
||||
query := `
|
||||
SELECT
|
||||
ROW_NUMBER() OVER () AS nomor,
|
||||
M_UserID,
|
||||
IFNULL(M_UserEmail, '') AS M_UserEmail,
|
||||
IFNULL(M_UserFullName, '') AS M_UserFullName,
|
||||
IFNULL(M_UserLastAccess, '') AS M_UserLastAccess,
|
||||
IFNULL(M_UserIsLoggedIn, '') AS M_UserIsLoggedIn,
|
||||
IFNULL(M_UserActiveToken, '') AS M_UserActiveToken,
|
||||
IFNULL(M_UserExpiredToken, '') AS M_UserExpiredToken,
|
||||
IFNULL(M_UserIsActive, '') AS M_UserIsActive,
|
||||
IFNULL(M_UserCreated, '') AS M_UserCreated,
|
||||
IFNULL(M_UserCreatedUserID, '') AS M_UserCreatedUserID,
|
||||
IFNULL(M_UserLastUpdated, '') AS M_UserLastUpdated,
|
||||
IFNULL(M_UserLastUpdatedUserID, '') AS M_UserLastUpdatedUserID,
|
||||
IFNULL(M_UserDeletedUserID, '') AS M_UserDeletedUserID,
|
||||
IFNULL(M_UserDeleted, '') AS M_UserDeleted,
|
||||
IFNULL(M_UserGroupCode, '') AS M_UserGroupCode,
|
||||
IFNULL(M_UserGroupName, '') AS M_UserGroupName,
|
||||
IFNULL(M_UserM_UserGroupID, '') AS M_UserM_UserGroupID,
|
||||
IFNULL(M_UserGroupID, '') AS M_UserGroupID
|
||||
FROM
|
||||
m_user
|
||||
JOIN m_usergroup
|
||||
ON M_UserM_UserGroupID = M_UserGroupID
|
||||
AND M_UserIsActive = 'Y'
|
||||
AND M_UserGroupIsActive = 'Y'
|
||||
`
|
||||
|
||||
// fmt.Errorf(search)
|
||||
rowPerPage := 2
|
||||
offset := 0
|
||||
|
||||
// check jika parameter search nya tidak kosong
|
||||
if search != "" {
|
||||
query += fmt.Sprintf(" AND (M_UserFullName LIKE '%%%s%%' OR M_UserEmail LIKE '%%%s%%')", search, search)
|
||||
} else {
|
||||
search = "%%"
|
||||
}
|
||||
|
||||
// query += " ORDER BY M_UserGroupID ASC"
|
||||
query += fmt.Sprintf(" ORDER BY M_UserGroupID ASC LIMIT %d OFFSET %d", rowPerPage, offset)
|
||||
|
||||
logger, _ := zap.NewProduction()
|
||||
defer logger.Sync()
|
||||
logger.Info("QUERY SEARCH ONlY AND SETTING LIMIT",
|
||||
zap.String("query search", query),
|
||||
)
|
||||
|
||||
if err := dbx.Handlex.Select(&userList, query); err != nil {
|
||||
return nil, fmt.Errorf("error querying database: %v", err)
|
||||
}
|
||||
|
||||
return userList, nil
|
||||
}
|
||||
|
||||
func (su *ServicesMasterMenuUser) GetListMasterUserPagination(search string, currentPage int, rowPerPage int) ([]models.MasterUser, error) {
|
||||
func (su *ServicesMasterMenuUser) GetListMasterUserPagination(search string, searchDropdown string, currentPage int, rowPerPage int) ([]models.MasterUser, error) {
|
||||
var userList []models.MasterUser
|
||||
|
||||
query := `
|
||||
@@ -779,13 +725,13 @@ func (su *ServicesMasterMenuUser) GetListMasterUserPagination(search string, cur
|
||||
offset := (currentPage - 1) * rowPerPage
|
||||
// offset := currentPage
|
||||
|
||||
if search != "" {
|
||||
query += fmt.Sprintf(" AND (M_UserEmail LIKE '%%%s%%' OR M_UserFullName LIKE '%%%s%%')", search, search)
|
||||
if search != "" || (searchDropdown != "0" && searchDropdown != "") {
|
||||
query += fmt.Sprintf(" AND (M_UserEmail LIKE '%%%s%%' OR M_UserFullName LIKE '%%%s%%') AND M_UserGroupID = '%s'", search, search, searchDropdown)
|
||||
} else {
|
||||
search = "%%"
|
||||
}
|
||||
|
||||
query += fmt.Sprintf(" ORDER BY M_UserGroupID ASC LIMIT %d OFFSET %d", rowPerPage, offset)
|
||||
query += fmt.Sprintf(" ORDER BY M_UserID ASC LIMIT %d OFFSET %d", rowPerPage, offset)
|
||||
|
||||
logger, _ := zap.NewProduction()
|
||||
defer logger.Sync()
|
||||
@@ -814,8 +760,8 @@ func (su *ServicesMasterMenuUser) GetListMasterUserGroupSearch() ([]models.UserG
|
||||
M_UserGroupIsActive
|
||||
FROM m_usergroup
|
||||
WHERE M_UserGroupIsActive = 'Y'
|
||||
order by M_UserGroupID ASC
|
||||
`
|
||||
query += " order by M_UserGroupID ASC"
|
||||
|
||||
if err := dbx.Handlex.Select(&userGroupList, query); err != nil {
|
||||
return nil, fmt.Errorf("error querying database: %v", err)
|
||||
|
||||
@@ -68,7 +68,7 @@ templ TableRowMasterUserV1(data []models.MasterUser) {
|
||||
<tr>
|
||||
<td>{ v.M_UserEmail }</td>
|
||||
<td>{ v.M_UserFullName }</td>
|
||||
<td>{ v.M_UserGroupName }</td>
|
||||
<td>{ v.M_UserGroupName }</td>
|
||||
<td>
|
||||
<div class="row px-5 d-flex justify-content-around">
|
||||
<a
|
||||
@@ -211,28 +211,13 @@ templ JsMasterMenuUserV1x() {
|
||||
|
||||
// for item dropdown
|
||||
templ ItemDropdown(dataDropdown []models.UserGroupV1) {
|
||||
if len(dataDropdown) == 0 {
|
||||
<option value="0" disabled selected>Tidak Ada Data</option>
|
||||
} else {
|
||||
for _, v := range dataDropdown {
|
||||
<option value={ strconv.Itoa(v.M_UserGroupID) } >{ v.M_UserGroupName }</option>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
templ ItemDropdownV2(hxTarget string, hxIndicator string, dataDropdown []models.UserGroupV1) {
|
||||
if len(dataDropdown) == 0 {
|
||||
<option value="0" disabled selected>Tidak Ada Data</option>
|
||||
} else {
|
||||
for _, v := range dataDropdown {
|
||||
<option
|
||||
hx-get={ "/dropdownusergroupselected/" + strconv.Itoa(v.M_UserGroupID) }
|
||||
hx-target={ hxTarget }
|
||||
hx-indicator={ hxIndicator }
|
||||
value={ strconv.Itoa(v.M_UserGroupID) } >{ v.M_UserGroupName }</option>
|
||||
}
|
||||
}
|
||||
if len(dataDropdown) == 0 {
|
||||
<option value="0" disabled selected>Tidak Ada Data</option>
|
||||
} else {
|
||||
for _, v := range dataDropdown {
|
||||
<option value={ strconv.Itoa(v.M_UserGroupID) }>{ v.M_UserGroupName }</option>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
templ ShowMasterMenuUserV1x(title string, cmp templ.Component, css templ.Component, js templ.Component,
|
||||
|
||||
@@ -127,7 +127,7 @@ func TableRowMasterUserV1(data []models.MasterUser) templ.Component {
|
||||
var templ_7745c5c3_Var5 string
|
||||
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(v.M_UserGroupName)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mastermenuuser\mastermenuuser.templ`, Line: 71, Col: 35}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mastermenuuser\mastermenuuser.templ`, Line: 71, Col: 26}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@@ -359,7 +359,7 @@ func ItemDropdown(dataDropdown []models.UserGroupV1) templ.Component {
|
||||
var templ_7745c5c3_Var15 string
|
||||
templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.Itoa(v.M_UserGroupID))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mastermenuuser\mastermenuuser.templ`, Line: 218, Col: 57}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mastermenuuser\mastermenuuser.templ`, Line: 218, Col: 48}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@@ -372,7 +372,7 @@ func ItemDropdown(dataDropdown []models.UserGroupV1) templ.Component {
|
||||
var templ_7745c5c3_Var16 string
|
||||
templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(v.M_UserGroupName)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mastermenuuser\mastermenuuser.templ`, Line: 218, Col: 80}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mastermenuuser\mastermenuuser.templ`, Line: 218, Col: 70}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@@ -391,104 +391,6 @@ func ItemDropdown(dataDropdown []models.UserGroupV1) templ.Component {
|
||||
})
|
||||
}
|
||||
|
||||
func ItemDropdownV2(hxTarget string, hxIndicator string, dataDropdown []models.UserGroupV1) 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)
|
||||
if len(dataDropdown) == 0 {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<option value=\"0\" disabled selected>Tidak Ada Data</option>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
} else {
|
||||
for _, v := range dataDropdown {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<option hx-get=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var18 string
|
||||
templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs("/dropdownusergroup/" + strconv.Itoa(v.M_UserGroupID))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mastermenuuser\mastermenuuser.templ`, Line: 230, Col: 65}
|
||||
}
|
||||
_, 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(hxTarget)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mastermenuuser\mastermenuuser.templ`, Line: 231, Col: 23}
|
||||
}
|
||||
_, 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-indicator=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var20 string
|
||||
templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs(hxIndicator)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mastermenuuser\mastermenuuser.templ`, Line: 232, Col: 29}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var20))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" value=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var21 string
|
||||
templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.Itoa(v.M_UserGroupID))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mastermenuuser\mastermenuuser.templ`, Line: 233, Col: 40}
|
||||
}
|
||||
_, 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("\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var22 string
|
||||
templ_7745c5c3_Var22, templ_7745c5c3_Err = templ.JoinStringErrs(v.M_UserGroupName)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mastermenuuser\mastermenuuser.templ`, Line: 233, Col: 63}
|
||||
}
|
||||
_, 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("</option>")
|
||||
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 ShowMasterMenuUserV1x(title string, cmp templ.Component, css templ.Component, js templ.Component,
|
||||
navbarmenu templ.Component,
|
||||
navbaruser templ.Component,
|
||||
@@ -500,12 +402,12 @@ func ShowMasterMenuUserV1x(title string, cmp templ.Component, css templ.Componen
|
||||
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var23 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var23 == nil {
|
||||
templ_7745c5c3_Var23 = templ.NopComponent
|
||||
templ_7745c5c3_Var17 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var17 == nil {
|
||||
templ_7745c5c3_Var17 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
templ_7745c5c3_Var24 := templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Var18 := 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()
|
||||
@@ -520,7 +422,7 @@ func ShowMasterMenuUserV1x(title string, cmp templ.Component, css templ.Componen
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
templ_7745c5c3_Err = layout.CorporateLayout(title, css, js, navbarmenu, navbaruser, userprofile).Render(templ.WithChildren(ctx, templ_7745c5c3_Var24), templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = layout.CorporateLayout(title, css, js, navbarmenu, navbaruser, userprofile).Render(templ.WithChildren(ctx, templ_7745c5c3_Var18), templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user