{% extends 'base.html' %}
{% load i18n dpagination%}

{% block title %}{% trans 'Groups' %}{% endblock %}

{% block breadcrumb %}
    <ol class="breadcrumb">
        <li><span class="glyphicon glyphicon-home"></span></li>
        <li class="active">{% trans 'Groups' %}</li>
    </ol>
{% endblock %}


{% block page-header %}
    {% trans 'Groups' %}
{% endblock %}


{% block main %}
    <div class="table-responsive">
        <table class="table table-striped table-bordered">
            <thead>
            <tr>
                <th width="50">#</th>
                <th width="50">{% trans 'TeCo' %}</th>
                <th>
                    <a href="{% url 'group_app:group_list' %}?{% url_order_by request order_by='title' %}">
                        {% trans 'Title' %}
                    </a>
                    {% if order_by == 'title' %}<span class="glyphicon glyphicon-filter"></span>{% endif %}
                </th>
                <th width="100">#</th>
            </tr>
            </thead>
            <tbody>
            {% for gr in groups %}
                <tr>
                    <td>{{ gr.pk }}</td>
                    <td>{{ gr.code }}</td>
                    <td>
                        <a href="{% url 'group_app:edit' gr.pk %}" class="btn-modal"{% if gr.code %} title="{{ gr.code }}" data-toggle="tooltip"{% endif %}>
                            {{ gr.title }}
                        </a>
                    </td>
                    <td class="btn-group btn-group-sm">
                        <a href="{% url 'group_app:edit' gr.pk %}" class="btn btn-default btn-modal">
                            <span class="glyphicon glyphicon-cog"></span>
                        </a>
                        <a href="{% url 'group_app:del' gr.pk %}" class="btn btn-danger btn-modal">
                            <span class="glyphicon glyphicon-remove"></span>
                        </a>
                    </td>
                </tr>
            {% empty %}
                <tr>
                    <td colspan="4"><a href="#">{% trans 'Groups was not found' %}</a></td>
                </tr>
            {% endfor %}
            </tbody>
            <tfoot>
            <tr>
                <td colspan="4" class="btn-group btn-group-sm">
                    <a href="{% url 'group_app:add' %}" class="btn btn-success btn-modal">
                        <span class="glyphicon glyphicon-plus"></span> <span class="hidden-xs">{% trans 'Add group' %}</span>
                    </a>
                </td>
            </tr>
            </tfoot>
        </table>
    </div>
{% endblock %}
