{{ __('admin.statistics_title') }}

{{-- Filter --}}
@if (request()->hasAny(['team_id', 'from', 'to'])) {{ __('admin.filter_reset') }} @endif
@if ($games->isEmpty())
{{ __('admin.no_games_yet') }}
@else {{-- Statistik-Cards --}}
{{ $games->count() }}
{{ __('admin.total_games') }}
{{ $wins }}
{{ __('admin.wins') }}
{{ $losses }}
{{ __('admin.losses') }}
{{ $draws }}
{{ __('admin.draws') }}
{{ $winRate }}%
{{ __('admin.win_rate') }}
{{-- Charts --}} @if ($totalWithScore > 0)
{{-- Siege/Niederlagen Pie Chart --}}

{{ __('admin.chart_win_loss') }}

{{-- Spieler-Teilnahme Bar Chart (nur Staff) --}} @if (auth()->user()->isStaff())

{{ __('admin.chart_player_participation') }}

@endif {{-- Eltern-Engagement Bar Chart --}}

{{ __('admin.chart_parent_involvement') }}

@endif {{-- Spiel-Tabelle --}}
@if (auth()->user()->isStaff()) @endif @foreach ($games as $game) @if (auth()->user()->isStaff()) @endif @endforeach
{{ __('admin.date') }} {{ __('ui.team') }} {{ __('ui.type') }} {{ __('events.opponent') }} {{ __('events.score') }}{{ __('admin.nav_players') }}{{ __('events.catering_short') }} {{ __('events.timekeeper_short') }}
{{ $game->start_at->translatedFormat(__('ui.date_format_short')) }} {{ $game->team->name }} {{ $game->type === \App\Enums\EventType::HomeGame ? __('admin.home_short') : __('admin.away_short') }} {{ $game->opponent ?? '–' }} @if ($game->hasScore()) {{ $game->scoreDisplay() }} @else @endif {{ $game->players_yes_count }}{{ $game->type->hasCatering() ? $game->caterings_yes_count : '–' }} {{ $game->type->hasTimekeepers() ? $game->timekeepers_yes_count : '–' }}
{{-- Spieler-Rangliste (nur Staff) --}} @if (auth()->user()->isStaff() && $playerRanking->isNotEmpty())

{{ __('admin.player_ranking_title') }}

{{ __('admin.player_ranking_desc', ['count' => $totalGames]) }}

@php $separatorShown = false; @endphp @foreach ($playerRanking as $index => $entry) @if (!$separatorShown && !$entry->is_primary_gk) @php $separatorShown = true; @endphp @if ($index > 0) @endif @endif @endforeach
# {{ __('admin.nav_players') }} {{ __('admin.position') }} {{ __('admin.games_played') }} {{ __('admin.player_goals') }} {{ __('admin.participation_rate') }}

{{ $index + 1 }} @if ($entry->player->getAvatarUrl()) @else
{{ $entry->player->getInitials() }}
@endif {{ $entry->player->full_name }}
@if ($entry->primary_position) {{ $entry->primary_position->shortLabel() }} @else @endif {{ $entry->games_played }} @if ($entry->total_goals > 0) {{ $entry->total_goals }} @else 0 @endif {{ $entry->rate }}%
{{-- Spielfeld-Aufstellung --}} @if ($courtPlayers->isNotEmpty())

{{ __('admin.court_visualization') }}

@php // Positionskoordinaten auf dem Spielfeld (viewBox 0 0 400 320) $courtPositions = [ 'torwart' => ['x' => 200, 'y' => 280], 'links_aussen' => ['x' => 55, 'y' => 185], 'rechts_aussen' => ['x' => 345, 'y' => 185], 'rueckraum_links' => ['x' => 115, 'y' => 105], 'rueckraum_mitte' => ['x' => 200, 'y' => 75], 'rueckraum_rechts' => ['x' => 285, 'y' => 105], 'kreislaeufer' => ['x' => 200, 'y' => 180], ]; $colorMap = [ 'green' => ['fill' => '#22c55e', 'text' => '#fff'], 'yellow' => ['fill' => '#eab308', 'text' => '#fff'], 'red' => ['fill' => '#ef4444', 'text' => '#fff'], 'gray' => ['fill' => '#9ca3af', 'text' => '#fff'], ]; @endphp {{-- Spielfeld-Hintergrund --}} {{-- Mittellinie --}} {{-- Tor (unten) --}} {{-- 6m-Torraum (Halbkreis) --}} {{-- 9m-Freiwurflinie (gestrichelt) --}} {{-- 7m-Markierung --}} {{-- Spieler-Positionen --}} @foreach ($courtPositions as $posValue => $coords) @php $entry = $courtPlayers->get($posValue); $color = $entry ? $colorMap[$entry->performance_color] : $colorMap['gray']; $posEnum = \App\Enums\PlayerPosition::tryFrom($posValue); @endphp @if ($entry) {{ $entry->player->jersey_number ?? $entry->player->getInitials() }} {{ Str::limit($entry->player->first_name, 8, '') }} @else {{ $posEnum?->shortLabel() }} @endif {{-- Positions-Kürzel unter dem Kreis --}} {{ $posEnum?->shortLabel() }} @endforeach
{{-- Legende --}}
{{ __('admin.performance_good') }}
{{ __('admin.performance_average') }}
{{ __('admin.performance_below') }}
{{ __('admin.court_no_data') }}
@endif {{-- Spieler-Detail-Modal --}}
{{-- Header --}}

{{ __('admin.stats_player_detail') }}

{{-- Zusammenfassung --}} {{-- Spiel-Liste --}}
{{-- Footer --}}
{{-- /x-data playerDetailModal --}} @endif {{-- Eltern-Engagement-Rangliste --}} @if ($parentRanking->isNotEmpty())

{{ __('admin.parent_ranking_title') }}

{{ __('admin.parent_ranking_desc', ['catering' => $totalCateringEvents, 'timekeeper' => $totalTimekeeperEvents]) }}

@foreach ($parentRanking as $index => $entry) @php $maxTotal = $parentRanking->first()->total; $barWidth = $maxTotal > 0 ? round(($entry->total / $maxTotal) * 100) : 0; @endphp @endforeach
# {{ __('admin.nav_users') }} {{ __('events.catering_short') }} {{ __('events.timekeeper_short') }} {{ __('admin.total_contributions') }}
{{ $index + 1 }} @if ($entry->user->getAvatarUrl()) @else
{{ $entry->user->getInitials() }}
@endif {{ $entry->user->name }}
@if ($entry->catering_count > 0) {{ $entry->catering_count }} @else 0 @endif @if ($entry->timekeeper_count > 0) {{ $entry->timekeeper_count }} @else 0 @endif {{ $entry->total }}
@endif @endif @push('scripts') @endpush @if ($totalWithScore > 0) @push('scripts') @endpush @endif