{{-- resources/views/wiki/partials/filter_list.blade.php --}} @php $filters = $filters ?? [ 'q' => request('q', ''), 'rarity' => request('rarity', ''), 'faction' => request('faction', ''), 'min_level' => request('min_level', ''), 'max_level' => request('max_level', ''), 'item_type' => request('item_type', ''), 'sort' => request('sort', 'id_asc'), ]; $items = $items ?? []; $isPaginator = $items instanceof \Illuminate\Pagination\LengthAwarePaginator || $items instanceof \Illuminate\Contracts\Pagination\Paginator || $items instanceof \Illuminate\Contracts\Pagination\LengthAwarePaginator; $itemCount = is_array($items) ? count($items) : (is_object($items) && method_exists($items, 'count') ? $items->count() : 0); $rarities = $rarities ?? []; $itemTypes = $itemTypes ?? []; $factions = $factions ?? []; // Support enums or plain strings $val = fn($x) => is_object($x) && isset($x->value) ? (string) $x->value : (string) $x; $label = function ($x) { if (is_object($x)) { if (method_exists($x, 'label')) return (string) $x->label(); if (isset($x->value)) return ucfirst((string) $x->value); } $s = (string) $x; return $s === '' ? '' : ucfirst($s); }; // Build option maps value => label for custom dropdowns $rarOpts = []; foreach ($rarities as $r) { $v = $val($r); if ($v === '') continue; $rarOpts[$v] = $label($r); } $facOpts = []; foreach ($factions as $f) { $v = $val($f); if ($v === '') continue; // faction labels are already Title Case typically $facOpts[$v] = is_object($f) && method_exists($f, 'label') ? (string) $f->label() : (string) $v; } $sortOpts = [ 'id_asc' => 'ID (low→high)', 'id_desc' => 'ID (high→low)', 'name_asc' => 'Name (A→Z)', 'name_desc' => 'Name (Z→A)', 'level_asc' => 'Level (low→high)', 'level_desc' => 'Level (high→low)', 'rarity_asc' => 'Rarity (low→high)', 'rarity_desc' => 'Rarity (high→low)', ]; $rarSelected = (string) ($filters['rarity'] ?? ''); $facSelected = (string) ($filters['faction'] ?? ''); $typeSelected = (string) ($filters['item_type'] ?? ''); $sortSelected = (string) ($filters['sort'] ?? 'id_asc'); @endphp
No items found.
@else