@forelse($groupsWithStandings as $group)
Klasemen {{ $group->group_name }}
| # |
Tim |
P |
W |
D |
L |
YC |
RC |
FOUL |
GF |
GA |
Pts |
@php
$allTeamsInGroup = $group->teams;
$standingsMap = $group->standings->keyBy('team_id');
$fullStandings = $allTeamsInGroup->map(function($team) use ($standingsMap) {
$s = $standingsMap->get($team->id);
return (object)[
'team' => $team,
'played' => $s->played ?? 0,
'won' => $s->won ?? 0,
'drawn' => $s->drawn ?? 0,
'lost' => $s->lost ?? 0,
'goals_for' => $s->goals_for ?? 0,
'goals_against' => $s->goals_against ?? 0,
'points' => $s->points ?? 0,
'yellow_card' => $s->yellow_card ?? 0,
'red_card' => $s->red_card ?? 0,
'foul' => $s->foul ?? 0,
'gd' => ($s->goals_for ?? 0) - ($s->goals_against ?? 0)
];
})->sort(function($a, $b) {
if ($a->points != $b->points) return $b->points <=> $a->points;
if ($a->gd != $b->gd) return $b->gd <=> $a->gd;
if ($a->goals_for != $b->goals_for) return $b->goals_for <=> $a->goals_for;
if ($a->red_card != $b->red_card) return $a->red_card <=> $b->red_card;
if ($a->yellow_card != $b->yellow_card) return $a->yellow_card <=> $b->yellow_card;
return $a->foul <=> $b->foul;
})->values();
@endphp
@foreach ($fullStandings as $index => $standing)
@php $isQualified = ($index + 1) <= 4; @endphp
| {{ $index + 1 }} |
@if($standing->team->logo_url)
 }})
@else
{{ getAbbreviation($standing->team->team_name) }}
@endif
{{ $standing->team->team_name }}
|
{{ $standing->played }} |
{{ $standing->won }} |
{{ $standing->drawn }} |
{{ $standing->lost }} |
{{ $standing->yellow_card }} |
{{ $standing->red_card }} |
{{ $standing->foul }} |
{{ $standing->goals_for }} |
{{ $standing->goals_against }} |
{{ $standing->points }}
|
@endforeach
@empty
Belum ada data grup.
@endforelse
@php
$matches = $matches ?? collect();
$qf = $matches->where('match_stage', 'quarter_final')->sortBy('match_date')->values();
$sf = $matches->where('match_stage', 'semi_final')->sortBy('match_date')->values();
$final = $matches->where('match_stage', 'final')->first();
$bronze = $matches->where('match_stage', 'third_place')->first();
@endphp
{{-- Quarter Finals --}}
Quarter Finals
@for ($i = 0; $i < 4; $i++)
@php $m = $qf->get($i); @endphp
{{-- Home Team --}}
@if($m && $m->homeTeam && $m->homeTeam->logo_url)
 }})
@else
{{ getAbbreviation($m->homeTeam->team_name ?? 'TBD') }}
@endif
{{ $m->homeTeam->team_name ?? 'TBD' }}
{{ $m->home_score ?? '-' }}
{{-- Away Team --}}
@if($m && $m->awayTeam && $m->awayTeam->logo_url)
 }})
@else
{{ getAbbreviation($m->awayTeam->team_name ?? 'TBD') }}
@endif
{{ $m->awayTeam->team_name ?? 'TBD' }}
{{ $m->away_score ?? '-' }}
@endfor
@for ($i = 0; $i < 2; $i++)
@endfor
{{-- Semi Finals --}}
Semi Finals
@for ($i = 0; $i < 2; $i++)
@php $m = $sf->get($i); @endphp
Semi Final {{ $i + 1 }}
{{-- Home --}}
@if($m && $m->homeTeam && $m->homeTeam->logo_url)
 }})
@else
{{ getAbbreviation($m->homeTeam->team_name ?? 'TBD') }}
@endif
{{ $m->homeTeam->team_name ?? 'TBD' }}
{{ $m->home_score ?? '-' }}
{{-- Away --}}
@if($m && $m->awayTeam && $m->awayTeam->logo_url)
 }})
@else
{{ getAbbreviation($m->awayTeam->team_name ?? 'TBD') }}
@endif
{{ $m->awayTeam->team_name ?? 'TBD' }}
{{ $m->away_score ?? '-' }}
@endfor
{{-- Final & Third Place --}}
{{-- Grand Final --}}
Grand Final
{{-- Home --}}
@if($final && $final->homeTeam && $final->homeTeam->logo_url)
 }})
@else
{{ getAbbreviation($final->homeTeam->team_name ?? 'TBD') }}
@endif
{{ $final->homeTeam->team_name ?? 'TBD' }}
{{ $final->home_score ?? '-' }}
{{-- Away --}}
@if($final && $final->awayTeam && $final->awayTeam->logo_url)
 }})
@else
{{ getAbbreviation($final->awayTeam->team_name ?? 'TBD') }}
@endif
{{ $final->awayTeam->team_name ?? 'TBD' }}
{{ $final->away_score ?? '-' }}