@extends('layouts.app') @section('title', 'Conversation: ' . ($conversation->subject ?? 'Messages')) @section('content')
{{-- Breadcrumb --}}

{{ $conversation->subject ?? 'Conversation' }}

{{-- Conversation Panel --}}
@php $userId = auth()->id(); $otherUser = (int) $conversation->sender_id === (int) $userId ? $conversation->receiver : $conversation->sender; $otherName = $otherUser?->username ?: trim(($otherUser?->first_name ?? '') . ' ' . ($otherUser?->last_name ?? '')) ?: 'Unknown User'; @endphp
{{-- Header --}}
@if($otherUser?->avatar) {{ $otherName }} @else
{{ strtoupper(substr($otherName, 0, 2)) }}
@endif
{{ $otherName }}
@if($otherUser?->email) {{ $otherUser->email }} @endif
@if($conversation->product) {{ Str::limit($conversation->product->details->first()?->title ?? 'Product', 30) }} @endif
{{-- Messages --}}
@forelse($messages as $message) @include('account.messages.partials.message-bubble', [ 'message' => $message, 'userId' => $userId, ]) @empty
No messages in this conversation
@endforelse
{{-- Pagination --}} @if($messages->hasPages()) @endif {{-- Reply Form --}}
{{-- Sidebar --}}
Conversation Details
Started
{{ $conversation->created_at?->format('M d, Y') ?? 'N/A' }}
Last Update
{{ $conversation->updated_at?->diffForHumans() ?? 'N/A' }}
Messages
{{ number_format($messages->total()) }}
@if($conversation->product)
Product
{{ Str::limit($conversation->product->details->first()?->title ?? 'Product', 30) }}
@endif
Safety Tip: Keep all communication on this platform. Never share personal or financial information.
{{-- Hidden Form for Delete --}} @endsection @push('styles') @endpush @push('scripts') @endpush