@extends('layouts.main_dashboard.app') @section('title', __('dashboard.General Notifications')) @section('page_heading', __('dashboard.General Notifications')) @section('skip_page_hero', true) @section('content')

{{ __('dashboard.General Notifications') }}

{{ app()->getLocale() === 'ar' ? 'تابع الرسائل العامة المنشورة وراجع القنوات والاستهداف والمرفقات من مكان واحد.' : 'Review published broadcast notifications, channels, targeting, and attachments from one place.' }}

{{ __('dashboard.Notifications Feed') }}

{{ __('dashboard.Review notification targets, attachments, and publication dates.') }}

{{ __('dashboard.Total Notifications') }}

{{ $notifications->total() }}

{{ app()->getLocale() === 'ar' ? 'إشعارات البريد' : 'Email Broadcasts' }}

{{ $notifications->filter(fn ($item) => collect($item->channels ?? [])->contains('email'))->count() }}

{{ __('dashboard.With Attachments') }}

{{ $notifications->filter(fn ($item) => filled($item->attachment))->count() }}

@if($notifications->isEmpty())

{{ __('dashboard.No notifications found.') }}

لا توجد إشعارات عامة منشورة حاليًا.

@else
@foreach($notifications as $item) @endforeach
{{ __('dashboard.Title') }} {{ __('dashboard.Target') }} {{ app()->getLocale() === 'ar' ? 'القنوات' : 'Channels' }} {{ app()->getLocale() === 'ar' ? 'الوصول' : 'Delivery' }} {{ __('dashboard.Attachment') }} {{ __('dashboard.Date') }} {{ __('dashboard.Actions') }}

{{ $item->title }}

{{ \Illuminate\Support\Str::limit($item->description, 80) }}

{{ collect($item->audience_types ?? [])->map(fn ($type) => match ($type) { 'students' => app()->getLocale() === 'ar' ? 'الطلاب' : 'Students', 'teachers' => app()->getLocale() === 'ar' ? 'المدرسون' : 'Teachers', 'subject_heads' => app()->getLocale() === 'ar' ? 'رؤساء الأقسام' : 'Subject Heads', 'social_workers' => app()->getLocale() === 'ar' ? 'الأخصائيون الاجتماعيون' : 'Social Workers', 'health_visitors' => app()->getLocale() === 'ar' ? 'الأخصائيون الصحيون' : 'Health Visitors', default => $type, })->implode('، ') ?: (app()->getLocale() === 'ar' ? 'غير محدد' : 'Unspecified') }}

{{ app()->getLocale() === 'ar' ? 'مراحل:' : 'Stages:' }} {{ collect(data_get($item->target_filters, 'stage_ids', []))->count() }} · {{ app()->getLocale() === 'ar' ? 'صفوف:' : 'Grades:' }} {{ collect(data_get($item->target_filters, 'grade_ids', []))->count() }} · {{ app()->getLocale() === 'ar' ? 'فصول:' : 'Classes:' }} {{ collect(data_get($item->target_filters, 'class_ids', []))->count() }}

@php $channels = $item->channels ?? ['in_app']; @endphp @foreach($channels as $channel) {{ $channel === 'email' ? (app()->getLocale() === 'ar' ? 'بريد' : 'Email') : (app()->getLocale() === 'ar' ? 'داخل النظام' : 'In-App') }} @endforeach

{{ app()->getLocale() === 'ar' ? 'مستلمون:' : 'Recipients:' }} {{ data_get($item->delivery_stats, 'resolved_users', $item->recipients->count()) }}

{{ app()->getLocale() === 'ar' ? 'إيميل ناجح:' : 'Email sent:' }} {{ data_get($item->delivery_stats, 'email_sent', 0) }}

@if($item->attachment) {{ __('dashboard.View') }} @else - @endif {{ $item->created_at->format('Y-m-d') }}
{{ __('dashboard.Edit') }}
@csrf @method('DELETE')
{{ $notifications->links() }}
@endif
@endsection