{{-- Cancelled Banner --}} @if ($event->status === \App\Enums\EventStatus::Cancelled)
{{ __('events.cancelled_banner') }}
@endif @if ($event->status === \App\Enums\EventStatus::Draft)
{{ __('events.draft_banner') }}
@endif {{-- Header --}}
{{ $event->team->name }}

{{ $event->title }}

@if ($event->type->isGameType() && $event->opponent)

{{ __('events.vs') }} {{ $event->opponent }} @if ($event->hasScore()) {{ $event->scoreDisplay() }} @endif

@endif
@if (auth()->user()->canAccessAdminPanel()) {{ __('ui.edit') }} @endif
{{ $event->start_at->translatedFormat(__('ui.date_format_long')) }} {{ __('ui.clock') }} @if ($event->end_at) – {{ $event->end_at->format('H:i') }} {{ __('ui.clock') }} @endif
@if ($event->location_name || $event->address_text)
@if ($event->location_name) {{ $event->location_name }}
@endif @if ($event->address_text) {{ $event->address_text }} @endif
@endif
{{-- Navigation Button --}} @if ($event->hasCoordinates()) @endif
{{-- Karte --}} @if ($event->hasCoordinates())
@endif {{-- Beschreibung --}} @if ($event->description_html)

{{ __('events.description') }}

{!! app(\App\Services\HtmlSanitizerService::class)->sanitize($event->description_html) !!}
@endif {{-- Dateien --}} @if ($event->files->isNotEmpty())

{{ __('events.files') }}

@foreach ($event->files->sortBy('category.name') as $file)
@if ($file->isImage()) @elseif ($file->isPdf())
PDF
@else
@endif

{{ $file->original_name }}

{{ $file->category->name }} {{ $file->humanSize() }}
@endforeach
@endif {{-- Teilnehmer --}}

{{ __('events.participants') }}

@php $yesCount = $event->participants->where('status', \App\Enums\ParticipantStatus::Yes)->count(); $noCount = $event->participants->where('status', \App\Enums\ParticipantStatus::No)->count(); $openCount = $event->participants->where('status', \App\Enums\ParticipantStatus::Unknown)->count(); @endphp
{{ $yesCount }} {{ __('events.confirmations') }} {{ $noCount }} {{ __('events.rejections') }} {{ $openCount }} {{ __('events.open_responses') }}
@if ($event->type === \App\Enums\EventType::Meeting) {{-- Besprechung: User-basierte Teilnehmer --}} @foreach ($event->participants->sortBy(fn($p) => $p->user->name ?? '') as $participant)
{{ $participant->user->name ?? '–' }}
@if (!auth()->user()->isDsgvoRestricted()) @if ($participant->user_id === auth()->id() || auth()->user()->canAccessAdminPanel()) @if ($event->status !== \App\Enums\EventStatus::Cancelled)
@csrf
@endif @endif @endif
@endforeach @else {{-- Reguläre Events: Spieler-basierte Teilnehmer --}} @foreach ($event->participants->sortBy('player.last_name') as $participant)
{{ $participant->player->full_name }}
@if (!auth()->user()->isDsgvoRestricted()) @if ($userChildIds->contains($participant->player_id) || auth()->user()->canAccessAdminPanel()) @if ($event->status !== \App\Enums\EventStatus::Cancelled)
@csrf
@endif @endif @endif
@endforeach @endif
{{-- Catering --}} @if ($event->type->hasCatering())

{{ __('events.catering') }}

@if ($event->status !== \App\Enums\EventStatus::Cancelled && !auth()->user()->isDsgvoRestricted())
@csrf
@elseif (auth()->user()->isDsgvoRestricted())

{{ __('ui.dsgvo_restricted_hint') }}

@endif @php $cateringsWithContribution = $event->caterings->where('status', \App\Enums\CateringStatus::Yes); $cateringsWithdrawn = (auth()->user()->canAccessAdminPanel() && \App\Models\Setting::isFeatureVisibleFor('catering_history', auth()->user())) ? $event->caterings->where('status', \App\Enums\CateringStatus::No) : collect(); @endphp @if ($cateringsWithContribution->isNotEmpty() || $cateringsWithdrawn->isNotEmpty())
@foreach ($cateringsWithContribution as $catering)
{{ $catering->user->name }} @if ($catering->note) — {{ $catering->note }} @endif
@endforeach @foreach ($cateringsWithdrawn as $catering) @php $userHistory = $cateringHistory->filter( fn ($log) => ($log->properties['new']['user_id'] ?? null) == $catering->user_id ); @endphp @if ($userHistory->isNotEmpty()) {{-- Chronologische Verlaufseinträge --}} @foreach ($userHistory as $log) @php $newStatus = $log->properties['new']['status'] ?? 'unknown'; @endphp
{{ $catering->user->name }} ({{ $newStatus === 'yes' ? __('events.signed_up') : __('events.withdrawn') }})
@if (auth()->user()->isStaff()) {{ $log->created_at->format('d.m.Y, H:i') }} @endif
@endforeach @else {{-- Fallback ohne Verlaufsdaten --}}
{{ $catering->user->name }} ({{ __('events.withdrawn') }})
@if (auth()->user()->isStaff()) {{ $catering->updated_at->format('d.m.Y, H:i') }} @endif
@endif @endforeach
@else

{{ __('events.no_catering_yet') }}

@endif
@endif {{-- Zeitnehmer --}} @if ($event->type->hasTimekeepers())

{{ __('events.timekeeper') }}

@if ($event->status !== \App\Enums\EventStatus::Cancelled && !auth()->user()->isDsgvoRestricted())
@csrf
@elseif (auth()->user()->isDsgvoRestricted())

{{ __('ui.dsgvo_restricted_hint') }}

@endif @php $timekeepersYes = $event->timekeepers->where('status', \App\Enums\CateringStatus::Yes); $timekeepersWithdrawn = (auth()->user()->canAccessAdminPanel() && \App\Models\Setting::isFeatureVisibleFor('catering_history', auth()->user())) ? $event->timekeepers->where('status', \App\Enums\CateringStatus::No) : collect(); @endphp @if ($timekeepersYes->isNotEmpty() || $timekeepersWithdrawn->isNotEmpty())
@foreach ($timekeepersYes as $tk)
{{ $tk->user->name }}
@endforeach @foreach ($timekeepersWithdrawn as $tk) @php $tkHistory = $timekeeperHistory->filter( fn ($log) => ($log->properties['new']['user_id'] ?? null) == $tk->user_id ); @endphp @if ($tkHistory->isNotEmpty()) @foreach ($tkHistory as $log) @php $newStatus = $log->properties['new']['status'] ?? 'unknown'; @endphp
{{ $tk->user->name }} ({{ $newStatus === 'yes' ? __('events.signed_up') : __('events.withdrawn') }})
@if (auth()->user()->isStaff()) {{ $log->created_at->format('d.m.Y, H:i') }} @endif
@endforeach @else
{{ $tk->user->name }} ({{ __('events.withdrawn') }})
@if (auth()->user()->isStaff()) {{ $tk->updated_at->format('d.m.Y, H:i') }} @endif
@endif @endforeach
@else

{{ __('events.no_timekeeper_yet') }}

@endif
@endif {{-- Fahrgemeinschaften --}} @if ($event->type->hasCarpool())

{{ __('events.carpool') }}

@if ($event->status !== \App\Enums\EventStatus::Cancelled && !auth()->user()->isDsgvoRestricted()) {{-- Eigenes Angebot --}} @if ($myCarpool)
{{ __('events.carpool_my_offer') }}
@csrf
@csrf
@else
@csrf
@endif @error('seats')

{{ $message }}

@enderror @error('carpool')

{{ $message }}

@enderror @elseif (auth()->user()->isDsgvoRestricted())

{{ __('ui.dsgvo_restricted_hint') }}

@endif {{-- Liste aller Fahrten --}} @if ($event->carpools->isNotEmpty())
@foreach ($event->carpools as $carpool) @php $isOwn = $carpool->user_id === auth()->id(); $passengerCount = $carpool->passengers->count(); $remaining = $carpool->seats - $passengerCount; $fillPercent = $carpool->seats > 0 ? ($passengerCount / $carpool->seats) * 100 : 0; $assignedChildIds = $carpool->passengers->pluck('player_id')->toArray(); $assignableChildren = $userChildIds->filter(fn ($id) => !in_array($id, $assignedChildIds)); @endphp
{{ $carpool->driver->name }} @if ($isOwn) {{ __('events.carpool_my_offer') }} @endif
{{ __('events.carpool_seats_count', ['free' => $remaining, 'total' => $carpool->seats]) }}
{{-- Fortschrittsbalken --}}
@if ($carpool->note)

{{ $carpool->note }}

@endif {{-- Passagiere --}} @if ($carpool->passengers->isNotEmpty())
@foreach ($carpool->passengers as $passenger) {{ $passenger->player->full_name }} @if ($event->status !== \App\Enums\EventStatus::Cancelled && ($passenger->added_by === auth()->id() || auth()->user()->isAdmin()))
@csrf
@endif
@endforeach
@endif {{-- Kinder zuordnen --}} @if ($event->status !== \App\Enums\EventStatus::Cancelled && !auth()->user()->isDsgvoRestricted() && $remaining > 0 && $assignableChildren->isNotEmpty())
@foreach ($assignableChildren as $childId) @php $child = $userChildren->firstWhere('id', $childId); @endphp @if ($child)
@csrf
@endif @endforeach
@elseif ($remaining <= 0 && !$isOwn)

{{ __('events.carpool_full') }}

@endif
@endforeach
@else

{{ __('events.no_carpool_yet') }}

@endif
@endif {{-- Kommentare --}}

{{ __('events.comments') }}

@if ($event->status !== \App\Enums\EventStatus::Cancelled && !auth()->user()->isDsgvoRestricted())
@csrf
@error('body')

{{ $message }}

@enderror
@elseif (auth()->user()->isDsgvoRestricted())

{{ __('ui.dsgvo_restricted_hint') }}

@endif @if ($event->comments->isEmpty())

{{ __('events.no_comments') }}

@else
@foreach ($event->comments->sortByDesc('created_at') as $comment) @if ($comment->isDeleted() && !auth()->user()->isStaff()) @continue @endif
{{ $comment->user->name }} {{ $comment->created_at->diffForHumans() }}
@if ($comment->isDeleted())

{{ $comment->body }} ({{ __('events.deleted_label') }})

@else

{{ $comment->body }}

@endif
@if (!$comment->isDeleted() && auth()->user()->isStaff())
@csrf @method('DELETE')
@endif
@endforeach
@endif
{{-- Leaflet.js Karte --}} @if ($event->hasCoordinates()) @push('styles') @endpush @push('scripts') @endpush @endif