From 5565c0d48dbd47ef237df00cb0d1c463cd0199a9 Mon Sep 17 00:00:00 2001 From: sindhu Date: Fri, 17 May 2024 16:39:34 +0700 Subject: [PATCH] list master user without searching --- component/customdropdown/customdropdown.templ | 5 - .../customdropdown/customdropdown_templ.go | 121 ++++++++++++++++++ .../customautocompletev1.templ | 28 ++++ .../customautocompletev1_templ.go | 72 +++++++++++ component/table/tablev2.templ | 11 +- component/table/tablev2_templ.go | 22 +++- handlers/dev/mastermenuuser.handlers.go | 22 ++++ handlers/dev/mastermenuusergroup.handlers.go | 4 +- services/dev/mastermenuuser.services.go | 24 ++++ views/dev/mastermenuuser/mastermenuuser.templ | 2 +- .../mastermenuuser/mastermenuuser_templ.go | 72 ++++++++++- 11 files changed, 363 insertions(+), 20 deletions(-) create mode 100644 component/customdropdown/customdropdown_templ.go create mode 100644 component/customtextfieldautocomplete/customautocompletev1.templ create mode 100644 component/customtextfieldautocomplete/customautocompletev1_templ.go diff --git a/component/customdropdown/customdropdown.templ b/component/customdropdown/customdropdown.templ index af2def0..998c952 100644 --- a/component/customdropdown/customdropdown.templ +++ b/component/customdropdown/customdropdown.templ @@ -1,10 +1,5 @@ package customdropdown; -import ( - "cpone/layout" - "cpone/models" -) - templ MainCustomDropdown(label string, name string, id string, hxTarget string, hxGet string, hxIndicator string, listItem templ.Component) {
diff --git a/component/customdropdown/customdropdown_templ.go b/component/customdropdown/customdropdown_templ.go new file mode 100644 index 0000000..8f41055 --- /dev/null +++ b/component/customdropdown/customdropdown_templ.go @@ -0,0 +1,121 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.2.663 +package customdropdown + +//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" + +func MainCustomDropdown(label string, name string, id string, hxTarget string, hxGet string, hxIndicator 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_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("
") + 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 + }) +} diff --git a/component/customtextfieldautocomplete/customautocompletev1.templ b/component/customtextfieldautocomplete/customautocompletev1.templ new file mode 100644 index 0000000..75f74a6 --- /dev/null +++ b/component/customtextfieldautocomplete/customautocompletev1.templ @@ -0,0 +1,28 @@ +package customtextfieldautocomplete + +templ MainCustomAutoCompleteV1(value string) { +
+ +
+
+ Loading... +
+
+
+} + +templ ListCustomAutoCompleteHideV1() { +
+} \ No newline at end of file diff --git a/component/customtextfieldautocomplete/customautocompletev1_templ.go b/component/customtextfieldautocomplete/customautocompletev1_templ.go new file mode 100644 index 0000000..a4dddf1 --- /dev/null +++ b/component/customtextfieldautocomplete/customautocompletev1_templ.go @@ -0,0 +1,72 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.2.663 +package customtextfieldautocomplete + +//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" + +func MainCustomAutoCompleteV1(value 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("
Loading...
") + 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 ListCustomAutoCompleteHideV1() 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) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + 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 + }) +} diff --git a/component/table/tablev2.templ b/component/table/tablev2.templ index a187755..c772578 100644 --- a/component/table/tablev2.templ +++ b/component/table/tablev2.templ @@ -1,10 +1,17 @@ package tablecomponent -templ TableV2(thName []string, thWidth []string, trComponent templ.Component, pagination templ.Component, idunique string, inputanSearch templ.Component) { +templ TableV2(thName []string, thWidth []string, trComponent templ.Component, pagination templ.Component, idunique string, inputanSearch templ.Component, dropdown templ.Component) { if len(thName) != len(thWidth) {
length array thname berbeda dengan array thwidth
} else { - @inputanSearch +
+
+ @dropdown +
+
+ @inputanSearch +
+
diff --git a/component/table/tablev2_templ.go b/component/table/tablev2_templ.go index 5ca7e4b..54533fc 100644 --- a/component/table/tablev2_templ.go +++ b/component/table/tablev2_templ.go @@ -10,7 +10,7 @@ import "context" import "io" import "bytes" -func TableV2(thName []string, thWidth []string, trComponent templ.Component, pagination templ.Component, idunique string, inputanSearch templ.Component) templ.Component { +func TableV2(thName []string, thWidth []string, trComponent templ.Component, pagination templ.Component, idunique string, inputanSearch templ.Component, dropdown 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 { @@ -29,18 +29,30 @@ func TableV2(thName []string, thWidth []string, trComponent templ.Component, pag return templ_7745c5c3_Err } } else { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = dropdown.Render(ctx, templ_7745c5c3_Buffer) + 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 = inputanSearch.Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
Tidak Ada Data } else { for _, v := range dataDropdown { - + } } } diff --git a/views/dev/mastermenuuser/mastermenuuser_templ.go b/views/dev/mastermenuuser/mastermenuuser_templ.go index 72ce865..732343e 100644 --- a/views/dev/mastermenuuser/mastermenuuser_templ.go +++ b/views/dev/mastermenuuser/mastermenuuser_templ.go @@ -331,10 +331,8 @@ func JsMasterMenuUserV1x() templ.Component { }) } -func ShowMasterMenuUserV1x(title string, cmp templ.Component, css templ.Component, js templ.Component, - navbarmenu templ.Component, - navbaruser templ.Component, - userprofile templ.Component) templ.Component { +// for item dropdown +func ItemDropdown(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 { @@ -347,7 +345,69 @@ func ShowMasterMenuUserV1x(title string, cmp templ.Component, css templ.Componen templ_7745c5c3_Var14 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Var15 := templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + if len(dataDropdown) == 0 { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } else { + for _, v := range dataDropdown { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + 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, + 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_Var17 := templ.GetChildren(ctx) + if templ_7745c5c3_Var17 == nil { + templ_7745c5c3_Var17 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + 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() @@ -362,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_Var15), 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 }