@extends('layouts.app') @section('title', 'CRM — Leads') @push('styles') @endpush @section('content')
New Leads
{{ $stats['new'] }}
Contacted
{{ $stats['contacted'] }}
Qualified
{{ $stats['qualified'] }}
Converted
{{ $stats['converted'] }}
Pipeline Value
৳{{ number_format($stats['total_value'], 0) }}
@if(!request()->hasAny(['search','status','source','assigned_to']))
@php $stages = ['new'=>['label'=>'New','class'=>'col-new'],'contacted'=>['label'=>'Contacted','class'=>'col-contacted'],'qualified'=>['label'=>'Qualified','class'=>'col-qualified'],'converted'=>['label'=>'Converted','class'=>'col-converted']]; @endphp @foreach($stages as $stage => $cfg)
{{ $cfg['label'] }} {{ $leads->where('status',$stage)->count() }}
@foreach($leads->where('status',$stage)->take(5) as $lead)
{{ $lead->lead_name }}
{{ $lead->company_name ?? '—' }}
{{ $lead->phone ?? '—' }} @if($lead->estimated_value > 0)৳{{ number_format($lead->estimated_value,0) }}@endif
@endforeach @if($leads->where('status',$stage)->count() > 5)
+{{ $leads->where('status',$stage)->count()-5 }} more
@endif
@endforeach
@endif
@forelse($leads as $lead) @empty @endforelse
Lead NameCompanySourcePhoneAssigned ToEst. ValueStatusPriorityActions
{{ $lead->lead_name }} {{ $lead->company_name ?? '—' }} {{ ucfirst(str_replace('_',' ',$lead->source)) }} {{ $lead->phone ?? '—' }} {{ $lead->assignedTo->name ?? 'Unassigned' }} {{ $lead->estimated_value > 0 ? '৳'.number_format($lead->estimated_value,0) : '—' }} @php $cls=['new'=>'info','contacted'=>'primary','qualified'=>'warning','unqualified'=>'secondary','converted'=>'success','lost'=>'danger']; @endphp {{ ucfirst($lead->status) }} @php $pcls=['low'=>'secondary','medium'=>'warning','high'=>'danger']; @endphp {{ ucfirst($lead->priority) }}
@if($lead->status !== 'converted')
@csrf
@endif
No leads found. Add your first lead
@if($leads->hasPages()) @endif
@endsection