@extends('layouts.superadmin') @section('title', 'مركز القضايا الحرجة') @section('page-title', '🧨 مركز القضايا الحرجة — Critical Cases Center') @section('content')
{{-- هيدر ملحمي --}}
مركز مراقبة الأعضاء في وضع خطر

القضايا الحرجة اليوم

هنا تتابع الأعضاء اللي ممكن نخسرهم: غياب متكرر أو طويل، مخالفات قوية، ملفات MemberCare مفتوحة، وكل حالة تحتاج تدخل سريع من الإدارة العليا.

تاريخ اليوم: {{ $today->format('Y-m-d') }} — آخر تحديث: {{ $now->format('H:i') }}

{{-- كروت رقمية سريعة --}}

ملفات MemberCare الدرجة / المفتوحة

{{ $stats['membercare_open'] }}

غيابات طويلة / حساسة (+3 أيام)

{{ $stats['high_absence'] }}

مخالفات خطرة (خصم نقاط)

{{ $stats['critical_violations'] }}

عدد الأعضاء في وضع خطر

{{ $stats['total_risky_members'] }}

{{-- فلاتر بسيطة للأقسام --}}
عرض القضايا حسب النوع: @php $types = [ '' => ['label' => 'الكل', 'icon' => 'fa-layer-group'], 'membercare' => ['label' => 'MemberCare', 'icon' => 'fa-hand-holding-heart'], 'absence' => ['label' => 'الغياب', 'icon' => 'fa-user-clock'], 'violation' => ['label' => 'المخالفات', 'icon' => 'fa-gavel'], ]; @endphp @foreach($types as $key => $meta) @php $isActive = $type === $key || ($key === '' && !$type); @endphp {{ $meta['label'] }} @endforeach
{{-- قائمة القضايا الحرجة اليوم --}}

القضايا الحرجة المسجّلة اليوم

المجموع: {{ $criticalToday->count() }}
@if($criticalToday->isEmpty())
لا توجد قضايا درجة مسجّلة اليوم 🎉
@else
@foreach($criticalToday as $item) @php $user = $item['user'] ?? null; $color = $item['priority'] === 'critical' ? 'red' : ($item['priority'] === 'high' ? 'orange' : 'amber'); $typeLabel = match($item['type']) { 'membercare' => 'ملف MemberCare', 'absence' => 'غياب / عذر', 'violation' => 'مخالفة / إنذار', default => 'قضية', }; $rank = $user->membership_status ?? null; $rankLabel = match($rank) { 'super-admin' => 'إدارة عليا', 'advisor' => 'مستشار', 'admin' => 'إداري', 'moderator' => 'مشرف', 'official' => 'عضو رسمي', 'beta' => 'عضو تجريبي', default => 'عضو', }; $avatarUrl = $user?->profile_photo_url ?? ($user ? 'https://ui-avatars.com/api/?name=' . urlencode($user->name) . '&background=e11d48&color=fff&size=64' : null); @endphp
{{-- صورة العضو + الاسم والرتبة --}}
@if($user)
@if($avatarUrl) {{ $user->name }} @else {{ mb_substr($user->name, 0, 1) }} @endif
@else @endif
{{ $user->name ?? ('عضو #' . ($item['member_id'] ?? '-')) }} @if($user) {{ $rankLabel }} @endif {{ ucfirst($item['priority']) }} {{ $typeLabel }}

{{ $item['title'] }}

@if(!empty($item['description']))

{{ $item['description'] }}

@endif
@if(!empty($item['created_at']))
{{ $item['created_at']->diffForHumans() }}
@endif
@endforeach
@endif
@endsection