{{-- resources/views/admin/athletes/_table.blade.php --}}
@forelse($athleteCollection as $index => $athlete) @empty @endforelse
No Foto Identitas Personal Gender Kategori & Spesialisasi Lomba Aksi
{{ $loop->iteration }}
Foto
{{ $athlete->name }} [{{ $athlete->status == 'active' ? 'Aktif' : 'Nonaktif' }}]
{{ $athlete->date_of_birth ? $athlete->date_of_birth->format('d M Y') : '-' }} @if($athlete->date_of_birth) ({{ $athlete->date_of_birth->age }} Thn) @endif
{{ $athlete->province_name ?? '-' }} | {{ $athlete->training_origin ?? 'Non Pelatnas' }}
@php $cats = is_string($athlete->age_category) ? json_decode($athlete->age_category, true) : $athlete->age_category; @endphp @if(is_array($cats)) Kategori Usia: {{ implode(', ', $cats) }} @endif
@if($athlete->gender == 'male') Putra @elseif($athlete->gender == 'female') Putri @else Campuran @endif @php $requestedCategory = request('specialty_category'); $performancesToDisplay = $athlete->performances; if ($requestedCategory) { $performancesToDisplay = $performancesToDisplay->filter(function($perf) use ($requestedCategory) { return ($perf->discipline->competition_category_id ?? null) == $requestedCategory; }); } @endphp @if($performancesToDisplay->isEmpty()) Belum ada spesialisasi. @else
    @foreach($performancesToDisplay->groupBy(fn($i) => $i->discipline->category->name ?? 'Lainnya') as $categoryName => $performances)
  • {{ $categoryName }}:
    {{ $performances->map(function($p) { return $p->discipline->name; })->implode(', ') }}
  • @endforeach
@endif
@csrf @method('DELETE')
@if(request('search') || request('specialty_category')) Pencarian tidak ditemukan @else {{ $emptyMessage ?? 'Belum ada data' }} @endif