{# @var ea \EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext #}
{# @var paginator \EasyCorp\Bundle\EasyAdminBundle\Orm\EntityPaginator #}
{% trans_default_domain 'EasyAdminBundle' %}

<div class="col-sm-12 col-md-6">
    {# <div class="nb-results">
        {{ 'paginator.results'|trans({'%count%': paginator.numResults})|raw }}
    </div>  #}
    <div class="items-per-page btn-group">
        {% set itemsPerPage = [15,30,50,100,200] %}
        {% for itemPerPage in itemsPerPage %}
            {% set url = ea_url({listMaxResults: itemPerPage, page : "1"}) %}
            <a href="{{ url }}"
               class="btn btn-sm {{ paginator.pageSize == itemPerPage ? 'btn-secondary' : 'btn-default' }}">{{ itemPerPage }}</a>
        {% endfor %}
    </div>
</div>

<div class="col-sm-12 col-md-6">
    <div class="float-sm-right">
        <ul class="pagination pagination-sm">
            <li class="page-item {{ not paginator.hasPreviousPage ? 'disabled' }}">
                <a class="page-link" href="{{ not paginator.hasPreviousPage ? '#' : paginator.generateUrlForPage(paginator.previousPage) }}" {{ not paginator.hasPreviousPage ? 'aria-disabled="true"' }}>
                    <i class="ti ti-arrow-left"></i> <span class="btn-label">{{ 'paginator.previous'|trans }}</span>
                </a>
            </li>

            {% for page in paginator.pageRange %}
                {% if page != 0 %}
                    <li class="page-item {{ page == paginator.currentPage ? 'active' }} {{ page is null ? 'disabled' }}">
                        {% if page is null %}
                            <span class="page-link">&hellip;</span>
                        {% else %}
                            <a class="page-link" href="{{ paginator.generateUrlForPage(page) }}">{{ page }}</a>
                        {% endif %}
                    </li>
                {% endif %}
            {% endfor %}

            <li class="page-item {{ not paginator.hasNextPage ? 'disabled' }}">
                <a class="page-link" href="{{ not paginator.hasNextPage ? '#' : paginator.generateUrlForPage(paginator.nextPage) }}" {{ not paginator.hasNextPage ? 'aria-disabled="true"' }}>
                    <span class="btn-label">{{ 'paginator.next'|trans }}</span> <i class="ti ti-arrow-right"></i>
                </a>
            </li>
        </ul>
    </div>
</div>
