Files
WebAPP/resources/views/events/index.blade.php
2026-03-03 11:52:03 +01:00

100 lines
5.6 KiB
PHP
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<x-layouts.app :title="__('events.title')">
<div class="flex flex-col sm:flex-row sm:items-center sm:justify-between mb-6">
<h1 class="text-2xl font-bold">{{ __('events.title') }}</h1>
</div>
{{-- Filter --}}
<form method="GET" action="{{ route('events.index') }}" class="bg-white rounded-lg shadow p-4 mb-6">
<div class="grid grid-cols-1 sm:grid-cols-4 gap-3">
<div>
<label for="team_id" class="block text-xs font-medium text-gray-600 mb-1">{{ __('ui.team') }}</label>
<select name="team_id" id="team_id" class="w-full rounded-md border-gray-300 text-sm">
<option value="">{{ __('ui.all_teams') }}</option>
@foreach ($teams as $team)
<option value="{{ $team->id }}" {{ request('team_id') == $team->id ? 'selected' : '' }}>{{ $team->name }}</option>
@endforeach
</select>
</div>
<div>
<label for="type" class="block text-xs font-medium text-gray-600 mb-1">{{ __('ui.type') }}</label>
<select name="type" id="type" class="w-full rounded-md border-gray-300 text-sm">
<option value="">{{ __('ui.all_types') }}</option>
@foreach (\App\Enums\EventType::cases() as $type)
<option value="{{ $type->value }}" {{ request('type') === $type->value ? 'selected' : '' }}>{{ $type->label() }}</option>
@endforeach
</select>
</div>
<div>
<label for="period" class="block text-xs font-medium text-gray-600 mb-1">{{ __('ui.period') }}</label>
<select name="period" id="period" class="w-full rounded-md border-gray-300 text-sm">
<option value="upcoming" {{ request('period', 'upcoming') === 'upcoming' ? 'selected' : '' }}>{{ __('ui.upcoming') }}</option>
<option value="past" {{ request('period') === 'past' ? 'selected' : '' }}>{{ __('ui.past') }}</option>
</select>
</div>
<div class="flex items-end">
<button type="submit" class="w-full bg-blue-600 text-white rounded-md px-4 py-2 text-sm hover:bg-blue-700">{{ __('ui.filter') }}</button>
</div>
</div>
</form>
{{-- Event-Liste nach Monaten gruppiert --}}
@if ($events->isEmpty())
<div class="bg-white rounded-lg shadow p-6 text-center text-gray-500">
{{ __('events.no_events') }}
</div>
@else
@php $currentMonth = null; @endphp
@foreach ($events as $event)
@php
$eventMonth = $event->start_at->translatedFormat('F Y');
$minStatus = $event->minimumsStatus();
$bgClass = match($minStatus) { true => 'bg-green-100', false => 'bg-red-100', default => 'bg-white' };
@endphp
{{-- Monats-Header --}}
@if ($eventMonth !== $currentMonth)
@php $currentMonth = $eventMonth; @endphp
<div class="{{ !$loop->first ? 'mt-6' : '' }} mb-3">
<h2 class="text-lg font-bold text-gray-800 border-b-2 border-gray-200 pb-1">{{ $eventMonth }}</h2>
</div>
@endif
<a href="{{ route('events.show', $event) }}" class="block {{ $bgClass }} rounded-lg shadow mb-3 hover:shadow-md transition-shadow" style="padding: 15px;">
<div class="flex flex-col sm:flex-row sm:items-center gap-4">
<img src="{{ $event->imageUrl() }}" alt="" class="hidden sm:block w-20 rounded-lg object-cover shrink-0 self-stretch">
<div class="flex-1 min-w-0">
<div class="flex items-center gap-2 mb-1 flex-wrap">
<x-event-type-badge :type="$event->type" />
<span class="text-xs text-gray-500">{{ $event->team->name }}</span>
@if ($event->status === \App\Enums\EventStatus::Cancelled)
<span class="inline-block px-2 py-0.5 rounded text-xs font-medium bg-red-100 text-red-800">{{ __('events.cancelled_label') }}</span>
@elseif ($event->status === \App\Enums\EventStatus::Draft)
<span class="inline-block px-2 py-0.5 rounded text-xs font-medium bg-yellow-100 text-yellow-800">{{ __('events.draft_label') }}</span>
@endif
</div>
<h3 class="font-semibold {{ $event->status === \App\Enums\EventStatus::Cancelled ? 'line-through text-gray-400' : 'text-gray-900' }}">
{{ $event->title }}
</h3>
<p class="text-sm text-gray-600">
{{ $event->start_at->translatedFormat(__('ui.date_format')) }} {{ __('ui.clock') }}
@if ($event->end_at)
{{ $event->end_at->format('H:i') }} {{ __('ui.clock') }}
@endif
</p>
@if ($event->location_name)
<p class="text-sm text-gray-500 mt-1">{{ $event->location_name }}</p>
@endif
</div>
<div class="shrink-0">
<x-event-status-boxes :event="$event" />
</div>
</div>
</a>
@endforeach
<div class="mt-6">
{{ $events->links() }}
</div>
@endif
</x-layouts.app>