@extends('layouts.app') @section('title', $lead->lead_number . ' — ' . $lead->client_name) @section('page-title', 'Lead Detail') @section('content') {{-- Header --}}
{{ $lead->lead_number }} {{ $lead->status_label }} @if($lead->isSold()) Converted @endif
{{ $lead->client_name }}
Edit Lead @if(auth()->user()->isSuperAdmin() || $lead->created_by === auth()->id())
@csrf @method('DELETE')
@endif
{{-- ── Left: Lead Info ─────────────────────────────────────────────── --}}
{{-- Contact Details --}}
Contact Details Edit
@if($lead->phone) @endif @if($lead->whatsapp) @endif @if($lead->telegram_id) @endif @if($lead->lead_source)
Lead Source
{{ ucfirst($lead->lead_source) }}
@endif
@if($lead->services->isNotEmpty())
Services Interested
@foreach($lead->services as $svc) {{ $svc->label }} @endforeach
@endif {{-- Custom Fields --}} @if($lead->customValues->isNotEmpty())
Additional Fields
@foreach($lead->customValues as $cv) @if($cv->field && $cv->value)
{{ $cv->field->field_label }}
{{ $cv->value }}
@endif @endforeach
@endif
{{-- Notes --}}
Notes & Comments {{ $lead->notes->count() }}
{{-- Add Note --}}
@csrf
@if(!auth()->user()->isSalesRep()) @endif

{{-- Notes list --}}
@forelse($lead->notes as $note) @if(!$note->is_private || !auth()->user()->isSalesRep())
{{ $note->author?->name }} {{ $note->author?->role_label }} @if($note->is_private) Private @endif @if($note->is_pinned) Pinned @endif
@if(!auth()->user()->isSalesRep()) @endif @if(auth()->user()->isSuperAdmin() || $note->added_by === auth()->id()) @endif
{!! nl2br(e($note->note)) !!}
{{ $note->created_at->format('M d, Y \a\t H:i') }} · {{ $note->created_at->diffForHumans() }}
@endif @empty

No notes yet. Be the first to add one.

@endforelse
{{-- Activity Log --}}
Activity Log Digital Fingerprint
@forelse($lead->activityLogs as $log)
{{ $log->user_name }} {{ ucfirst(str_replace('_',' ',$log->user_role)) }} — {{ $log->description }}
{{ $log->created_at->format('M d, Y H:i:s') }} @if($log->ip_address) · {{ $log->ip_address }} @endif
@if($log->old_values || $log->new_values)
@if($log->old_values) From: @foreach($log->old_values as $k => $v) {{ $k }}: {{ $v }} @endforeach @endif @if($log->new_values) To: @foreach($log->new_values as $k => $v) {{ $k }}: {{ $v }} @endforeach @endif
@endif
@empty

No activity recorded yet.

@endforelse
{{-- ── Right: Meta Panel ───────────────────────────────────────────── --}}
{{-- Quick Status Update --}}
Update Status

Status changes are auto-saved and logged.

{{-- Lead Meta --}}
Lead Information
Lead # {{ $lead->lead_number }}
Created by {{ $lead->creator?->name ?? '—' }}
Assigned to {{ $lead->assignedTo?->name ?? '—' }}
Created {{ $lead->created_at->format('M d, Y') }}
Last Updated {{ $lead->updated_at->diffForHumans() }}
@if($lead->converted_at)
Converted {{ $lead->converted_at->format('M d, Y') }}
@endif
{{-- Status History --}}
Status History {{ $lead->statusHistory->count() }}
@forelse($lead->statusHistory as $history)
@if($history->old_status) {{ $history->old_status_label }} @endif {{ $history->new_status_label }}
by {{ $history->changedBy?->name ?? 'System' }} · {{ $history->created_at->format('M d, Y H:i') }}
@empty
No history
@endforelse
@endsection @push('scripts') @endpush