{{-- HEADER --}}
{{-- NOTE BOX --}}
{{-- FILTER --}}
{{-- FLASH --}}
@if (session('success'))
{{-- MOBILE CARD --}}
@forelse($categories as $category)
@php
$no = ($categories instanceof \Illuminate\Pagination\AbstractPaginator)
? $categories->firstItem() + $loop->index
: $loop->iteration;
$isTenant = str_contains(strtolower($category->name), 'tenant');
@endphp
@empty
@endforelse
{{-- PAGINATION --}}
@if($categories instanceof \Illuminate\Pagination\AbstractPaginator && request('per_page') !== 'all')
@php
$currentPage = $categories->currentPage();
$lastPage = $categories->lastPage();
$perPage = request('per_page', 5);
$search = request('search');
$from = $categories->firstItem() ?? 0;
$to = $categories->lastItem() ?? 0;
$total = $categories->total();
$window = 1;
$rangeStart = max(2, $currentPage - $window);
$rangeEnd = min($lastPage - 1, $currentPage + $window);
$pagesWithDots = [1];
if ($rangeStart > 2) $pagesWithDots[] = '...';
for ($i = $rangeStart; $i <= $rangeEnd; $i++) $pagesWithDots[] = $i;
if ($rangeEnd < $lastPage - 1) $pagesWithDots[] = '...';
if ($lastPage > 1) $pagesWithDots[] = $lastPage;
$buildUrl = function(int $page) use ($perPage, $search): string {
$params = ['page' => $page, 'per_page' => $perPage];
if ($search) $params['search'] = $search;
return url()->current() . '?' . http_build_query($params);
};
@endphp
@if($total > 0)
Kelola Kategori
Catatan: Jika ingin memasukkan kategori Tenant, maka dalam namanya harus ada kata "Tenant"
{{ session('success') }}
@endif
{{-- DESKTOP TABLE --}}
| # | Nama Kategori | Aksi | |
|---|---|---|---|
| {{ $no }} |
@if($isTenant)
Tenant
@else
Regular
@endif
{{ $category->name }}
|
||
|
Belum ada kategori.
|
|||
@if($isTenant)
@else
@endif
Menampilkan {{ $from }}โ{{ $to }}
dari {{ $total }} kategori
@if($lastPage > 1)
@endif
@endif
@endif