@extends('layouts.admin.layout') @section('content') @php $dayNames = [0=>'Sun',1=>'Mon',2=>'Tue',3=>'Wed',4=>'Thu',5=>'Fri',6=>'Sat']; $termLabels = ['day'=>'day(s)','week'=>'week(s)','month'=>'month(s)','year'=>'year(s)']; $typeBadge = [ 'public' => 'bg-green-100 text-green-700', 'private' => 'bg-gray-100 text-gray-600', 'online' => 'bg-blue-100 text-blue-700', ]; $activeTab = request('tab', 'description'); $isAdmin = auth()->user()->usergroup_id == 3; @endphp {{-- ── Page header ───────────────────────────────────────────────────── --}}

Event Details

@if($isAdmin || Auth::user()->hasPermission('create-events')) Edit @endif @if($isAdmin || Auth::user()->hasPermission('delete-events'))
@csrf @method('DELETE')
@endif
@include('partials.message') {{-- ── Event hero card ───────────────────────────────────────────────── --}}
{{-- Cover image --}}
@if($event->ImagePath) @else
@endif
{{-- Meta --}}

{{ $event->title }}

{{ $event->select_type }} @if($event->repeats == 1) Recurring @endif

{{ $event->repeats == 1 ? 'Series Start' : 'Date & Time' }}

{{ date('d M Y, h:i A', strtotime($event->start_date)) }}

@if($event->repeats != 1)

ends {{ date('d M Y, h:i A', strtotime($event->end_date)) }}

@else

series ends {{ date('d M Y', strtotime($event->end_date)) }}

@endif
@if($event->repeats == 1)

Recurrence

Every {{ $event->freq }} {{ $termLabels[$event->freq_term] ?? $event->freq_term }}

@if($event->freq_term === 'week' && !empty($event->days_of_week))

on {{ implode(', ', array_map(fn($d) => $dayNames[(int)$d] ?? '', $event->days_of_week)) }}

@endif
@endif

Location

{{ $event->location ?: '—' }}

Category

{{ $event->category ?: '—' }}

Organised By

{{ $event->organised_by ?: '—' }}

Options

@if($event->publish_to_web) Published @endif @if($event->enable_gallery) Gallery On @endif @if($event->enable_attendance) Attendance On @endif
{{-- ── Tabs ───────────────────────────────────────────────────────────── --}}
{{-- Tab nav --}}
@if($event->enable_gallery) @endif @if($expired) @endif @if($event->enable_attendance) @endif
{{-- ── Description tab ──────────────────────────────────────────── --}}
@if($event->description)

{{ $event->description }}

@else

No description added.

@endif
{{-- ── Photos tab ────────────────────────────────────────────────── --}} @if($event->enable_gallery)
{{-- Upload form --}}
@csrf
{{-- Photo grid --}} @if($photos->isEmpty())

No photos uploaded yet.

@else
@foreach($photos as $photo)

{{ $photo->updated_at->format('d M Y') }}

@endforeach
@endif
@endif {{-- ── Attendees tab ─────────────────────────────────────────────── --}} @if($expired)
{{-- Sub-tabs --}}
@if($attended->isEmpty())

No attendance records.

@else
@foreach($attended as $record) @php $profile = $record->user?->userprofile; $fullname = $profile ? trim($profile->firstname . ' ' . $profile->lastname) : $record->user?->name; $avatar = $profile?->AvatarPath; @endphp @if($avatar) @else
{{ strtoupper(substr($fullname ?? '?', 0, 1)) }}
@endif {{ $fullname }}
@endforeach
@endif
@if($notAttended->isEmpty())

No records.

@else
@foreach($notAttended as $record) @php $profile = $record->user?->userprofile; $fullname = $profile ? trim($profile->firstname . ' ' . $profile->lastname) : $record->user?->name; $avatar = $profile?->AvatarPath; @endphp @if($avatar) @else
{{ strtoupper(substr($fullname ?? '?', 0, 1)) }}
@endif {{ $fullname }}
@endforeach
@endif
@endif {{-- ── Attendance tab ─────────────────────────────────────────────── --}} @if($event->enable_attendance)
{{-- Open / start a session --}} @can('create-attendance') @if($event->repeats == 1) {{-- Recurring: date picker pre-filled with next occurrence --}} @php $existingDates = $sessions->pluck('attendance_date') ->map(fn($d) => \Carbon\Carbon::parse($d)->toDateString())->toArray(); $upcomingOcc = $event->upcomingOccurrences($existingDates, 5); $nextOcc = $upcomingOcc[0] ?? null; @endphp @if($nextOcc)

Open Attendance Session

{{-- Quick-select occurrence pills --}} @if(count($upcomingOcc) > 1)
@foreach($upcomingOcc as $i => $occ) @endforeach
@endif
@csrf
@else

No upcoming occurrences — series may have ended.

@endif @else {{-- Non-recurring: simple "open for today" --}} @php $todaySession = $sessions->firstWhere(fn($s) => \Carbon\Carbon::parse($s->attendance_date)->toDateString() === now()->toDateString()); @endphp @if(!$todaySession)
@csrf
@else
Session open for today Start Check-in
@endif @endif @endcan {{-- Sessions list --}} @if($sessions->isEmpty())

No attendance sessions yet.

@else
@foreach($sessions as $sess) @php $isLocked = (bool) $sess->locked_at; @endphp
{{-- Date --}}

{{ \Carbon\Carbon::parse($sess->attendance_date)->format('M') }}

{{ \Carbon\Carbon::parse($sess->attendance_date)->format('d') }}

{{-- Info --}}
{{ \Carbon\Carbon::parse($sess->attendance_date)->format('D, d M Y') }} @if($isLocked) Locked @else Open @endif

{{ $sess->attendees_count }} {{ Str::plural('member', $sess->attendees_count) }} checked in

{{-- Actions --}}
@if(!$isLocked) @can('create-attendance') Check-in @endcan @endif View
@endforeach
@endif
@endif {{-- ── Notes tab ─────────────────────────────────────────────────── --}}
{{-- Add note form --}}
@csrf
{{-- Notes list --}}
@forelse($notes as $note)

{{ $note->notes }}

{{ $note->created_at->format('d M Y, h:i A') }}

@empty

No notes yet.

@endforelse
@endsection @push('scripts') @endpush