@php $colors = ['facebook' => '#1877f2', 'instagram' => '#d62976', 'tiktok' => '#22d3ee', 'youtube' => '#ef4444', 'linkedin' => '#0a66c2', 'threads' => '#a855f7']; @endphp
@foreach ($platforms as $key => $label)
{{ strtoupper(substr($label, 0, 2)) }}
{{ number_format($totals[$key]) }}
{{ $label }}
@endforeach
@forelse ($rows as $r) @php($acc = is_array($r->accounts) ? $r->accounts : (json_decode($r->accounts, true) ?: [])) @empty @endforelse
Customer Connected platforms Total Last reported
{{ strtoupper(substr($r->name ?: $r->email, 0, 1)) }}
{{ $r->name }}
{{ $r->email }}
@forelse ($acc as $p => $n) @if ($n > 0) {{ ucfirst($p) }} · {{ $n }} @endif @empty none @endforelse
{{ array_sum($acc) }} {{ $r->reported_at ? \Carbon\Carbon::parse($r->reported_at)->diffForHumans() : '—' }}
No connected accounts reported yet.
{{ $rows->links('pagination.dark') }}
{{-- Linked accounts detail modal --}} @if ($viewingUser) {{-- NOTE: use only the inline parenthesised php directive in this file; a block form here would mis-pair with the inline calls above and swallow the table during compilation. --}} @php($accountColors = \App\Services\UserDashboardMetrics::PLATFORM_META) @php($statusChip = ['connected' => 'bg-green-500/15 text-green-400', 'token_expired' => 'bg-amber-500/15 text-amber-400', 'error' => 'bg-red-500/15 text-red-400', 'disabled' => 'bg-slate-500/15 text-slate-400']) @php($reportedTotal = is_array($viewingUser->usage?->accounts) ? array_sum($viewingUser->usage->accounts) : 0)
{{ strtoupper(mb_substr($viewingUser->name ?? $viewingUser->email, 0, 1)) }}

Linked accounts — {{ $viewingUser->name ?? $viewingUser->email }}

{{ $viewingUser->email }} · {{ $viewingUser->socialAccounts->count() }} synced {{ \Illuminate\Support\Str::plural('account', $viewingUser->socialAccounts->count()) }}

@forelse ($viewingUser->socialAccounts as $a) @php([$pLabel, $pColor, $pShort] = $accountColors[$a->platform] ?? [ucfirst($a->platform), '#64748b', strtoupper(substr($a->platform, 0, 2))])
{{ $pShort }}
{{ '@'.$a->username }} {{ str_replace('_', ' ', ucfirst($a->status)) }}
{{ $pLabel }} @if ($a->display_name)·{{ $a->display_name }}@endif ·{{ ucfirst($a->role) }} @if ($a->connected_at)·connected {{ $a->connected_at->diffForHumans() }}@endif
Account ID
{{ $a->desktop_id }}
@empty
@if ($reportedTotal > 0) This customer's desktop reports {{ $reportedTotal }} connected {{ \Illuminate\Support\Str::plural('account', $reportedTotal) }}, but their app hasn't synced per-account details yet (needs a desktop version that calls /me/accounts). @else No accounts synced for this customer yet. @endif
@endforelse
@endif