{% set current_theme = current_theme() %} {% from "macros/form_buttons.j2" import render_form_buttons %} {% from
"macros/form_errors.j2" import render_field_errors, render_form_errors %}
<!doctype html>
<html lang="{{ get_locale() }}" class="h-100">
    <head>
        {{ current_theme.headertags() }}

        <title>{{_("Editar configuración")}}</title>

        {{ current_theme.local_style() }}
        <!-- Custom styles for this template -->
        <link href="{{ url_for('static', filename='css/form-validation') }}" rel="stylesheet" />
    </head>

    <body>
        {{ current_theme.navbar() }}

        <main>
            {{ current_theme.notify() }} {% from "macros/demo_banner.j2" import demo_mode_banner %} {{ demo_mode_banner() }}

            <div class="container px-4 py-5" id="icon-grid">
                <h5 class="pb-2 border-bottom">{{_("Configuración del Correo Electrónico")}}.</h5>
                {% if error %}
                <div class="alert alert-danger" role="alert">{{ error }}</div>
                {% endif %} {% if config.email_verificado %}
                <div class="alert alert-success" role="alert">
                    <i class="bi bi-check-circle" aria-hidden="true"></i> {{_("La configuración de correo electrónico ha sido
                    verificada correctamente")}}.
                </div>
                {% endif %}
                <form method="post">
                    <div class="row">
                        <br />
                        <h5 class="pb-2 border-bottom">{{_("Datos de acceso al servidor SMTP")}}.</h5>

                        <div class="col-sm-6">
                            <label for="servidor" class="form-label">{{_("Servidor")}}:</label>
                            {{ form.MAIL_SERVER(class="form-control", id="servidor",) }} {{
                            render_field_errors(form.MAIL_SERVER) }}
                        </div>

                        <div class="col-sm-6">
                            <label for="puerto" class="form-label">{{_("Puerto")}}:</label>
                            {{ form.MAIL_PORT(class="form-control", id="puerto",) }} {{ render_field_errors(form.MAIL_PORT) }}
                        </div>
                    </div>

                    <br />

                    <div class="row">
                        <div class="col-sm-6">
                            <label for="usuario" class="form-label">{{_("Usuario")}}:</label>
                            {{ form.MAIL_USERNAME(class="form-control", id="usuario") }} {{
                            render_field_errors(form.MAIL_USERNAME) }}
                        </div>

                        <div class="col-sm-6">
                            <label for="contrasena" class="form-label">{{_("Contraseña (Oculta por seguridad.)")}}:</label>
                            {{ form.MAIL_PASSWORD(class="form-control", id="contrasena") }} {{
                            render_field_errors(form.MAIL_PASSWORD) }}
                        </div>
                    </div>

                    <br />

                    <div class="row">
                        <div class="col-sm-6">
                            <label for="tls" class="form-label">{{_("Utilizar TLS")}}.</label>
                            {{ form.MAIL_USE_TLS() }} {{ render_field_errors(form.MAIL_USE_TLS) }}
                        </div>

                        <div class="col-sm-6">
                            <label for="ssl" class="form-label">{{_("Utilizar SSL")}}.</label>
                            {{ form.MAIL_USE_SSL() }} {{ render_field_errors(form.MAIL_USE_SSL) }}
                        </div>
                    </div>

                    <div class="row">
                        <div class="col-sm-6">
                            <br />
                            <label for="default_sender" class="form-label"
                                >{{_("Correo predeterminado como enviado por")}}.</label
                            >
                            {{ form.MAIL_DEFAULT_SENDER(class="form-control", id="default_sender") }} {{
                            render_field_errors(form.MAIL_DEFAULT_SENDER) }}
                        </div>
                        <div class="col-sm-6">
                            <br />
                            <label for="default_sender_name" class="form-label"
                                >{{_("Correo predeterminado enviado por nombre")}}.</label
                            >
                            {{ form.MAIL_DEFAULT_SENDER_NAME(class="form-control", id="default_sender_name") }} {{
                            render_field_errors(form.MAIL_DEFAULT_SENDER_NAME) }}
                        </div>
                    </div>

                    <div class="row"><br /></div>
                    <div class="row"><br /></div>

                    <div class="row">
                        <br />
                        <div class="col">
                            <div>
                                <a href="{{ url_for('setting.mail_check') }}" type="button" class="btn btn-primary"
                                    >{{_("Enviar Correo de Prueba")}}</a
                                >
                            </div>
                        </div>
                    </div>

                    {{ render_form_buttons(_("Actualizar Configuración"), url_for('admin_profile.pagina_admin')) }}
                </form>
            </div>
        </main>
    </body>
</html>
