{{-- resources/views/admin/purchased-leads/index.blade.php --}} @extends('layouts.contentLayoutMaster') @php // Ensure layout config exists $configData = $configData ?? array_merge(\App\Helpers\Helper::applClasses(), [ 'mainLayoutType' => 'vertical', 'showMenu' => true, 'layoutWidth' => 'full', ]); // Keep statuses in sync with controller $allowedStatuses = ['new', 'in_progress', 'contacted', 'quoted', 'sold', 'dead', 'archived']; // Flags so we can render health safely even if not enabled $healthEnabled = isset($health) && $health instanceof \Illuminate\Contracts\Pagination\LengthAwarePaginator; @endphp @section('title', 'Purchased Leads (Admin)') @section('content')

Upload / Manage Purchased Leads

{{-- Flash / errors --}} @if (session('success'))
{{ session('success') }}
@endif @if ($errors->any())
@endif @if (session('details') && is_array(session('details')) && count(session('details')))
Notes:
@endif {{-- Upload cards --}}
{{-- Life upload --}}
Upload Life Leads (CSV)
@csrf
Columns: purchase_date, first_name, last_name, email, phone_number, date_of_birth, age, street_address, city, state, zipcode, county, insurance_type, owner_id/owner_email (optional), status (optional). {{-- No full_name used. --}}
{{-- Mortgage Protection upload --}}
Upload Mortgage Protection Leads (CSV)
@csrf
Same as Life plus: mortgage, lender.
{{-- Health / Medicare upload (always visible) --}}
Upload Health / Medicare Leads (CSV) @unless ($healthEnabled) DB not enabled @endunless
@csrf
Same columns as Life; include any health-specific columns you capture.
@unless ($healthEnabled) Health table is visible. If uploads fail, create the purchased_health_leads table and model to enable storage. @endunless
{{-- Life table --}}
Life Leads
@csrf
@forelse ($life as $lead) @empty @endforelse
ID Purchase Date First Last Email Phone DOB Age Street City State Zip County Insurance Status Owner Actions
{{ $lead->id }} {{ optional($lead->purchase_date)->format('Y-m-d') }} {{ $lead->first_name }} {{ $lead->last_name }} {{ $lead->email }} {{ $lead->phone_number }} {{ optional($lead->date_of_birth)->format('Y-m-d') }} {{ $lead->age }} {{ $lead->street_address }} {{ $lead->city }} {{ $lead->state }} {{ $lead->zipcode }} {{ $lead->county }} {{ $lead->insurance_type }} {{ $lead->status }} {{ optional($lead->owner)->name ?? '—' }} Edit
No Life leads yet.
Total: {{ $life->total() }}
{{ $life->withQueryString()->links() }}
{{-- Mortgage table --}}
Mortgage Protection Leads
@csrf
@forelse ($mp as $lead) @empty @endforelse
ID Purchase Date First Last Email Phone DOB Age Mortgage Lender Street City State Zip County Insurance Status Owner Actions
{{ $lead->id }} {{ optional($lead->purchase_date)->format('Y-m-d') }} {{ $lead->first_name }} {{ $lead->last_name }} {{ $lead->email }} {{ $lead->phone_number }} {{ optional($lead->date_of_birth)->format('Y-m-d') }} {{ $lead->age }} {{ $lead->mortgage }} {{ $lead->lender }} {{ $lead->street_address }} {{ $lead->city }} {{ $lead->state }} {{ $lead->zipcode }} {{ $lead->county }} {{ $lead->insurance_type }} {{ $lead->status }} {{ optional($lead->owner)->name ?? '—' }} Edit
No Mortgage Protection leads yet.
Total: {{ $mp->total() }}
{{ $mp->withQueryString()->links() }}
{{-- Health table (always visible; safe when not enabled) --}}
Health / Medicare Leads
@csrf
@if ($healthEnabled) @forelse ($health as $lead) @empty @endforelse @else @endif
ID Purchase Date First Last Email Phone DOB Age Street City State Zip County Insurance Status Owner Actions
{{ $lead->id }} {{ optional($lead->purchase_date)->format('Y-m-d') }} {{ $lead->first_name }} {{ $lead->last_name }} {{ $lead->email }} {{ $lead->phone_number }} {{ optional($lead->date_of_birth)->format('Y-m-d') }} {{ $lead->age }} {{ $lead->street_address }} {{ $lead->city }} {{ $lead->state }} {{ $lead->zipcode }} {{ $lead->county }} {{ $lead->insurance_type }} {{ $lead->status }} {{ optional($lead->owner)->name ?? '—' }} Edit
No Health leads yet.
Health/Medicare purchased leads are not enabled in the DB yet. The table remains visible so you don’t have to edit this page later.
Total: {{ $healthEnabled ? $health->total() : 0 }}
@if ($healthEnabled)
{{ $health->withQueryString()->links() }}
@endif
@endsection @section('page-script') @endsection