@extends('dashboard.admin.layouts.master') @php use App\Models\Crm\Lead; use App\Models\Crm\LeadActivity; $me = auth('admin')->user(); $canEdit = $me->can('crm.leads.edit'); $whatsapp = $lead->whatsappNumber(); @endphp @section('toolbar')

{{ $lead->name }} {{ $lead->statusLabel() }}

@if ($lead->phone) {{ trans('crm.list.call') }} @endif @if ($whatsapp) WhatsApp @endif @if (Route::has('admin.dashboard.crm.leads.convert') && $lead->isOpen() && $canEdit && $me->can('clinic.bookings.create'))
@csrf
@endif @if (Route::has('admin.dashboard.crm.leads.edit') && $canEdit) {{ trans('crm.show.edit') }} @endif
@endsection @section('content')
@if (session('success'))
{{ session('success') }}
@endif @if ($errors->any())
@endif
{{-- Side column: who, and the controls. --}}
{{ trans('crm.show.phone') }}{{ $lead->phone ?: '—' }}
{{ trans('crm.show.email') }}{{ $lead->email ?: '—' }}
{{ trans('crm.show.address') }}{{ $lead->address ?: '—' }}
{{ trans('crm.show.interest') }}{{ $lead->offer?->title ?? ($lead->interest ?: '—') }}
{{ trans('crm.show.created') }}{{ $lead->created_at?->format('Y-m-d H:i') }}
@if ($lead->first_contacted_at)
{{ trans('crm.show.first_contact') }}{{ $lead->first_contacted_at->format('Y-m-d H:i') }}
@endif
{{-- Status --}}

{{ trans('crm.list.status') }}

@if ($lead->status === Lead::STATUS_CONVERTED)
{{ trans('crm.show.already_converted') }}
@elseif ($canEdit)
@csrf @method('PATCH')
@else {{ $lead->statusLabel() }} @endif
{{-- Assignee --}}

{{ trans('crm.list.assignee') }}

@can('crm.leads.assign')
@csrf @method('PATCH')
@else
{{ $lead->assignee?->name ?? trans('crm.list.unassigned') }} @if ($canEdit && $lead->isOpen() && (int) $lead->assigned_to !== (int) $me->id)
@csrf @method('PATCH')
@endif
@endcan
{{-- Next follow-up --}}

{{ trans('crm.list.next_follow_up') }}

@if ($lead->isOverdue())
{{ trans('crm.list.overdue') }}
@endif @if ($canEdit && $lead->isOpen())
@csrf @method('PATCH')
@else {{ $lead->next_follow_up_at?->format('Y-m-d H:i') ?? '—' }} @endif
{{-- Main column: log, requests, timeline. --}}
@if ($canEdit)

{{ trans('crm.show.log_title') }}

@csrf
@foreach (['call' => 'bi-telephone', 'whatsapp' => 'bi-whatsapp', 'note' => 'bi-chat-left-text'] as $type => $icon) @endforeach
@foreach (LeadActivity::CALL_OUTCOMES as $outcome) @endforeach
@endif

{{ trans('crm.show.requests_title', ['count' => count($requests)]) }}

@forelse ($requests as $item) @include('dashboard.admin.crm.leads.partials.request', ['item' => $item]) @empty
{{ trans('crm.show.no_requests') }}
@endforelse

{{ trans('crm.show.timeline') }}

@include('dashboard.admin.crm.leads.partials.timeline', ['activities' => $lead->activities])
@endsection @section('js') @endsection