@extends('admin.layouts.app') @section('title', __('admin.events.list_title') . ' — ' . __('admin.brand.name')) @section('page_title', __('admin.events.list_title')) @php $filterKeys = ['category_id', 'event_type', 'is_active', 'from', 'to']; $activeFilters = collect($filterKeys)->filter(fn ($k) => filled(request($k)))->count(); // Schedules are stored UTC and read in business time. $tz = \App\Support\Time\BookingsTimezone::business(); // Resolved once, not per row. $admin = auth('admin')->user(); $canEdit = (bool) $admin?->can('events.edit'); $canDelete = (bool) $admin?->can('events.delete'); @endphp @section('content') {{-- auth('admin')->user()->can(), not @can: @can resolves against the DEFAULT guard and is inert on admin screens. The routes carry the real gate; this only keeps the UI honest. --}} @if (auth('admin')->user()?->can('events.create')) @endif @include('admin.partials.flash') @foreach (request()->only(['q', 'sort', 'dir']) as $key => $value) @endforeach
@if ($events->isEmpty()) @else
@foreach ($events as $event) @endforeach
{{ __('admin.events.fields.category') }} {{ __('admin.events.fields.event_type') }} {{ __('admin.events.fields.audience') }} {{ __('admin.fields.actions') }}
@if ($event->image_path) @endif {{ $event->title }}
{{ $event->category?->name ?: '—' }} @php $start = $event->starts_at?->copy()->setTimezone($tz); @endphp {{ $start?->format('Y-m-d H:i') ?? '—' }} {{-- The public flow fails closed on an incomplete range, so an event missing an end is silently unreachable. Say so here rather than leaving the admin to discover it from a dead link. --}} @unless ($event->hasCompleteSchedule()) {{ __('admin.events.hints.schedule_incomplete') }} @endunless {{ __('admin.events.types.' . $event->event_type) }} {{-- Group count, not names: the list stays scannable and the detail is one click away on the show page. --}} @if ($event->groups_count) {{ trans_choice('admin.events.audience_count', $event->groups_count, ['count' => $event->groups_count]) }} @else {{ __('admin.events.hints.no_audience') }} @endif @if ($canEdit) @else @endif
{{ $events->links() }}
@endif
@endsection