@extends('layouts.app') @section('title', 'Chat Management') @section('subtitle', 'Monitor all conversations') @section('content')

Chat Management

Monitor all buyer-seller conversations

Total Chats

{{ $stats['total_chats'] }}

Active Chats

{{ $stats['active_chats'] }}

Total Messages

{{ $stats['total_messages'] }}

Today's Messages

{{ $stats['today_messages'] }}

@if(request('search')) Clear @endif

All Conversations

List of all buyer-seller conversations in the system.

@if($chats->count() > 0)
@foreach($chats as $chat) @php $messageCount = $chat->messages()->count(); $unreadCount = $chat->unreadMessages()->count(); @endphp @endforeach
Participants Product Last Message Status Messages Actions
{{ strtoupper(substr($chat->buyer->name, 0, 1)) }}
{{ strtoupper(substr($chat->seller->name, 0, 1)) }}
{{ $chat->buyer->name }} @if($chat->buyer->company_name) ({{ $chat->buyer->company_name }}) @endif
{{ $chat->seller->name }} @if($chat->seller->company_name) ({{ $chat->seller->company_name }}) @endif
{{ Str::limit($chat->product->name, 30) }}
${{ number_format($chat->product->price, 2) }}
@if($chat->last_message) {{ Str::limit($chat->last_message, 50) }} @else No messages yet @endif
@if($chat->last_message_at) {{ $chat->last_message_at->diffForHumans() }} @endif
{{ ucfirst($chat->status) }}
{{ $messageCount }} total @if($unreadCount > 0) {{ $unreadCount }} unread @endif
@csrf @method('DELETE')
@else

No conversations found

@if(request('search')) Try adjusting your search terms. @else There are no conversations in the system yet. @endif

@endif
@if($chats->count() > 0)
{{ $chats->links() }}
@endif
@endsection