@extends('layouts.app') @section('content') @php $isNotificationsTab = $activeTab === 'notifications'; $hasExplicitConversation = filled(request()->query('conversation')); $showMobileConversation = ! $isNotificationsTab && $hasExplicitConversation && filled($selectedConversation); $messageTabParams = ['tab' => 'messages']; if ($hasExplicitConversation && $selectedConversationKey) { $messageTabParams['conversation'] = $selectedConversationKey; } $messageTabUrl = route('messages.index', $messageTabParams); $messageListUrl = route('messages.index', ['tab' => 'messages']); $noticeTabUrl = route('messages.index', ['tab' => 'notifications']); @endphp
@if($isNotificationsTab)
@if($notifications->isEmpty())
No notifications
New updates and alerts will appear here.
@else
@foreach($notifications as $notification) @php $data = is_array($notification->data) ? $notification->data : []; $notificationTitle = $data['title'] ?? $data['message'] ?? class_basename($notification->type); $notificationText = $data['body'] ?? $data['description'] ?? $data['message'] ?? 'You have a new notification.'; @endphp
{{ $notificationTitle }}
{{ $notification->created_at?->diffForHumans() }}
{{ $notificationText }}
@if(is_null($notification->read_at)) Unread @endif
@endforeach
@endif
@else
@if($selectedConversation)
{{ $selectedConversation['partner_name'] }}
{{ $selectedConversation['partner_role'] }} - {{ $selectedConversation['subscription_label'] }}
{{ $selectedConversation['latest_at']?->format('d M Y, h:i A') }}
@foreach($selectedConversation['messages'] as $message)
{{ $message->sender_id === auth()->id() ? 'You' : ($message->sender->name ?? 'Unknown') }}
{{ $message->message }}
{{ $message->created_at->format('d M, h:i A') }}
@endforeach
@csrf
@else
Select a conversation
Open an owner or subscriber conversation from the left. Only chats linked to your subscribed package relationships appear here.
@endif
@endif
@endsection