<!--
Copyright (C) 2024 Nicola Murino

This WebUI uses the KeenThemes Mega Bundle, a proprietary theme:

https://keenthemes.com/products/templates-mega-bundle

KeenThemes HTML/CSS/JS components are allowed for use only within the
SFTPGo product and restricted to be used in a resealable HTML template
that can compete with KeenThemes products anyhow.

This WebUI is allowed for use only within the SFTPGo product and
therefore cannot be used in derivative works/products without an
explicit grant from the SFTPGo Team (support@sftpgo.com).
-->
{{template "base" .}}

{{- define "page_body"}}
<div class="card shadow-sm">
    <div class="card-header bg-light">
        <h3 data-i18n="{{.Title}}" class="card-title section-title"></h3>
    </div>
    <div class="card-body">
        {{- template "errmsg" .Error}}
        <form id="eventaction_form" action="{{.CurrentURL}}" method="POST" autocomplete="off">

            <div class="form-group row">
                <label for="idName" data-i18n="general.name" class="col-md-3 col-form-label">Name</label>
                <div class="col-md-9">
                    <input id="idName" type="text" placeholder="" name="name" value="{{.Action.Name}}" maxlength="255" autocomplete="off"
                        spellcheck="false" required {{if eq .Mode 2}}class="form-control-plaintext readonly-input" readonly{{else}}class="form-control"{{end}} />
                </div>
            </div>

            <div class="form-group row mt-10">
                <label for="idDescription" data-i18n="general.description" class="col-md-3 col-form-label">Description</label>
                <div class="col-md-9">
                    <input id="idDescription" type="text" class="form-control" name="description" value="{{.Action.Description}}" maxlength="255">
                </div>
            </div>

            <div class="form-group row mt-10">
                <label for="idType" data-i18n="general.type" class="col-md-3 col-form-label">Type</label>
                <div class="col-md-9">
                    <select id="idType" name="type" class="form-select" data-control="i18n-select2" data-hide-search="true">
                        {{- range .ActionTypes}}
                        <option value="{{.Value}}" {{if eq $.Action.Type .Value }}selected{{end}} data-i18n="{{.Name}}"></option>
                        {{- end}}
                    </select>
                </div>
            </div>

            <div class="form-group row action-type action-pwd-expiration mt-10">
                <label for="idPwdExpirationThreshold" data-i18n="actions.threshold" class="col-md-3 col-form-label">Threshold</label>
                <div class="col-md-9">
                    <input id="idPwdExpirationThreshold" type="number" min="1" class="form-control" name="pwd_expiration_threshold" value="{{.Action.Options.PwdExpirationConfig.Threshold}}" aria-describedby="idPwdExpirationThresholdHelp" />
                    <div id="idPwdExpirationThresholdHelp" class="form-text" data-i18n="actions.threshold_help"></div>
                </div>
            </div>

            <div class="form-group row action-type action-user-inactivity mt-10">
                <label for="idInactivityThresholdDisable" data-i18n="actions.disable_threshold" class="col-md-3 col-form-label">Disable Threshold</label>
                <div class="col-md-9">
                    <input id="idInactivityThresholdDisable" type="number" min="0" class="form-control" name="inactivity_disable_threshold" value="{{.Action.Options.UserInactivityConfig.DisableThreshold}}" aria-describedby="idInactivityThresholdDisableHelp" />
                    <div id="idInactivityThresholdDisableHelp" class="form-text" data-i18n="actions.disable_threshold_help"></div>
                </div>
            </div>

            <div class="form-group row action-type action-user-inactivity mt-10">
                <label for="idInactivityThresholdDelete" data-i18n="actions.delete_threshold" class="col-md-3 col-form-label">Delete Threshold</label>
                <div class="col-md-9">
                    <input id="idInactivityThresholdDelete" type="number" min="0" class="form-control" name="inactivity_delete_threshold" value="{{.Action.Options.UserInactivityConfig.DeleteThreshold}}" aria-describedby="idInactivityThresholdDeleteHelp" />
                    <div id="idInactivityThresholdDeleteHelp" class="form-text" data-i18n="actions.delete_threshold_help"></div>
                </div>
            </div>

            <div class="form-group action-type action-idp row mt-10">
                <label for="idIDPMode" data-i18n="general.mode" class="col-md-3 col-form-label">Mode</label>
                <div class="col-md-9">
                    <select id="idIDPMode" name="idp_mode" class="form-select" data-control="i18n-select2" data-hide-search="true">
                        <option value="0" data-i18n="actions.idp_mode_add_update" {{ if eq .Action.Options.IDPConfig.Mode 0 }}selected{{end}}>Create or update</option>
                        <option value="1" data-i18n="actions.idp_mode_add" {{ if eq .Action.Options.IDPConfig.Mode 1 }}selected{{end}}>Create if it doesn't exist</option>
                    </select>
                </div>
            </div>

            <div class="form-group row action-type action-idp mt-10">
                <label for="idIDPUser" data-i18n="title.template_user" class="col-md-3 col-form-label">User template</label>
                <div class="col-md-9">
                    <textarea class="form-control" id="idIDPUser" name="idp_user" aria-describedby="idIDPUserHelp"
                        rows="4">{{.Action.Options.IDPConfig.TemplateUser}}</textarea>
                    <div id="idIDPUserHelp" class="form-text" data-i18n="actions.template_user_help"></div>
                </div>
            </div>

            <div class="form-group row action-type action-idp mt-10">
                <label for="idIDPAdmin" data-i18n="title.template_admin" class="col-md-3 col-form-label">Admin template</label>
                <div class="col-md-9">
                    <textarea class="form-control" id="idIDPAdmin" name="idp_admin" aria-describedby="idIDAdminHelp"
                        rows="4">{{.Action.Options.IDPConfig.TemplateAdmin}}</textarea>
                    <div id="idIDAdminHelp" class="form-text" data-i18n="actions.template_admin_help"></div>
                </div>
            </div>

            <div class="form-group row action-type action-http mt-10">
                <label for="idHTTPEndpoint" data-i18n="actions.http_url" class="col-md-3 col-form-label">Endpoint</label>
                <div class="col-md-9">
                    <input id="idHTTPEndpoint" type="text" class="form-control" name="http_endpoint" value="{{.Action.Options.HTTPConfig.Endpoint}}" aria-describedby="idHTTPEndpointHelp" />
                    <div id="idHTTPEndpointHelp" class="form-text" data-i18n="actions.http_url_help"></div>
                </div>
            </div>

            <div class="form-group row action-type action-http mt-10">
                <label for="idHTTPUsername" data-i18n="login.username" class="col-md-3 col-form-label">Username</label>
                <div class="col-md-9">
                    <input id="idHTTPUsername" type="text" class="form-control" name="http_username" value="{{.Action.Options.HTTPConfig.Username}}" aria-describedby="idHTTPUsernameHelp" autocomplete="off" />
                    <div id="idHTTPUsernameHelp" class="form-text" data-i18n="actions.placeholders_help"></div>
                </div>
            </div>

            <div class="form-group row action-type action-http mt-10">
                <label for="idHTTPPassword" data-i18n="login.password" class="col-md-3 col-form-label">Password</label>
                <div class="col-md-9">
                    <input id="idHTTPPassword" type="password" class="form-control" name="http_password" autocomplete="new-password"
                        spellcheck="false" value="{{if .Action.Options.HTTPConfig.Password.IsEncrypted}}{{.RedactedSecret}}{{else}}{{.Action.Options.HTTPConfig.Password.GetPayload}}{{end}}" />
                </div>
            </div>

            <div class="card action-type action-http mt-10">
                <div class="card-header bg-light">
                    <h3 data-i18n="actions.http_headers" class="card-title section-title-inner">HTTP headers</h3>
                </div>
                <div class="card-body">
                    <div id="http_headers">
                        <div class="form-group">
                            <div data-repeater-list="http_headers">
                                {{- range $idx, $val := .Action.Options.HTTPConfig.Headers}}
                                <div data-repeater-item>
                                    <div data-repeater-item>
                                        <div class="form-group row">
                                            <div class="col-md-5 mt-3 mt-md-8">
                                                <input data-i18n="[placeholder]general.name" type="text" class="form-control" name="http_header_key" value="{{$val.Key}}" spellcheck="false" />
                                            </div>
                                            <div class="col-md-6 mt-3 mt-md-8">
                                                <input data-i18n="[placeholder]general.value" type="text" class="form-control" name="http_header_value" value="{{$val.Value}}" spellcheck="false" />
                                            </div>
                                            <div class="col-md-1 mt-3 mt-md-8">
                                                <a href="#" data-repeater-delete
                                                    class="btn btn-light-danger ps-5 pe-4">
                                                    <i class="ki-duotone ki-trash fs-2">
                                                        <span class="path1"></span>
                                                        <span class="path2"></span>
                                                        <span class="path3"></span>
                                                        <span class="path4"></span>
                                                        <span class="path5"></span>
                                                    </i>
                                                </a>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                {{- else}}
                                <div data-repeater-item>
                                    <div class="form-group row">
                                        <div class="col-md-5 mt-3 mt-md-8">
                                            <input data-i18n="[placeholder]general.name" type="text" class="form-control" name="http_header_key" value="" spellcheck="false" />
                                        </div>
                                        <div class="col-md-6 mt-3 mt-md-8">
                                            <input data-i18n="[placeholder]general.value" type="text" class="form-control" name="http_header_value" value="" spellcheck="false" />
                                        </div>
                                        <div class="col-md-1 mt-3 mt-md-8">
                                            <a href="#" data-repeater-delete
                                                class="btn btn-light-danger ps-5 pe-4">
                                                <i class="ki-duotone ki-trash fs-2">
                                                    <span class="path1"></span>
                                                    <span class="path2"></span>
                                                    <span class="path3"></span>
                                                    <span class="path4"></span>
                                                    <span class="path5"></span>
                                                </i>
                                            </a>
                                        </div>
                                    </div>
                                </div>
                                {{- end}}
                            </div>
                        </div>

                        <div class="form-group mt-5">
                            <a href="#" data-repeater-create class="btn btn-light-primary">
                                <i class="ki-duotone ki-plus fs-3"></i>
                                <span data-i18n="general.add">Add</span>
                            </a>
                        </div>
                    </div>
                </div>
            </div>

            <div class="card action-type action-http mt-10">
                <div class="card-header bg-light">
                    <h3 data-i18n="actions.query_parameters" class="card-title section-title-inner">Query parameters</h3>
                </div>
                <div class="card-body">
                    <div id="query_parameters">
                        <div class="form-group">
                            <div data-repeater-list="query_parameters">
                                {{- range $idx, $val := .Action.Options.HTTPConfig.QueryParameters}}
                                <div data-repeater-item>
                                    <div data-repeater-item>
                                        <div class="form-group row">
                                            <div class="col-md-5 mt-3 mt-md-8">
                                                <input data-i18n="[placeholder]general.name" type="text" class="form-control" name="http_query_key" value="{{$val.Key}}" spellcheck="false" />
                                            </div>
                                            <div class="col-md-6 mt-3 mt-md-8">
                                                <input data-i18n="[placeholder]general.value" type="text" class="form-control" name="http_query_value" value="{{$val.Value}}" spellcheck="false" />
                                            </div>
                                            <div class="col-md-1 mt-3 mt-md-8">
                                                <a href="#" data-repeater-delete
                                                    class="btn btn-light-danger ps-5 pe-4">
                                                    <i class="ki-duotone ki-trash fs-2">
                                                        <span class="path1"></span>
                                                        <span class="path2"></span>
                                                        <span class="path3"></span>
                                                        <span class="path4"></span>
                                                        <span class="path5"></span>
                                                    </i>
                                                </a>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                {{- else}}
                                <div data-repeater-item>
                                    <div class="form-group row">
                                        <div class="col-md-5 mt-3 mt-md-8">
                                            <input data-i18n="[placeholder]general.name" type="text" class="form-control" name="http_query_key" value="" spellcheck="false" />
                                        </div>
                                        <div class="col-md-6 mt-3 mt-md-8">
                                            <input data-i18n="[placeholder]general.value" type="text" class="form-control" name="http_query_value" value="" spellcheck="false" />
                                        </div>
                                        <div class="col-md-1 mt-3 mt-md-8">
                                            <a href="#" data-repeater-delete
                                                class="btn btn-light-danger ps-5 pe-4">
                                                <i class="ki-duotone ki-trash fs-2">
                                                    <span class="path1"></span>
                                                    <span class="path2"></span>
                                                    <span class="path3"></span>
                                                    <span class="path4"></span>
                                                    <span class="path5"></span>
                                                </i>
                                            </a>
                                        </div>
                                    </div>
                                </div>
                                {{- end}}
                            </div>
                        </div>

                        <div class="form-group mt-5">
                            <a href="#" data-repeater-create class="btn btn-light-primary">
                                <i class="ki-duotone ki-plus fs-3"></i>
                                <span data-i18n="general.add">Add</span>
                            </a>
                        </div>
                    </div>
                </div>
            </div>

            <div class="form-group action-type action-http row mt-10">
                <label for="idHTTPMethod" data-i18n="general.method" class="col-md-3 col-form-label">Method</label>
                <div class="col-md-9">
                    <select id="idHTTPMethod" name="http_method" class="form-select" data-control="i18n-select2" data-hide-search="true">
                        {{- range .HTTPMethods}}
                        <option value="{{.}}" {{if eq $.Action.Options.HTTPConfig.Method . }}selected{{end}}>{{.}}</option>
                        {{- end}}
                    </select>
                </div>
            </div>

            <div class="form-group row action-type action-http mt-10">
                <label for="idHTTPTimeout" data-i18n="general.timeout" class="col-md-3 col-form-label">Timeout</label>
                <div class="col-md-9">
                    <input id="idHTTPTimeout" type="number" min="1" max="180" class="form-control" name="http_timeout" value="{{.Action.Options.HTTPConfig.Timeout}}" aria-describedby="idHTTPTimeoutHelp" />
                    <div id="idHTTPTimeoutHelp" class="form-text" data-i18n="actions.http_timeout_help"></div>
                </div>
            </div>

            <div class="form-group row align-items-center action-type action-http mt-10">
                <div class="col-md-12">
                    <div class="form-check form-switch form-check-custom form-check-solid">
                        <input class="form-check-input" type="checkbox" id="idHTTPSkipTLSVerify" name="http_skip_tls_verify" {{if .Action.Options.HTTPConfig.SkipTLSVerify}}checked{{end}}/>
                        <label data-i18n="general.skip_tls_verify" class="form-check-label fw-semibold text-gray-800" for="idHTTPSkipTLSVerify">
                            Skip TLS verify
                        </label>
                    </div>
                </div>
            </div>

            <div class="form-group row action-type action-http mt-10">
                <label for="idHTTPBody" data-i18n="actions.body" class="col-md-3 col-form-label">Body</label>
                <div class="col-md-9">
                    <textarea class="form-control" id="idHTTPBody" name="http_body" aria-describedby="idHTTPBodyHelp"
                        rows="4">{{.Action.Options.HTTPConfig.Body}}</textarea>
                    <div id="idHTTPBodyHelp" class="form-text" data-i18n="actions.http_body_help"></div>
                </div>
            </div>

            <div class="card action-type action-http mt-10">
                <div class="card-header bg-light">
                    <h3 data-i18n="actions.multipart_body" class="card-title section-title-inner">Multipart body</h3>
                </div>
                <div class="card-body">
                    <div id="multipart_body">
                        {{- template "infomsg-no-mb" "actions.multipart_body_help"}}
                        <div class="form-group">
                            <div data-repeater-list="multipart_body">
                                {{- range $idx, $val := .Action.Options.HTTPConfig.Parts}}
                                <div data-repeater-item>
                                    <div data-repeater-item>
                                        <div class="form-group row">
                                            <div class="col-md-3 mt-3 mt-md-8">
                                                <input data-i18n="[placeholder]actions.http_part_name" type="text" class="form-control" name="http_part_name" value="{{$val.Name}}" />
                                            </div>
                                            <div class="col-md-3 mt-3 mt-md-8">
                                                <input data-i18n="[placeholder]actions.http_part_file" type="text" class="form-control" name="http_part_file" value="{{$val.Filepath}}" />
                                            </div>
                                            <div class="col-md-5 mt-3 mt-md-8">
                                                <textarea class="form-control" name="http_part_headers" data-i18n="[placeholder]actions.http_part_headers"
                                                    rows="2">{{range $val.Headers}}{{.Key}}: {{.Value}}&#010;{{end}}</textarea>
                                            </div>
                                            <div class="col-md-1 mt-3 mt-md-8">
                                                <a href="#" data-repeater-delete
                                                    class="btn btn-light-danger ps-5 pe-4">
                                                    <i class="ki-duotone ki-trash fs-2">
                                                        <span class="path1"></span>
                                                        <span class="path2"></span>
                                                        <span class="path3"></span>
                                                        <span class="path4"></span>
                                                        <span class="path5"></span>
                                                    </i>
                                                </a>
                                            </div>
                                        </div>
                                        <div class="form-group row">
                                            <div class="col-md-11 mt-3 mt-md-8">
                                                <textarea class="form-control" name="http_part_body" data-i18n="[placeholder]actions.body"
                                                    rows="3">{{$val.Body}}</textarea>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                {{- else}}
                                <div data-repeater-item>
                                    <div class="form-group row">
                                        <div class="col-md-3 mt-3 mt-md-8">
                                            <input data-i18n="[placeholder]actions.http_part_name" type="text" class="form-control" name="http_part_name" value="" />
                                        </div>
                                        <div class="col-md-3 mt-3 mt-md-8">
                                            <input data-i18n="[placeholder]actions.http_part_file" type="text" class="form-control" name="http_part_file" value="" />
                                        </div>
                                        <div class="col-md-5 mt-3 mt-md-8">
                                            <textarea class="form-control" name="http_part_headers" data-i18n="[placeholder]actions.http_part_headers"
                                                rows="2"></textarea>
                                        </div>
                                        <div class="col-md-1 mt-3 mt-md-8">
                                            <a href="#" data-repeater-delete
                                                class="btn btn-light-danger ps-5 pe-4">
                                                <i class="ki-duotone ki-trash fs-2">
                                                    <span class="path1"></span>
                                                    <span class="path2"></span>
                                                    <span class="path3"></span>
                                                    <span class="path4"></span>
                                                    <span class="path5"></span>
                                                </i>
                                            </a>
                                        </div>
                                    </div>
                                    <div class="form-group row">
                                        <div class="col-md-11 mt-3 mt-md-8">
                                            <textarea class="form-control" name="http_part_body" data-i18n="[placeholder]actions.body"
                                                rows="3"></textarea>
                                        </div>
                                    </div>
                                </div>
                                {{- end}}
                            </div>
                        </div>

                        <div class="form-group mt-5">
                            <a href="#" data-repeater-create class="btn btn-light-primary">
                                <i class="ki-duotone ki-plus fs-3"></i>
                                <span data-i18n="general.add">Add</span>
                            </a>
                        </div>
                    </div>
                </div>
            </div>

            <div class="form-group row action-type action-cmd mt-10">
                <label for="idCmdPath" data-i18n="actions.types.command" class="col-md-3 col-form-label">Command</label>
                <div class="col-md-9">
                    <input id="idCmdPath" type="text" class="form-control" name="cmd_path" value="{{.Action.Options.CmdConfig.Cmd}}" aria-describedby="idCmdPathHelp" />
                    <div id="idCmdPathHelp" class="form-text" data-i18n="actions.command_help"></div>
                </div>
            </div>

            <div class="form-group row action-type action-cmd mt-10">
                <label for="idCommandArgs" data-i18n="actions.command_args" class="col-md-3 col-form-label">Arguments</label>
                <div class="col-md-9">
                    <textarea class="form-control" id="idCommandArgs" name="cmd_arguments" aria-describedby="idCommandArgsHelp"
                        rows="2">{{.Action.Options.CmdConfig.GetArgumentsAsString}}</textarea>
                    <div id="idCommandArgsHelp" class="form-text" data-i18n="actions.command_args_help"></div>
                </div>
            </div>

            <div class="form-group row action-type action-cmd mt-10">
                <label for="idCmdTimeout" data-i18n="general.timeout" class="col-md-3 col-form-label">Timeout</label>
                <div class="col-md-9">
                    <input id="idCmdTimeout" type="number" min="1" max="120" class="form-control" name="cmd_timeout"
                        value="{{.Action.Options.CmdConfig.Timeout}}" />
                </div>
            </div>

            <div class="card action-type action-cmd mt-10">
                <div class="card-header bg-light">
                    <h3 data-i18n="general.env_vars" class="card-title section-title-inner">Environment variables</h3>
                </div>
                <div class="card-body">
                    <div id="env_vars">
                        {{- template "infomsg-no-mb" "actions.command_env_vars_help"}}
                        <div class="form-group">
                            <div data-repeater-list="env_vars">
                                {{- range $idx, $val := .Action.Options.CmdConfig.EnvVars}}
                                <div data-repeater-item>
                                    <div data-repeater-item>
                                        <div class="form-group row">
                                            <div class="col-md-5 mt-3 mt-md-8">
                                                <input data-i18n="[placeholder]general.name" type="text" class="form-control" name="cmd_env_key" value="{{$val.Key}}" spellcheck="false" />
                                            </div>
                                            <div class="col-md-6 mt-3 mt-md-8">
                                                <input data-i18n="[placeholder]general.value" type="text" class="form-control" name="cmd_env_value" value="{{$val.Value}}" spellcheck="false" />
                                            </div>
                                            <div class="col-md-1 mt-3 mt-md-8">
                                                <a href="#" data-repeater-delete
                                                    class="btn btn-light-danger ps-5 pe-4">
                                                    <i class="ki-duotone ki-trash fs-2">
                                                        <span class="path1"></span>
                                                        <span class="path2"></span>
                                                        <span class="path3"></span>
                                                        <span class="path4"></span>
                                                        <span class="path5"></span>
                                                    </i>
                                                </a>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                {{- else}}
                                <div data-repeater-item>
                                    <div class="form-group row">
                                        <div class="col-md-5 mt-3 mt-md-8">
                                            <input data-i18n="[placeholder]general.name" type="text" class="form-control" name="cmd_env_key" value="" spellcheck="false" />
                                        </div>
                                        <div class="col-md-6 mt-3 mt-md-8">
                                            <input data-i18n="[placeholder]general.value" type="text" class="form-control" name="cmd_env_value" value="" spellcheck="false" />
                                        </div>
                                        <div class="col-md-1 mt-3 mt-md-8">
                                            <a href="#" data-repeater-delete
                                                class="btn btn-light-danger ps-5 pe-4">
                                                <i class="ki-duotone ki-trash fs-2">
                                                    <span class="path1"></span>
                                                    <span class="path2"></span>
                                                    <span class="path3"></span>
                                                    <span class="path4"></span>
                                                    <span class="path5"></span>
                                                </i>
                                            </a>
                                        </div>
                                    </div>
                                </div>
                                {{- end}}
                            </div>
                        </div>

                        <div class="form-group mt-5">
                            <a href="#" data-repeater-create class="btn btn-light-primary">
                                <i class="ki-duotone ki-plus fs-3"></i>
                                <span data-i18n="general.add">Add</span>
                            </a>
                        </div>
                    </div>
                </div>
            </div>

            <div class="form-group row action-type action-smtp mt-10">
                <label for="idEmailRecipients" data-i18n="actions.email_recipients" class="col-md-3 col-form-label">To</label>
                <div class="col-md-9">
                    <textarea class="form-control" id="idEmailRecipients" name="email_recipients" aria-describedby="idEmailRecipientsHelp"
                        rows="2">{{.Action.Options.EmailConfig.GetRecipientsAsString}}</textarea>
                    <div id="idEmailRecipientsHelp" class="form-text" data-i18n="actions.email_recipients_help"></div>
                </div>
            </div>

            <div class="form-group row action-type action-smtp mt-10">
                <label for="idEmailBcc" data-i18n="actions.email_bcc" class="col-md-3 col-form-label">Bcc</label>
                <div class="col-md-9">
                    <textarea class="form-control" id="idEmailBcc" name="email_bcc" aria-describedby="idEmailBccHelp"
                        rows="2">{{.Action.Options.EmailConfig.GetBccAsString}}</textarea>
                    <div id="idEmailBccHelp" class="form-text" data-i18n="actions.email_bcc_help"></div>
                </div>
            </div>

            <div class="form-group row action-type action-smtp mt-10">
                <label for="idEmailSubject" data-i18n="actions.email_subject" class="col-md-3 col-form-label">Subject</label>
                <div class="col-md-9">
                    <input id="idEmailSubject" type="text" class="form-control" name="email_subject" maxlength="255" value="{{.Action.Options.EmailConfig.Subject}}" aria-describedby="idEmailSubjectHelp" />
                    <div id="idEmailSubjectHelp" class="form-text" data-i18n="actions.placeholders_help"></div>
                </div>
            </div>

            <div class="form-group row action-type action-smtp mt-10">
                <label for="idEmailContentType" data-i18n="actions.content_type" class="col-md-3 col-form-label">Content Type</label>
                <div class="col-md-9">
                    <select id="idEmailContentType" name="email_content_type" class="form-select" data-control="i18n-select2" data-hide-search="true">
                        <option value="0" {{ if eq .Action.Options.EmailConfig.ContentType 0 }}selected{{end}}>Text/plain</option>
                        <option value="1" {{ if eq .Action.Options.EmailConfig.ContentType 1 }}selected{{end}}>Text/html</option>
                    </select>
                </div>
            </div>

            <div class="form-group row action-type action-smtp mt-10">
                <label for="idEmailBody" data-i18n="actions.body" class="col-md-3 col-form-label">Body</label>
                <div class="col-md-9">
                    <textarea class="form-control" id="idEmailBody" name="email_body" aria-describedby="idEmailBodyHelp"
                        rows="4">{{.Action.Options.EmailConfig.Body}}</textarea>
                    <div id="idEmailBodyHelp" class="form-text" data-i18n="actions.placeholders_help"></div>
                </div>
            </div>

            <div class="form-group row action-type action-smtp mt-10">
                <label for="idEmailAttachments" data-i18n="actions.attachments" class="col-md-3 col-form-label">Attachments</label>
                <div class="col-md-9">
                    <textarea class="form-control" id="idEmailAttachments" name="email_attachments" aria-describedby="idEmailAttachmentsHelp"
                        rows="2">{{.Action.Options.EmailConfig.GetAttachmentsAsString}}</textarea>
                    <div id="idEmailAttachmentsHelp" class="form-text" data-i18n="actions.attachments_help"></div>
                </div>
            </div>

            <div class="card action-type action-dataretention mt-10">
                <div class="card-header bg-light">
                    <h3 data-i18n="actions.data_retention" class="card-title section-title-inner">Data retention</h3>
                </div>
                <div class="card-body">
                    <div id="data_retention">
                        {{- template "infomsg-no-mb" "actions.data_retention_help"}}
                        <div class="form-group">
                            <div data-repeater-list="data_retention">
                                {{- range $idx, $val := .Action.Options.RetentionConfig.Folders}}
                                <div data-repeater-item>
                                    <div data-repeater-item>
                                        <div class="form-group row">
                                            <div class="col-md-5 mt-3 mt-md-8">
                                                <input data-i18n="[placeholder]events.path" type="text" class="form-control" name="folder_retention_path" value="{{$val.Path}}" />
                                            </div>
                                            <div class="col-md-2 mt-3 mt-md-8">
                                                <input data-i18n="[placeholder]general.hours" type="text" class="form-control" name="folder_retention_val" value="{{$val.Retention}}" />
                                            </div>
                                            <div class="col-md-4 mt-3 mt-md-8">
                                                <select name="folder_retention_options" data-i18n="[data-placeholder]general.options" class="form-select select-repetear" data-allow-clear="true" data-close-on-select="false" data-hide-search="true" multiple>
                                                    <option value=""></option>
                                                    <option value="1" data-i18n="actions.delete_empty_dirs" {{if $val.DeleteEmptyDirs}}selected{{end}}>Delete empty dirs</option>
                                                </select>
                                            </div>
                                            <div class="col-md-1 mt-3 mt-md-8">
                                                <a href="#" data-repeater-delete
                                                    class="btn btn-light-danger ps-5 pe-4">
                                                    <i class="ki-duotone ki-trash fs-2">
                                                        <span class="path1"></span>
                                                        <span class="path2"></span>
                                                        <span class="path3"></span>
                                                        <span class="path4"></span>
                                                        <span class="path5"></span>
                                                    </i>
                                                </a>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                {{- else}}
                                <div data-repeater-item>
                                    <div class="form-group row">
                                        <div class="col-md-5 mt-3 mt-md-8">
                                            <input data-i18n="[placeholder]events.path" type="text" class="form-control" name="folder_retention_path" value="" />
                                        </div>
                                        <div class="col-md-2 mt-3 mt-md-8">
                                            <input data-i18n="[placeholder]general.hours" type="text" class="form-control" name="folder_retention_val" value="" />
                                        </div>
                                        <div class="col-md-4 mt-3 mt-md-8">
                                            <select name="folder_retention_options" data-i18n="[data-placeholder]general.options" class="form-select select-repetear" data-allow-clear="true" data-close-on-select="false" data-hide-search="true" multiple>
                                                <option value=""></option>
                                                <option value="1" data-i18n="actions.delete_empty_dirs">Delete empty dirs</option>
                                            </select>
                                        </div>
                                        <div class="col-md-1 mt-3 mt-md-8">
                                            <a href="#" data-repeater-delete
                                                class="btn btn-light-danger ps-5 pe-4">
                                                <i class="ki-duotone ki-trash fs-2">
                                                    <span class="path1"></span>
                                                    <span class="path2"></span>
                                                    <span class="path3"></span>
                                                    <span class="path4"></span>
                                                    <span class="path5"></span>
                                                </i>
                                            </a>
                                        </div>
                                    </div>
                                </div>
                                {{- end}}
                            </div>
                        </div>

                        <div class="form-group mt-5">
                            <a href="#" data-repeater-create class="btn btn-light-primary">
                                <i class="ki-duotone ki-plus fs-3"></i>
                                <span data-i18n="general.add">Add</span>
                            </a>
                        </div>
                    </div>
                </div>
            </div>

            <div class="form-group row action-type action-fs mt-10">
                <label for="idFsActionType" data-i18n="actions.fs_action" class="col-md-3 col-form-label">Fs action</label>
                <div class="col-md-9">
                    <select id="idFsActionType" name="fs_action_type" class="form-select" data-control="i18n-select2" data-hide-search="true">
                        {{- range .FsActions}}
                        <option value="{{.Value}}" data-i18n="{{.Name}}" {{if eq $.Action.Options.FsConfig.Type .Value }}selected{{end}}></option>
                        {{- end}}
                    </select>
                </div>
            </div>

            <div class="card action-type action-fs-type action-fs-rename mt-10">
                <div class="card-header bg-light">
                    <h3 data-i18n="actions.fs_types.rename" class="card-title section-title-inner">Rename</h3>
                </div>
                <div class="card-body">
                    <div id="fs_rename">
                        {{- template "infomsg-no-mb" "actions.paths_src_dst_help"}}
                        <div class="form-group">
                            <div data-repeater-list="fs_rename">
                                {{- range $idx, $val := .Action.Options.FsConfig.Renames}}
                                <div data-repeater-item>
                                    <div data-repeater-item>
                                        <div class="form-group row">
                                            <div class="col-md-5 mt-3 mt-md-8">
                                                <input data-i18n="[placeholder]actions.source_path" type="text" class="form-control" name="fs_rename_source" value="{{$val.Key}}" spellcheck="false" />
                                            </div>
                                            <div class="col-md-6 mt-3 mt-md-8">
                                                <input data-i18n="[placeholder]actions.target_path" type="text" class="form-control" name="fs_rename_target" value="{{$val.Value}}" spellcheck="false" />
                                            </div>
                                            <div class="col-md-1 mt-3 mt-md-8">
                                                <a href="#" data-repeater-delete
                                                    class="btn btn-light-danger ps-5 pe-4">
                                                    <i class="ki-duotone ki-trash fs-2">
                                                        <span class="path1"></span>
                                                        <span class="path2"></span>
                                                        <span class="path3"></span>
                                                        <span class="path4"></span>
                                                        <span class="path5"></span>
                                                    </i>
                                                </a>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                {{- else}}
                                <div data-repeater-item>
                                    <div class="form-group row">
                                        <div class="col-md-5 mt-3 mt-md-8">
                                            <input data-i18n="[placeholder]actions.source_path" type="text" class="form-control" name="fs_rename_source" value="" spellcheck="false" />
                                        </div>
                                        <div class="col-md-6 mt-3 mt-md-8">
                                            <input data-i18n="[placeholder]actions.target_path" type="text" class="form-control" name="fs_rename_target" value="" spellcheck="false" />
                                        </div>
                                        <div class="col-md-1 mt-3 mt-md-8">
                                            <a href="#" data-repeater-delete
                                                class="btn btn-light-danger ps-5 pe-4">
                                                <i class="ki-duotone ki-trash fs-2">
                                                    <span class="path1"></span>
                                                    <span class="path2"></span>
                                                    <span class="path3"></span>
                                                    <span class="path4"></span>
                                                    <span class="path5"></span>
                                                </i>
                                            </a>
                                        </div>
                                    </div>
                                </div>
                                {{- end}}
                            </div>
                        </div>

                        <div class="form-group mt-5">
                            <a href="#" data-repeater-create class="btn btn-light-primary">
                                <i class="ki-duotone ki-plus fs-3"></i>
                                <span data-i18n="general.add">Add</span>
                            </a>
                        </div>
                    </div>
                </div>
            </div>

            <div class="form-group row action-type action-fs-type action-fs-delete mt-10">
                <label for="idFsDelete" data-i18n="general.paths" class="col-md-3 col-form-label">Paths</label>
                <div class="col-md-9">
                    <textarea class="form-control" id="idFsDelete" name="fs_delete_paths" aria-describedby="idFsDeleteHelp"
                        rows="2">{{.Action.Options.FsConfig.GetDeletesAsString}}</textarea>
                    <div id="idFsDeleteHelp" class="form-text" data-i18n="actions.paths_help"></div>
                </div>
            </div>

            <div class="form-group row action-type action-fs-type action-fs-mkdir mt-10">
                <label for="idFsMkdir" data-i18n="general.paths" class="col-md-3 col-form-label">Paths</label>
                <div class="col-md-9">
                    <textarea class="form-control" id="idFsMkdir" name="fs_mkdir_paths" aria-describedby="idFsMkdirHelp"
                        rows="2">{{.Action.Options.FsConfig.GetMkDirsAsString}}</textarea>
                    <div id="idFsMkdirHelp" class="form-text" data-i18n="actions.paths_help"></div>
                </div>
            </div>

            <div class="form-group row action-type action-fs-type action-fs-exist mt-10">
                <label for="idFsExist" data-i18n="general.paths" class="col-md-3 col-form-label">Paths</label>
                <div class="col-md-9">
                    <textarea class="form-control" id="idFsExist" name="fs_exist_paths" aria-describedby="idFsExistHelp"
                        rows="2">{{.Action.Options.FsConfig.GetExistAsString}}</textarea>
                    <div id="idFsExistHelp" class="form-text" data-i18n="actions.paths_help"></div>
                </div>
            </div>

            <div class="card action-type action-fs-type action-fs-copy mt-10">
                <div class="card-header bg-light">
                    <h3 data-i18n="actions.fs_types.copy" class="card-title section-title-inner">Copy</h3>
                </div>
                <div class="card-body">
                    <div id="fs_copy">
                        {{- template "infomsg-no-mb" "actions.paths_src_dst_help"}}
                        <div class="form-group">
                            <div data-repeater-list="fs_copy">
                                {{- range $idx, $val := .Action.Options.FsConfig.Copy}}
                                <div data-repeater-item>
                                    <div data-repeater-item>
                                        <div class="form-group row">
                                            <div class="col-md-5 mt-3 mt-md-8">
                                                <input data-i18n="[placeholder]actions.source_path" type="text" class="form-control" name="fs_copy_source" value="{{$val.Key}}" spellcheck="false" />
                                            </div>
                                            <div class="col-md-6 mt-3 mt-md-8">
                                                <input data-i18n="[placeholder]actions.target_path" type="text" class="form-control" name="fs_copy_target" value="{{$val.Value}}" spellcheck="false" />
                                            </div>
                                            <div class="col-md-1 mt-3 mt-md-8">
                                                <a href="#" data-repeater-delete
                                                    class="btn btn-light-danger ps-5 pe-4">
                                                    <i class="ki-duotone ki-trash fs-2">
                                                        <span class="path1"></span>
                                                        <span class="path2"></span>
                                                        <span class="path3"></span>
                                                        <span class="path4"></span>
                                                        <span class="path5"></span>
                                                    </i>
                                                </a>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                {{- else}}
                                <div data-repeater-item>
                                    <div class="form-group row">
                                        <div class="col-md-5 mt-3 mt-md-8">
                                            <input data-i18n="[placeholder]actions.source_path" type="text" class="form-control" name="fs_copy_source" value="" spellcheck="false" />
                                        </div>
                                        <div class="col-md-6 mt-3 mt-md-8">
                                            <input data-i18n="[placeholder]actions.target_path" type="text" class="form-control" name="fs_copy_target" value="" spellcheck="false" />
                                        </div>
                                        <div class="col-md-1 mt-3 mt-md-8">
                                            <a href="#" data-repeater-delete
                                                class="btn btn-light-danger ps-5 pe-4">
                                                <i class="ki-duotone ki-trash fs-2">
                                                    <span class="path1"></span>
                                                    <span class="path2"></span>
                                                    <span class="path3"></span>
                                                    <span class="path4"></span>
                                                    <span class="path5"></span>
                                                </i>
                                            </a>
                                        </div>
                                    </div>
                                </div>
                                {{- end}}
                            </div>
                        </div>

                        <div class="form-group mt-5">
                            <a href="#" data-repeater-create class="btn btn-light-primary">
                                <i class="ki-duotone ki-plus fs-3"></i>
                                <span data-i18n="general.add">Add</span>
                            </a>
                        </div>
                    </div>
                </div>
            </div>

            <div class="form-group row action-type action-fs-type action-fs-compress mt-10">
                <label for="idFsCompressName" data-i18n="actions.archive_path" class="col-md-3 col-form-label">Archive path</label>
                <div class="col-md-9">
                    <input id="idFsCompressName" type="text" class="form-control" name="fs_compress_name" maxlength="255" value="{{.Action.Options.FsConfig.Compress.Name}}" aria-describedby="idFsCompressNameHelp" />
                    <div id="idFsCompressNameHelp" class="form-text" data-i18n="actions.archive_path_help"></div>
                </div>
            </div>

            <div class="form-group row action-type action-fs-type action-fs-compress mt-10">
                <label for="idFsCompressPaths" data-i18n="general.paths" class="col-md-3 col-form-label">Paths</label>
                <div class="col-md-9">
                    <textarea class="form-control" id="idFsCompressPaths" name="fs_compress_paths" aria-describedby="idFsCompressPathsHelp"
                        rows="2">{{.Action.Options.FsConfig.GetCompressPathsAsString}}</textarea>
                    <div id="idFsCompressPathsHelp" class="form-text" data-i18n="actions.paths_help"></div>
                </div>
            </div>

            <div class="d-flex justify-content-end mt-12">
                <input type="hidden" name="_form_token" value="{{.CSRFToken}}">
                <button type="submit" id="form_submit" class="btn btn-primary px-10" name="form_action" value="submit">
                    <span data-i18n="general.submit" class="indicator-label">
                        Submit
                    </span>
                    <span data-i18n="general.wait" class="indicator-progress">
                        Please wait...
                        <span class="spinner-border spinner-border-sm align-middle ms-2"></span>
                    </span>
                </button>
            </div>
        </form>
    </div>
</div>
{{- end}}

{{- define "additionalnavitems"}}
<div class="d-flex align-items-center ms-2 ms-lg-3" id="kt_header_user_menu_toggle">
    <div class="btn btn-icon btn-active-light-primary w-35px h-35px w-md-40px h-md-40px" data-bs-toggle="modal" data-bs-target="#info_modal">
        <i class="ki-duotone ki-information-2 fs-2">
            <i class="path1"></i>
            <i class="path2"></i>
            <i class="path3"></i>
        </i>
    </div>
</div>
{{- end}}

{{- define "modals"}}
<div class="modal fade" id="info_modal" tabindex="-1">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <h3 data-i18n="actions.placeholders_modal_title" class="modal-title">Supported placeholders</h3>
                <div data-i18n="[aria-label]general.close" class="btn btn-icon btn-sm btn-active-light-primary" data-bs-dismiss="modal" aria-label="Close">
                    <i class="ki-solid ki-cross fs-2x text-gray-700"></i>
                </div>
            </div>
            <div class="modal-body fs-5 fw-semibold">
                <p>
                    <span class="shortcut">{{`{{Name}}`}}</span> => <span data-i18n="actions.placeholders_modal.name">Username, folder name, admin username for provider events, domain name for certificate events.</span>
                </p>
                <p>
                    <span class="shortcut">{{`{{Event}}`}}</span> => <span data-i18n="actions.placeholders_modal.event">Event name, for example "upload", "download" for filesystem events or "add", "update" for provider events.</span>
                </p>
                <p>
                    <span class="shortcut">{{`{{Status}}`}}</span> => <span data-i18n="actions.placeholders_modal.status">Status for "upload", "download" and "ssh_cmd" events. 1 means no error, 2 means a generic error occurred, 3 means quota exceeded error.</span>
                </p>
                <p>
                    <span class="shortcut">{{`{{StatusString}}`}}</span> => <span data-i18n="actions.placeholders_modal.status_string">Status as string. Possible values "OK", "KO".</span>
                </p>
                <p>
                    <span class="shortcut">{{`{{ErrorString}}`}}</span> => <span data-i18n="actions.placeholders_modal.error_string">Error details. Replaced with an empty string if no errors occur.</span>
                </p>
                <p>
                    <span class="shortcut">{{`{{VirtualPath}}`}}</span> => <span data-i18n="actions.placeholders_modal.virtual_path">Path seen by SFTPGo users, for example "/adir/afile.txt".</span>
                </p>
                <p>
                    <span class="shortcut">{{`{{VirtualDirPath}}`}}</span> => <span data-i18n="actions.placeholders_modal.virtual_dir_path">Parent directory for VirtualPath, for example if VirtualPath is "/adir/afile.txt", VirtualDirPath is "/adir".</span>
                </p>
                <p>
                    <span class="shortcut">{{`{{FsPath}}`}}</span> => <span data-i18n="actions.placeholders_modal.fs_path">Full filesystem path, for example "/user/homedir/adir/afile.txt" or "C:/data/user/homedir/adir/afile.txt" on Windows.</span>
                </p>
                <p>
                    <span class="shortcut">{{`{{Ext}}`}}</span> => <span data-i18n="actions.placeholders_modal.ext">File extension, for example ".txt" if the filename is "afile.txt".</span>
                </p>
                <p>
                    <span class="shortcut">{{`{{ObjectName}}`}}</span> => <span data-i18n="actions.placeholders_modal.object_name">File/directory name, for example "afile.txt" or provider object name.</span>
                </p>
                <p>
                    <span class="shortcut">{{`{{ObjectType}}`}}</span> => <span data-i18n="actions.placeholders_modal.object_type">Object type for provider events: "user", "group", "admin", etc.</span>
                </p>
                <p>
                    <span class="shortcut">{{`{{VirtualTargetPath}}`}}</span> => <span data-i18n="actions.placeholders_modal.virtual_target_path">Virtual target path for renames.</span>
                </p>
                <p>
                    <span class="shortcut">{{`{{VirtualTargetDirPath}}`}}</span> => <span data-i18n="actions.placeholders_modal.virtual_target_dir_path">Parent directory for VirtualTargetPath.</span>
                </p>
                <p>
                    <span class="shortcut">{{`{{TargetName}}`}}</span> => <span data-i18n="actions.placeholders_modal.target_name">Target object name for renames.</span>
                </p>
                <p>
                    <span class="shortcut">{{`{{FsTargetPath}}`}}</span> => <span data-i18n="actions.placeholders_modal.fs_target_path">Full filesystem target path for renames.</span>
                </p>
                <p>
                    <span class="shortcut">{{`{{FileSize}}`}}</span> => <span data-i18n="actions.placeholders_modal.file_size">File size.</span>
                </p>
                <p>
                    <span class="shortcut">{{`{{Elapsed}}`}}</span> => <span data-i18n="actions.placeholders_modal.elapsed">Elapsed time as milliseconds for filesystem events.</span>
                </p>
                <p>
                    <span class="shortcut">{{`{{Protocol}}`}}</span> => <span data-i18n="actions.placeholders_modal.protocol">Protocol, for example "SFTP", "FTP".</span>
                </p>
                <p>
                    <span class="shortcut">{{`{{IP}}`}}</span> => <span data-i18n="actions.placeholders_modal.ip">Client IP address.</span>
                </p>
                <p>
                    <span class="shortcut">{{`{{Role}}`}}</span> => <span data-i18n="actions.placeholders_modal.role">User or admin role.</span>
                </p>
                <p>
                    <span class="shortcut">{{`{{Timestamp}}`}}</span> => <span data-i18n="actions.placeholders_modal.timestamp">Event timestamp as nanoseconds since epoch.</span>
                </p>
                <p>
                    <span class="shortcut">{{`{{Email}}`}}</span> => <span data-i18n="actions.placeholders_modal.email">For filesystem events, this is the email associated with the user performing the action. For the provider events, this is the email associated with the affected user or admin. Blank in all other cases.</span>
                </p>
                <p>
                    <span class="shortcut">{{`{{ObjectData}}`}}</span> => <span data-i18n="actions.placeholders_modal.object_data">Provider object data serialized as JSON with sensitive fields removed.</span>
                </p>
                <p>
                    <span class="shortcut">{{`{{ObjectDataString}}`}}</span> => <span data-i18n="actions.placeholders_modal.object_data_string">Provider object data as JSON escaped string with sensitive fields removed.</span>
                </p>
                <p>
                    <span class="shortcut">{{`{{RetentionReports}}`}}</span> => <span data-i18n="actions.placeholders_modal.retention_reports">Data retention reports as zip compressed CSV files. Supported as email attachment, file path for multipart HTTP request and as single parameter for HTTP requests body.</span>
                </p>
                <p>
                    <span class="shortcut">{{`{{IDPField<fieldname>}}`}}</span> => <span data-i18n="actions.placeholders_modal.idp_field">Identity Provider custom fields containing a string.</span>
                </p>
                <p>
                    <span class="shortcut">{{`{{Metadata}}`}}</span> => <span data-i18n="actions.placeholders_modal.metadata">Cloud storage metadata for the downloaded file serialized as JSON.</span>
                </p>
                <p>
                    <span class="shortcut">{{`{{MetadataString}}`}}</span> => <span data-i18n="actions.placeholders_modal.metadata_string">Cloud storage metadata for the downloaded file as JSON escaped string.</span>
                </p>
                <p>
                    <span class="shortcut">{{`{{UID}}`}}</span> => <span data-i18n="actions.placeholders_modal.uid">Unique ID.</span>
                </p>
            </div>
            <div class="modal-footer">
                <button data-i18n="general.ok" class="btn btn-primary" type="button" data-bs-dismiss="modal">OK</button>
            </div>
        </div>
    </div>
</div>
{{- end}}

{{- define "extra_js"}}
<script {{- if .CSPNonce}} nonce="{{.CSPNonce}}"{{- end}} src="{{.StaticURL}}/assets/plugins/custom/formrepeater/formrepeater.bundle.js"></script>
<script type="text/javascript" {{- if .CSPNonce}} nonce="{{.CSPNonce}}"{{- end}}>
    function onTypeChanged(val){
        $('.action-type').hide();
        switch (val) {
            case '1':
                $('.action-http').show();
                break;
            case '2':
                $('.action-cmd').show();
                break;
            case '3':
                $('.action-smtp').show();
                break;
            case '8':
                $('.action-dataretention').show();
                break;
            case '9':
                $('.action-fs').show();
                onFsActionChanged($("#idFsActionType").val());
                break;
            case '11':
                $('.action-pwd-expiration').show();
                break;
            case '13':
                $('.action-idp').show();
                break;
            case '14':
                $('.action-user-inactivity').show();
                break;
        }
    }

    function onFsActionChanged(val){
        $('.action-fs-type').hide();
        switch (val) {
            case '1':
                $('.action-fs-rename').show();
                break;
            case '2':
                $('.action-fs-delete').show();
                break;
            case '3':
                $('.action-fs-mkdir').show();
                break;
            case '4':
                $('.action-fs-exist').show();
                break;
            case '5':
                $('.action-fs-compress').show();
                break;
            case '6':
                $('.action-fs-copy').show();
                break;
        }
    }

    $(document).on("i18nload", function(){
        onTypeChanged('{{.Action.Type}}');
        onFsActionChanged('{{.Action.Options.FsConfig.Type}}');
    });

    $(document).on("i18nshow", function(){
        initRepeater('#http_headers');
        initRepeater('#query_parameters');
        initRepeater('#multipart_body');
        initRepeater('#env_vars');
        initRepeater('#data_retention');
        initRepeater('#fs_rename');
        initRepeater('#fs_copy');
        initRepeaterItems();

        $('#idType').on("change", function(){
            onTypeChanged(this.value);
        });

        $('#idFsActionType').on("change", function(){
            onFsActionChanged(this.value);
        });

        $('#eventaction_form').submit(function (event) {
			let submitButton = document.querySelector('#form_submit');
			submitButton.setAttribute('data-kt-indicator', 'on');
			submitButton.disabled = true;
        });
    });
</script>
{{- end}}