{{-- Complete Leads Overview UI with Advanced Filters - All required columns: Contact Info, Business Name, Assigned To, Requirement, Source, Priority, Status, Created, Last Follow-up, Action - Advanced filters: Assign To, Source, Date Range (Created Date) - Modern UI with stats cards and responsive design - No horizontal scroll - fully responsive table - Redesigned Edit Modal with Follow-ups and Assignment tabs - CSV Import with Preview - Pagination - Colorful design with gradients and vibrant accents --}} @extends('business.layouts.admin') @section('breadcrumb') @endsection @section('content')
{{ $leads->count() }}
Total Leads
{{ $leads->where('status', 'new')->count() }}
New Leads
{{ $leads->where('status', 'contacted')->count() }}
In Progress
{{ $leads->where('status', 'converted')->count() }}
Converted

@forelse($leads as $lead) @php $priority = strtolower($lead['priority'] ?? 'medium'); $status = strtolower($lead['status'] ?? 'new'); $pColor = match ($priority) { 'urgent' => '#dc2626', 'high' => '#ef4444', 'medium' => '#f59e0b', 'low' => '#10b981', default => '#6b7280', }; $pIcon = match ($priority) { 'urgent' => 'ti ti-alert-triangle', 'high' => 'ti ti-arrow-up', 'medium' => 'ti ti-minus', 'low' => 'ti ti-arrow-down', default => 'ti ti-flag', }; $pBg = match ($priority) { 'urgent' => '#fee2e2', 'high' => '#fef3c7', 'medium' => '#fef9c3', 'low' => '#dcfce7', default => '#f1f5f9', }; $statusConfig = match ($status) { 'new' => ['bg' => '#dbeafe', 'color' => '#1e40af', 'icon' => 'ti ti-sparkles'], 'contacted' => ['bg' => '#dcfce7', 'color' => '#166534', 'icon' => 'ti ti-phone-call'], 'on_hold' => ['bg' => '#fed7aa', 'color' => '#9a3412', 'icon' => 'ti ti-clock-pause'], 'converted' => ['bg' => '#f3e8ff', 'color' => '#6b21a5', 'icon' => 'ti ti-checkbox'], 'lost' => ['bg' => '#fee2e2', 'color' => '#991b1b', 'icon' => 'ti ti-circle-x'], 'invalid' => ['bg' => '#f1f5f9', 'color' => '#475569', 'icon' => 'ti ti-ban'], default => ['bg' => '#f1f5f9', 'color' => '#475569', 'icon' => 'ti ti-help'], }; $sourceIcon = match (strtolower($lead['source'] ?? 'direct')) { 'website' => '🌐', 'social media' => '📱', 'referral' => '👥', 'email campaign' => '📧', default => '📞', }; $sourceColor = match (strtolower($lead['source'] ?? 'direct')) { 'website' => '#3b82f6', 'social media' => '#ec4899', 'referral' => '#10b981', 'email campaign' => '#8b5cf6', default => '#64748b', }; $leadJson = json_encode([ 'uuid' => $lead['uuid'], 'name' => $lead['name'] ?? '', 'phone' => $lead['phone'] ?? '', 'email' => $lead['email'] ?? '', 'source' => $lead['source'] ?? 'Direct', 'priority' => $lead['priority'] ?? 'medium', 'status' => $lead['status'] ?? 'new', 'requirement' => $lead['requirement'] ?? '', 'busi_name' => $lead['busi_name'] ?? '', 'assigned_employee' => $lead['assigned_employee'] ?? null, 'last_follow_up_at' => $lead['last_follow_up_at'] ?? null, 'lost_reason' => $lead['lost_reason'] ?? '', 'invalid_reason' => $lead['invalid_reason'] ?? '', 'created_at' => $lead['created_at'] ?? '', ]); @endphp @empty @endforelse
{{ __('CONTACT') }} {{ __('BUSINESS') }} {{ __('ASSIGNED TO') }} {{ __('REQUIREMENT') }} {{ __('SOURCE') }} {{ __('PRIORITY') }} {{ __('STATUS') }} {{ __('CREATED') }} {{ __('LAST FOLLOW-UP') }} {{ __('ACTION') }}
{{ Str::limit($lead['name'] ?? 'Unknown', 20) }}
{{ $lead['phone'] }}
{{ Str::limit($lead['email'] ?? 'No email', 25) }}
@if(!empty($lead['busi_name']))
{{ Str::limit($lead['busi_name'], 20) }}
@else @endif
@if (!empty($lead['assigned_employee']))
{{ Str::limit($lead['assigned_employee']['name'], 15) }}
@else Unassigned @endif
{{ Str::limit($lead['requirement'] ?? '—', 40) }}
{{ $sourceIcon }} {{ ucfirst($lead['source'] ?? 'Direct') }}
{{ ucfirst($priority) }}
{{ ucfirst($status) }}
{{ \Carbon\Carbon::parse($lead['created_at'])->format('d M, Y') }} {{ \Carbon\Carbon::parse($lead['created_at'])->format('h:i A') }}
@php $lastFollowup = $lead['last_follow_up_at'] ?? null; @endphp @if($lastFollowup) {{ \Carbon\Carbon::parse($lastFollowup)->format('d M, Y') }} {{ \Carbon\Carbon::parse($lastFollowup)->diffForHumans() }} @else Not set @endif

{{ __('No leads found.') }}

@if(isset($meta) && $meta['total'] > 0)
Showing {{ $leads->count() }} of {{ $meta['total'] }} leads
@endif
@endsection