<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>
                <x-btn :href="route('meet.webinars.show', $room)" variant="link" size="sm" plain class="mt-1">← Back to webinar</x-btn>
            </div>
            <x-btn :href="route('meet.webinar.register', $room)" target="_blank" variant="link" size="sm" plain>Public registration page</x-btn>
        </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="btn-group">
                            <form method="POST" action="{{ route('meet.webinar.registrations.approve', [$room, $registration]) }}">@csrf<x-btn type="submit" variant="link" size="sm">Approve</x-btn></form>
                            <form method="POST" action="{{ route('meet.webinar.registrations.reject', [$room, $registration]) }}">@csrf<x-btn type="submit" variant="danger" size="sm">Reject</x-btn></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>
