@extends('layouts.admin', [ 'title' => 'Appointments', 'pageTitle' => 'Appointments', 'active' => 'appointments', ]) @php $statusVariants = [ 'pending' => 'warning', 'confirmed' => 'primary', 'checked_in' => 'purple', 'completed' => 'success', 'cancelled' => 'danger', 'no_show' => 'muted', ]; $sortOptions = [ 'upcoming' => 'Upcoming', 'newest' => 'Newest', 'oldest' => 'Oldest', ]; $hasActiveFilters = collect($filters ?? []) ->filter(fn ($value, $key) => filled($value) && ! ($key === 'sort' && $value === 'upcoming')) ->isNotEmpty(); $summary = [ ['label' => 'Today', 'value' => $stats['today'], 'note' => $stats['remaining_today'] . ' remaining', 'icon' => 'calendar-days', 'class' => 'bg-blue-50 text-booklio-primary'], ['label' => 'Confirmed', 'value' => $stats['confirmed_week'], 'note' => 'This week', 'icon' => 'check', 'class' => 'bg-emerald-50 text-emerald-600'], ['label' => 'Pending', 'value' => $stats['pending'], 'note' => 'Needs review', 'icon' => 'clock', 'class' => 'bg-amber-50 text-amber-600'], ['label' => 'No Show', 'value' => $stats['no_show_7_days'], 'note' => 'Last 7 days', 'icon' => 'x', 'class' => 'bg-red-50 text-red-600'], ]; @endphp @section('content')

Manage bookings, status updates, and customer check-ins.

Calendar View New Appointment
@if (session('status'))
{{ session('status') }}
@endif
@foreach ($summary as $item)

{{ $item['label'] }}

{{ $item['value'] }}

{{ $item['note'] }}

@endforeach
Filter @if ($hasActiveFilters) Reset @endif
@if ($appointments->isNotEmpty())
@foreach ($appointments as $item)
{{ $item->customer?->initials ?? 'CU' }}

{{ $item->customer?->name ?? 'Customer removed' }}

{{ $item->service?->name ?? 'Service removed' }}

{{ $item->status_label }}

Date

{{ $item->starts_at?->format('M d, Y') }}

Time

{{ $item->starts_at?->format('g:i A') }}

Staff

{{ $item->staffProfile?->name ?? 'Unassigned' }}

Amount

${{ number_format((float) $item->price, 2) }}

View Status
@endforeach
@else

No appointments found

{{ $hasActiveFilters ? 'No appointments match the current filters.' : 'Create the first appointment for this business.' }}

New Appointment
@endif
@push('modals') @include('admin.appointments.partials.create-modal', ['modalAppointment' => null, 'mode' => 'create', 'modalId' => 'create-appointment-modal']) @foreach ($appointments as $item) @include('admin.appointments.partials.status-modal', ['modalAppointment' => $item, 'modalId' => 'status-appointment-modal-' . $item->id]) @endforeach @endpush @endsection