65 lines
2.9 KiB
PHP
65 lines
2.9 KiB
PHP
@if ($paginator->hasPages())
|
||
@php
|
||
$current = $paginator->currentPage();
|
||
$last = $paginator->lastPage();
|
||
$window = 2; // Seiten links/rechts von aktueller
|
||
$start = max(1, $current - $window);
|
||
$end = min($last, $current + $window);
|
||
@endphp
|
||
<div class="mq-pagination">
|
||
<span class="mq-pag-info">
|
||
{{ $paginator->firstItem() }}–{{ $paginator->lastItem() }} von {{ $paginator->total() }}
|
||
</span>
|
||
<div class="mq-pag-btns">
|
||
|
||
{{-- Zurück --}}
|
||
@if ($paginator->onFirstPage())
|
||
<button class="mq-pag-btn" disabled>
|
||
<svg width="12" height="12" viewBox="0 0 12 12" fill="none"><path d="M7.5 2L3.5 6l4 4" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"/></svg>
|
||
</button>
|
||
@else
|
||
<button type="button" wire:click="previousPage('{{ $paginator->getPageName() }}')" wire:loading.attr="disabled" class="mq-pag-btn">
|
||
<svg width="12" height="12" viewBox="0 0 12 12" fill="none"><path d="M7.5 2L3.5 6l4 4" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"/></svg>
|
||
</button>
|
||
@endif
|
||
|
||
{{-- Erste Seite + … --}}
|
||
@if ($start > 1)
|
||
<button type="button" wire:click="gotoPage(1, '{{ $paginator->getPageName() }}')" class="mq-pag-btn">1</button>
|
||
@if ($start > 2)
|
||
<button class="mq-pag-btn" disabled>…</button>
|
||
@endif
|
||
@endif
|
||
|
||
{{-- Seitenfenster --}}
|
||
@for ($p = $start; $p <= $end; $p++)
|
||
@if ($p == $current)
|
||
<button class="mq-pag-btn active">{{ $p }}</button>
|
||
@else
|
||
<button type="button" wire:click="gotoPage({{ $p }}, '{{ $paginator->getPageName() }}')" class="mq-pag-btn">{{ $p }}</button>
|
||
@endif
|
||
@endfor
|
||
|
||
{{-- … + Letzte Seite --}}
|
||
@if ($end < $last)
|
||
@if ($end < $last - 1)
|
||
<button class="mq-pag-btn" disabled>…</button>
|
||
@endif
|
||
<button type="button" wire:click="gotoPage({{ $last }}, '{{ $paginator->getPageName() }}')" class="mq-pag-btn">{{ $last }}</button>
|
||
@endif
|
||
|
||
{{-- Vor --}}
|
||
@if ($paginator->hasMorePages())
|
||
<button type="button" wire:click="nextPage('{{ $paginator->getPageName() }}')" wire:loading.attr="disabled" class="mq-pag-btn">
|
||
<svg width="12" height="12" viewBox="0 0 12 12" fill="none"><path d="M4.5 2L8.5 6l-4 4" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"/></svg>
|
||
</button>
|
||
@else
|
||
<button class="mq-pag-btn" disabled>
|
||
<svg width="12" height="12" viewBox="0 0 12 12" fill="none"><path d="M4.5 2L8.5 6l-4 4" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"/></svg>
|
||
</button>
|
||
@endif
|
||
|
||
</div>
|
||
</div>
|
||
@endif
|