{{-- resources/views/agent/files/archive.blade.php --}} @extends('layouts.contentLayoutMaster') @section('title', 'Lead Archives') @php use Illuminate\Support\Facades\Route as Routes; use Illuminate\Support\Str; // ── Defensive defaults ───────────────────────────────────────────────────── $leads = $leads ?? collect(); $f_leadType = $f_leadType ?? strtolower((string) request('lead_type', '')); // assigned|personal|purchased|social $f_group = $f_group ?? strtolower((string) request('group', '')); // life|mortgage|health $f_state = strtoupper((string) request('state', '')); // 2-letter state code $f_archived_from = $f_archived_from ?? (string) request('archived_from', ''); // Y-m-d $f_archived_to = $f_archived_to ?? (string) request('archived_to', ''); // Y-m-d $rowsPer = isset($rowsPer) ? (int) $rowsPer : max(25, min((int) request('per', 100), 1000)); // Derived helpers $hasFilters = (bool) ($f_leadType || $f_group || $f_state || $f_archived_from || $f_archived_to); $backUrl = Routes::has('agent.files') ? route('agent.files') : url()->previous(); $routeArchiveIndex = Routes::has('agent.files.archive') ? route('agent.files.archive') : url()->current(); // POST target for "View Selected": prefer named route; fallback to URL. $viewSelectedRoute = Routes::has('agent.leads.archived.view-selected') ? route('agent.leads.archived.view-selected') : url('/agent/leads/archived/view-selected'); // 50 U.S. states $states = [ 'AL'=>'Alabama','AK'=>'Alaska','AZ'=>'Arizona','AR'=>'Arkansas','CA'=>'California','CO'=>'Colorado', 'CT'=>'Connecticut','DE'=>'Delaware','FL'=>'Florida','GA'=>'Georgia','HI'=>'Hawaii','ID'=>'Idaho', 'IL'=>'Illinois','IN'=>'Indiana','IA'=>'Iowa','KS'=>'Kansas','KY'=>'Kentucky','LA'=>'Louisiana', 'ME'=>'Maine','MD'=>'Maryland','MA'=>'Massachusetts','MI'=>'Michigan','MN'=>'Minnesota','MS'=>'Mississippi', 'MO'=>'Missouri','MT'=>'Montana','NE'=>'Nebraska','NV'=>'Nevada','NH'=>'New Hampshire','NJ'=>'New Jersey', 'NM'=>'New Mexico','NY'=>'New York','NC'=>'North Carolina','ND'=>'North Dakota','OH'=>'Ohio','OK'=>'Oklahoma', 'OR'=>'Oregon','PA'=>'Pennsylvania','RI'=>'Rhode Island','SC'=>'South Carolina','SD'=>'South Dakota', 'TN'=>'Tennessee','TX'=>'Texas','UT'=>'Utah','VT'=>'Vermont','VA'=>'Virginia','WA'=>'Washington', 'WV'=>'West Virginia','WI'=>'Wisconsin','WY'=>'Wyoming', ]; @endphp @section('content')
| First Name | Last Name | Phone Number | Date of Birth | {{-- State column --}}State | Lead Type | {{-- REPLACED: Group -> Status --}}Status | Archived Date | ||
|---|---|---|---|---|---|---|---|---|---|
| {{-- Checkbox posts ids/keys only (status is NOT used as a key) --}} | {{ $first ?: '—' }} | {{ $last ?: '—' }} | {{ $phone ?: '—' }} | {{ $email ?: '—' }} | @if ($dob) {{ \Illuminate\Support\Carbon::parse($dob)->format('Y-m-d') }} @else — @endif | {{-- State cell --}}{{ $state ?: '—' }} | {{ $lt ?: '—' }} | {{-- NEW: Status cell (display-only) --}}{{ $status ?: '—' }} | {{ $archDt ? \Illuminate\Support\Carbon::parse($archDt)->format('Y-m-d H:i') : '—' }} |
| No archived leads matched your filters. | |||||||||