@extends('layouts.main_dashboard.app') @php $routePrefix = auth()->user()?->usesStaffPortal() ? 'teacher' : 'admin'; $isTeacherPortal = auth()->user()?->usesStaffPortal(); $isArabic = app()->getLocale() === 'ar'; $notificationItems = $notifications->getCollection(); $totalRecipients = $notificationItems->sum(fn ($notification) => $notification->users->count()); $latestNotification = $notificationItems->first(); $draftCount = $notificationItems->where('is_draft', true)->count(); $sentCount = $notificationItems->where('is_draft', false)->count(); @endphp @section('title', $isTeacherPortal ? ($isArabic ? 'إدارة الإشعارات' : 'Notification Management') @section('page_heading', $isTeacherPortal ? ($isArabic ? 'إدارة الإشعارات' : 'Notification Management') : __('dashboard.My Sent Notifications')) @section('skip_page_hero', true) @section('content')

{{ $isTeacherPortal ? ($isArabic ? 'مساحة المدرس' : 'Teacher workspace') : ($isArabic ? 'إدارة الإشعارات' : 'Notification management') }}

{{ $isTeacherPortal ? ($isArabic ? 'إدارة الإشعارات' : 'Notification Management') : __('dashboard.My Sent Notifications') }}

{{ $isTeacherPortal ? ($isArabic ? 'واجهة موحدة لإدارة إشعاراتك: راجع الرسائل التي أرسلتها، تابع عدد المستلمين، وأنشئ إشعارًا جديدًا من نفس الشاشة.' : 'A unified workspace to manage your notifications: review sent messages, track recipient counts, and create a new notification from the same screen.') : __('dashboard.Review and manage the notifications you broadcasted, filter by title, and keep the timeline neat.') }}

{{ $isArabic ? 'إجمالي الإشعارات' : 'Total notifications' }}

{{ number_format($notifications->total()) }}

{{ $isArabic ? 'المستلمون داخل الصفحة' : 'Recipients on page' }}

{{ number_format($totalRecipients) }}

{{ $isArabic ? 'المرسلة' : 'Sent now' }}

{{ number_format($sentCount) }}

{{ $isArabic ? 'آخر إرسال' : 'Latest send' }}

{{ $latestNotification?->created_at?->format('Y-m-d') ?? '—' }}

{{ $isArabic ? 'المسودات' : 'Drafts' }}: {{ number_format($draftCount) }}

{{ $isArabic ? 'سجل الإشعارات' : 'Notification log' }}

{{ $isArabic ? 'الإشعارات الحالية' : 'Current notifications' }}

{{ $isArabic ? 'راجع ما أرسلته وعدّل المحتوى أو احذف الرسائل من نفس الجدول.' : 'Review what you sent, then edit or delete items from the same table.' }}

@if($notificationItems->isEmpty())

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

{{ __('dashboard.You have not sent any notifications yet.') }}

@else
@foreach($notificationItems as $notification) @endforeach
{{ __('dashboard.Title') }} {{ __('dashboard.Recipient Count') }} {{ __('dashboard.Status') }} {{ __('dashboard.Created Date') }} {{ __('dashboard.Actions') }}

{{ $notification->title }}

{{ \Illuminate\Support\Str::limit($notification->body, 120) }}

{{ number_format($notification->users->count()) }} {{ $notification->is_draft ? __('dashboard.Draft') : __('dashboard.Sent') }} {{ $notification->created_at?->format('Y-m-d') ?? '—' }}
{{ __('dashboard.View') }} {{ __('dashboard.Edit') }}
@csrf @method('DELETE')
{{ $notifications->appends(request()->query())->links('pagination::simple-tailwind') }}
@endif
@endsection