{% extends "base_misc.html" %}
{% block title %}Send Email{% endblock %}

{% block view_buttons  %}{% 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">Send mail</button>
            {% include "bootstrap_fields.html" with fields=form %}
            {% include "snippets/misc_mail_servicelist.html" %}
            <hr>
            <button class="btn btn-success" type="submit">Send mail</button>
        </form>
    {% endif %}


{% endblock %}

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

{% endblock %}