@if($openMessage)
@php
$isInbound = $openMessage->direction?->value === 'inbound';
$isEmail = $openMessage->channel?->value === 'email';
@endphp
{{-- ── Offcanvas header ── --}}
@if($isInbound)
@else
@endif
{{ $openMessage->subject ?: '(no subject)' }}
{{-- ── Meta grid ── --}}
@if($isInbound)
| From |
{{ $openMessage->from_email ?? '—' }} |
@else
| To |
{{ $isEmail ? ($openMessage->recipient_email ?? '—') : ($openMessage->recipient_phone ?? '—') }}
@if($openMessage->recipient_name)
({{ $openMessage->recipient_name }})
@endif
|
@if($openMessage->senderEmail)
| From |
{{ $openMessage->senderEmail->email }} |
@endif
@endif
| Date |
{{ $openMessage->created_at?->format('d M Y, H:i') }} |
@if(!$isInbound && $openMessage->template)
| Template |
{{ $openMessage->template->name }} |
@endif
@if(!$isInbound && $openMessage->creator)
| Sent by |
{{ $openMessage->creator->name }} |
@endif
@if(!$isInbound && $openMessage->origin_type && !$openMessage->creator)
| Origin |
{{ $openMessage->origin_type->label() }} |
@endif
{{-- ── Badges row ── --}}
@if(!$isInbound && $openMessage->status)
{{ $openMessage->status->label() }}
@endif
@if($isInbound && $openMessage->classification === 'dsar_response')
DSAR Response
@elseif($isInbound && $openMessage->classification === 'generic')
Generic
@elseif($isInbound && $openMessage->classification)
{{ $openMessage->classification }}
@endif
@if($openMessage->classification_confidence)
{{ ucfirst($openMessage->classification_confidence) }} confidence
@endif
@if($openMessage->channel)
{{ ucfirst($openMessage->channel->value) }}
@endif
@if($openMessage->provider)
{{ ucfirst($openMessage->provider->value) }}
@endif
{{-- Synapse reasoning --}}
@if($openMessage->classification_notes)
{{ $openMessage->classification_notes }}
@endif
{{-- Failure reason --}}
@if($openMessage->failure_reason)
{{ $openMessage->failure_reason }}
@endif
{{-- Delivery tracking (outbound only) --}}
@if(!$isInbound && $openMessage->events->isNotEmpty())
Delivery Tracking
@foreach($openMessage->events as $event)
@php
$ip = $event->payload['ip'] ?? null;
$ua = $event->payload['useragent'] ?? $event->payload['user_agent'] ?? null;
$url = $event->payload['url'] ?? null;
$reason = $event->payload['reason'] ?? $event->payload['response'] ?? null;
@endphp
{{ $event->event_type->label() }}
{{ $event->occurred_at?->format('d M Y, H:i') }}
@if($ip || $ua)
@if($ip){{ $ip }}@endif
@if($ua){{ $ua }}@endif
@endif
@if($url)
{{ Str::limit($url, 60) }}
@endif
@if($reason)
{{ Str::limit($reason, 100) }}
@endif
@endforeach
@elseif(!$isInbound)
{{-- Timestamps summary if no detailed events --}}
@php
$stamps = array_filter([
'Queued' => $openMessage->queued_at,
'Sent' => $openMessage->sent_at,
'Delivered' => $openMessage->delivered_at,
'Opened' => $openMessage->opened_at,
'Failed' => $openMessage->failed_at,
]);
@endphp
@if(count($stamps) > 0)
Delivery Timeline
@foreach($stamps as $label => $ts)
{{ $label }}:
{{ $ts->format('d M Y H:i') }}
@endforeach
@endif
@endif
{{-- Email body --}}
@if($openMessage->body_html)
@elseif($openMessage->body_text)
{{ $openMessage->body_text }}
@else
No message body.
@endif
{{-- Attachments --}}
@if($openMessage->attachments->isNotEmpty())
Attachments ({{ $openMessage->attachments->count() }})
@foreach($openMessage->attachments as $att)
{{ $att->filename }}
{{ $att->mime ?? 'unknown type' }}
@if($att->size)
· {{ number_format($att->size / 1024, 1) }} KB
@endif
@if($att->extraction_status === 'completed')
· Text extracted
@endif
@if($att->extraction_status === 'completed' && !empty($att->extracted_text))
View extracted text
{{ $att->extracted_text }}
@endif
@endforeach
@endif
{{-- Provider message ID / thread info --}}
@if($openMessage->provider_message_id || $openMessage->thread_key)
@if($openMessage->provider_message_id)
Provider ID: {{ $openMessage->provider_message_id }}
@endif
@if($openMessage->thread_key)
Thread: {{ $openMessage->thread_key }}
@endif
@endif
{{-- /offcanvas-body --}}
@else
{{-- Loading skeleton --}}