@php $monthNames = [ 1 => 'January', 2 => 'February', 3 => 'March', 4 => 'April', 5 => 'May', 6 => 'June', 7 => 'July', 8 => 'August', 9 => 'September', 10 => 'October', 11 => 'November', 12 => 'December', ]; $monthSelectOptions = []; foreach ($monthNames as $num => $label) { $monthSelectOptions[] = ['value' => (string) $num, 'label' => $label]; } $yearSelectOptions = collect($yearOptions ?? [])->map(fn ($y) => ['value' => (string) $y, 'label' => (string) $y])->all(); $statusFilterOptions = [['value' => '', 'label' => 'All statuses']]; foreach (($statusOptions ?? []) as $st) { $statusFilterOptions[] = ['value' => (string) $st, 'label' => ucfirst($st)]; } $selectedStatusStr = $selectedStatus !== null ? (string) $selectedStatus : ''; $leadTypeFilterOptions = [['value' => '', 'label' => 'All types']]; foreach (($leadTypeOptions ?? []) as $lt) { $leadTypeFilterOptions[] = ['value' => (string) $lt, 'label' => ucfirst($lt)]; } $selectedLeadTypeStr = $selectedLeadType !== null ? (string) $selectedLeadType : ''; $assignedFilterOptions = [['value' => '', 'label' => 'All assignees']]; foreach (($users ?? []) as $u) { $label = trim(($u->name ?? '').' '.($u->surname ?? '')); $label = $label !== '' ? $label : ('User #'.$u->id); $label = (bool) ($u->is_disabled ?? false) ? ($label.' (disabled)') : $label; $assignedFilterOptions[] = ['value' => (string) $u->id, 'label' => $label]; } $selectedAssignedStr = $selectedAssignedUserId !== null ? (string) $selectedAssignedUserId : ''; @endphp {{ __('All Leads') }}
@php $leadSummaryMetrics = [ ['label' => 'Total leads', 'key' => 'total'], ['label' => 'Individuals', 'key' => 'individual'], ['label' => 'Businesses', 'key' => 'business'], ['label' => 'New', 'key' => 'new'], ['label' => 'Contacted', 'key' => 'contacted'], ['label' => 'Converted', 'key' => 'converted'], ['label' => 'Lost', 'key' => 'lost'], ]; @endphp
@foreach ($leadSummaryMetrics as $metric)
{{ $metric['label'] }}
{{ number_format((int) data_get($summary, $metric['key'], 0)) }}
@endforeach
@php $allLeadsAlpineConfig = [ 'toolbarMode' => 'all', 'saleDate' => old('sale_date', now()->format('Y-m-d')), 'saleStatus' => old('status', 'delivered'), 'saleVehicleMake' => old('vehicle_make', ''), 'saleVehicleModel' => old('vehicle_model', ''), 'saleVehicleVariant' => old('vehicle_variant', ''), 'saleVehicleYear' => old('vehicle_year', ''), 'saleStockNumber' => old('stock_number', ''), 'sellingPrice' => old('selling_price', ''), 'grossProfit' => old('gross_profit', ''), 'notes' => old('notes', ''), 'todayDate' => now()->format('Y-m-d'), 'leadUrlBase' => url('/leads'), 'parkReasonDefault' => old('park_reason', ''), 'parkFollowUpDefault' => old('park_follow_up_date', now()->format('Y-m-d')), 'appointmentDateDefault' => old('appointment_date', now()->format('Y-m-d')), 'appointmentTimeDefault' => old('appointment_time', '09:00'), 'appointmentLocationDefault' => old('location', ''), 'appointmentNotesDefault' => old('notes', ''), 'financeApplicationDateDefault' => old('application_date', now()->format('Y-m-d')), 'financeApplicationStatusDefault' => old('status', 'submitted'), 'financeApplicantNameDefault' => old('applicant_name', ''), 'financeVehicleDefault' => old('vehicle', ''), 'reopenConvert' => null, ]; if (filled(old('__convert_lead_id'))) { $reopenLeadId = (int) old('__convert_lead_id'); $allLeadsAlpineConfig['reopenConvert'] = [ 'leadId' => $reopenLeadId, 'leadLabel' => (string) old('__convert_lead_label', ''), 'convertUrl' => route('leads.convert-to-sale', $reopenLeadId), ]; } if (filled(old('__park_lead_id'))) { $allLeadsAlpineConfig['reopenPark'] = [ 'leadId' => (int) old('__park_lead_id'), 'leadLabel' => (string) old('__park_lead_label', ''), ]; } if (filled(old('__appointment_lead_id'))) { $allLeadsAlpineConfig['reopenAppointment'] = [ 'leadId' => (int) old('__appointment_lead_id'), 'leadLabel' => (string) old('__appointment_lead_label', ''), ]; } if (filled(old('__finance_application_lead_id'))) { $allLeadsAlpineConfig['reopenFinanceApplication'] = [ 'leadId' => (int) old('__finance_application_lead_id'), 'leadLabel' => (string) old('__finance_application_lead_label', ''), 'applicantName' => (string) old('applicant_name', ''), ]; } if (! empty($isManagementView) && $isManagementView) { $allLeadsAlpineConfig['canReassignLead'] = true; } if (filled(old('__reassign_lead_id'))) { $allLeadsAlpineConfig['reopenReassign'] = [ 'leadId' => (int) old('__reassign_lead_id'), 'leadLabel' => (string) old('__reassign_lead_label', ''), 'assignedUserId' => old('assigned_user_id') !== null && old('assigned_user_id') !== '' ? (string) old('assigned_user_id') : '', ]; } @endphp
@if (! empty($isManagementView) && $isManagementView) @endif

{{ number_format(count($leads ?? [])) }} record(s)

Mark as sale is only for leads without a recorded sale. Choose a different row if this one is not eligible.

@include('leads.partials.index-table-colgroup') @include('leads.partials.index-table-head') @forelse (($leads ?? []) as $lead) @include('leads.partials.index-table-row', ['lead' => $lead]) @empty @endforelse
No leads for this selection.
@if (! empty($isManagementView) && $isManagementView)
@endif