@include('socialbase::components.scrollbar-styles')

Messages

@forelse($conversations as $conversation)
@if($conversation['type'] !== 'system') @endif
@if($conversation['type'] === 'direct' && $conversation['other_user']) {{ $conversation['other_user']['name'] }}

{{ $conversation['other_user']['name'] }}

@if($conversation['unread_count'] > 0) {{ $conversation['unread_count'] }} @endif
@if($conversation['last_message'])

{{ \Illuminate\Support\Str::limit(strip_tags(preg_replace('/\*\*|\*|__|_|~~|`|```|\|\||\[([^\]]+)\]\([^\)]+\)/', '$1', $conversation['last_message']->content)), 50) }}

@endif @if($conversation['last_message_at'])

{{ $conversation['last_message_at']->diffForHumans() }}

@endif
@elseif($conversation['type'] === 'group')
@if(count($conversation['participants']) > 0)
@foreach(array_slice($conversation['participants'], 0, 2) as $participant) @if($participant['avatar']) {{ $participant['name'] }} @else
{{ strtoupper(substr($participant['name'], 0, 1)) }}
@endif @endforeach
@else
@endif

{{ $conversation['subject'] ?? 'Group Chat' }}

({{ $conversation['participants_count'] }})
@if($conversation['unread_count'] > 0) {{ $conversation['unread_count'] }} @endif
@if($conversation['last_message'])

{{ \Illuminate\Support\Str::limit(strip_tags(preg_replace('/\*\*|\*|__|_|~~|`|```|\|\||\[([^\]]+)\]\([^\)]+\)/', '$1', $conversation['last_message']->content)), 50) }}

@endif @if($conversation['last_message_at'])

{{ $conversation['last_message_at']->diffForHumans() }}

@endif
@elseif($conversation['type'] === 'system')

System Messages

@if($conversation['unread_count'] > 0) {{ $conversation['unread_count'] }} @endif
@if($conversation['last_message'])

{{ \Illuminate\Support\Str::limit(strip_tags(preg_replace('/\*\*|\*|__|_|~~|`|```|\|\||\[([^\]]+)\]\([^\)]+\)/', '$1', $conversation['last_message']->content)), 50) }}

@endif
@endif
@empty

No messages yet

@endforelse
@if($selectedConversation) @php $currentConversation = collect($conversations)->firstWhere('id', $selectedConversation); $otherUser = $currentConversation['other_user'] ?? null; @endphp @if($otherUser) @elseif($currentConversation && $currentConversation['type'] === 'group')
@if(count($currentConversation['participants']) > 0)
@foreach(array_slice($currentConversation['participants'], 0, 3) as $participant) @if($participant['avatar']) {{ $participant['name'] }} @else
{{ strtoupper(substr($participant['name'], 0, 1)) }}
@endif @endforeach
@endif

{{ $currentConversation['subject'] ?? 'Group Chat' }} ({{ $currentConversation['participants_count'] }} members)

{{ implode(', ', array_slice(array_column($currentConversation['participants'], 'name'), 0, 3)) }} @if($currentConversation['participants_count'] > 3) and {{ $currentConversation['participants_count'] - 3 }} more @endif

@endif
@forelse($messages as $message)
@if(!$message['is_system']) {{ $message['sender_name'] }} @endif
@if($message['is_system'])
{!! \Paymenter\Extensions\Others\SocialBase\Helpers\MessageFormatter::format($message['content']) !!}

{{ $message['created_at']->format('M j, g:i A') }}

@else
@if(!$message['is_mine'])

{{ $message['sender_name'] }}

@endif @if(!empty($message['content']))
{!! \Paymenter\Extensions\Others\SocialBase\Helpers\MessageFormatter::format($message['content']) !!}
@endif @if(!empty($message['attachments']))
@foreach($message['attachments'] as $index => $attachment) @php $isImage = in_array(strtolower($attachment['extension'] ?? ''), ['jpg', 'jpeg', 'png', 'gif', 'webp']); $isVideo = in_array(strtolower($attachment['extension'] ?? ''), ['mp4', 'mov', 'avi']); $secureUrl = route('socialbase.messages.attachment.download', ['messageId' => $message['id'], 'attachmentIndex' => $index]); @endphp @if($isImage) {{ $attachment['name'] ?? 'Image' }} @elseif($isVideo) @else
{{ $attachment['name'] ?? 'file' }}
{{ strtoupper($attachment['extension'] ?? 'file') }} • {{ number_format(($attachment['size'] ?? 0) / 1024, 1) }} KB
@endif @endforeach
@endif
@if(!$message['is_system'])
@if(!$message['is_mine']) @endif
@endif
@endif @if(isset($message['reactions']) && count($message['reactions']) > 0)
@foreach($message['reactions'] as $type => $reaction) @endforeach
@endif

{{ $message['created_at']->format('g:i A') }}

@empty

No messages yet. Start the conversation!

@endforelse
@php $currentConversation = collect($conversations)->firstWhere('id', $selectedConversation); $isSystemConversation = $currentConversation && $currentConversation['type'] === 'system'; @endphp @if($isSystemConversation)

You can only receive system messages, not send them

@else @if(!empty($attachments))
@foreach($attachments as $index => $attachment)
@php $isImage = in_array(strtolower($attachment->getClientOriginalExtension()), ['jpg', 'jpeg', 'png', 'gif', 'webp']); $isVideo = in_array(strtolower($attachment->getClientOriginalExtension()), ['mp4', 'mov', 'avi']); @endphp @if($isImage) Preview @elseif($isVideo)
@else
{{ $attachment->getClientOriginalExtension() }}
@endif
{{ $attachment->getClientOriginalName() }}
@endforeach
@endif
@error('newMessage')

{{ $message }}

@enderror @error('attachments.*')

{{ $message }}

@enderror @endif
@else

Select a conversation to start messaging

@endif
@if($selectedConversation) @php $currentConversation = collect($conversations)->firstWhere('id', $selectedConversation); $otherUser = $currentConversation['other_user'] ?? null; @endphp @if($otherUser) @endif @endif @if($showMembersModal)

Group Members

Manage your group members

@foreach($groupMembers as $member)
{{ $member['name'] }}

{{ $member['name'] }} @if($member['is_creator']) Creator @endif

{{ $member['email'] }}

@if(!$member['is_creator'] && Auth::id() == collect($conversations)->firstWhere('id', $selectedConversation)['created_by']) @endif
@endforeach
@endif @if($showAddMembersModal)

Add Members

Invite more people to the group

@foreach($availableUsers as $user)
@if(in_array($user['id'], $selectedUsersToAdd)) @endif
{{ $user['name'] }}

{{ $user['name'] }}

@endforeach
@if(count($selectedUsersToAdd) > 0)

{{ count($selectedUsersToAdd) }} {{ count($selectedUsersToAdd) === 1 ? 'user' : 'users' }} selected

@endif
@endif @if($showRenameModal)

Rename Group

Choose a new name for your group

@error('newGroupName')

{{ $message }}

@enderror
@endif @include('socialbase::components.scrollbar-styles')