@extends('layouts.app') @section('title', $lead->customer->name) @section('heading', 'Lead: '.$lead->customer->name) @section('content') @php $c = $lead->customer; @endphp

{{ $lead->stage->label() }} {{ config('crm.sources')[$lead->source] ?? $lead->source }}{{ $lead->source_detail ? ' · '.$lead->source_detail : '' }} · opened {{ $lead->created_at->format('d M Y, H:i') }}

Owner: {{ $lead->assignee?->name ?? 'Unassigned' }} @if (! $lead->assignee) @can('leads.edit')

@csrf
@endcan @endif

Call {{ $c->display_phone }} @if ($c->email)Email@endif @can('customers.view')Customer profile@endcan
{{-- WhatsApp --}} @if ($lead->is_open)

Message on WhatsApp

@csrf
@foreach ($templates as $key => $t)@endforeach

WhatsApp opens with this text ready. You press send there, and the contact is logged here.

@endif {{-- Stage controls --}} @can('leads.edit')

Pipeline

@if ($lead->is_open)
    @foreach (\App\Enums\LeadStage::open() as $s)
  1. @csrf
  2. @endforeach
Mark as won
@csrf
Mark as lost
@csrf
@elseif ($lead->stage === \App\Enums\LeadStage::Won)

Won on {{ $lead->won_at->format('d M Y') }}: {{ $lead->wonVehicle?->display_name }} ({{ $lead->wonVehicle?->stock_id }}) for KSh {{ number_format((float) $lead->won_price) }}.

@else

Lost on {{ $lead->lost_at->format('d M Y') }}: {{ config('crm.lost_reasons')[$lead->lost_reason] ?? $lead->lost_reason }}{{ $lead->lost_note ? ' – '.$lead->lost_note : '' }}.

@csrf
@endif
@endcan {{-- Test drive --}} @if ($lead->is_open) @can('testdrives.manage')

Schedule a test drive

@csrf
@if ($lead->testDrives->count())
    @foreach ($lead->testDrives as $t)
  • {{ $t->scheduled_for->format('D d M, H:i') }} · {{ $t->vehicle->display_name }}{{ ucfirst(str_replace('_', ' ', $t->status)) }}{{ $t->is_signed ? ' · indemnity signed' : '' }}
  • @endforeach
@endif
@endcan @endif {{-- Timeline --}}

Activity

@can('leads.edit') @if ($lead->is_open)
@csrf
@endif @endcan
    @foreach ($lead->activities as $a)
  1. {{ ucfirst(str_replace('_', ' ', $a->type)) }} {{ $a->body }}{{ $a->user?->name ?? 'System' }}
  2. @endforeach
@endsection