{% extends "pretixcontrol/event/base.html" %}
{% load i18n %}
{% load bootstrap3 %}
{% block title %}{% trans "Send email" %}{% endblock %}
{% block content %}
    <h1>
        {% trans "Send email" %}
        <a class="btn btn-link btn-lg"
                href="{% url "control:event.order" event=request.event.slug organizer=request.event.organizer.slug code=order.code %}">
            {% blocktrans trimmed with order=order.code %}
                Back to order {{ order }}
            {% endblocktrans %}
        </a>
    </h1>
    {% block inner %}
        <form class="form-horizontal" method="post" action="">
            {% csrf_token %}
            {% bootstrap_field form.sendto layout='horizontal' %}
            {% bootstrap_field form.subject layout='horizontal' %}
            {% bootstrap_field form.message layout='horizontal' %}
            {% bootstrap_field form.attach_tickets layout='horizontal' %}
            {% if form.attach_invoices %}
                {% bootstrap_field form.attach_invoices layout='horizontal' %}
            {% endif %}
            {% if request.method == "POST" %}
                <fieldset>
                    <legend>{% trans "E-mail preview" %}</legend>
                    <div class="tab-pane mail-preview-group">
                        <div lang="{{ order.locale }}" class="mail-preview">
                            <strong>{{ preview_output.subject }}</strong><br><br>
                            {{ preview_output.html|safe }}
                        </div>
                    </div>
                </fieldset>
            {% endif %}
            <div class="form-group submit-group">
                <button type="submit" class="btn btn-default btn-save pull-left" name="action" value="preview">
                {% trans "Preview email" %}
                </button>
                <button type="submit" class="btn btn-primary btn-save">
                    {% trans "Send" %}
                </button>
            </div>
        </form>
    {% endblock %}
{% endblock %}
