@extends('layouts.app')
@section('title', $event->title)
@section('content')
    <x-page-head :title="$event->title" :subtitle="ucfirst($event->event_type ?? 'event')">
        <x-slot:actions>
            @if ($event->isPendingApproval())
                <form method="POST" action="{{ route('extras.events.approve', $event) }}" style="display:inline;">@csrf<button class="btn btn-primary">Approve</button></form>
                <form method="POST" action="{{ route('extras.events.reject', $event) }}" style="display:inline;">@csrf<button class="btn btn-outline">Reject</button></form>
            @endif
            <a href="{{ route('extras.events.edit', $event) }}" class="btn btn-outline">Edit</a>
            <a href="{{ route('extras.events.index') }}" class="btn btn-outline">Back</a>
        </x-slot:actions>
    </x-page-head>
    <x-panel>
        <dl style="display:grid;grid-template-columns:160px 1fr;gap:10px;">
            <dt>Status</dt><dd><x-badge variant="blue">{{ str_replace('_', ' ', $event->status) }}</x-badge></dd>
            <dt>When</dt><dd>{{ $event->starts_at->format('l, d M Y H:i') }} @if($event->ends_at) – {{ $event->ends_at->format('H:i') }} @endif</dd>
            <dt>Location</dt><dd>{{ $event->location ?? '—' }}</dd>
            <dt>Audience</dt><dd>{{ ucfirst($event->audience) }}</dd>
            <dt>Organizer</dt><dd>
                @if ($event->organizer_type === 'student_leadership')
                    {{ $event->studentOrganizer?->full_name }} ({{ $eventsService->leadershipLabel($event->studentOrganizer?->leadership_role) }})
                @else
                    {{ $event->createdBy?->name ?? 'Administration' }}
                @endif
            </dd>
            @if ($event->contact_person)<dt>Contact</dt><dd>{{ $event->contact_person }} {{ $event->contact_phone }}</dd>@endif
            @if ($event->registration_required)<dt>Registration</dt><dd>Required @if($event->max_attendees)(max {{ $event->max_attendees }})@endif</dd>@endif
        </dl>
        @if ($event->description)<div style="margin-top:16px;white-space:pre-wrap;">{{ $event->description }}</div>@endif
    </x-panel>
@endsection
