{{-- resources/views/admin/analysis/_hth_result.blade.php --}} @php $stat = $comparison['stats']; $disc = $comparison['discipline']; $isTime = in_array($disc->result_type, ['time']); $unit = $disc->unit_symbol ?? ''; $hasPasiRival = $comparison['pasiRival'] !== null; $hasCompetitor = $comparison['competitor'] !== null; $calcGap = function($ath, $rival) use ($isTime, $unit) { if ($ath == 0 || $rival == 0) { return ['status' => 'Data Kosong', 'diff' => '-', 'color' => 'text-muted', 'icon' => 'fa-minus']; } $diff = abs($ath - $rival); $fmtDiff = number_format($diff, 2) . ' ' . $unit; if ($ath == $rival) { return ['status' => 'SEIMBANG', 'diff' => '0 ' . $unit, 'color' => 'text-secondary', 'icon' => 'fa-equals']; } $athWins = $isTime ? ($ath < $rival) : ($ath > $rival); if ($athWins) { return ['status' => 'UNGGUL', 'diff' => '+' . $fmtDiff, 'color' => 'text-success', 'icon' => 'fa-arrow-up']; } else { return ['status' => 'TERTINGGAL', 'diff' => '-' . $fmtDiff, 'color' => 'text-danger', 'icon' => 'fa-arrow-down']; } }; $gapPasiPB = $hasPasiRival ? $calcGap($stat['pb']['ath'], $stat['pb']['pasi']) : null; $gapPasiSB = $hasPasiRival ? $calcGap($stat['sb']['ath'], $stat['sb']['pasi']) : null; $gapCompPB = $hasCompetitor ? $calcGap($stat['pb']['ath'], $stat['pb']['comp']) : null; $gapCompSB = $hasCompetitor ? $calcGap($stat['sb']['ath'], $stat['sb']['comp']) : null; @endphp
| Indikator Performa | {{ $comparison['athlete']->name }} (Utama) | @if($hasPasiRival){{ $comparison['pasiRival']->name }} (Internal) | @endif @if($hasCompetitor){{ $comparison['competitor']->name }} (Intl) | @endif
|---|---|---|---|
| Personal Best (PB) | {{ $stat['pb']['ath'] > 0 ? $stat['pb']['ath'] : '-' }} |
@if($hasPasiRival)
{{ $stat['pb']['pasi'] > 0 ? $stat['pb']['pasi'] : '-' }} |
@endif
@if($hasCompetitor)
{{ $stat['pb']['comp'] > 0 ? $stat['pb']['comp'] : '-' }} |
@endif
| Season Best (SB) | {{ $stat['sb']['ath'] > 0 ? $stat['sb']['ath'] : '-' }} |
@if($hasPasiRival)
{{ $stat['sb']['pasi'] > 0 ? $stat['sb']['pasi'] : '-' }} |
@endif
@if($hasCompetitor)
{{ $stat['sb']['comp'] > 0 ? $stat['sb']['comp'] : '-' }} |
@endif