@if ($paginator->hasPages())
<nav class="crm-pagination d-flex flex-wrap align-items-center justify-content-between gap-2 mt-3" aria-label="Pagination Navigation">
    <small class="text-muted">Showing {{ $paginator->firstItem() }}–{{ $paginator->lastItem() }} of {{ $paginator->total() }}</small>
    <ul class="pagination pagination-sm mb-0">
        <li class="page-item {{ $paginator->onFirstPage() ? 'disabled' : '' }}"><a class="page-link" href="{{ $paginator->url(1) }}" aria-label="First page">First</a></li>
        <li class="page-item {{ $paginator->onFirstPage() ? 'disabled' : '' }}"><a class="page-link px-3" href="{{ $paginator->previousPageUrl() ?: '#' }}" aria-label="Previous page">‹</a></li>
        @foreach ($elements as $element)
            @if (is_string($element))<li class="page-item disabled"><span class="page-link">{{ $element }}</span></li>@endif
            @if (is_array($element))
                @foreach ($element as $page => $url)
                    <li class="page-item {{ $page == $paginator->currentPage() ? 'active' : '' }}"><a class="page-link" href="{{ $url }}">{{ $page }}</a></li>
                @endforeach
            @endif
        @endforeach
        <li class="page-item {{ $paginator->hasMorePages() ? '' : 'disabled' }}"><a class="page-link px-3" href="{{ $paginator->nextPageUrl() ?: '#' }}" aria-label="Next page">›</a></li>
        <li class="page-item {{ $paginator->hasMorePages() ? '' : 'disabled' }}"><a class="page-link" href="{{ $paginator->url($paginator->lastPage()) }}" aria-label="Last page">Last</a></li>
    </ul>
    <form method="GET" action="{{ url()->current() }}" class="d-flex align-items-center gap-1">
        @foreach(request()->except($paginator->getPageName()) as $name => $value)
            @if(is_scalar($value))<input type="hidden" name="{{ $name }}" value="{{ $value }}">@endif
        @endforeach
        <label class="small text-muted text-nowrap" for="goto-{{ $paginator->getPageName() }}">Go to</label>
        <input id="goto-{{ $paginator->getPageName() }}" type="number" name="{{ $paginator->getPageName() }}" min="1" max="{{ $paginator->lastPage() }}" value="{{ $paginator->currentPage() }}" class="form-control form-control-sm" style="width:72px">
        <button class="btn btn-sm btn-outline-primary" type="submit">Go</button>
    </form>
</nav>
@endif
