{% extends base %}
{% load form_extras %}

{% block content %}

    <form id="form" method="post">
        {% csrf_token %}
        <input type="hidden" id="action" name="action" value="{{action}}"/>
        <input type="hidden" name="path" value="{{path}}"/>
        <input type="hidden" name="back" value="{{back}}"/>
        <input type="hidden" name="grid_id" value="{{grid_id}}"/>

        {% include "components/banners.html" %}

        <div class="panel panel-default">
            <div class="panel-body">

                <div class="form-group">
                    <div class="col-sm-4">
                        <label>Champs</label>
                    </div>
                    <div class="col-sm-8">
                        <select name="label" class="form-control">
                            {% for field in fields %}
                            <option value="{{field.key}}" {% if field.key == column.label %}selected{% endif %}>{{field.label}}</option>
                            {% endfor %}
                        </select>
                    </div>
                </div>

                <div class="form-group">
                    <div class="col-sm-4">
                        <label>Tri</label>
                    </div>
                    <div class="col-sm-8">
                        <select name="order_by" class="form-control">
                            <option value="0" {% if order_by == 0 %}selected{% endif %}>(Aucun)</option>
                            <option value="1" {% if order_by == 1 %}selected{% endif %}>Ascendant</option>
                            <option value="2" {% if order_by == 2 %}selected{% endif %}>Descendant</option>
                        </select>
                    </div>
                </div>

                {% include "components/field_text_short.html" with field=form|field:'order' %}
                {% include "components/field_text_short.html" with field=form|field:'width' %}

            </div>
            <div class="panel-footer">
                <button type="button" class="btn btn-default" onclick="go_back('{{ back }}')">Annuler</button>
                <button type="submit" class="btn btn-primary">Enregistrer</button>
                {% if user.is_staff and column %}
                <button type="button" class="btn btn-danger" onclick="open2('{% url 'django:column_delete' column.id %}')">Supprimer</button>
                {% endif %}
            </div>
        </div>

    </form>

{% endblock %}