add search dan pagination

This commit is contained in:
Hanan Askarim
2024-05-20 17:27:54 +07:00
parent 13aa1c21a6
commit 035b4aa430
5 changed files with 114 additions and 3 deletions

View File

@@ -177,7 +177,12 @@ templ ShowKelainan(
templ TableKelainan(data []models.Kelainan, tableID string) {
<div id={ tableID } hx-swap-oob={ "#" + tableID }>
@tablecomponent.TableV3([]string{"NO", "GRUP KELAINAN", "AKSI"},
[]string{"15%", "65%", "20%"},
[]string{"10%", "70%", "20%"},
TableRowV1(data))
</div>
}
templ SwapTableKelainan(pagination templ.Component, table templ.Component) {
@pagination
@table
}

View File

@@ -329,7 +329,7 @@ func TableKelainan(data []models.Kelainan, tableID string) templ.Component {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = tablecomponent.TableV3([]string{"NO", "GRUP KELAINAN", "AKSI"},
[]string{"15%", "65%", "20%"},
[]string{"10%", "70%", "20%"},
TableRowV1(data)).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
@@ -344,3 +344,31 @@ func TableKelainan(data []models.Kelainan, tableID string) templ.Component {
return templ_7745c5c3_Err
})
}
func SwapTableKelainan(pagination templ.Component, table 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_Var14 := templ.GetChildren(ctx)
if templ_7745c5c3_Var14 == nil {
templ_7745c5c3_Var14 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Err = pagination.Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = table.Render(ctx, 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
})
}