@extends('layouts.superadmin') @section('title','الرسائل — الأعضاء والدعم الفني') @section('content')
{{-- HERO --}}
مركز الرسائل — Members Messages
رسائل خاصة + دعم فني — فلاتر وإحصائيات ومودلات رسمية
{{-- Tabs --}}
الرسائل الخاصة الدعم الفني
@if($behavior==='private') @endif
{{-- FILTERS --}}
{{-- PRIVATE ONLY FILTERS --}} @if($behavior==='private')
@endif {{-- SUPPORT ONLY FILTERS --}} @if($behavior==='support')
@endif
{{-- SUMMARY --}} @if($behavior==='private')
الإجمالي
{{ $privateSummary['total'] ?? 0 }}
غير مقروء
{{ $privateSummary['unread'] ?? 0 }}
مهم
{{ $privateSummary['important'] ?? 0 }}
مؤرشف
{{ $privateSummary['archived'] ?? 0 }}
مع ردود
{{ $privateSummary['with_replies'] ?? 0 }}
أكثر المُرسلين
@forelse($topSenders as $r)
{{ $r->name }} {{ $r->username ? '@'.$r->username : '' }}
{{ $r->c }}
@empty
لا بيانات
@endforelse
أكثر المستلمين
@forelse($topReceivers as $r)
{{ $r->name }} {{ $r->username ? '@'.$r->username : '' }}
{{ $r->c }}
@empty
لا بيانات
@endforelse
@endif @if($behavior==='support')
إجمالي التذاكر
{{ $supportSummary['total'] ?? 0 }}
Open
{{ $supportSummary['open'] ?? 0 }}
Closed
{{ $supportSummary['closed'] ?? 0 }}
@endif {{-- LISTS --}} @if($behavior==='private')
الرسائل الخاصة
عدد النتائج: {{ $privateRows?->total() ?? 0 }}
@if(!$privateRows || $privateRows->isEmpty())
لا رسائل ضمن الفلاتر الحالية.
@else
@foreach($privateRows as $m) @php $isUnread = is_null($m->read_at); $isImp = (bool)$m->important; $isArch = ((int)($m->archived_by_receiver ?? 0) === 1) || ((int)($m->archived_by_sender ?? 0) === 1); @endphp @endforeach
التاريخ الموضوع من إلى حالة ردود أكشن
{{ \Carbon\Carbon::parse($m->created_at)->format('Y-m-d H:i') }}
{{ $m->subject ?: '— بدون عنوان —' }}
{{ \Str::limit($m->body, 90) }}
{{ $m->sender?->name ?? ('#'.$m->sender_id) }}
{{ $m->sender?->username ? '@'.$m->sender->username : '' }}
{{ $m->receiver?->name ?? ('#'.$m->receiver_id) }}
{{ $m->receiver?->username ? '@'.$m->receiver->username : '' }}
@if($isUnread) UNREAD @else READ @endif @if($isImp) ★ IMPORTANT @endif @if($isArch) ARCHIVED @endif {{ (int)($m->replies_count ?? 0) }} {{-- افتح الثريد تبعك --}} Thread
{{ $privateRows->links() }}
@endif
@endif @if($behavior==='support')
تذاكر الدعم الفني
عدد النتائج: {{ $supportThreads?->total() ?? 0 }}
@if(!$supportThreads || $supportThreads->isEmpty())
لا تذاكر ضمن الفلاتر الحالية.
@else
{{ $supportThreads->links() }}
@endif
@endif {{-- ✅ COMPOSE MODAL (Private Messages) --}}
@endsection