@if(!empty($groupData['standings']))
@foreach($groupData['standings'] as $groupName => $rows)
| # |
Pemain |
M |
W |
D |
L |
GF |
GA |
Pts |
@foreach($rows as $uid => $stat)
@php
$adv = $loop->index < ($tournament->groups_per_advance ?? 2);
$player = $groupData['players'][$uid] ?? null;
@endphp
| {{ $loop->iteration }} |
{{ $player?->username ?? '?' }}
@if($adv)
↑ LOLOS
@endif
|
{{ $stat['played'] }} |
{{ $stat['w'] }} |
{{ $stat['d'] ?? 0 }} |
{{ $stat['l'] }} |
{{ $stat['gf'] }} |
{{ $stat['ga'] }} |
{{ $stat['pts'] }} |
@endforeach
@php $gMatches = $groupData['matches']->where('group_name', $groupName); @endphp
@if($gMatches->count())
Pertandingan
@foreach($gMatches as $gm)
@php
$pubGmLegs = $gm->relationLoaded('seriesLegs') ? $gm->seriesLegs : collect([$gm]);
$pubGmDone = $pubGmLegs->where('status','completed');
$pubBo = isset($tournament) ? $tournament->getBoForPhase('group') : 1;
$pubBan = isset($tournament) ? $tournament->getBanCountForPhase('group') : 0;
$gmDone = $gm->status === 'completed' || ($gm->winner_id !== null);
// Build modal data for completed matches
$gmBanRec = $gm->relationLoaded('seriesBanRecords') ? $gm->seriesBanRecords : collect();
$gmLwb = $pubGmLegs->map(fn($l) => [
'leg' => $l->leg_number,
'score1' => $l->score1 ?? 0,
'score2' => $l->score2 ?? 0,
'winner_id'=> $l->winner_id,
'is_draw' => $l->is_draw,
'is_gg' => $l->is_golden_goal,
'club1' => $l->club1 ? ['name'=>$l->club1->name,'logo'=>$l->club1->logo_url,'overall'=>$l->club1->overall] : null,
'club2' => $l->club2 ? ['name'=>$l->club2->name,'logo'=>$l->club2->logo_url,'overall'=>$l->club2->overall] : null,
'bans_p1' => $gmBanRec->where('player_id',$gm->player1_id)
->filter(fn($b)=> $b->leg_number===$l->leg_number || $b->leg_number===null)
->map(fn($b)=>['name'=>$b->club?->name??'?','logo'=>$b->club?->logo_url??''])->values()->toArray(),
'bans_p2' => $gmBanRec->where('player_id',$gm->player2_id)
->filter(fn($b)=> $b->leg_number===$l->leg_number || $b->leg_number===null)
->map(fn($b)=>['name'=>$b->club?->name??'?','logo'=>$b->club?->logo_url??''])->values()->toArray(),
])->values()->toArray();
$gmBp1 = $gmBanRec->where('player_id',$gm->player1_id)->map(fn($b)=>['name'=>$b->club?->name??'?','logo'=>$b->club?->logo_url??'','leg'=>$b->leg_number])->values()->toArray();
$gmBp2 = $gmBanRec->where('player_id',$gm->player2_id)->map(fn($b)=>['name'=>$b->club?->name??'?','logo'=>$b->club?->logo_url??'','leg'=>$b->leg_number])->values()->toArray();
$pgAgg1 = $pubGmDone->sum('score1');
$pgAgg2 = $pubGmDone->sum('score2');
$pgW1 = $pubGmDone->filter(fn($l)=>$l->winner_id===$gm->player1_id)->count();
$pgW2 = $pubGmDone->filter(fn($l)=>$l->winner_id===$gm->player2_id)->count();
@endphp
@if($gmDone)
@php
$gmModalData = json_encode([
'id' => $gm->id,
'round' => 'Grup '.$groupName,
'p1' => $gm->player1?->username ?? 'TBD',
'p2' => $gm->player2?->username ?? 'TBD',
'p1avatar' => $gm->player1?->avatar ?? '',
'p2avatar' => $gm->player2?->avatar ?? '',
'winner' => $gm->winner?->username ?? ($gm->is_draw ? 'Seri' : ''),
'winner_id'=> $gm->winner_id,
'p1_id' => $gm->player1_id,
'p2_id' => $gm->player2_id,
'bans_p1' => $gmBp1,
'bans_p2' => $gmBp2,
'legs' => $gmLwb,
]);
@endphp
@endif
{{ $gm->player1?->username ?? 'TBD' }}
@if($gm->status === 'completed')
{{-- Badge BO / Ban — selalu tampil sesuai aturan tournament --}}
@if($pubBo > 1)
BO{{ $pubBo }}
@endif
@if($pubBan > 0)
Ban {{ $pubBan }}
@endif
{{-- Score / Aggregate --}}
@if($pubGmLegs->count() > 1)
@php $doneLegs = $pubGmLegs->where('status','completed'); @endphp
{{ $pgW1 }} – {{ $pgW2 }}
Leg Wins · Agg: {{ $pgAgg1 }}–{{ $pgAgg2 }}
@else
{{ $gm->score1 }} – {{ $gm->score2 }}
@if($gm->is_draw)
Seri
@else
✓
@endif
@endif
@else
{{-- Match belum selesai --}}
@if($pubBo > 1)
BO{{ $pubBo }}
@endif
@if($pubBan > 0)
Ban {{ $pubBan }}
@endif
@if($pubBo > 1 && $pubGmDone->count() > 0)
Leg {{ $pubGmDone->count()+1 }}/{{ $pubBo }}
@else
vs
@endif
@endif
{{ $gm->player2?->username ?? 'TBD' }}
@if($gmDone)
↗ detail
@endif
@endforeach
@endif
@php
$tbMatches = isset($groupData['tiebreakers'])
? $groupData['tiebreakers']->where('group_name', $groupName)
: collect();
@endphp
@if($tbMatches->count())
GOLDEN GOAL — Tiebreaker Grup {{ $groupName }}
· Seri tidak diizinkan
@foreach($tbMatches as $tb)
@php
$tbBanRec = $tb->relationLoaded('seriesBanRecords') ? $tb->seriesBanRecords : collect();
$tbDone = $tb->status === 'completed';
$tbLwb = collect([$tb])->map(fn($l) => [
'leg'=>$l->leg_number,'score1'=>$l->score1??0,'score2'=>$l->score2??0,
'winner_id'=>$l->winner_id,'is_draw'=>$l->is_draw,'is_gg'=>$l->is_golden_goal,
'club1'=>null,'club2'=>null,'bans_p1'=>[],'bans_p2'=>[],
])->values()->toArray();
@endphp
@php
$tbModalData = json_encode([
'id' => $tb->id,
'round' => 'GG Tiebreaker Grup '.$groupName,
'p1' => $tb->player1?->username ?? 'TBD',
'p2' => $tb->player2?->username ?? 'TBD',
'p1avatar' => $tb->player1?->avatar ?? '',
'p2avatar' => $tb->player2?->avatar ?? '',
'winner' => $tb->winner?->username ?? '',
'winner_id'=> $tb->winner_id,
'p1_id' => $tb->player1_id,
'p2_id' => $tb->player2_id,
'bans_p1' => [],
'bans_p2' => [],
'legs' => $tbLwb,
]);
@endphp
@if($tbDone)@endif
{{ $tb->player1?->username ?? 'TBD' }}
@if($tb->status === 'completed')
{{ $tb->score1 }} – {{ $tb->score2 }}
🏆 {{ $tb->winner?->username ?? '?' }}
@else
⚡ GG
@endif
{{ $tb->player2?->username ?? 'TBD' }}
@endforeach
@endif
{{-- end .pes-card --}}
@endforeach
@else
⏳
Fase grup belum dimulai
Tunggu admin untuk memulai turnamen.
@endif
{{-- ── Match Detail Modal (rendered for group stage, deduped with knockout) ── --}}
{{-- ── Group Stage Match Detail Modal & JS ── --}}
@push('scripts')
@endpush