@extends('layouts.app') @section('title', $lead->reference) @php $order = ['new' => 0, 'qualified' => 1, 'converted' => 2]; $cur = $order[$lead->status] ?? -1; // 'lost' => -1 @endphp @section('content') {{ __('leads.statuses.' . $lead->status) }} @can('applications.create') @if($lead->application) {{ __('leads.already_converted') }} @else {{ __('leads.convert') }} @endif @endcan @can('leads.edit') {{ __('app.edit') }} @endcan {{ __('app.back') }} {{-- Overdue follow-up alert --}} @if($lead->isFollowUpOverdue())
{{ __('leads.follow_up') }} — {{ __('leads.overdue') }}: {{ $lead->next_follow_up_at->format('Y-m-d') }}
@endif {{-- Pipeline stepper --}}
{{ __('leads.pipeline') }}
@foreach(['new' => 'qualified', 'qualified' => 'converted', 'converted' => null] as $step => $_) @php $i = $order[$step]; $cls = $lead->status === 'lost' ? '' : ($i < $cur ? 'done' : ($i === $cur ? 'current' : '')); @endphp
@if($cls === 'done')@endif {{ __('leads.statuses.' . $step) }}
@endforeach @if($lead->status === 'lost')
{{ __('leads.statuses.lost') }}
@endif
{{-- KPI strip --}}
{{ __('leads.estimated_amount') }}
{{ $lead->source ? __('leads.sources.' . $lead->source) : '—' }}
{{ __('leads.source') }}
{{ $lead->next_follow_up_at ? $lead->next_follow_up_at->format('Y-m-d') : '—' }}
{{ __('leads.next_follow_up') }}
{{ optional($lead->owner)->name ?? '—' }}
{{ __('leads.owner') }}
{{ $lead->reference }} {{ $lead->contact_name }} {{ $lead->contact_phone }} {{ $lead->contact_email }} {{ optional($lead->financeProduct)->name }} {{ $lead->created_at->format('Y-m-d') }} {{ $lead->notes }} {{-- Quick status change --}} @can('leads.edit')
@csrf @method('PATCH')
@endcan
{{-- Linked customer --}}
@if($lead->customer)
{{ $lead->customer->name }}
{{ $lead->customer->national_id ?: $lead->customer->phone }}
@can('customers.view') {{ __('app.view') }} @endcan
@else
{{ __('app.no_related') }}
@endif
{{-- Linked application --}}
@if($lead->application)
{{ $lead->application->application_number }}
@include('applications.partials.status_badge', ['status' => $lead->application->status])
@can('applications.view') {{ __('app.view') }} @endcan
@else
{{ __('app.no_related') }}
@can('applications.create') @unless($lead->status === 'lost') {{ __('leads.convert') }} @endunless @endcan
@endif
@endsection