@extends('layouts.portal')
@section('title', 'Leads and enquiries')
@section('subtitle', 'Work the pipeline: contact, qualify, quote and convert website enquiries.')
@section('actions') Quotations @endsection
@section('content')
@php
$cur = $filters['status'] ?? '';
$keep = collect($filters)->except('status')->filter()->all();
$tone = ['new' => 'blue', 'contacted' => 'amber', 'qualified' => 'violet', 'application' => 'violet', 'negotiation' => 'amber', 'converted' => 'green', 'lost' => 'red'];
$stageLabel = \App\Services\LeadService::STAGES;
@endphp
All {{ $counts->sum() }}
@foreach($statuses as $st)
{{ $stageLabel[$st] ?? ucfirst($st) }} {{ $counts[$st] ?? 0 }}
@endforeach
Overdue follow-ups {{ $overdueCount }}
@forelse($leads as $l)
{{ initials($l->name) }}
{{ $l->name }} Received {{ $l->created_at->format('d M Y, g:i A') }} · {{ $l->created_at->diffForHumans() }}
{{ $stageLabel[$l->status] ?? ucfirst($l->status) }} Score {{ $l->score }} @if($l->email_verified) ✓ verified @endif @if($l->touches > 1){{ $l->touches }}× enquired @endif {{ ucfirst($l->type ?: 'enquiry') }} @if($l->source){{ $l->source }} @endif
Email @if($l->email){{ $l->email }} @elseNot given @endif
Phone @if($l->phone){{ $l->phone }} · @if($canWhatsApp && ($waPhone = \App\Services\WhatsAppService::normalize($l->phone)))WhatsApp chat @elseWhatsApp @endif
@if($l->whatsapp_opt_out_at) WhatsApp: opted out @elseif($l->whatsapp_opt_in) WhatsApp OK @endif
@elseNot given @endif
@if($l->company)Company {{ $l->company }} @endif
Interested in {{ $l->course?->title ?? 'No specific course' }}
Source {{ $l->utm_source ?? $l->source ?? 'direct' }}{{ $l->utm_medium ? ' / '.$l->utm_medium : '' }}@if($l->utm_campaign) · {{ $l->utm_campaign }} @endif @if($l->offer) · offer “{{ $l->offer->name }}”@endif
@if($l->assignee)Owner {{ $l->assignee->name }} @endif
@if($l->follow_up_at)Follow up {{ $l->follow_up_at->format('d M Y') }} @endif
@if($l->email)
@if($l->convertedEnrollment)
Converted → enrollment {{ $l->convertedEnrollment->code }}
@endif
Enroll {{ $l->name }}
Creates the learner account (with a set-password email) if needed, enrolls into the batch and raises the invoice. Registration confirmation is emailed automatically.
@else
Add an email address to this lead before quoting.
@endif
@csrf
Call WhatsApp Email Meeting Note
Log
@if($canWhatsApp && $l->phone && ! $l->whatsapp_opt_out_at)
Send a WhatsApp template
@csrf
@include('admin.whatsapp._template-picker', ['templates' => $waTemplates, 'pickerId' => 'l'.$l->id])
@if($waTemplates->isNotEmpty())
Send@endif
Free-text replies are in the chat once the customer has written in the last 24 hours.
@csrf
{{ $l->whatsapp_opt_in ? 'Remove WhatsApp consent' : 'Record WhatsApp consent (given by phone / in person)' }}
@endif
@foreach($l->activities as $act)
{{ $act->created_at->format('d M, H:i') }} · {{ ucfirst($act->type) }} {{ \Illuminate\Support\Str::limit($act->body, 140) }}@if($act->user) — {{ $act->user->name }} @endif
@endforeach
@empty
@endforelse
{{ $leads->links() }}
@endsection
@push('scripts')@endpush