{{-- resources/views/agent/leads/partials/assigned.blade.php --}} @php use Illuminate\Support\Facades\Route; // Safe fallback if the controller didn't pass $assignedData $assigned = is_array($assignedData ?? null) ? $assignedData : []; // Tabs we support for ASSIGNED $types = [ 'life' => 'Life', 'mortgage' => 'Mortgage Protection', ]; // If at least one dataset exists, start there; else default to Life $available = array_values(array_filter(array_keys($types), fn($k) => array_key_exists($k, $assigned))); $firstActive = $available[0] ?? 'life'; // Unique IDs so these don’t collide with Purchased tab $paneId = fn($key) => "assigned-{$key}"; $tabId = fn($key) => "assigned-tab-{$key}"; @endphp
Assigned Leads
{{-- Optional Bulk Update controls (Status / Insurance Type) --}}
{{-- Bulk Status --}}
@csrf {{-- dynamic ids[life][], ids[mortgage][] will be injected by JS --}}
{{-- Bulk Insurance Type --}}
@csrf
{{-- Tabs --}} {{-- Tab panes --}}
@foreach ($types as $key => $label) @if (array_key_exists($key, $assigned)) @php $rows = $assigned[$key]; @endphp
@forelse ($rows as $lead) {{-- Inline Insurance Type --}} {{-- Inline Status --}} {{-- Last Updated (from updated_at or last_modified_at if present) --}} {{-- Convert Button --}} @empty @endforelse
First Last Email Phone City State Insurance Type Status Last Updated Action
{{ $lead->first_name }} {{ $lead->last_name }} {{ $lead->email }} {{ $lead->phone_number }} {{ $lead->city }} {{ $lead->state }}
@csrf @method('PATCH')
@csrf @method('PATCH')
@php $last = $lead->last_modified_at ?? ($lead->updated_at ?? null); @endphp {{ $last ? \Illuminate\Support\Carbon::parse($last)->format('Y-m-d H:i') : '' }}
@csrf
No {{ $label }} leads found.
{{-- Pagination --}}
{{ $rows->links() }}
@endif @endforeach
@push('scripts') @endpush