{{-- resources/views/superadmin/notifyhub/dashboard.blade.php --}} @extends('layouts.superadmin') @section('title','NotifyHub — غرفة الإشعارات') @section('content') @php $from = $from ?? now()->subDays(14)->toDateString(); $to = $to ?? now()->toDateString(); $kpis = $kpis ?? (object)[ 'total'=>0,'sent'=>0,'scheduled'=>0,'draft'=>0,'failed'=>0 ]; $typePie = $typePie ?? collect(); $statusPie = $statusPie ?? collect(); $daily = $daily ?? collect(); $latest = $latest ?? collect(); $ai = $ai ?? [ 'total'=>0,'sent'=>0,'scheduled'=>0,'failed'=>0,'fail_rate'=>0, 'tips'=>[ ['title'=>'جاهزين!', 'body'=>'ابدأ بإنشاء إشعار جديد أو فعل القواعد التلقائية.'] ] ]; $route = fn($name) => \Illuminate\Support\Facades\Route::has($name) ? route($name) : '#'; // JSON للرسوم $typeLabels = $typePie->pluck('type')->values(); $typeValues = $typePie->pluck('c')->values(); $statusLabels = $statusPie->pluck('status')->values(); $statusValues = $statusPie->pluck('c')->values(); $daysLabels = $daily->pluck('day')->values(); $daysTotal = $daily->pluck('total_sent')->map(fn($x)=> (int)$x)->values(); $daysFailed = $daily->pluck('failed')->map(fn($x)=> (int)$x)->values(); $badge = [ 'sent' => 'border-emerald-400/25 bg-emerald-500/15 text-emerald-200', 'scheduled' => 'border-sky-400/25 bg-sky-500/15 text-sky-200', 'draft' => 'border-slate-400/25 bg-white/10 text-white/80', 'cancelled' => 'border-rose-400/25 bg-rose-500/15 text-rose-200', 'failed' => 'border-rose-400/25 bg-rose-500/15 text-rose-200', ]; @endphp
{{-- HERO --}}
NotifyHub — مركز الإشعارات • SuperAdmin • Push + Internal

غرفة NotifyHub للإدارة العليا

هنا بتتحكم بكل الإشعارات: يدوي + تلقائي (Rules) + جدولة + سجل قنوات الإرسال — ومع تحليلات AI + עוגות ותרשימים.

Total: {{ number_format((int)($kpis->total ?? 0)) }} Sent: {{ number_format((int)($kpis->sent ?? 0)) }} Scheduled: {{ number_format((int)($kpis->scheduled ?? 0)) }} Failed: {{ number_format((int)($kpis->failed ?? 0)) }}
{{-- FILTER / ACTIONS --}}
فلترة الفترة
مؤشرات + رسوم
@csrf
{{-- تشغيل الجدولة --}} @if(\Illuminate\Support\Facades\Route::has('superadmin.notifyhub.scheduler.run'))
@csrf
@endif
{{-- FLASH --}} @if(session('success'))
{{ session('success') }}
@endif @if(session('error'))
{{ session('error') }}
@endif @if(session('warning'))
{{ session('warning') }}
@endif {{-- KPI CARDS --}}
إجمالي الإشعارات
{{ number_format((int)($kpis->total ?? 0)) }}
Sent
{{ number_format((int)($kpis->sent ?? 0)) }}
Scheduled
{{ number_format((int)($kpis->scheduled ?? 0)) }}
Draft
{{ number_format((int)($kpis->draft ?? 0)) }}
Failed
{{ number_format((int)($kpis->failed ?? 0)) }}
{{-- CHARTS + AI --}}
{{-- עוגות ותרשימים --}}
עוגות ותרשימים
توزيع النوع + الحالة
الرسوم تعتمد على البيانات ضمن الفترة المختارة.
Types
Status
Daily KPIs
الإرسال اليومي + الفشل
خطوط بسيطة لتشخيص الأداء.
{{-- AI TIPS --}}
تحليلات AI
Insights + نصائح
Fail Rate
{{ (float)($ai['fail_rate'] ?? 0) }}%
Sent
{{ number_format((int)($ai['sent'] ?? 0)) }}
Scheduled
{{ number_format((int)($ai['scheduled'] ?? 0)) }}
Failed
{{ number_format((int)($ai['failed'] ?? 0)) }}
@foreach(($ai['tips'] ?? []) as $t)
{{ $t['title'] ?? 'Tip' }}
{{ $t['body'] ?? '' }}
@endforeach
Quick Actions
أوامر سريعة
{{-- LATEST --}}
آخر 10 إشعارات
نظرة سريعة على آخر ما تم إنشاؤه.
عرض الكل
@forelse($latest as $n) @php $st = (string)($n->status ?? 'draft'); $stCls = $badge[$st] ?? 'border-white/10 bg-white/10 text-white/80'; $typ = (string)($n->type ?? 'custom'); @endphp @empty @endforelse
# العنوان Type Audience Status Created
{{ (int)($n->id ?? 0) }}
{{ (string)($n->title ?? '—') }}
{{ \Illuminate\Support\Str::limit((string)($n->body ?? ''), 120) }}
{{ $typ }} {{ (string)($n->audience ?? 'all') }} {{ $st }} {{ !empty($n->created_at) ? \Illuminate\Support\Carbon::parse($n->created_at)->format('Y-m-d H:i') : '—' }}
لا يوجد إشعارات بعد — ابدأ بإنشاء أول إشعار 👑
{{-- Charts --}} @endsection