{% extends "orga/mails/base.html" %}
{% load bootstrap4 %}
{% load i18n %}
{% block mail_content %}

    {% if form.instance.sent %}
    <div class="alert alert-info">
        {% blocktrans trimmed with timestamp=form.instance.sent %}
            This email was sent on {{ timestamp }}
        {% endblocktrans %}
    </div>
    {% endif %}
    <form method="post" action="">
        {% csrf_token %}
        <legend>{% trans "Mail Editor" %}</legend>
        {% bootstrap_form form layout='event' %}
        <div class="form-group row">
            <div class="ml-auto col-md-9">
                {% if action == "edit" %}
                    <button type="submit" class="btn btn-primary">{% trans "Save" %}</button>
                {% elif action == "view" %}
                    {% if form.instance.sent %}
                        <a class="btn btn-primary" href={{ form.instance.urls.copy }}>{% trans "Copy to draft" %}</a>
                    {% else %}
                        <a class="btn btn-primary" href={{ form.instance.urls.send }}>{% trans "Send" %}</a>
                        <a class="btn btn-secondary" href={{ form.instance.urls.edit }}>{% trans "Edit" %}</a>
                        <a class="btn btn-danger" href={{ form.instance.urls.delete }}>{% trans "Discard" %}</a>
                    {% endif %}
                {% endif %}
            </div>
        </div>
    </form>

{% endblock %}
