@extends('client.layouts.dashboard') @section('title', 'Lead Details: ' . ($lead->contact_name ?: $lead->phone_number)) @section('styles') @endsection @section('content')
Back to Leads
{{-- Left Column: Lead Info and Status Updates --}}
{{-- Profile Card --}}
Lead Profile
{{ \App\Models\Lead::statusLabel($lead->status_key) }}
Contact Name
{{ $lead->contact_name ?: 'Unknown' }}
Assigned Agent
@if($lead->user) {{ $lead->user->name }} @else Unassigned @endif
Priority
@if($lead->priority) {{ $lead->priority }} @else @endif
Lead Source
{{ ucfirst($lead->source ?: 'Organic') }}
Created At
{{ $lead->created_at->format('M d, Y h:i A') }}
@if($lead->status_note)
Latest Status Note

{{ $lead->status_note }}

@endif
{{-- Status Update Form --}}
Update Lead Status
@csrf @method('PUT')
Schedule Follow-up Task
@php $followUpVal = ''; if ($lead->next_follow_up_at) { $followUpVal = $lead->next_follow_up_at->format('Y-m-d\TH:i'); } @endphp
{{-- Activity Timeline --}}
Activity Log
@if($lead->activities->isEmpty())

No activity logs recorded yet.

@else
@foreach($lead->activities as $activity)
@if($activity->activity_type === 'status_change') @elseif($activity->activity_type === 'reminder_set') @elseif($activity->activity_type === 'reminder_completed') @else @endif
{{ ucfirst(str_replace('_', ' ', $activity->activity_type)) }} {{ $activity->created_at->diffForHumans() }}

{{ $activity->description }}

@if($activity->user) Logged by: {{ $activity->user->name }} @endif
@endforeach
@endif
{{-- Right Column: Call logs, messages, and reminders --}}
{{-- Reminders Widget --}}
Scheduled Reminders
@forelse($lead->reminders as $reminder) @empty @endforelse
Reminder Title Schedule Date Status Actions
{{ $reminder->title }}
@if($reminder->note) {{ $reminder->note }} @endif
{{ $reminder->remind_at->format('M d, Y h:i A') }} @if($reminder->is_completed) Done @elseif($reminder->isOverdue()) Overdue @else Pending @endif @if(!$reminder->is_completed)
@csrf @method('PUT')
@else Completed {{ $reminder->completed_at ? $reminder->completed_at->format('M d') : '' }} @endif
No reminders scheduled for this lead.
{{-- Call Logs Timeline --}}
Call History Logs
@forelse($callLogs as $call) @empty @endforelse
Call Type Agent / Device Call Time Duration Annotation
{{ $call->call_type_formatted }}
{{ $call->user->name ?? 'Unknown Agent' }}
{{ $call->device_name ?: 'Device' }}
{{ $call->call_time->format('M d, Y h:i A') }} {{ gmdate('H:i:s', $call->call_duration) }} @if($call->status_key)
{{ $call->status_label }} @if($call->status_note) @endif
@else @endif
No call history logs found for this number.
{{-- SMS / Messaging Logs --}}
Messaging Activity
@forelse($smsLogs as $sms) @empty @endforelse
Channel Message Preview Agent Delivery Status Sent Time
@if($sms->channel === 'whatsapp') WhatsApp @else SMS @endif
{{ $sms->message_body }}
@if($sms->template_name) Template: {{ $sms->template_name }} @endif
{{ $sms->user->name ?? 'System' }} @if($sms->status === 'delivered') Delivered @elseif($sms->status === 'sent') Sent @elseif($sms->status === 'failed') Failed @else {{ $sms->status ?: 'Pending' }} @endif {{ $sms->sent_at ? $sms->sent_at->format('M d, g:i A') : $sms->created_at->format('M d, g:i A') }}
No messaging activity found for this number.
@endsection @section('scripts') @endsection