@extends('layouts.business') @section('content')

@if($chat->type === 'group') @else @endif {{ $chat->subject }}

{{ $chat->participants->count() }} participant{{ $chat->participants->count() !== 1 ? 's' : '' }}
Back @if(auth()->id() === $chat->created_by)
@csrf @method('DELETE')
@endif
@if(!$chat->is_active) @endif
@forelse($messages as $message)
@if($chat->type === 'group' && $message->sender_id !== auth()->id()) {{ $message->sender->first_name }} {{ $message->sender->last_name }} @endif

{{ $message->content }}

{{ $message->created_at->format('H:i') }}
@empty

No messages yet. Start the conversation!

@endforelse
@if($chat->is_active)
@csrf
@else
This chat is disabled. Messages cannot be sent.
@endif
@endsection