{{-- Header --}}
@php($otherUsers = $this->conversation?->other_users ?? collect()) @php($firstUser = $otherUsers->first()) @if($otherUsers->count() > 1) {{-- Multiple users display --}}
@foreach($otherUsers->sortByDesc('is_online')->take(3) as $user)
@endforeach
@else @if($firstUser) @else
@endif @endif
@if($otherUsers->count() === 1) {{ $firstUser->name_and_surname }} @elseif($this->conversation->name) {{ $this->conversation->name }} @elseif($otherUsers->count() === 2) {{ $otherUsers->pluck('firstname')->join(', ') }} @else {{ $firstUser->firstname }} +{{ $otherUsers->count() - 1 }} @endif
@if($firstUser && $otherUsers->count() === 1)
@if($firstUser->is_online) {{ __('Active now') }} @else {{ __('Active') }} {{ $firstUser->last_activity?->diffForHumans() ?? __('recently') }} @endif
@endif
{{-- Body --}}
@if($this->messages->count() > 0) @php($previousDate = null) @foreach($this->messages as $message) @if ($previousDate !== $message->created_at->format('d.m.Y'))
@if($message->created_at->isToday()) {{ __('Today') }} @elseif($message->created_at->isYesterday()) {{ __('Yesterday') }} @else {{ $message->created_at->format('d/m/Y') }} @endif
@endif @php($previousDate = $message->created_at->format('d.m.Y')) @endforeach @else
{{ __('No messages yet') }}
{{ __('Start the conversation!') }}
@endif
{{-- Footer --}}