@php $cards = [ ['label' => __('Received'), 'value' => number_format((int) $counts->sum()), 'icon' => 'inbox', 'accent' => '#4f46e5', 'sub' => __('Posts kept')], ['label' => __('Created'), 'value' => number_format((int) ($counts['created'] ?? 0)), 'icon' => 'check-circle', 'accent' => '#059669', 'sub' => __('New organisation')], ['label' => __('Duplicate'), 'value' => number_format((int) ($counts['duplicate'] ?? 0)), 'icon' => 'user-group', 'accent' => '#d97706', 'sub' => __('Already on file')], ['label' => __('Failed'), 'value' => number_format((int) ($counts['failed'] ?? 0)), 'icon' => 'exclamation-triangle', 'accent' => '#e11d48', 'sub' => __('Nothing was opened')], ]; $statusColors = ['received' => 'slate', 'created' => 'emerald', 'duplicate' => 'amber', 'failed' => 'rose']; @endphp
@foreach ($cards as $m)

{{ $m['label'] }}

{{ $m['value'] }}

{{ $m['sub'] }}
@endforeach

{{ __('Posts') }}

@if ($canConfigure) {{ __('The address and token a connector uses are in') }} {{ __('CRM Settings') }}. @else {{ __('A director connects Meta, Google or Zapier in CRM Settings. Posts then appear here.') }} @endif

@forelse ($leads as $lead) @if ($openId === $lead->id) @endif @empty @endforelse
{{ __('Arrived') }} {{ __('From') }} {{ __('Status') }} {{ __('Organisation') }} {{ __('Opportunity') }}
{{ $lead->received_at?->timezone(config('app.display_timezone', 'Africa/Harare'))->format('j M Y H:i') }} {{ $lead->source }} {{ __(\App\Models\Crm\IncomingLead::STATUSES[$lead->status] ?? $lead->status) }} {{ $lead->customer?->name ?? ($lead->error ?: __('Not opened')) }} @if ($lead->opportunity) {{ $lead->opportunity->title }} @else {{ __('None') }} @endif
{{ json_encode($lead->payload, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) }}
@if ($leads->hasPages())
{{ $leads->links() }}
@endif