{% extends "base.html" %}
{% load i18n %}

{% block title %}{% trans "Send Email" %}{% endblock %}

{% block view_buttons  %}{% endblock %}
{% block toolbar %}{% endblock %}
{% block action_buttons %}
{% endblock %}
{% block content %}

    {% if form %}
        <form method="post" class="form-horizontal">{% csrf_token %}
            <button id="zesubmit" class="btn btn-success" type="submit">{% trans "Send mail" %}</button>
            {% include "bootstrap_fields.html" with fields=form %}
            {% include "snippets/misc_mail_objectlist.html" %}
            <hr>
            <button class="btn btn-success" type="submit">{% trans "Send mail" %}</button>
        </form>
    {% endif %}


{% endblock %}

{% block footer %}
    {{ block.super }}
    <script type="text/javascript" xmlns="http://www.w3.org/1999/html">
        $(document).ready(function() {
            adagios.rest.status.emails({'fields': 'email'})
                    .done(function(data) {
                        $("#id_to").select2({
                            tags:data,
                            tokenSeparators: [",", " "],
                            placeholder:"{% trans "Comma seperated list of email addresses to send to" %}"
                        });

                    });
        })
    </script>

{% endblock %}