{{-- CRM: the signed-in admin's lead follow-ups due today or overdue (plan 15, task 9). --}} @php $crmAdmin = auth('admin')->user(); $myDue = \App\Models\Crm\Lead::query()->due()->where('assigned_to', $crmAdmin->id); $myDueCount = (clone $myDue)->count(); $myDueLeads = $myDue->orderBy('next_follow_up_at')->limit(5)->get(); $unassignedNew = \App\Models\Crm\Lead::query()->where('status', \App\Models\Crm\Lead::STATUS_NEW)->whereNull('assigned_to')->count(); @endphp

{{ trans('crm.list.my_follow_ups') }} {{ trans('crm.home.summary', ['due' => $myDueCount, 'unassigned' => $unassignedNew]) }}

@forelse ($myDueLeads as $dueLead)
{{ $dueLead->name }} {{ $dueLead->statusLabel() }} ยท {{ \Illuminate\Support\Str::limit((string) $dueLead->interest, 50) }}
{{ $dueLead->next_follow_up_at->format('Y-m-d H:i') }} @if ($dueLead->phone) @endif
@empty
{{ trans('crm.home.none_due') }}
@endforelse