@php $contact = $contact; $company = $company ?? null; $deals = $deals ?? collect(); $timeline = $timeline ?? collect(); $rollup = $rollup ?? ['open_deals' => 0, 'won_value' => 0]; $phone = preg_replace('/\D+/', '', (string) ($contact->country_code . $contact->mobile)); $dispName = (string) ($contact->name ?: trim(($contact->first_name ?? '') . ' ' . ($contact->last_name ?? '')) ?: ($phone ?: '(no name)')); $icon = function ($type) { if (str_starts_with($type, 'message')) return ''; if (str_starts_with($type, 'deal')) return ''; if (str_contains($type, 'call')) return ''; if (str_contains($type, 'task')) return ''; return ''; }; @endphp
{{ __('All contacts') }} {{-- Header --}}
{{ mb_strtoupper(mb_substr($dispName, 0, 1)) }}

{{ $dispName }}

@if ($phone)+{{ $phone }}@endif @if ($contact->email){{ $contact->email }}@endif @if ($company){{ $company->name }}@endif
@if ($contact->tags && $contact->tags->count())
@foreach ($contact->tags as $t) {{ $t->name }} @endforeach
@endif
{{-- Rollup --}}
@foreach ([ ['label' => __('Open deals'), 'value' => number_format($rollup['open_deals'])], ['label' => __('Won revenue'), 'value' => number_format($rollup['won_value'], 2)], ['label' => __('Timeline events'), 'value' => number_format($timeline->count())], ] as $kpi)
{{ $kpi['label'] }}
{{ $kpi['value'] }}
@endforeach
{{-- Activity timeline --}}
{{ __('Activity timeline') }}
@forelse ($timeline as $ev)
{!! $icon($ev['type']) !!}
{{ $ev['title'] }} {{ $ev['at'] }}
@if (!empty($ev['body']))

{{ $ev['body'] }}

@endif
@empty

{{ __('No activity yet for this contact.') }}

@endforelse
{{-- Deals --}}