Files
ladill-events/resources/views/events/attendees.blade.php
T
isaacclad a5ebd1e414
Deploy Ladill Events / deploy (push) Successful in 48s
fix(events): point Messaging settings at suite defaults, not API keys
Mirror Care: suite platform keys count as ready for attendee email/SMS;
Account Messaging is primary, product Bird/SMS keys are advanced.
SmsService now prefers channel=suite before customer API keys.
2026-07-16 11:36:43 +00:00

203 lines
14 KiB
PHP

<x-user-layout>
@php $isContribution = ($qrCode->content()['mode'] ?? 'ticketing') === 'contributions'; @endphp
<x-slot name="title">{{ $isContribution ? 'Contributions' : 'Attendees' }} {{ $qrCode->label }}</x-slot>
<div class="mx-auto max-w-5xl space-y-6">
{{-- Flash --}}
@foreach(['success', 'error'] as $flash)
@if(session($flash))
<div class="rounded-xl border px-4 py-3 text-sm {{ $flash === 'success' ? 'border-emerald-200 bg-emerald-50 text-emerald-700' : 'border-red-200 bg-red-50 text-red-700' }}">
{{ session($flash) }}
</div>
@endif
@endforeach
{{-- Header --}}
<div class="flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between">
<div>
<a href="{{ route('attendees.index') }}" class="inline-flex items-center gap-1 text-sm text-slate-500 hover:text-slate-700">
<svg class="h-4 w-4" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="M15.75 19.5 8.25 12l7.5-7.5"/></svg>
Attendees
</a>
<h1 class="mt-1.5 text-2xl font-bold text-slate-900">{{ $isContribution ? 'Contributions' : 'Attendees' }}</h1>
<p class="mt-0.5 text-sm text-slate-500">{{ $qrCode->content()['name'] ?? $qrCode->label }}</p>
</div>
@unless($isContribution)
<a href="{{ route('events.badge-printing', $qrCode) }}"
class="inline-flex items-center justify-center gap-2 rounded-xl border border-violet-200 bg-violet-50 px-4 py-2.5 text-sm font-semibold text-violet-700 hover:bg-violet-100 transition">
<svg class="h-4 w-4" fill="none" stroke="currentColor" stroke-width="1.8" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="M9 12h3.75M9 15h3.75M9 18h3.75m3 .75H18a2.25 2.25 0 0 0 2.25-2.25V6.108c0-1.135-.845-2.098-1.976-2.192a48.424 48.424 0 0 0-1.123-.08m-5.801 0c-.065.21-.1.433-.1.664 0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75 2.25 2.25 0 0 0-.1-.664m-5.8 0A2.251 2.251 0 0 1 13.5 2.25H15c1.012 0 1.867.668 2.15 1.586m-5.8 0c-.376.023-.75.05-1.124.08C9.095 4.01 8.25 4.973 8.25 6.108V8.25m0 0H4.875c-.621 0-1.125.504-1.125 1.125v11.25c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V9.375c0-.621-.504-1.125-1.125-1.125H8.25Z"/></svg>
Print badges
</a>
@endunless
</div>
{{-- Mass comms --}}
@if(!empty($commsModes))
<div id="comms" class="rounded-2xl border border-indigo-100 bg-indigo-50/60 p-4"
x-data="{
mode: @js($defaultCommsMode),
preview: null,
busy: false,
async loadPreview() {
const r = await fetch(@js(route('events.attendees.comms-preview', $qrCode)).replace(/&amp;/g, '&') + '?mode=' + encodeURIComponent(this.mode), {
headers: { 'Accept': 'application/json', 'X-Requested-With': 'XMLHttpRequest' },
});
if (r.ok) this.preview = await r.json();
},
}"
x-init="loadPreview()">
<div class="flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between">
<div class="flex items-start gap-3">
<span class="flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-indigo-100 text-indigo-600">
<svg class="h-5 w-5" fill="none" stroke="currentColor" stroke-width="1.8" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="M21.75 6.75v10.5a2.25 2.25 0 0 1-2.25 2.25h-15a2.25 2.25 0 0 1-2.25-2.25V6.75m19.5 0A2.25 2.25 0 0 0 19.5 4.5h-15a2.25 2.25 0 0 0-2.25 2.25m19.5 0v.243a2.25 2.25 0 0 1-1.07 1.916l-7.5 4.615a2.25 2.25 0 0 1-2.36 0L3.32 8.91a2.25 2.25 0 0 1-1.07-1.916V6.75"/></svg>
</span>
<div>
<p class="text-sm font-semibold text-slate-900">Message attendees</p>
<p class="text-xs text-slate-500">
Send programme links, virtual join links, or both. Uses suite messaging by default (no API keys).
<a href="{{ $messagingSettingsUrl ?? '#' }}" class="font-medium text-indigo-600 hover:text-indigo-800" target="_blank" rel="noopener">Account messaging settings</a>
·
<a href="{{ route('account.integrations') }}" class="text-slate-500 hover:text-slate-700">Advanced keys</a>
</p>
<template x-if="preview">
<p class="mt-2 text-xs text-slate-600">
<span x-text="preview.recipients"></span> recipients ·
est. GHS <span x-text="preview.estimated_ghs.toFixed(2)"></span>
<span x-show="preview.integrations_error" class="font-semibold text-red-600" x-text="' — ' + preview.integrations_error"></span>
</p>
</template>
</div>
</div>
<form method="POST" action="{{ route('events.attendees.share-comms', $qrCode) }}"
@submit="async ($event) => {
if (busy) return;
if (! await $store.ladillConfirm.ask({
title: 'Send messages?',
message: 'Send to all confirmed attendees by email and SMS where available?',
confirmLabel: 'Send',
variant: 'primary',
})) { $event.preventDefault(); return; }
busy = true;
}"
class="flex w-full shrink-0 flex-col gap-2 sm:w-auto sm:flex-row sm:items-center">
@csrf
<select name="mode" x-model="mode" @change="loadPreview()"
class="rounded-xl border border-slate-200 bg-white px-3 py-2 text-sm text-slate-700 focus:border-indigo-400 focus:outline-none">
@if(in_array(\App\Services\Events\EventCommsService::MODE_PROGRAMME, $commsModes))
<option value="programme">Programme only</option>
@endif
@if(in_array(\App\Services\Events\EventCommsService::MODE_JOIN, $commsModes))
<option value="join">Join link only</option>
@endif
@if(in_array(\App\Services\Events\EventCommsService::MODE_BOTH, $commsModes))
<option value="both">Programme &amp; join link</option>
@endif
</select>
<button type="submit" :disabled="busy || (preview && !preview.affordable)"
class="btn-primary w-full sm:w-auto">
<span x-text="busy ? 'Sending…' : 'Send to attendees'">Send to attendees</span>
</button>
</form>
</div>
</div>
@endif
{{-- Stats --}}
<div class="grid gap-3 {{ isset($stats['virtual_sessions']) ? ($isContribution ? 'grid-cols-2 sm:grid-cols-4' : 'grid-cols-2 sm:grid-cols-5') : ($isContribution ? 'grid-cols-2' : 'grid-cols-3') }}">
<div class="rounded-2xl border border-slate-200 bg-white p-4">
<p class="text-2xl font-bold text-slate-900">{{ number_format($stats['total']) }}</p>
<p class="text-xs text-slate-500">{{ $isContribution ? 'Contributions' : 'Registered' }}</p>
</div>
@unless($isContribution)
<div class="rounded-2xl border border-slate-200 bg-white p-4">
<p class="text-2xl font-bold text-slate-900">{{ number_format($stats['checked_in']) }}</p>
<p class="text-xs text-slate-500">Checked in</p>
</div>
@endunless
<div class="rounded-2xl border border-slate-200 bg-white p-4">
<p class="text-2xl font-bold text-slate-900">GHS {{ number_format($stats['revenue'], 2) }}</p>
<p class="text-xs text-slate-500">{{ $isContribution ? 'Total raised' : 'Revenue' }}</p>
</div>
@if(isset($stats['virtual_sessions']))
<div class="rounded-2xl border border-slate-200 bg-white p-4">
<p class="text-2xl font-bold text-slate-900">{{ number_format($stats['virtual_live']) }}/{{ number_format($stats['virtual_sessions']) }}</p>
<p class="text-xs text-slate-500">Sessions live</p>
</div>
<div class="rounded-2xl border border-slate-200 bg-white p-4">
<p class="text-2xl font-bold text-slate-900">{{ number_format($stats['virtual_recordings']) }}</p>
<p class="text-xs text-slate-500">Recordings ready</p>
</div>
@endif
</div>
{{-- Toolbar --}}
<form method="GET" class="flex items-center gap-2">
<input type="text" name="search" value="{{ request('search') }}" placeholder="Search name, email, code…"
class="w-full max-w-sm rounded-xl border border-slate-200 px-3.5 py-2 text-sm focus:border-indigo-400 focus:outline-none focus:ring-1 focus:ring-indigo-400/30">
<select name="status" onchange="this.form.submit()" class="rounded-xl border border-slate-200 px-3 py-2 text-sm text-slate-600 focus:border-indigo-400 focus:outline-none">
<option value="">All</option>
<option value="confirmed" @selected(request('status') === 'confirmed')>Confirmed</option>
<option value="pending" @selected(request('status') === 'pending')>Pending</option>
</select>
</form>
{{-- Table --}}
<div class="overflow-hidden rounded-2xl border border-slate-200 bg-white">
<div class="overflow-x-auto">
<table class="min-w-full text-sm">
<thead class="border-b border-slate-100 bg-slate-50/70 text-left text-xs uppercase tracking-wide text-slate-400">
<tr>
<th class="px-4 py-3">{{ $isContribution ? 'Contributor' : 'Attendee' }}</th>
<th class="px-4 py-3">{{ $isContribution ? 'Category' : 'Ticket' }}</th>
@unless($isContribution)<th class="px-4 py-3">Badge</th>@endunless
<th class="px-4 py-3">Status</th>
@unless($isContribution)<th class="px-4 py-3 text-right">Check-in</th>@endunless
</tr>
</thead>
<tbody class="divide-y divide-slate-100">
@forelse($registrations as $reg)
<tr class="hover:bg-slate-50/60">
<td class="px-4 py-3">
<p class="font-semibold text-slate-800">{{ $reg->attendee_name }}</p>
<p class="text-xs text-slate-400">{{ $reg->attendee_email }}</p>
@foreach(($reg->badge_fields ?? []) as $k => $v)
<span class="mr-1 inline-block rounded bg-slate-100 px-1.5 py-0.5 text-[10px] text-slate-500">{{ $k }}: {{ $v }}</span>
@endforeach
</td>
<td class="px-4 py-3">
<span class="font-medium text-slate-700">{{ $reg->tier_name }}</span>
@if($reg->isPaid())<p class="text-xs text-slate-400">GHS {{ number_format($reg->amountCedis(), 2) }}</p>@endif
</td>
@unless($isContribution)
<td class="px-4 py-3"><code class="rounded bg-slate-100 px-2 py-0.5 text-xs">{{ $reg->badge_code }}</code></td>
@endunless
<td class="px-4 py-3">
<span class="inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium {{ $reg->status === 'confirmed' ? 'bg-emerald-50 text-emerald-700' : ($reg->status === 'pending' ? 'bg-amber-50 text-amber-700' : 'bg-slate-100 text-slate-500') }}">
{{ ucfirst($reg->status) }}
</span>
</td>
@unless($isContribution)
<td class="px-4 py-3 text-right">
<form method="POST" action="{{ route('events.attendees.check-in', [$qrCode, $reg]) }}">
@csrf @method('PATCH')
<button type="submit" class="rounded-lg border px-2.5 py-1 text-xs font-semibold transition {{ $reg->checked_in_at ? 'border-emerald-200 bg-emerald-50 text-emerald-700' : 'border-slate-200 text-slate-500 hover:bg-slate-50' }}">
{{ $reg->checked_in_at ? '✓ In' : 'Check in' }}
</button>
</form>
</td>
@endunless
</tr>
@empty
<tr><td colspan="{{ $isContribution ? 3 : 5 }}" class="px-4 py-12 text-center text-sm text-slate-400">{{ $isContribution ? 'No contributions yet.' : 'No registrations yet.' }}</td></tr>
@endforelse
</tbody>
</table>
</div>
@if($registrations->hasPages())
<div class="border-t border-slate-100 px-4 py-3">{{ $registrations->links() }}</div>
@endif
</div>
</div>
</x-user-layout>