@props([ 'approval' => null, 'href' => null, 'compact' => false, ]) @php $task = $approval?->task; $run = $task?->run; $input = $run?->input ?? []; $prospect = $input['prospect'] ?? $input['entity'] ?? []; $icpScore = collect($run?->tasks ?? []) ->first(fn ($t) => ($t->skills_applied[0] ?? null) === 'icp-matcher') ?->output_payload['score'] ?? null; $subject = collect($run?->tasks ?? []) ->first(fn ($t) => ($t->skills_applied[0] ?? null) === 'subject-optimizer') ?->output_payload['subject'] ?? null; $expiresIn = $approval?->expires_at ? max(0, (int) now()->diffInHours($approval->expires_at, false)) : null; $content = (string) ($approval?->edited_content ?? $approval?->original_content ?? ''); $initials = strtoupper(substr((string) ($prospect['name'] ?? $prospect['email'] ?? '?'), 0, 1)); @endphp
merge(['class' => 'bg-surface border border-border rounded-lg p-5']) }} aria-label="Approval for {{ $prospect['name'] ?? $prospect['email'] ?? 'recipient' }}">
{{ $initials }}
{{ $prospect['name'] ?? $prospect['email'] ?? 'Unknown recipient' }}
{{ $prospect['title'] ?? '' }} @if (! empty($prospect['company'])) · {{ $prospect['company'] }} @endif @if (! empty($prospect['country'])) · {{ $prospect['country'] }} @endif
@if ($icpScore !== null) @endif
@if ($subject)
Subject
{{ $subject }}
@endif
{{ $compact ? \Illuminate\Support\Str::limit($content, 240) : $content }}