// Code generated by templ - DO NOT EDIT.

// templ: version: v0.3.943
package home

//lint:file-ignore SA4006 This context is only used if a nested component is present.

import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"

const (
	VerifyFormTagID  = "verify-form"
	VerifyModalTagID = "verify-modal"
)

func VerifyFormInit(formTagID, loginTabTagID string) templ.ComponentScript {
	return templ.ComponentScript{
		Name: `__templ_VerifyFormInit_0e30`,
		Function: `function __templ_VerifyFormInit_0e30(formTagID, loginTabTagID){$(` + "`" + `#${formTagID}` + "`" + `)
        .form({
            ...Form.Settings,
            fields: {
                Password: {
                    rules: [
                        ...Form.Rules.Password
                    ]
                }
            }
        })
        .api({
            action: "user_verify", 
            method: "PATCH",
            beforeSend: function(settings) {
                return Form.Token.Encode(settings, "VerifyToken")
            },
            onSuccess: function(response, element, xhr) {
                Form.Toast.Success(response)

                setTimeout(() => {
                    $.tab("change tab", loginTabTagID);
                    $(".ui.mini.modal").modal("hide");
                }, 1000);
            },
            onFailure: function(response, element, xhr) {
                Form.Toast.Failure(response)
            }
        })
    ;
}`,
		Call:       templ.SafeScript(`__templ_VerifyFormInit_0e30`, formTagID, loginTabTagID),
		CallInline: templ.SafeScriptInline(`__templ_VerifyFormInit_0e30`, formTagID, loginTabTagID),
	}
}

func VerifyForm() templ.Component {
	return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
		templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
		if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
			return templ_7745c5c3_CtxErr
		}
		templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
		if !templ_7745c5c3_IsBuffer {
			defer func() {
				templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
				if templ_7745c5c3_Err == nil {
					templ_7745c5c3_Err = templ_7745c5c3_BufErr
				}
			}()
		}
		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 = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<div id=\"")
		if templ_7745c5c3_Err != nil {
			return templ_7745c5c3_Err
		}
		var templ_7745c5c3_Var2 string
		templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(VerifyModalTagID)
		if templ_7745c5c3_Err != nil {
			return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/app/server/component/page/home/form.verify.templ`, Line: 42, Col: 27}
		}
		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
		if templ_7745c5c3_Err != nil {
			return templ_7745c5c3_Err
		}
		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "\" class=\"ui mini inverted modal\"><div class=\"content\"><form id=\"")
		if templ_7745c5c3_Err != nil {
			return templ_7745c5c3_Err
		}
		var templ_7745c5c3_Var3 string
		templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(VerifyFormTagID)
		if templ_7745c5c3_Err != nil {
			return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/app/server/component/page/home/form.verify.templ`, Line: 44, Col: 29}
		}
		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
		if templ_7745c5c3_Err != nil {
			return templ_7745c5c3_Err
		}
		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "\" class=\"ui inverted form\"><h1 class=\"ui dividing inverted header\">Verify your account</h1><div class=\"required field\"><label>Password</label><div class=\"ui inverted transparent left icon input\"><i class=\"lock icon\"></i> <input type=\"password\" placeholder=\"Password\" name=\"Password\"></div></div><div class=\"ui divider\"></div><div class=\"ui middle aligned center aligned grid\"><div class=\"column\"><button class=\"ui fluid primary submit button\">Verify</button></div></div></form></div></div>")
		if templ_7745c5c3_Err != nil {
			return templ_7745c5c3_Err
		}
		templ_7745c5c3_Err = VerifyFormInit(VerifyFormTagID, LoginTabTagID).Render(ctx, templ_7745c5c3_Buffer)
		if templ_7745c5c3_Err != nil {
			return templ_7745c5c3_Err
		}
		return nil
	})
}

var _ = templruntime.GeneratedTemplate
