{% extends 'base.html' %}
{% load static %}
{% load i18n %}
{% load bootstrap3 %}
{% block custom_head_css_js %}
    <link href="{% static 'css/plugins/select2/select2.min.css' %}" rel="stylesheet">
    <script src="{% static 'js/plugins/select2/select2.full.min.js' %}"></script>
{% endblock %}

{% block content %}
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>{{ action }}</h5>
                    </div>
                    <div class="ibox-content">
                        {% if form.non_field_errors %}
                            <div class="alert alert-danger">
                               {{ form.non_field_errors }}
                            </div>
                       {% endif %}
                        <form method="post" class="form-horizontal" action="" >
                            {% csrf_token %}
                            {% bootstrap_field form.name layout="horizontal" %}
                            {% bootstrap_field form.users layout="horizontal" %}
{#                            <div class="form-group">#}
{#                              <label for="users" class="col-sm-2 control-label">{% trans 'Users' %}</label>#}
{#                                <div class="col-sm-9">#}
{#                                    <select name="users" id="id_users" data-placeholder="{% trans 'Select User' %}" class="select2 form-control m-b" multiple  tabindex="2">#}
{#                                        {% for user in users %}#}
{#                                            {% if user.id in group_users %}#}
{#                                            <option value="{{ user.id }}" selected>{{ user.name }}</option>#}
{#                                            {% else %}#}
{#                                                <option value="{{ user.id }}">{{ user.name }}</option>#}
{#                                            {% endif %}#}
{#                                        {% endfor %}#}
{#                                    </select>#}
{#                                </div>#}
{#                            </div>#}
                            {% bootstrap_field form.comment layout="horizontal" %}
                            <div class="form-group">
                                <div class="col-sm-4 col-sm-offset-2">
                                    <button class="btn btn-white" type="reset">{% trans 'Cancel' %}</button>
                                    <button id="submit_button" class="btn btn-primary" type="submit">{% trans 'Confirm' %}</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
    {% include "users/_select_user_modal.html" %}
{% endblock %}
{% block custom_foot_js %}
<script>
$(document).ready(function () {
    $('.select2').select2();
})
</script>
{% endblock %}
