{% macro renderPager(pager, search) %}
    {% if search == '' %}
    {{
        pagerfanta(
            pager,
            'twitter_bootstrap_translated',
            {
                'proximity' : 1,
                'routeName': 'claro_groups_list_registration_pager'
            }
        )
    }}
    {% else %}
        {{
            pagerfanta(
                pager,
                'twitter_bootstrap_translated',
                {
                    'proximity' : 1,
                    'routeName': 'claro_groups_list_registration_pager_search',
                    'routeParams': {'search': search}
                }
            )
        }}
    {% endif %}
{% endmacro %}

{% from _self import renderPager %}

<div id="group-list-pager-block">

    {{ renderPager(groups, search) }}

    <div class="table-responsive">
        <table id="group-table" class="table table-striped table-bordered table-condensed">
            <thead>
                <tr>
                    <th>{{ 'name'|trans({}, 'platform') }}</th>
                    <th>{{ 'users'|trans({}, 'platform') }}</th>
                    <th></th>
                </tr>
            </thead>
            <tbody id="group-table-body">
                {% for group in groups.currentPageResults() %}
                    <tr id="{{ group.getId() }}" class="row-user">
                        <td>{{ group.getName() }}</td>
                        <td>
                            <a
                                href="{{ path('claro_admin_user_of_group_list', {'groupId': group.getId()}) }}"
                                id="link-show-{{ group.getId() }}"
                            >
                                {{ 'show'|trans({}, 'platform') }}
                            </a>
                        </td>
                        <td>
                            <input type="checkbox" value="{{ group.getId() }}" class="chk-subject" align="center">
                        </td>
                    </tr>
                {% endfor %}
            </tbody>
        </table>
    </div>

    {% if search != '' %}
        <p>
            <small>
                * {{ 'results_for_search_on'|trans({}, 'platform') }} "{{ search }}"
            </small>
        </p>
    {% endif %}

    {{ renderPager(groups, search) }}
</div>
