<x-app-layout title="Webinar registrations">
    <div class="mx-auto max-w-2xl">
        <div class="flex items-center justify-between">
            <div>
                <h1 class="text-xl font-semibold text-slate-900">Registrations</h1>
                <p class="text-sm text-slate-500">{{ $room->title }}</p>
                <a href="{{ route('meet.webinars.show', $room) }}" class="mt-1 inline-block text-sm text-indigo-600 hover:underline">← Back to webinar</a>
            </div>
            <a href="{{ route('meet.webinar.register', $room) }}" target="_blank" class="text-sm text-indigo-600 hover:underline">Public registration page</a>
        </div>

        <ul class="mt-6 divide-y divide-slate-100 rounded-2xl border border-slate-200 bg-white">
            @forelse ($registrations as $registration)
                <li class="flex items-center justify-between px-6 py-4 text-sm">
                    <div>
                        <p class="font-medium">{{ $registration->display_name }}</p>
                        <p class="text-slate-500">{{ $registration->email }} · {{ ucfirst($registration->status) }}</p>
                    </div>
                    @if ($registration->status === 'pending')
                        <div class="flex gap-2">
                            <form method="POST" action="{{ route('meet.webinar.registrations.approve', [$room, $registration]) }}">@csrf<button class="text-emerald-600 hover:underline">Approve</button></form>
                            <form method="POST" action="{{ route('meet.webinar.registrations.reject', [$room, $registration]) }}">@csrf<button class="text-red-600 hover:underline">Reject</button></form>
                        </div>
                    @endif
                </li>
            @empty
                <li class="px-6 py-8 text-center text-slate-500">No registrations yet.</li>
            @endforelse
        </ul>
    </div>
</x-app-layout>
