@if($activeChat)
@php $isGroup = $activeChat->chat_type === 'group'; $activeChatName = $isGroup ? optional($activeChat->group)->name : $activeChat?->other_participant?->name; $initials = strtoupper(substr($activeChatName ?? 'C', 0, 2)); $bgColor = $isGroup ? 'bg-gradient-success' : 'bg-gradient-primary'; $isOnline = !$isGroup ? $activeChat?->other_participant?->is_online : false; @endphp {{--
@if($isGroup) @else {{ $initials }} @endif
--}} @if($activeChat?->chat_type === 'group')
{{-- {{ optional($activeChat->group)->members_count ?? 0 }} --}} @else @if(!empty($activeChat?->other_participant?->profile_image)) {{ $activeChat?->other_participant?->name }} @else
{{ $initials }}
@endif @if($isOnline) @else {{-- --}} @endif @endif

{{ $activeChatName }}

@if($isOnline) {{ __('labels.online') }} @else {{-- {{ __('labels.offline') }} --}} @endif @if($isGroup) {{ optional($activeChat->group)->members()->count() ?? 0 }} {{ __('labels.members') }} @endif
@else

{{ __('labels.select_chat') }}

{{ __('labels.select_chat_message') }}

@endif {{-- --}}
@if(isset($activeChat?->sentMessages)) @foreach($activeChat?->sentMessages as $message) @if($message->user_id === auth()->id())
{{ $message->content }}
@if($message->attachments && $message->attachments->count())
@foreach($message->attachments as $attachment) {{ \Illuminate\Support\Str::limit($attachment->original_name, 25) }} @endforeach
@endif {{ $message->created_at->format('h:i A') }}
@else
{{ $message?->sender?->name ?? 'sender' }}
{{ $message?->sender?->name ?? 'sender' }}
{{ $message->content }}
@if($message->attachments && $message->attachments->count())
@foreach($message->attachments as $attachment) {{ \Illuminate\Support\Str::limit($attachment->original_name, 25) }} @endforeach
@endif {{ $message->created_at->format('h:i A') }}
@endif @endforeach @endif
@if(!$activeChat || !count($activeChat->messages ?? []))

{{ __('labels.no_messages_yet') }}

{{ __('labels.start_conversation') }}

@endif
{{-- --}} {{-- --}} {{-- --}} {{-- --}} {{-- --}} {{-- --}}
{{--
{{ __('labels.press_enter_send') }}
--}}