{% set current_theme = current_theme() %}
<!doctype html>
<html lang="{{ current_locale() }}" class="h-100">
    <head>
        {{ current_theme.headertags() }} {{ mde.css }}
        <title>{{ _('Nuevo Mensaje') }} - {{ course.nombre }}</title>
        {{ current_theme.local_style() }}
    </head>

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

        <main>
            {{ current_theme.notify() }}

            <div class="container px-4 py-5">
                <div class="pb-2 border-bottom">
                    <h4>
                        <nav aria-label="breadcrumb">
                            <ol class="breadcrumb">
                                <li class="breadcrumb-item">
                                    <a class="text-reset text-decoration-none link-dark" href="{{ url_for('home.panel') }}">
                                        {{ _('Inicio') }}
                                    </a>
                                </li>
                                <li class="breadcrumb-item">
                                    <a
                                        class="text-reset text-decoration-none link-dark"
                                        href="{{ url_for('course.curso', course_code=course.codigo) }}"
                                    >
                                        {{ course.nombre }}
                                    </a>
                                </li>
                                <li class="breadcrumb-item">
                                    <a
                                        class="text-reset text-decoration-none link-dark"
                                        href="{{ url_for('msg.course_messages', course_code=course.codigo) }}"
                                    >
                                        {{ _('Mensajes') }}
                                    </a>
                                </li>
                                <li class="breadcrumb-item active">{{ _('Nuevo Mensaje') }}</li>
                            </ol>
                        </nav>
                    </h4>
                </div>

                <div class="row justify-content-center">
                    <div class="col-md-8">
                        <form method="post">
                            {{ form.csrf_token }} {{ form.course_id }}

                            <div class="mb-3">
                                <label for="subject" class="form-label">{{ _('Asunto') }}</label>
                                {{ form.subject(class="form-control", id="subject", placeholder=_("¿En qué podemos ayudarte?"))
                                }} {% if form.subject.errors %}
                                <div class="text-danger small">
                                    {% for error in form.subject.errors %}
                                    <div>{{ error }}</div>
                                    {% endfor %}
                                </div>
                                {% endif %}
                            </div>

                            <div class="mb-3">
                                <label for="content" class="form-label">{{ _('Mensaje') }}</label>
                                {{ form.content }} {% if form.content.errors %}
                                <div class="text-danger small">
                                    {% for error in form.content.errors %}
                                    <div>{{ error }}</div>
                                    {% endfor %}
                                </div>
                                {% endif %}
                            </div>

                            {{ mde.preview }} {{ mde.js }}

                            <div class="d-flex gap-2">
                                <button class="btn btn-primary" type="submit">
                                    <i class="bi bi-envelope-plus"></i> {{ _('Enviar Mensaje') }}
                                </button>
                                <a
                                    href="{{ url_for('msg.course_messages', course_code=course.codigo) }}"
                                    class="btn btn-secondary"
                                >
                                    {{ _('Cancelar') }}
                                </a>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </main>
    </body>
</html>
