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

{{-- --}}
{{ __('labels.recent_chats') }}
{{ count($chats) }}
@if($chats->count()) @foreach($chats as $chat) @php $user = $chat->users->where('id', '!=', auth()->id())->first(); $source = $chat?->group?->name ?? $user?->name ?? $chat?->creator?->name ?? 'U'; $initials = mb_strtoupper(mb_substr($source, 0, 2)); $bgColors = ['bg-primary', 'bg-success', 'bg-warning', 'bg-danger', 'bg-info']; $bgColor = $bgColors[array_rand($bgColors)]; @endphp
@if($chat?->chat_type === 'group')
{{ optional($chat->group)->members_count ?? 0 }} @else @if(!empty($user?->profile_image)) {{ $user->name }} @else
{{ $initials }}
@endif @endif @if(isset($chat->user_status) && $chat->user_status === 'online') @endif
{{ $chat->chat_type === 'group' ? optional($chat->group)->name : optional($user)->name }}
@if($chat?->latestMessage) {{ $chat?->latestMessage?->created_at->format('h:i A') }} @endif
@if($chat?->latestMessage)

{{ Str::limit(optional($chat->latestMessage)->content, 25) }}

@else

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

@endif
@if($chat?->unread_count)
{{ $chat->unread_count }}
@endif
@endforeach @else

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

{{-- --}}
@endif
{{ __('labels.groups') }}
{{ count($groups) }}
@forelse($groups as $group)
@php $bgColors = ['bg-gradient-primary', 'bg-gradient-success', 'bg-gradient-warning', 'bg-gradient-danger']; $bgColor = $bgColors[$loop->index % count($bgColors)]; @endphp
{{ $group->members_count ?? 0 }}
{{ $group?->name }}
@if($group?->chat?->latestMessage) {{ $group?->chat?->latestMessage?->created_at->format('h:i A') }} @endif
@if($group?->chat?->latestMessage)

{{ Str::limit(optional($group->chat->latestMessage)->content, 25) }}

@else

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

@endif
@if($group?->chat?->unreadCunt)
{{ $group->chat->unreadCunt }}
@endif
@empty

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

{{-- --}}
@endforelse
{{ __('labels.active_now') }}
{{ count($chatUsers) }}
@forelse($chatUsers as $user)
@php $initials = mb_strtoupper(mb_substr($user->name ?? 'U', 0, 2)); $bgColors = ['bg-primary', 'bg-success', 'bg-info', 'bg-warning']; $bgColor = $bgColors[$loop->index % count($bgColors)]; @endphp @if(!empty($user?->profile_image)) {{ $user->name }} @else
{{ $initials }}
@endif
{{ $user->name }}
{{ __('labels.online') }}
@empty

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

@endforelse