{{-- ── Thread ─────────────────────────────────────────── --}}
@forelse($messages as $msg) @if($msg['is_private']) {{-- Private note --}}
Private Note · {{ $msg['sender_name'] }} · {{ $msg['time'] }}
{!! $msg['body'] !!}
@elseif($msg['is_customer']) {{-- Customer message — left side --}}
{{ strtoupper(substr($msg['sender_name'], 0, 2)) }}
{{ $msg['sender_name'] }} · {{ $msg['time'] }}
{!! $msg['body'] !!}
@if(!empty($msg['channels']))
@foreach($msg['channels'] as $ch) {{ strtoupper($ch) }}{{ ($ch==='email'&&$msg['sent_via_email'])||($ch==='push'&&$msg['sent_via_push'])||($ch==='sms'&&$msg['sent_via_sms'])||($ch==='whatsapp'&&$msg['sent_via_whatsapp']) ? ' ✓' : '' }} @endforeach
@endif
@else {{-- Admin / system message — right side --}}
{{ $msg['sender_name'] }} · {{ $msg['time'] }} @if(!$msg['is_visible_to_customer']) · hidden from customer @endif
@if($msg['subject'] && $msg['subject'] !== 'Message from Support' && $msg['subject'] !== 'Private Note')
{{ $msg['subject'] }}
@endif {!! $msg['body'] !!}
@if(!empty($msg['channels']))
@foreach($msg['channels'] as $ch) {{ strtoupper($ch) }}{{ ($ch==='email'&&$msg['sent_via_email'])||($ch==='push'&&$msg['sent_via_push'])||($ch==='sms'&&$msg['sent_via_sms'])||($ch==='whatsapp'&&$msg['sent_via_whatsapp']) ? ' ✓' : '' }} @endforeach
@endif
{{ strtoupper(substr($msg['sender_name'], 0, 2)) }}
@endif @empty
No messages yet.
@endforelse
{{-- ── Reply box ───────────────────────────────────────── --}}
{{-- Options row --}}
@if(!$isPrivate) Always sends to notification bell @endif
{{-- Input + send button --}}
@error('body')

{{ $message }}

@enderror