@extends('layouts.main_dashboard.app') @section('title', app()->getLocale() === 'ar' ? 'لوحة الأخصائية الاجتماعية' : 'Social Worker Dashboard') @section('skip_page_hero', true) @php $isArabic = app()->getLocale() === 'ar'; @endphp @section('content')
{{-- ═══ Hero ═══ --}}
{{ $isArabic ? 'بوابة الأخصائية الاجتماعية' : 'Social Worker Portal' }}

{{ $isArabic ? 'لوحة متابعة الحالات والدعم الاجتماعي' : 'Case Tracking & Social Support Dashboard' }}

{{ $isArabic ? 'متابعة يومية للطلاب الأكثر احتياجًا، الإنذارات المبكرة، الجلسات الإرشادية، والتواصل مع الأسر.' : 'Daily tracking of priority students, early warnings, counseling sessions, and family communication.' }}

@unless($hasScope)

{{ $isArabic ? 'لا يوجد نطاق مسند لهذا الحساب بعد' : 'No scope assigned yet' }}

{{ $isArabic ? 'اربط الأخصائية بمراحل أو صفوف أو فصول ليبدأ النظام بعرض الحالات.' : 'Assign stages, grades, or classes to start seeing cases.' }}

@endunless {{-- ═══ Stats ═══ --}}
@foreach($supportHighlights as $h)

{{ $h['label'] }}

{{ $h['value'] }}

@endforeach
{{-- ═══ Main Grid ═══ --}}
{{-- Left: Priority Students --}}

{{ $isArabic ? 'طلاب بحاجة إلى تدخل قريب' : 'Students needing intervention' }}

{{ $isArabic ? 'مرتبون حسب تكرار الغياب' : 'Sorted by absence frequency' }}

{{ $isArabic ? 'عرض الكل' : 'View all' }}
@forelse($flaggedStudentCards as $s)

{{ $s['student_name'] }}

{{ $s['class_name'] }}

{{ $s['absences_count'] }} {{ $s['risk_label'] }}
@empty

{{ $isArabic ? 'لا توجد حالات حرجة حالياً.' : 'No critical cases right now.' }}

@endforelse
{{-- Right Column --}}
{{-- Quick Actions --}} {{-- Active Alerts --}}

{{ $isArabic ? 'الإنذارات المفتوحة' : 'Active alerts' }}

{{ $isArabic ? 'عرض الكل' : 'View all' }}
@forelse($activeAlertCards as $alert)

{{ $alert['title'] }}

{{ $alert['student_name'] }}

{{ strtoupper($alert['severity']) }}
@empty
{{ $isArabic ? 'لا توجد إنذارات مفتوحة.' : 'No active alerts.' }}
@endforelse
{{-- Today Sessions --}}

{{ $isArabic ? 'جلسات اليوم' : "Today's sessions" }}

{{ $isArabic ? 'كل الجلسات' : 'All sessions' }}
@forelse($todaySessionCards as $session)

{{ $session['student_name'] }}

{{ $session['starts_at_label'] }}

{{ $session['status'] }}
@empty
{{ $isArabic ? 'لا توجد جلسات اليوم.' : 'No sessions today.' }}
@endforelse
{{-- ═══ Trend + Risk ═══ --}}

{{ $isArabic ? 'اتجاه الغياب — آخر 7 أيام' : '7-day absence trend' }}

{{ $isArabic ? 'إجمالي: ' . $totalAbsenceSessions . ' غياب' : 'Total: ' . $totalAbsenceSessions . ' absences' }}

{{ $isArabic ? 'آخر أسبوع' : 'Last week' }}
@foreach($weeklyAbsenceTrendChart as $point)
{{ $point['total'] }} {{ $point['day_label'] }}
@endforeach

{{ $isArabic ? 'أعلى الفصول خطورة' : 'Highest-risk classes' }}

{{ $isArabic ? 'التفاصيل' : 'Details' }}
@forelse($classRiskCards as $class)

{{ $class['name'] }}

{{ $class['students_count'] }} {{ $isArabic ? 'طالب' : 'students' }}

{{ $class['absences_count'] }} {{ $class['risk_label'] }}
@empty

{{ $isArabic ? 'لا توجد بيانات.' : 'No data yet.' }}

@endforelse
@if($gradeAbsenceBars->isNotEmpty())

{{ $isArabic ? 'الغياب حسب الصف' : 'Absences by grade' }}

@foreach($gradeAbsenceBars as $bar)
{{ $bar['grade_name'] }}
{{ $bar['total'] }}
@endforeach
@endif
{{-- ═══ Scope Summary ═══ --}} @if($hasScope)

{{ $isArabic ? 'ملخص النطاق المسند' : 'Assigned scope summary' }}

{{ $isArabic ? 'المراحل' : 'Stages' }}

@forelse($scopeSummary['stages'] as $item) {{ $item }} @empty {{ $isArabic ? 'لا يوجد' : 'None' }} @endforelse

{{ $isArabic ? 'الصفوف' : 'Grades' }}

@forelse($scopeSummary['grades'] as $item) {{ $item }} @empty {{ $isArabic ? 'لا يوجد' : 'None' }} @endforelse

{{ $isArabic ? 'الفصول' : 'Classes' }}

@forelse($scopeSummary['classes'] as $item) {{ $item }} @empty {{ $isArabic ? 'لا يوجد' : 'None' }} @endforelse
@endif
@endsection