@php $activeThreadId = $activeThread?->id; $currentUserId = auth()->id(); @endphp Chat profesional | IRIS
@include('partials.profesional-header', ['title' => 'Chat profesional', 'subtitle' => 'Canal privado entre psicólogos y psiquiatras. Cada conversación se abre por solicitud y se organiza con tags.']) @include('partials.frontend-alerts')
@if($activeThread) @php($other = $activeThread->otherParticipant($currentUserId))
{{ ucfirst($other?->rol ?? 'profesional') }}

{{ $other?->nombre_completo ?? 'Profesional IRIS' }}

{{ $activeThread->topic ?: 'Conversación profesional' }}

@foreach(($activeThread->tags ?? ['general']) as $tag)#{{ $tag }}@endforeach
@forelse($messages as $message) @php($mine = (int) $message->user_id === $currentUserId)
{{ $mine ? 'Tú' : ($message->user?->nombre_completo ?? 'Profesional IRIS') }} {{ $message->created_at?->format('d/m/Y H:i') }}

{{ $message->message }}

@foreach(($message->tags ?? ['general']) as $tag)#{{ $tag }}@endforeach
@empty
Este chat está activo. Envía el primer mensaje.
@endforelse
@csrf
@foreach($availableTags as $tag) @endforeach
@else
💬

Selecciona o solicita un chat

Las conversaciones privadas entre profesionales empiezan cuando la otra persona acepta la solicitud.

@endif