Compare commits

...

1 Commits

Author SHA1 Message Date
sindhu
7a93a4994a toast handle error dan toast show in input search 2024-05-16 17:20:23 +07:00
16 changed files with 822 additions and 27 deletions

View File

@@ -5200,6 +5200,11 @@ a.text-hover-tosca:hover .svg-icon svg:hover g [fill],
height: auto;
}
/* ### TOAST FONT SIZE */
.toast {
font-size: 1.1rem;
}
/* ### BUTTON HOVER TEXT */
/* ### */
/* ## PRIMARY */

View File

@@ -1,6 +1,6 @@
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, toastX templ.Component) {
if len(thName) != len(thWidth) {
<div>length array thname berbeda dengan array thwidth</div>
} else {
@@ -23,10 +23,10 @@ templ TableV2(thName []string, thWidth []string, trComponent templ.Component, pa
@pagination
</div>
</div>
@toastX
}
}
templ DivEmpty() {
<div>
</div>
}
<div></div>
}

View File

@@ -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, toastX 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 {
@@ -102,6 +102,10 @@ func TableV2(thName []string, thWidth []string, trComponent templ.Component, pag
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = toastX.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)

View File

@@ -0,0 +1,86 @@
package customtoastv1
// kalau eror => bg nya danger
// kalau sukses => bgnya success
// kalau warning => bgnya warning
func toastBackground(typeToast string) string {
return "bg-" + typeToast
}
func toastBody(typeToastBody string) string {
return "bg-" + typeToastBody + "-transparent"
}
func toastIcon(typeToast string) string {
var stringx string
if typeToast == "success" {
stringx = "solar:check-circle-broken"
} else {
if typeToast == "danger" {
stringx = "solar:close-circle-broken"
} else {
if typeToast == "warning" {
stringx = "solar:shield-warning-bold"
} else {
if typeToast == "information" {
stringx = "solar:info-square-broken"
}
}
}
}
return stringx
}
templ CustomToastV2Show(title string, message string, typeToast string) {
<div
class="toast fade show"
role="alert"
aria-live="assertive"
aria-atomic="true"
id="notification-001"
hx-swap-oob="true"
hx-get="/dev/hidetoast"
hx-trigger="load delay:3s"
hx-target="this"
style="border-radius: 8px 8px 8px 8px;"
>
<div class={ "toast-header", toastBackground(typeToast) , "text-white" }>
<span
class="iconify mr-2"
data-icon={ toastIcon(typeToast) }
></span>
<strong class="mr-auto">{ title }</strong>
<button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class={ "toast-body",toastBody(typeToast) }>
{ message }
</div>
</div>
}
templ CustomToastV2Hide() {
<div id="notification-001"
class="toast fade hide"
role="alert"
aria-live="assertive"
aria-atomic="true"
style="opacity: 0"
hx-swap-oob="true"
>
<div class="toast-header bg-success text-white">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--ep mr-2 icon-xl" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 1024 1024" data-icon="ep:success-filled"><path fill="currentColor" d="M512 64a448 448 0 1 1 0 896a448 448 0 0 1 0-896m-55.808 536.384l-99.52-99.584a38.4 38.4 0 1 0-54.336 54.336l126.72 126.72a38.27 38.27 0 0 0 54.336 0l262.4-262.464a38.4 38.4 0 1 0-54.272-54.336z"></path></svg>
<strong class="mr-auto">Success</strong>
<small class="text-muted text-white">just now</small>
<button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="toast-body bg-success-transparent">
This is a success toast.
</div>
</div>
}

View File

@@ -0,0 +1,175 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.663
package customtoastv1
//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"
// kalau eror => bg nya danger
// kalau sukses => bgnya success
// kalau warning => bgnya warning
func toastBackground(typeToast string) string {
return "bg-" + typeToast
}
func toastBody(typeToastBody string) string {
return "bg-" + typeToastBody + "-transparent"
}
func toastIcon(typeToast string) string {
var stringx string
if typeToast == "success" {
stringx = "solar:check-circle-broken"
} else {
if typeToast == "danger" {
stringx = "solar:close-circle-broken"
} else {
if typeToast == "warning" {
stringx = "solar:shield-warning-bold"
} else {
if typeToast == "information" {
stringx = "solar:info-square-broken"
}
}
}
}
return stringx
}
func CustomToastV2Show(title string, message string, typeToast 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 class=\"toast fade show\" role=\"alert\" aria-live=\"assertive\" aria-atomic=\"true\" id=\"notification-001\" hx-swap-oob=\"true\" hx-get=\"/dev/hidetoast\" hx-trigger=\"load delay:3s\" hx-target=\"this\" style=\"border-radius: 8px 8px 8px 8px;\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var2 = []any{"toast-header", toastBackground(typeToast), "text-white"}
templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var2...)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(templ.CSSClasses(templ_7745c5c3_Var2).String())
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\toastbootstrap\customtoastv2.templ`, Line: 1, Col: 0}
}
_, 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("\"><span class=\"iconify mr-2\" data-icon=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var4 string
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(toastIcon(typeToast))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\toastbootstrap\customtoastv2.templ`, Line: 52, Col: 36}
}
_, 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("\"></span> <strong class=\"mr-auto\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(title)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\toastbootstrap\customtoastv2.templ`, Line: 54, Col: 34}
}
_, 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("</strong> <button type=\"button\" class=\"ml-2 mb-1 close\" data-dismiss=\"toast\" aria-label=\"Close\"><span aria-hidden=\"true\">×</span></button></div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var6 = []any{"toast-body", toastBody(typeToast)}
templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var6...)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var7 string
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(templ.CSSClasses(templ_7745c5c3_Var6).String())
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\toastbootstrap\customtoastv2.templ`, Line: 1, Col: 0}
}
_, 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
}
var templ_7745c5c3_Var8 string
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(message)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\toastbootstrap\customtoastv2.templ`, Line: 60, Col: 12}
}
_, 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
})
}
func CustomToastV2Hide() 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_7745c5c3_Buffer.WriteString("<div id=\"notification-001\" class=\"toast fade hide\" role=\"alert\" aria-live=\"assertive\" aria-atomic=\"true\" style=\"opacity: 0\" hx-swap-oob=\"true\"><div class=\"toast-header bg-success text-white\"><svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" aria-hidden=\"true\" role=\"img\" class=\"iconify iconify--ep mr-2 icon-xl\" width=\"1em\" height=\"1em\" preserveAspectRatio=\"xMidYMid meet\" viewBox=\"0 0 1024 1024\" data-icon=\"ep:success-filled\"><path fill=\"currentColor\" d=\"M512 64a448 448 0 1 1 0 896a448 448 0 0 1 0-896m-55.808 536.384l-99.52-99.584a38.4 38.4 0 1 0-54.336 54.336l126.72 126.72a38.27 38.27 0 0 0 54.336 0l262.4-262.464a38.4 38.4 0 1 0-54.272-54.336z\"></path></svg> <strong class=\"mr-auto\">Success</strong> <small class=\"text-muted text-white\">just now</small> <button type=\"button\" class=\"ml-2 mb-1 close\" data-dismiss=\"toast\" aria-label=\"Close\"><span aria-hidden=\"true\">×</span></button></div><div class=\"toast-body bg-success-transparent\">This is a success toast.\r</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

@@ -10,6 +10,7 @@ import (
"cpone/component/pagination"
tablecomponent "cpone/component/table"
customtoastv2 "cpone/component/toastbootstrap"
"cpone/models"
"cpone/utils"
mastermenuusergroup "cpone/views/dev/mastermenuusergroup"
@@ -158,13 +159,19 @@ func (lh *MasterMenuUserGroupHandler) HandlerShowMasterMenuUserGroupV1(c echo.Co
// var toastComponent templ.Component
contentIDHtmxExtension := utils.GenerateRandomID("htmxExtmgu")
var flagxError bool = false
var msgx string = ""
logger, _ := zap.NewProduction()
dataMenu, err := lh.MasterMenuUserGroupService.GetMasterMenus()
fmt.Println(dataMenu)
fmt.Println(err)
if err != nil {
fmt.Println(dataMenu)
return err
// return err
flagxError = true
// msgx = err.Error()
msgx = "Error Get Menu"
}
dataUser, err := services.GetUser()
@@ -172,7 +179,10 @@ func (lh *MasterMenuUserGroupHandler) HandlerShowMasterMenuUserGroupV1(c echo.Co
fmt.Println(err)
if err != nil {
fmt.Println(dataUser)
return err
// return err
flagxError = true
// msgx = err.Error()
msgx = "Error Get User"
}
rowPerPage := 2
@@ -185,7 +195,10 @@ func (lh *MasterMenuUserGroupHandler) HandlerShowMasterMenuUserGroupV1(c echo.Co
zap.Any("error", err),
)
fmt.Println(dataUserGroup)
return err
// return err
flagxError = true
// msgx = err.Error()
msgx = "Error Get User Group"
}
dataUserGroupAll, err := lh.MasterMenuUserGroupService.GetListMasterUserGroup()
@@ -197,7 +210,10 @@ func (lh *MasterMenuUserGroupHandler) HandlerShowMasterMenuUserGroupV1(c echo.Co
zap.Any("error", err),
)
fmt.Println(dataUserGroupAll)
return err
// return err
flagxError = true
// msgx = err.Error()
msgx = "Error Get User All"
}
// si := mastermenuusergroup.ListMasterUserGroupInitial(dataUserGroup)
@@ -229,7 +245,10 @@ func (lh *MasterMenuUserGroupHandler) HandlerShowMasterMenuUserGroupV1(c echo.Co
zap.Any("error", err),
)
fmt.Println(dataBreadCrumb)
return err
// return err
flagxError = true
// msgx = err.Error()
msgx = "Error Get Breadcrumb"
}
// si := mastermenuusergroup.ListMasterUserGroupInitial(dataBreadCrumb)
@@ -239,6 +258,15 @@ func (lh *MasterMenuUserGroupHandler) HandlerShowMasterMenuUserGroupV1(c echo.Co
zap.Any("data", dataBreadCrumb),
)
// IF ERROR OCCURS
if flagxError {
si := customtoastv2.CustomToastV2Show("Error", msgx, "danger")
return utils.View(c, si)
}
// IF ERROR OCCURS
flagxError = false
// navbar menu
navbarmenuComponent := navbarmenu.NavbarMenu(dataMenu)
@@ -262,6 +290,7 @@ func (lh *MasterMenuUserGroupHandler) HandlerShowMasterMenuUserGroupV1(c echo.Co
// toastComponent = customtoast.CustomToastV1("", contentIDHtmxExtension)
// table user group
toastComponent := tablecomponent.DivEmpty()
searchQueryParam := "&q="
tabelusergroupComponent := tablecomponent.TableV2(
@@ -271,6 +300,7 @@ func (lh *MasterMenuUserGroupHandler) HandlerShowMasterMenuUserGroupV1(c echo.Co
pagination.PaginationV1(totalPages, 1, "/dev/usergroupv1pagination", contentID, searchQueryParam),
contentID,
inputansearchComponent,
toastComponent,
)
si := mastermenuusergroup.ShowMasterMenuUserGroupV1x(
@@ -443,6 +473,8 @@ func (lh *MasterMenuUserGroupHandler) DeleteUserGroup(c echo.Context) error {
func (lh *MasterMenuUserGroupHandler) HandlerShowMasterMenuUserGroupSearchV1(c echo.Context) error {
search := c.QueryParam("q")
logger, _ := zap.NewProduction()
var flagxError bool = false
var msgx string = ""
// dataUserGroup, err := lh.MasterMenuUserGroupService.GetListMasterUserGroupBySearch(search)
rowPerPage := 2
@@ -454,7 +486,10 @@ func (lh *MasterMenuUserGroupHandler) HandlerShowMasterMenuUserGroupSearchV1(c e
zap.Any("page", page),
zap.Any("error ", err),
)
return err
// return err
flagxError = true
// msgx = err.Error()
msgx = "Error Convert Page Param"
}
currentPageParam := c.QueryParam("currentPage")
@@ -465,7 +500,10 @@ func (lh *MasterMenuUserGroupHandler) HandlerShowMasterMenuUserGroupSearchV1(c e
zap.Any("page", page),
zap.Any("error ", err),
)
return err
// return err
flagxError = true
// msgx = err.Error()
msgx = "Error Convert Current Page Param"
}
dataUserGroup, err := lh.MasterMenuUserGroupService.GetListMasterUserGroupPagination(search, currentPage, rowPerPage)
@@ -478,7 +516,10 @@ func (lh *MasterMenuUserGroupHandler) HandlerShowMasterMenuUserGroupSearchV1(c e
zap.Any("search param", search),
)
fmt.Println(dataUserGroup)
return err
// return err
flagxError = true
// msgx = err.Error()
msgx = "Error Get User Group"
}
defer logger.Sync()
@@ -487,6 +528,7 @@ func (lh *MasterMenuUserGroupHandler) HandlerShowMasterMenuUserGroupSearchV1(c e
)
// data user filtered
dataUserGroupFiltered, err := lh.MasterMenuUserGroupService.GetListMasterUserGroupFilteredBySearch(search)
fmt.Println(dataUserGroupFiltered)
fmt.Println(err)
@@ -497,7 +539,10 @@ func (lh *MasterMenuUserGroupHandler) HandlerShowMasterMenuUserGroupSearchV1(c e
zap.Any("search param", search),
)
fmt.Println(dataUserGroupFiltered)
return err
// return err
flagxError = true
// msgx = err.Error()
msgx = "Error Get User Search"
}
defer logger.Sync()
@@ -506,6 +551,15 @@ func (lh *MasterMenuUserGroupHandler) HandlerShowMasterMenuUserGroupSearchV1(c e
)
// si := mastermenuusergroup.ListMasterUserGroupInitial(dataUserGroup)
// IF ERROR OCCURS
if flagxError {
si := customtoastv2.CustomToastV2Show("Error", msgx, "danger")
return utils.View(c, si)
}
// IF ERROR OCCURS
flagxError = false
contentID := utils.GenerateRandomID("tablebody")
// tabelusergroupComponent := mastermenuusergroup.TableRowV1(dataUserGroup)
@@ -519,6 +573,8 @@ func (lh *MasterMenuUserGroupHandler) HandlerShowMasterMenuUserGroupSearchV1(c e
// inputansearchComponent := customtextfieldsearch.MainCustomTextFieldSearchV1("#"+contentIDSearch, "q", "Cari User Group", "text", "/dev/searchusergroupv1?"+link, "input changed delay:500ms, search", "#"+contentID, "#indicator", search, contentIDHtmxExtension)
inputansearchComponent := tablecomponent.DivEmpty()
toastComponent := customtoastv2.CustomToastV2Show("Success", "Success Loaded", "success")
tabelusergroupComponent := tablecomponent.TableV2(
[]string{"KODE", "USERGROUP", "AKSI"},
[]string{"40%", "40%", "20%"},
@@ -526,6 +582,7 @@ func (lh *MasterMenuUserGroupHandler) HandlerShowMasterMenuUserGroupSearchV1(c e
pagination.PaginationV1(totalPages, 1, "/dev/usergroupv1pagination", contentID, searchQueryParam),
contentID,
inputansearchComponent,
toastComponent,
)
si := tabelusergroupComponent
@@ -534,6 +591,9 @@ func (lh *MasterMenuUserGroupHandler) HandlerShowMasterMenuUserGroupSearchV1(c e
}
func (lh *MasterMenuUserGroupHandler) HandlerShowMasterMenuUserGroupPaginationV1(c echo.Context) error {
var flagxError bool = false
var msgx string = ""
logger, _ := zap.NewProduction()
search := c.QueryParam("q")
@@ -545,7 +605,11 @@ func (lh *MasterMenuUserGroupHandler) HandlerShowMasterMenuUserGroupPaginationV1
zap.Any("page", page),
zap.Any("error ", err),
)
return err
// return err
flagxError = true
// msgx = err.Error()
msgx = "Error Convert Page Param"
}
dataUserGroupAll, err := lh.MasterMenuUserGroupService.GetListMasterUserGroup()
@@ -557,7 +621,11 @@ func (lh *MasterMenuUserGroupHandler) HandlerShowMasterMenuUserGroupPaginationV1
zap.Any("error", err),
)
fmt.Println(dataUserGroupAll)
return err
// return err
flagxError = true
// msgx = err.Error()
msgx = "Error Get User Group"
}
currentPageParam := c.QueryParam("currentPage")
@@ -568,7 +636,11 @@ func (lh *MasterMenuUserGroupHandler) HandlerShowMasterMenuUserGroupPaginationV1
zap.Any("page", page),
zap.Any("error ", err),
)
return err
// return err
flagxError = true
// msgx = err.Error()
msgx = "Error Convert Current Page Param"
}
rowPerPage := 2
@@ -582,7 +654,11 @@ func (lh *MasterMenuUserGroupHandler) HandlerShowMasterMenuUserGroupPaginationV1
zap.Any("search param", search),
)
fmt.Println(dataUserGroup)
return err
// return err
flagxError = true
// msgx = err.Error()
msgx = "Error User Group Search"
}
// si := mastermenuusergroup.ListMasterUserGroupInitial(dataUserGroup)
@@ -603,7 +679,11 @@ func (lh *MasterMenuUserGroupHandler) HandlerShowMasterMenuUserGroupPaginationV1
zap.Any("search param", search),
)
fmt.Println(dataUserGroupFiltered)
return err
// return err
flagxError = true
// msgx = err.Error()
msgx = "Error Search User Group Filtered"
}
defer logger.Sync()
@@ -611,6 +691,15 @@ func (lh *MasterMenuUserGroupHandler) HandlerShowMasterMenuUserGroupPaginationV1
zap.Any("data", dataUserGroupFiltered),
)
// IF ERROR OCCURS
if flagxError {
si := customtoastv2.CustomToastV2Show("Error", msgx, "danger")
return utils.View(c, si)
}
// IF ERROR OCCURS
flagxError = false
contentID := utils.GenerateRandomID("tablebody")
// table user group
@@ -623,6 +712,7 @@ func (lh *MasterMenuUserGroupHandler) HandlerShowMasterMenuUserGroupPaginationV1
// inputansearchComponent := customtextfieldsearch.MainCustomTextFieldSearchV1("#"+contentIDSearch, "q", "Cari User Group", "text", "/dev/searchusergroupv1?"+link, "input changed delay:500ms, search", "#"+contentID, "#indicator", search, contentIDHtmxExtension)
inputansearchComponent := tablecomponent.DivEmpty()
toastComponent := tablecomponent.DivEmpty()
tabelusergroupComponent := tablecomponent.TableV2(
[]string{"KODE", "USERGROUP", "AKSI"},
[]string{"40%", "40%", "20%"},
@@ -630,6 +720,7 @@ func (lh *MasterMenuUserGroupHandler) HandlerShowMasterMenuUserGroupPaginationV1
pagination.PaginationV1(totalPages, currentPage, "/dev/usergroupv1pagination", contentID, searchQueryParam),
contentID,
inputansearchComponent,
toastComponent,
)
// tabelusergroupComponent := mastermenuusergroup.TableRowV1(dataUserGroup)
@@ -639,6 +730,14 @@ func (lh *MasterMenuUserGroupHandler) HandlerShowMasterMenuUserGroupPaginationV1
return utils.View(c, si)
}
func (lh *MasterMenuUserGroupHandler) HandlerHideToast(c echo.Context) error {
toastComponent := customtoastv2.CustomToastV2Hide()
si := toastComponent
return utils.View(c, si)
}
// Coba Anndy
func (lh *MasterMenuUserGroupHandler) HandlerShowMasterMenuUserGroupTryAndy(c echo.Context) error {
logger, _ := zap.NewProduction()

View File

@@ -0,0 +1,74 @@
package public_handlers
import (
"cpone/models"
"cpone/utils"
"cpone/views/dev/mastermenuusergroup"
tablecomponent "cpone/component/table"
public_toast "cpone/views/public/toast"
"github.com/labstack/echo/v4"
)
type ToolsService interface {
}
func NewToolsHandler(us ToolsService) *ToolsHandler {
return &ToolsHandler{
ToolsService: us,
}
}
type ToolsHandler struct {
ToolsService ToolsService
}
func (lh *ToolsHandler) HandlerHideToast(c echo.Context) error {
toastComponent := public_toast.PublicToastV1Hide()
si := toastComponent
return utils.View(c, si)
}
func (lh *ToolsHandler) HandlerShowToast(c echo.Context) error {
inputansearchComponent := tablecomponent.DivEmpty()
toastComponent := public_toast.PublicToastV1Show("Success", "Success Loaded", "success")
pagination := tablecomponent.DivEmpty()
dummyData := []models.UserGroupV1{
{
Nomor: "1",
M_UserGroupID: 1,
M_UserGroupCode: "group1",
M_UserGroupName: "Group 1",
M_UserGroupCreated: "2024-05-16",
M_UserGroupLastUpdated: "2024-05-16",
M_UserGroupIsActive: "Active",
},
}
tabelusergroupComponent := tablecomponent.TableV2(
[]string{"KODE", "USERGROUP", "AKSI"},
[]string{"40%", "40%", "20%"},
mastermenuusergroup.TableRowV1(dummyData),
pagination,
"",
inputansearchComponent,
toastComponent,
)
si := public_toast.ShowToast("",
tabelusergroupComponent,
tabelusergroupComponent,
tabelusergroupComponent,
tabelusergroupComponent,
tabelusergroupComponent,
tabelusergroupComponent,
)
return utils.View(c, si)
}

View File

@@ -70,6 +70,11 @@ func SetupRoutesPublic(app *echo.Echo, appStore db.AppStore) {
public.GET("landingpage", lh.ShowLandingPage)
loginHdr := public_handlers.NewLoginHandler(l)
public.GET("login", loginHdr.HandlerShowLogin)
// FOR TOAST
toastHdr := public_handlers.NewToolsHandler(l)
public.GET("toastpublic", toastHdr.HandlerShowToast)
public.GET("hidetoastpublic", toastHdr.HandlerHideToast)
}
func SetupRoutesCorporate(app *echo.Echo, appStore db.AppStore) {
public := app.Group("/corp")
@@ -192,6 +197,7 @@ func SetupRoutesDev(app *echo.Echo, appStore db.AppStore) {
dev.POST("/usergroup/add", devUGhandlers.AddUserGroup)
dev.POST("/usergroup/edit", devUGhandlers.EditUserGroup)
dev.GET("/usergroup/delete/:id", devUGhandlers.DeleteUserGroup)
dev.GET("/hidetoast", devUGhandlers.HandlerHideToast)
// try
dev.GET("/usergroupv1", devUGhandlers.HandlerShowMasterMenuUserGroupV1)

View File

@@ -1,7 +1,7 @@
package layout
// LAYOUT PLAYGROUND
templ CorporateLayout(title string, css templ.Component, js templ.Component, navbarmenu templ.Component,
templ CorporateLayout(title string, css templ.Component, js templ.Component, navbarmenu templ.Component,
navbaruser templ.Component, sidebaruserprofile templ.Component) {
<!DOCTYPE html>
<!--
@@ -223,6 +223,26 @@ templ CorporateLayout(title string, css templ.Component, js templ.Component, nav
<!--end::Header-->
<!--begin::Content-->
<div class="container-fluid">
// toast
<div class="toast-top-right" id="container-system-notification" style="position: absolute; top: 1vh; right: 0vw; z-index: 999;">
<!-- toast success -->
<div id="notification-001"
class="toast fade hide" role="alert" aria-live="assertive" aria-atomic="true">
<div class="toast-header bg-success text-white">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--ep mr-2 icon-xl" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 1024 1024" data-icon="ep:success-filled"><path fill="currentColor" d="M512 64a448 448 0 1 1 0 896a448 448 0 0 1 0-896m-55.808 536.384l-99.52-99.584a38.4 38.4 0 1 0-54.336 54.336l126.72 126.72a38.27 38.27 0 0 0 54.336 0l262.4-262.464a38.4 38.4 0 1 0-54.272-54.336z"></path></svg>
<strong class="mr-auto">Success</strong>
<small class="text-muted text-white">just now</small>
<button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="toast-body bg-success-transparent">
This is a success toast.
</div>
</div>
</div>
// end toast
{ children... }
</div>
<!--end::Content-->

View File

@@ -62,7 +62,7 @@ func CorporateLayout(title string, css templ.Component, js templ.Component, navb
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<!--end::Header--><!--begin::Content--><div class=\"container-fluid\">")
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<!--end::Header--><!--begin::Content--><div class=\"container-fluid\"><div class=\"toast-top-right\" id=\"container-system-notification\" style=\"position: absolute; top: 1vh; right: 0vw; z-index: 999;\"><!-- toast success --><div id=\"notification-001\" class=\"toast fade hide\" role=\"alert\" aria-live=\"assertive\" aria-atomic=\"true\"><div class=\"toast-header bg-success text-white\"><svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" aria-hidden=\"true\" role=\"img\" class=\"iconify iconify--ep mr-2 icon-xl\" width=\"1em\" height=\"1em\" preserveAspectRatio=\"xMidYMid meet\" viewBox=\"0 0 1024 1024\" data-icon=\"ep:success-filled\"><path fill=\"currentColor\" d=\"M512 64a448 448 0 1 1 0 896a448 448 0 0 1 0-896m-55.808 536.384l-99.52-99.584a38.4 38.4 0 1 0-54.336 54.336l126.72 126.72a38.27 38.27 0 0 0 54.336 0l262.4-262.464a38.4 38.4 0 1 0-54.272-54.336z\"></path></svg> <strong class=\"mr-auto\">Success</strong> <small class=\"text-muted text-white\">just now</small> <button type=\"button\" class=\"ml-2 mb-1 close\" data-dismiss=\"toast\" aria-label=\"Close\"><span aria-hidden=\"true\">×</span></button></div><div class=\"toast-body bg-success-transparent\">This is a success toast.\r</div></div></div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}

View File

@@ -211,8 +211,9 @@ templ JsMasterMenuUserGroupV1x() {
templ ShowMasterMenuUserGroupV1x(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) {
userprofile templ.Component,
) {
@layout.CorporateLayout(title, css, js, navbarmenu, navbaruser, userprofile,) {
@cmp
}
}

View File

@@ -321,7 +321,8 @@ func JsMasterMenuUserGroupV1x() templ.Component {
func ShowMasterMenuUserGroupV1x(title string, cmp templ.Component, css templ.Component, js templ.Component,
navbarmenu templ.Component,
navbaruser templ.Component,
userprofile templ.Component) 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 {

View File

@@ -211,8 +211,10 @@ templ JsMasterMenuUserGroupV1x() {
templ ShowMasterMenuUserGroupV1x(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) {
userprofile templ.Component,
) {
@layout.CorporateLayout(title, css, js, navbarmenu, navbaruser, userprofile,
) {
@cmp
}
}

View File

@@ -323,7 +323,8 @@ func JsMasterMenuUserGroupV1x() templ.Component {
func ShowMasterMenuUserGroupV1x(title string, cmp templ.Component, css templ.Component, js templ.Component,
navbarmenu templ.Component,
navbaruser templ.Component,
userprofile templ.Component) 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 {

View File

@@ -0,0 +1,100 @@
package public_toast
import (
"cpone/layout"
)
// kalau eror => bg nya danger
// kalau sukses => bgnya success
// kalau warning => bgnya warning
func toastBackground(typeToast string) string {
return "bg-" + typeToast
}
func toastBody(typeToastBody string) string {
return "bg-" + typeToastBody + "-transparent"
}
func toastIcon(typeToast string) string {
var stringx string
if typeToast == "success" {
stringx = "solar:check-circle-broken"
} else {
if typeToast == "danger" {
stringx = "solar:close-circle-broken"
} else {
if typeToast == "warning" {
stringx = "solar:shield-warning-bold"
} else {
if typeToast == "information" {
stringx = "solar:info-square-broken"
}
}
}
}
return stringx
}
templ PublicToastV1Show(title string, message string, typeToast string) {
<div
class="toast fade show"
role="alert"
aria-live="assertive"
aria-atomic="true"
id="notification-001"
hx-swap-oob="true"
hx-get="/hidetoastpublic"
hx-trigger="load delay:3s"
hx-target="this"
style="border-radius: 8px 8px 8px 8px;"
>
<div class={ "toast-header", toastBackground(typeToast) , "text-white" }>
<span
class="iconify mr-2"
data-icon={ toastIcon(typeToast) }
></span>
<strong class="mr-auto">{ title }</strong>
<button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class={ "toast-body",toastBody(typeToast) }>
{ message }
</div>
</div>
}
templ PublicToastV1Hide() {
<div
id="notification-001"
class="toast fade hide"
role="alert"
aria-live="assertive"
aria-atomic="true"
style="opacity: 0"
hx-swap-oob="true"
>
<div class="toast-header bg-success text-white">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--ep mr-2 icon-xl" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 1024 1024" data-icon="ep:success-filled"><path fill="currentColor" d="M512 64a448 448 0 1 1 0 896a448 448 0 0 1 0-896m-55.808 536.384l-99.52-99.584a38.4 38.4 0 1 0-54.336 54.336l126.72 126.72a38.27 38.27 0 0 0 54.336 0l262.4-262.464a38.4 38.4 0 1 0-54.272-54.336z"></path></svg>
<strong class="mr-auto">Success</strong>
<small class="text-muted text-white">just now</small>
<button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="toast-body bg-success-transparent">
This is a success toast.
</div>
</div>
}
templ ShowToast(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,221 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.663
package public_toast
//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/layout"
)
// kalau eror => bg nya danger
// kalau sukses => bgnya success
// kalau warning => bgnya warning
func toastBackground(typeToast string) string {
return "bg-" + typeToast
}
func toastBody(typeToastBody string) string {
return "bg-" + typeToastBody + "-transparent"
}
func toastIcon(typeToast string) string {
var stringx string
if typeToast == "success" {
stringx = "solar:check-circle-broken"
} else {
if typeToast == "danger" {
stringx = "solar:close-circle-broken"
} else {
if typeToast == "warning" {
stringx = "solar:shield-warning-bold"
} else {
if typeToast == "information" {
stringx = "solar:info-square-broken"
}
}
}
}
return stringx
}
func PublicToastV1Show(title string, message string, typeToast 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 class=\"toast fade show\" role=\"alert\" aria-live=\"assertive\" aria-atomic=\"true\" id=\"notification-001\" hx-swap-oob=\"true\" hx-get=\"/hidetoastpublic\" hx-trigger=\"load delay:3s\" hx-target=\"this\" style=\"border-radius: 8px 8px 8px 8px;\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var2 = []any{"toast-header", toastBackground(typeToast), "text-white"}
templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var2...)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(templ.CSSClasses(templ_7745c5c3_Var2).String())
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\public\toast\toastpublicv1.templ`, Line: 1, Col: 0}
}
_, 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("\"><span class=\"iconify mr-2\" data-icon=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var4 string
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(toastIcon(typeToast))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\public\toast\toastpublicv1.templ`, Line: 56, Col: 36}
}
_, 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("\"></span> <strong class=\"mr-auto\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(title)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\public\toast\toastpublicv1.templ`, Line: 58, Col: 34}
}
_, 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("</strong> <button type=\"button\" class=\"ml-2 mb-1 close\" data-dismiss=\"toast\" aria-label=\"Close\"><span aria-hidden=\"true\">×</span></button></div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var6 = []any{"toast-body", toastBody(typeToast)}
templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var6...)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var7 string
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(templ.CSSClasses(templ_7745c5c3_Var6).String())
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\public\toast\toastpublicv1.templ`, Line: 1, Col: 0}
}
_, 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
}
var templ_7745c5c3_Var8 string
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(message)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\public\toast\toastpublicv1.templ`, Line: 64, Col: 12}
}
_, 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
})
}
func PublicToastV1Hide() 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_7745c5c3_Buffer.WriteString("<div id=\"notification-001\" class=\"toast fade hide\" role=\"alert\" aria-live=\"assertive\" aria-atomic=\"true\" style=\"opacity: 0\" hx-swap-oob=\"true\"><div class=\"toast-header bg-success text-white\"><svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" aria-hidden=\"true\" role=\"img\" class=\"iconify iconify--ep mr-2 icon-xl\" width=\"1em\" height=\"1em\" preserveAspectRatio=\"xMidYMid meet\" viewBox=\"0 0 1024 1024\" data-icon=\"ep:success-filled\"><path fill=\"currentColor\" d=\"M512 64a448 448 0 1 1 0 896a448 448 0 0 1 0-896m-55.808 536.384l-99.52-99.584a38.4 38.4 0 1 0-54.336 54.336l126.72 126.72a38.27 38.27 0 0 0 54.336 0l262.4-262.464a38.4 38.4 0 1 0-54.272-54.336z\"></path></svg> <strong class=\"mr-auto\">Success</strong> <small class=\"text-muted text-white\">just now</small> <button type=\"button\" class=\"ml-2 mb-1 close\" data-dismiss=\"toast\" aria-label=\"Close\"><span aria-hidden=\"true\">×</span></button></div><div class=\"toast-body bg-success-transparent\">This is a success toast.\r</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 ShowToast(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_Var10 := templ.GetChildren(ctx)
if templ_7745c5c3_Var10 == nil {
templ_7745c5c3_Var10 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Var11 := 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_Var11), 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
})
}