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

{% block title %}{% trans 'User groups' %}{% endblock %}

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

{% block page-header %}
    {% trans 'User groups' %}
{% endblock %}

{% block main %}
    <div class="table-responsive">
        <table class="table table-striped table-bordered">
            <thead>
            <tr>
                <th width="50">#</th>
                <th>
                    <a href="{% url 'abonapp:group_list' %}?{% url_order_by request order_by='title' %}">
                        {% trans 'Group title' %}
                    </a>
                    {% if order_by == 'title' %}<span class="glyphicon glyphicon-filter"></span>{% endif %}
                </th>
                <th width="100" class="hidden-xs">
                    {% trans 'Number of subscribers' %}
                </th>
                <th width="100">#</th>
            </tr>
            </thead>
            <tbody>
            {% for gr in groups %}
                <tr>
                    {% url 'abonapp:people_list' gr.pk as aburl %}
                    <td><a href="{{ aburl }}">{{ gr.pk }}</a></td>
                    <td><a href="{{ aburl }}">{{ gr.title }}</a></td>
                    <td class="hidden-xs">{{ gr.usercount }}</td>
                    <td class="btn-group btn-group-sm">
                        <a href="{% url 'abonapp:ch_group_tariff' gr.pk %}" class="btn btn-default" title="{% trans 'User groups' %}">
                            <span class="glyphicon glyphicon-cog"></span>
                        </a>
                        <a href="{% url 'abonapp:attach_nas' gr.pk %}" class="btn btn-default btn-modal" title="{% trans 'NAS' %}">
                            <span class="glyphicon glyphicon-globe"></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">
                    {% if perms.abonapp.view_abonlog %}
                        <a href="{% url 'abonapp:log' %}" class="btn btn-default">
                            <span class="glyphicon glyphicon-record"></span> <span class="hidden-xs">{% trans 'Subscribers actions' %}</span>
                        </a>
                    {% endif %}
                    {% if perms.abonapp.view_invoiceforpayment %}
                        <a href="{% url 'abonapp:debtors' %}" class="btn btn-default">
                            <span class="glyphicon glyphicon-exclamation-sign"></span> <span class="hidden-xs">{% trans 'List of debtors' %}</span>
                        </a>
                    {% endif %}
                    <a href="{% url 'abonapp:vcards' %}" class="btn btn-default">
                        <span class="glyphicon glyphicon-phone"></span>
                        <span class="hidden-xs">{% trans 'Export vCards' %}</span>
                    </a>
                </td>
            </tr>
            </tfoot>
        </table>
    </div>
{% endblock %}
