112 lines
4.5 KiB
PHP
112 lines
4.5 KiB
PHP
@if ($paginator->hasPages() || $paginator->total() > \Domain\Enums\Pagination\ItemsPerPaginationEnum::twelve->value)
|
|
<nav class="d-flex flex-column flex-sm-row justify-content-between align-items-center gap-2"
|
|
aria-label="{{ __('pagination.paginate_list') }}">
|
|
{{-- SELECT ITEMS PER PAGE --}}
|
|
<div class="d-flex align-items-center align-self-sm-end align-self-center gap-1">
|
|
<span class="small text-muted" id="pagination-per-page-label">{{ __('pagination.paginate_list') }}</span>
|
|
<div class="dropup-center">
|
|
<button class="btn btn-sm btn-primary dropdown-toggle" data-bs-toggle="dropdown" type="button" aria-expanded="false"
|
|
aria-labelledby="pagination-per-page-label">
|
|
{{ $paginator->perPage() }}
|
|
</button>
|
|
<ul class="dropdown-menu dropdown-menu-limit">
|
|
@foreach (\Domain\Enums\Pagination\ItemsPerPaginationEnum::cases() as $itemsPerPaginationEnum)
|
|
<li>
|
|
<a class="dropdown-item user-select-none @if ($paginator->perPage() === $itemsPerPaginationEnum->value) active @endif text-center"
|
|
href="{{ request()->fullUrlWithQuery(['page' => 1, 'pagination' => $itemsPerPaginationEnum->value]) }}">
|
|
{{ $itemsPerPaginationEnum->value }}
|
|
</a>
|
|
</li>
|
|
@endforeach
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
|
|
{{-- Mobile: Previous / Next only --}}
|
|
<div class="d-flex justify-content-center flex-fill d-sm-none">
|
|
<ul class="pagination mb-0">
|
|
@if ($paginator->onFirstPage())
|
|
<li class="page-item disabled">
|
|
<span class="page-link">@lang('pagination.previous')</span>
|
|
</li>
|
|
@else
|
|
<li class="page-item">
|
|
<a class="page-link" href="{{ $paginator->previousPageUrl() }}" rel="prev">@lang('pagination.previous')</a>
|
|
</li>
|
|
@endif
|
|
|
|
@if ($paginator->hasMorePages())
|
|
<li class="page-item">
|
|
<a class="page-link" href="{{ $paginator->nextPageUrl() }}" rel="next">@lang('pagination.next')</a>
|
|
</li>
|
|
@else
|
|
<li class="page-item disabled">
|
|
<span class="page-link">@lang('pagination.next')</span>
|
|
</li>
|
|
@endif
|
|
</ul>
|
|
</div>
|
|
|
|
{{-- Desktop: Full pagination --}}
|
|
<div class="d-none d-sm-flex flex-column align-items-center">
|
|
<p class="small text-muted mb-1">
|
|
{!! __('Showing') !!}
|
|
<span class="fw-semibold">{{ $paginator->firstItem() }}</span>
|
|
{!! __('to') !!}
|
|
<span class="fw-semibold">{{ $paginator->lastItem() }}</span>
|
|
{!! __('of') !!}
|
|
<span class="fw-semibold">{{ $paginator->total() }}</span>
|
|
{!! __('results') !!}
|
|
</p>
|
|
|
|
@if ($paginator->hasPages())
|
|
<ul class="pagination mb-0">
|
|
@if ($paginator->onFirstPage())
|
|
<li class="page-item disabled" aria-label="@lang('pagination.previous')">
|
|
<span class="page-link" aria-hidden="true">‹</span>
|
|
</li>
|
|
@else
|
|
<li class="page-item">
|
|
<a class="page-link" href="{{ $paginator->previousPageUrl() }}" aria-label="@lang('pagination.previous')" rel="prev">‹</a>
|
|
</li>
|
|
@endif
|
|
|
|
@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)
|
|
@if ($page == $paginator->currentPage())
|
|
<li class="page-item active" aria-current="page"><span class="page-link">{{ $page }}</span></li>
|
|
@else
|
|
<li class="page-item"><a class="page-link" href="{{ $url }}">{{ $page }}</a></li>
|
|
@endif
|
|
@endforeach
|
|
@endif
|
|
@endforeach
|
|
|
|
@if ($paginator->hasMorePages())
|
|
<li class="page-item">
|
|
<a class="page-link" href="{{ $paginator->nextPageUrl() }}" aria-label="@lang('pagination.next')" rel="next">›</a>
|
|
</li>
|
|
@else
|
|
<li class="page-item disabled" aria-label="@lang('pagination.next')">
|
|
<span class="page-link" aria-hidden="true">›</span>
|
|
</li>
|
|
@endif
|
|
</ul>
|
|
@endif
|
|
</div>
|
|
</nav>
|
|
|
|
@push('styles')
|
|
<style nonce="{{ Vite::cspNonce() }}">
|
|
.dropdown-menu-limit {
|
|
max-height: 13rem;
|
|
overflow-y: auto;
|
|
}
|
|
</style>
|
|
@endpush
|
|
@endif
|