@extends('layouts.admin', [ 'title' => 'Customers', 'pageTitle' => 'Customers', 'active' => 'customers', ]) @php $statusVariants = [ 'active' => 'success', 'vip' => 'primary', 'new' => 'purple', 'inactive' => 'muted', ]; $sortOptions = [ 'newest' => 'Newest', 'name' => 'Name', 'spent_desc' => 'Highest Spent', 'last_visit_desc' => 'Last Visit', ]; $hasActiveFilters = collect($filters ?? []) ->filter(fn ($value, $key) => filled($value) && ! ($key === 'sort' && $value === 'newest')) ->isNotEmpty(); $summaryCards = [ ['label' => 'Total Customers', 'value' => number_format($summary['total']), 'note' => 'CRM profiles in this business', 'icon' => 'users', 'class' => 'bg-blue-50 text-booklio-primary'], ['label' => 'Returning Rate', 'value' => $summary['returning_rate'] . '%', 'note' => 'Customers with 2+ bookings', 'icon' => 'check', 'class' => 'bg-emerald-50 text-emerald-600'], ['label' => 'Outstanding Due', 'value' => '$' . number_format($summary['outstanding_due'], 2), 'note' => $summary['unpaid_invoices'] . ' unpaid invoices', 'icon' => 'file-text', 'class' => 'bg-amber-50 text-amber-600'], ['label' => 'VIP Customers', 'value' => number_format($summary['vip']), 'note' => 'High-value profiles', 'icon' => 'user', 'class' => 'bg-violet-50 text-violet-600'], ]; @endphp @section('content')
Manage customer profiles, appointment history, invoices, and notes.
{{ $item['label'] }}
{{ $item['value'] }}
{{ $item['note'] }}
{{ $customer->name }}
{{ $customer->phone ?: $customer->email ?: 'No contact yet' }}
Appointments
{{ $customer->appointments_count }}
Spent
${{ number_format((float) $customer->total_spent, 2) }}
Due
${{ number_format($due, 2) }}
Last Visit
{{ $customer->last_visit_at?->format('M d, Y') ?? 'No visits' }}
{{ $hasActiveFilters ? 'No customers match the current filters. Reset filters or add a new customer.' : 'Create your first customer profile to track bookings, invoices, and notes.' }}