{{-- ══════════════════════════════════════════════════════════════ Channel Bar – Call · Email · SMS ══════════════════════════════════════════════════════════════ --}}
{{-- ── Call ── --}}
{{-- ── Email ── --}}
Email @if($emailValidity) {{ $emailValidity->validity->label() }} @endif
@if($emailValidity?->email)
{{ $emailValidity->email }}
@elseif($emailValidity?->reason)
{{ $emailValidity->reason }}
@else
@endif
@can('communications.send.email') @else @endcan
{{-- ── SMS ── --}}
SMS @if($smsValidity) {{ $smsValidity->validity->label() }} @endif
@if($smsValidity?->phone)
{{ $smsValidity->phone }}
@elseif($smsValidity?->reason)
{{ $smsValidity->reason }}
@else
@endif
@can('communications.send.sms') @else @endcan
{{-- /row --}} {{-- ══════════════════════════════════════════════════════════════ Inline Compose Panel ══════════════════════════════════════════════════════════════ --}} {{-- ══════════════════════════════════════════════════════════════ Activity Feed ══════════════════════════════════════════════════════════════ --}}
Activity
@if($activities->isEmpty())
No activity yet.
@else
@foreach($activities as $activity) @if($activity['kind'] === 'call') @php $comm = $activity['data']; @endphp
{{ $comm->preview ?? 'Voice call' }}
{{ $comm->started_at?->diffForHumans() }} @if($comm->agent)  · {{ $comm->agent->name_first }} @endif @if($comm->recordings->isNotEmpty())  ·  Recorded @endif
$comm->status === 'completed', 'text-bg-danger' => in_array($comm->status, ['failed', 'missed']), 'text-bg-warning' => $comm->status === 'voicemail', 'text-bg-secondary' => !in_array($comm->status, ['completed', 'failed', 'missed', 'voicemail']), ])>{{ ucfirst(str_replace('_', ' ', $comm->status)) }}
{{-- Waveform player for completed recordings --}} @foreach($comm->recordings->where('status', 'completed') as $rec)
Could not load audio.
00:00 / {{ $rec->duration_label }}
{{-- ── Synapse Panel ── --}} @php $st = $rec->synapseTranscript; $cs = $rec->callScore; $hasT = $st && $st->status === 'completed'; $hasS = $cs && $cs->status === 'completed' && $cs->is_initial_call === true; $canExpand = $hasT || $hasS; $autoOpen = $hasS && ($cs->auto_fail || !$cs->passed); $secLabels = [ 'funding_explanation' => 'Funding', 'financial_transparency' => 'Transparency', 'neutral_advice' => 'Neutral Advice', 'client_understanding' => 'Understanding', 'reflection_cancellation'=> 'Reflection', ]; @endphp
{{-- Header bar --}}
{{-- Left: status / badges --}}
@if(!$st) No transcript yet @elseif($st->status === 'processing') Transcribing… @elseif($st->status === 'failed') Transcription failed @elseif(!$cs) Transcript ready @elseif($cs->status === 'processing') Analysing… @elseif($cs->status === 'failed') Analysis failed @elseif($cs->status === 'completed' && $cs->is_initial_call === null) Not Applicable No scoreable content @elseif($cs->status === 'completed' && $cs->is_initial_call === false) Follow-up Compliance scoring not applicable @elseif($cs->status === 'completed' && $cs->is_initial_call === true) Initial Call @if($cs->auto_fail) AUTO FAIL @elseif($cs->passed) PASS @else FAIL @endif {{ $cs->risk_rating_label }} {{ $cs->total_score }}/100 @endif
{{-- Right: icon action buttons + expand toggle --}}
@if($hasT) @endif @if($canExpand) @endif
{{-- Expandable body --}} @if($canExpand)
{{-- Score breakdown --}} @if($hasS) @if($cs->auto_fail && !empty($cs->auto_fail_triggers))
Auto-fail triggers:
@foreach($cs->auto_fail_triggers as $trigger)
{{ $trigger }}
@endforeach
@endif @if($cs->section_scores) @foreach($secLabels as $key => $label) @if(isset($cs->section_scores[$key])) @php $s = $cs->section_scores[$key]; $pct = $s['max'] > 0 ? ($s['score'] / $s['max'] * 100) : 0; $col = $pct >= 100 ? '#16a34a' : ($pct > 0 ? '#d97706' : '#dc2626'); @endphp
{{ $label }}
{{ $s['score'] }}/{{ $s['max'] }}
@endif @endforeach @endif @if($cs->summary)

{{ $cs->summary }}

@endif @if($hasT)
@endif @endif {{-- AI Summary + Sentiment (AssemblyAI) --}} @if($hasT && ($st->ai_summary || $st->sentiment_data))
@if($st->ai_summary)
Summary  {{ $st->ai_summary }}
@endif @if($st->sentiment_data) @php $sb = $st->sentiment_breakdown; @endphp
Sentiment
{{ $sb['positive'] ?? 0 }}% {{ $sb['neutral'] ?? 0 }}% {{ $sb['negative'] ?? 0 }}%
@endif
@endif {{-- Transcript --}} @if($hasT)
{{ $st->formatted_transcript }}
@endif
@endif
{{-- /synapse panel --}} @endforeach
@else @php $msg = $activity['data']; @endphp
{{ $msg->subject ?: Str::limit($msg->body_text, 80) }}
@if($msg->channel->value === 'email') {{ $msg->recipient_email ?? '—' }} @else {{ $msg->recipient_phone ?? '—' }} @endif @if($msg->template)  · via {{ $msg->template->name }} @endif @if($msg->creator)  · {{ $msg->creator->name }} @elseif($msg->origin_type)  · {{ $msg->origin_type->label() }} @endif  · {{ $msg->created_at?->diffForHumans() }}
@if($msg->failure_reason)
{{ $msg->failure_reason }}
@endif
{{ $msg->status->label() }}
@endif @endforeach
@endif
{{-- /activity feed --}}