{{-- resources/views/public/athlete_detail_best.blade.php --}}

⏱️ Personal Best

All Time
@forelse($groupedHistories as $discName => $histories) @php $firstItem = $histories->first(); $isDistance = in_array($firstItem->discipline->result_type, ['distance', 'points']); if($isDistance) { $best = $histories->sortByDesc('result_mark')->first(); } else { $best = $histories->sortBy('result_mark')->first(); } // Variasi Warna Border Hover (Adaptif) $hoverColors = [ 'hover:border-blue-400 dark:hover:border-blue-500/30', 'hover:border-purple-400 dark:hover:border-purple-500/30', 'hover:border-emerald-400 dark:hover:border-emerald-500/30' ]; $hoverClass = $hoverColors[$loop->index % 3]; // Variasi Warna Teks (Gelap di Light Mode, Terang di Dark Mode) $textColors = [ 'text-blue-600 dark:text-blue-400', 'text-purple-600 dark:text-purple-400', 'text-emerald-600 dark:text-emerald-400' ]; $textClass = $textColors[$loop->index % 3]; @endphp

{{ $discName }}

{{ $best->competition_name }}

{{ $best->result_mark }}{{ $best->discipline->unit_symbol ?? '' }}

@php $hasRecord = $best->performanceRemarks->whereIn('code', ['NR', 'WR'])->first(); @endphp @if($hasRecord)

{{ $hasRecord->code == 'NR' ? '🇮🇩 NR' : '🌍 WR' }}

@else

{{ $best->date->format('Y') }}

@endif
@empty

Belum ada catatan Personal Best.

@endforelse

📊 Season Best {{ date('Y') }}

Active
@forelse($groupedHistories as $discName => $histories) @php $thisYearHistories = $histories->filter(function($h) { return $h->date->format('Y') == date('Y'); }); if ($thisYearHistories->isEmpty()) continue; $firstItem = $thisYearHistories->first(); $isDistance = in_array($firstItem->discipline->result_type, ['distance', 'points']); if($isDistance) { $sb = $thisYearHistories->sortByDesc('result_mark')->first(); $pb = $histories->sortByDesc('result_mark')->first(); } else { $sb = $thisYearHistories->sortBy('result_mark')->first(); $pb = $histories->sortBy('result_mark')->first(); } $diff = null; if(is_numeric($sb->result_mark) && is_numeric($pb->result_mark)) { $diff = abs($sb->result_mark - $pb->result_mark); $diff = round($diff, 2); } @endphp

{{ $discName }}

{{ $sb->competition_name }}

{{ $sb->result_mark }}{{ $sb->discipline->unit_symbol ?? '' }}

@if($diff !== null && $diff > 0)

{{ $isDistance ? '-' : '+' }}{{ $diff }} vs PB

@elseif($diff === 0.0)

Equals PB!

@else

SB

@endif
@empty

Belum ada data kompetisi di tahun {{ date('Y') }}.

@endforelse