@php $badge = ['lead' => 'bg-amber-100 text-amber-700', 'prospect' => 'bg-blue-100 text-blue-700', 'client' => 'bg-green-100 text-green-700', 'inactive' => 'bg-gray-100 text-gray-600']; $sortLink = function ($key, $label) use ($sort, $dir) { $nd = ($sort === $key && $dir === 'asc') ? 'desc' : 'asc'; $url = request()->fullUrlWithQuery(['sort' => $key, 'dir' => $nd]); $arrow = $sort === $key ? ($dir === 'asc' ? ' ↑' : ' ↓') : ''; return ''.$label.$arrow.''; }; @endphp @if(auth()->user()?->hasPermission('crm.contacts.create')) + New Contact @endif
@forelse($contacts as $contact) @empty @endforelse
{!! $sortLink('display', 'Name') !!} {!! $sortLink('email', 'Email') !!} Phone {!! $sortLink('type', 'Type') !!} {!! $sortLink('created', 'Added') !!}
{{ $contact->display_name }} {{ $contact->email ?: '—' }} {{ $contact->phone ?: '—' }} {{ ucfirst($contact->type) }} {{ $contact->created_at->format('Y-m-d') }} @if(auth()->user()?->hasPermission('crm.contacts.edit')) Edit @endif
No contacts found.
{{ $contacts->links() }}