{{-- ══ Panel izquierdo: lista de conversaciones ══ --}}
{{-- Header --}}
Conversaciones
{{-- Búsqueda + filtros --}}
{{-- Lista conversaciones --}}
@forelse($conversaciones as $conv) @empty
Sin conversaciones
@endforelse
{{-- ══ Panel derecho: mensajes ══ --}} @if($convSelec)
{{-- Header conv seleccionada --}}
{{ strtoupper(substr($convSelec->contact?->nombre ?? '?', 0, 1)) }}

{{ $convSelec->contact?->nombre ?? 'Sin nombre' }}

{{ $convSelec->canal === 'telegram' ? 'Telegram' : 'Web' }} · {{ $convSelec->contact?->telefono ?? $convSelec->contact?->canal_id }}

{{-- Acciones --}}
@if($convSelec->estado === 'bot') @elseif($convSelec->estado === 'agente') @endif @if($convSelec->estado !== 'cerrada') @endif
{{-- Mensajes --}}
@forelse($mensajes as $msg) @if ($msg['tipo'] === 'usuario')

{{ $msg['contenido'] }}

{{ $msg['created_at'] }}
@elseif ($msg['tipo'] === 'bot')
Bot

{{ $msg['contenido'] }}

{{ $msg['created_at'] }}
@else
Agente

{{ $msg['contenido'] }}

{{ $msg['created_at'] }}
@endif @empty
Sin mensajes
@endforelse
{{-- Input respuesta (solo en estado agente) --}} @if($convSelec->estado === 'agente')
@elseif($convSelec->estado === 'bot')
El bot está respondiendo. Usa Tomar control para responder manualmente.
@else
Conversación cerrada.
@endif
@else

Selecciona una conversación para ver los mensajes

@endif