@extends('admin.admin') @php use Illuminate\Support\Str; @endphp @section('content')
{{ __('All Chats') }}
{{-- IF NO SESSION → Empty Chat Placeholder --}} @if(!$session)
{{ __('No conversation selected') }}

{{ __('Choose a chat from the left panel to view messages.') }}

@else {{-- IF SESSION EXISTS → Full Chat UI --}}
@php $visitorName = $session->visitor_name ?? __('Anonymous User'); $initial = strtoupper(mb_substr($visitorName, 0, 1)); $colorIndex = crc32($visitorName) % count($avatarPalette); $bgColor = $avatarPalette[$colorIndex]; @endphp
{{ $initial }}
{{ $visitorName }}
@php $assignedAgent = $session->assignedAgent; @endphp @if($assignedAgent) @if($assignedAgent->id === auth()->id()) {{ __('Assigned To') }}: {{ __('You') }} @else {{ __('Assigned To') }}: {{ $assignedAgent->name }} @endif @else {{ __('Not assigned') }} @endif
{{ $session->last_activity_at?->diffForHumans() }}
@foreach($session->messages as $message)
@if($message->sender_type === 'admin') {{ $message->sender->name }} @elseif($message->sender_type === 'bot') 🤖 {{ __('Bot') }} @else {{ $session->visitor_name ?? __('User') }} @endif {{ $message->created_at->format('h:i A') }}
{{ $message->message }}
@endforeach
@endif {{-- END SESSION CHECK --}}
{{-- IF NO SESSION → Placeholder UI --}} @if(!$session)
{{ __('No Conversation Selected') }}

{{ __('Select a chat to view visitor details') }}

@else {{-- IF SESSION EXISTS → FULL INFO PANEL --}}
{{ __('Visitor Information') }}
{{ __('Name') }}
{{ __('Email') }}
{{ __('Phone') }}
{{ __('IP Address') }}
{{ __('Session Details') }}
{{ __('Status') }}
{{ __('Started At') }}
{{ __('Last Activity') }}
{{ __('Total Messages') }}
{{ __('Quick Actions') }}
@if(auth()->user()->user_type != 5) @endif
@endif
@endsection @include('chatbot::admin.includes')