@extends('layouts.superadmin')
@section('title', 'لوحة تحكم الإدارة العليا')
@section('page-title', 'لوحة التحكم الرئيسية')
@section('content')
@php
use Illuminate\Support\Facades\DB;
use Carbon\Carbon;
$user = auth()->user();
$enableMemberCareWidget =
($showMemberCareWidget ?? true) && isset($memberCareWidgetCases) && $memberCareWidgetCases->isNotEmpty();
$latestFalconNotes = DB::table('falcon_rola_notes')->orderBy('created_at', 'desc')->limit(3)->get();
$tz = config('app.timezone', 'Asia/Jerusalem');
$next = $nextSchedule ?? null;
if ($next) {
$title = $next->event_title ?? 'فعالية ProActive القادمة';
$type = $next->event_type ?? 'regular'; // regular|plus
$typeTxt = $type === 'plus' ? '+Plus' : 'عادية';
$date = Carbon::parse($next->event_date, $tz);
$dateStr = $date->format('Y-m-d');
$dayName = $date->locale('ar')->dayName;
$hostName = $next->leader_name ?? '—';
$isToday = $date->isToday();
} else {
$title = 'فعالية ProActive القادمة';
$type = 'regular';
$typeTxt = 'عادية';
$dateStr = '—';
$dayName = '—';
$hostName = '—';
$isToday = false;
}
@endphp
{{-- =================== Taateer Expiry Alerts Widget =================== --}}
@if(isset($taateerExpiryWidget) && $taateerExpiryWidget)
@php
$tw = $taateerExpiryWidget;
$danger = $tw['danger'] ?? collect(); // <= 24h (إنذار)
$warning = $tw['warning'] ?? collect(); // <= 48h (تنبيه)
$expired = $tw['expired'] ?? collect(); // منتهي
$safe = $tw['safe'] ?? collect(); // بأمان
$counts = $tw['counts'] ?? ['danger'=>0,'warning'=>0,'expired'=>0,'safe'=>0,'needs_action'=>0];
$rb = $tw['roleBreakdown'] ?? ['admin'=>0,'supervisor'=>0,'member'=>0];
$hasDanger = ($counts['danger'] ?? 0) > 0 || ($counts['expired'] ?? 0) > 0;
$tzDash = config('app.timezone','Asia/Jerusalem');
$taateerRoute = \Illuminate\Support\Facades\Route::has('superadmin.taateer.index')
? route('superadmin.taateer.index')
: '#';
@endphp
{{-- =========================
✅ Ramadan Epic Competition Boards (Only #9/#10)
✅ No "use" anywhere
✅ Collapsible + Member/Guest + Today/Total + Yesterday Champion 👑 under name
========================= --}}
@php
$tz = config('app.timezone', 'Asia/Jerusalem');
$today = \Carbon\Carbon::now($tz)->toDateString();
$yesterday = \Carbon\Carbon::now($tz)->subDay()->toDateString();
$scoreTable = 'ramadan_competition_score_events';
$seasonTable = 'ramadan_seasons';
$linksTable = 'ramadan_competition_links';
$competitionsTable = 'competitions';
$visitorsTable = 'ramadan_visitors';
$usersTable = 'users';
$seasonId = null;
if (\Illuminate\Support\Facades\Schema::hasTable($seasonTable)) {
$seasonId = \Illuminate\Support\Facades\DB::table($seasonTable)
->where('is_active', 1)->orderByDesc('id')->value('id');
}
$scoreOk = \Illuminate\Support\Facades\Schema::hasTable($scoreTable);
$pkey = function ($type, $uid, $vid) {
$type = ($type === 'visitor') ? 'visitor' : 'user';
return $type === 'visitor' ? ('v:' . (int)$vid) : ('u:' . (int)$uid);
};
$userName = function ($u) {
if (!$u) return 'عضو';
$name = trim((string)($u->name ?? ''));
if ($name !== '') return $name;
$un = trim((string)($u->username ?? ''));
if ($un !== '') return '@' . $un;
$email = trim((string)($u->email ?? ''));
if ($email !== '') return $email;
$id = (int)($u->id ?? 0);
return $id > 0 ? ('User#' . $id) : 'عضو';
};
$visitorName = function ($v) {
if (!$v) return 'ضيف';
$name = trim((string)($v->name ?? ''));
if ($name !== '') return $name;
$id = (int)($v->id ?? 0);
return $id > 0 ? ('Visitor#' . $id) : 'ضيف';
};
$epicBoards = collect();
$epicError = null;
if (!$seasonId) {
$epicError = 'لا يوجد موسم رمضان فعّال حالياً.';
} elseif (!\Illuminate\Support\Facades\Schema::hasTable($linksTable) || !\Illuminate\Support\Facades\Schema::hasTable($competitionsTable)) {
$epicError = 'جداول ربط مسابقات رمضان غير موجودة.';
} else {
$comps = \Illuminate\Support\Facades\DB::table($linksTable.' as l')
->join($competitionsTable.' as c', 'c.id', '=', 'l.competition_id')
->where('l.season_id', $seasonId)
->whereIn('c.id', [9,10]) // ✅ فقط 9 أو 10
->select('c.id','c.title','c.status')
->orderByDesc('c.id')
->get();
$compIds = [];
foreach ($comps as $c) { $compIds[] = (int)$c->id; }
if (empty($compIds)) {
$epicError = 'لا توجد مسابقات مرتبطة برمضان (9 أو 10).';
} elseif (!$scoreOk) {
$epicError = 'جدول نقاط رمضان غير موجود: '.$scoreTable;
} else {
$agg = \Illuminate\Support\Facades\DB::table($scoreTable)
->where('season_id', $seasonId)
->whereIn('competition_id', $compIds)
->select('competition_id','participant_type','user_id','visitor_id')
->selectRaw('SUM(points) as total_points')
->selectRaw('SUM(CASE WHEN event_date = ? THEN points ELSE 0 END) as today_points', [$today])
->groupBy('competition_id','participant_type','user_id','visitor_id')
->get();
$yAgg = \Illuminate\Support\Facades\DB::table($scoreTable)
->where('season_id', $seasonId)
->whereIn('competition_id', $compIds)
->where('event_date', $yesterday)
->select('competition_id','participant_type','user_id','visitor_id')
->selectRaw('SUM(points) as pts')
->groupBy('competition_id','participant_type','user_id','visitor_id')
->get();
$yMaxByComp = [];
foreach ($yAgg as $r) {
$cid = (int)$r->competition_id;
$pts = (int)($r->pts ?? 0);
if (!isset($yMaxByComp[$cid]) || $pts > $yMaxByComp[$cid]) $yMaxByComp[$cid] = $pts;
}
$yChampKeys = [];
foreach ($yAgg as $r) {
$cid = (int)$r->competition_id;
$pts = (int)($r->pts ?? 0);
$max = (int)($yMaxByComp[$cid] ?? 0);
if ($max <= 0) continue;
if ($pts === $max) {
$key = $pkey((string)($r->participant_type ?? 'user'), (int)($r->user_id ?? 0), (int)($r->visitor_id ?? 0));
if (!isset($yChampKeys[$cid])) $yChampKeys[$cid] = [];
$yChampKeys[$cid][$key] = true;
}
}
$userIds = [];
$visitorIds = [];
foreach ($agg as $r) {
$type = (string)($r->participant_type ?? 'user');
if ($type === 'visitor') {
$vid = (int)($r->visitor_id ?? 0);
if ($vid > 0) $visitorIds[$vid] = true;
} else {
$uid = (int)($r->user_id ?? 0);
if ($uid > 0) $userIds[$uid] = true;
}
}
$usersMap = collect();
if (!empty($userIds) && \Illuminate\Support\Facades\Schema::hasTable($usersTable)) {
$usersMap = \Illuminate\Support\Facades\DB::table($usersTable)
->whereIn('id', array_keys($userIds))
->select('id','name','username','email','avatar')
->get()->keyBy('id');
}
$visitorsMap = collect();
if (!empty($visitorIds) && \Illuminate\Support\Facades\Schema::hasTable($visitorsTable)) {
$visitorsMap = \Illuminate\Support\Facades\DB::table($visitorsTable)
->whereIn('id', array_keys($visitorIds))
->select('id','name')
->get()->keyBy('id');
}
$byComp = [];
foreach ($agg as $r) {
$cid = (int)$r->competition_id;
$type = (string)($r->participant_type ?? 'user');
$uid = (int)($r->user_id ?? 0);
$vid = (int)($r->visitor_id ?? 0);
$key = $pkey($type, $uid, $vid);
$name = ($type === 'visitor')
? $visitorName($visitorsMap->get($vid))
: $userName($usersMap->get($uid));
$todayPts = (int)($r->today_points ?? 0);
$totalPts = (int)($r->total_points ?? 0);
$isChamp = isset($yChampKeys[$cid]) && isset($yChampKeys[$cid][$key]);
if (!isset($byComp[$cid])) $byComp[$cid] = [];
$byComp[$cid][] = [
'name' => $name,
'type_label' => ($type === 'visitor') ? 'ضيف' : 'عضو',
'today_points' => $todayPts,
'total_points' => $totalPts,
'is_yesterday_champion' => $isChamp,
];
}
$out = [];
foreach ($comps as $c) {
$cid = (int)$c->id;
$list = $byComp[$cid] ?? [];
usort($list, function ($a, $b) {
if ((int)$a['today_points'] === (int)$b['today_points']) {
if ((int)$a['total_points'] === (int)$b['total_points']) {
return strcmp((string)$a['name'], (string)$b['name']);
}
return ((int)$b['total_points'] <=> (int)$a['total_points']);
}
return ((int)$b['today_points'] <=> (int)$a['today_points']);
});
$sumToday = 0; $sumTotal = 0;
foreach ($list as $p) { $sumToday += (int)$p['today_points']; $sumTotal += (int)$p['total_points']; }
$out[] = [
'competition' => $c,
'totals' => [
'participants' => count($list),
'today_points' => $sumToday,
'total_points' => $sumTotal,
],
'participants' => $list,
];
}
$epicBoards = collect($out);
}
}
@endphp
{{-- ✅ قسم ملحمي — مسابقات #9/#10 --}}
قسم ملحمي: المشاركون في مسابقات رمضان ونقاطهم
يعرض: نوع المشارك (عضو/ضيف) + نقاط اليوم + النقاط الكلية.
👑 بطل الأمس يظهر تحت الاسم مباشرة.
اليوم: {{ $today }}
الأمس: {{ $yesterday }}
فقط: #9 / #10
@if($epicError)
@else
@foreach($epicBoards as $b)
@php
$c = $b['competition'];
$t = $b['totals'];
$participants = $b['participants'];
@endphp
الحالة: {{ $c->status ?? '—' }}
•
مشاركون: {{ (int)$t['participants'] }}
نقاط اليوم: {{ (int)$t['today_points'] }}
المجموع: {{ (int)$t['total_points'] }}
مشاركون
{{ (int)$t['participants'] }}
نقاط اليوم
{{ (int)$t['today_points'] }}
المجموع
{{ (int)$t['total_points'] }}
@if(empty($participants))
لا يوجد مشاركون/نقاط لهذه المسابقة بعد.
@else
المشارك
النوع
نقاط اليوم
النقاط الكلية
@foreach($participants as $p)
{{-- 👑 بطل الأمس تحت الاسم --}}
@if(!empty($p['is_yesterday_champion']))
بطل الأمس
@endif
@if(($p['type_label'] ?? '') === 'ضيف')
ضيف
@else
عضو
@endif
{{ (int)($p['today_points'] ?? 0) }}
{{ (int)($p['total_points'] ?? 0) }}
@endforeach
*ملاحظة: الترتيب حسب نقاط اليوم ثم النقاط الكلية.
@endif
@endforeach
@endif
القاعدة: قبل يومين (48 ساعة) يظهر تنبيه — قبل يوم (24 ساعة) يظهر إنذار .
مهم: الهدف هو التجديد قبل الانتهاء لتفادي أي تعطل في التحقق أو الدخول.
@if($taateerRoute !== '#')
@endif
{{-- Summary pills --}}
{{ (int)($counts['expired'] ?? 0) }}
{{ (int)($counts['danger'] ?? 0) }}
{{ (int)($counts['warning'] ?? 0) }}
{{ (int)($counts['safe'] ?? 0) }}
{{-- EXPIRED --}}
@if($expired->isNotEmpty())
@foreach($expired->take(12) as $m)
انتهى عند:
{{ \Carbon\Carbon::parse($m->expiresAt, $tzDash)->locale('ar')->isoFormat('D MMMM YYYY – h:mm A') }}
@endforeach
@if($expired->count() > 12)
و {{ $expired->count() - 12 }} آخرون…
@endif
@endif
{{-- DANGER <= 24h --}}
@if($danger->isNotEmpty())
@foreach($danger->take(12) as $m)
@php $h = max(0, (int)$m->hoursLeft); @endphp
ينتهي:
{{ \Carbon\Carbon::parse($m->expiresAt, $tzDash)->locale('ar')->isoFormat('D MMMM YYYY – h:mm A') }}
@endforeach
@if($danger->count() > 12)
و {{ $danger->count() - 12 }} آخرون…
@endif
@endif
{{-- WARNING <= 48h --}}
@if($warning->isNotEmpty())
@foreach($warning->take(12) as $m)
@php $h = max(0, (int)$m->hoursLeft); @endphp
ينتهي:
{{ \Carbon\Carbon::parse($m->expiresAt, $tzDash)->locale('ar')->isoFormat('D MMMM YYYY – h:mm A') }}
@endforeach
@if($warning->count() > 12)
و {{ $warning->count() - 12 }} آخرون…
@endif
@endif
{{-- SAFE (collapsible) --}}
@if($safe->isEmpty())
لا يوجد.
@else
@if($safe->count() > 10)
و {{ $safe->count() - 10 }} آخرون…
@endif
@endif
@endif
{{-- خلفية Enterprise (fancy) --}}
{{-- Toast container --}}
{{-- ======================= Top Sticky Console Bar + Tabs ======================= --}}
{{-- Top Header (Compact) --}}
{{ \Carbon\Carbon::now()->locale('ar')->isoFormat('dddd D MMMM YYYY') }}
•
{{ now($tz)->format('H:i') }}
{{-- User badge: hidden on mobile to save space --}}
{{ $user->name }}
مشرف / الإدارة العليا
{{-- Tabs (Mobile-first: horizontal scroll instead of big wrap) --}}
@php
$tabs = [
['key' => 'overview', 'label' => 'نظرة عامة', 'icon' => 'fa-layer-group'],
['key' => 'members', 'label' => 'الأعضاء', 'icon' => 'fa-users-gear'],
['key' => 'requests', 'label' => 'الطلبات', 'icon' => 'fa-inbox'],
['key' => 'presence', 'label' => 'التواجد', 'icon' => 'fa-signal'],
['key' => 'analytics', 'label' => 'التحليلات', 'icon' => 'fa-chart-pie'],
['key' => 'proactive', 'label' => 'ProActive', 'icon' => 'fa-bolt'],
['key' => 'tips', 'label' => 'النصائح', 'icon' => 'fa-lightbulb'],
];
@endphp
{{-- subtle divider line --}}
@foreach ($tabs as $t)
@endforeach
{{-- optional: hide scrollbar --}}
{{-- ======================= PANELS ======================= --}}
{{-- Panel: OVERVIEW --}}
{{-- Hero Card (Enterprise Profile + KPIs) --}}
لوحة الإدارة العليا — تحكم Enterprise
{{ \Carbon\Carbon::now()->locale('ar')->isoFormat('dddd D MMMM YYYY') }}
•
آخر تسجيل دخول:
هنا تراقب صحة المنظومة ،
التزام الأعضاء، وملفات الإدارة داخل
.
{{-- KPIs --}}
@php
$kpis = [
[
'label' => 'إجمالي المستخدمين',
'value' => $stats['total_users'] ?? '—',
'valueCls' => 'text-slate-900 dark:text-white',
'icon' => 'fa-users',
'iconWrap' =>
'bg-blue-500/10 text-blue-600 dark:bg-blue-500/10 dark:text-blue-200',
],
[
'label' => 'الأعضاء الرسميين',
'value' => $stats['official_members'] ?? '—',
'valueCls' => 'text-emerald-600 dark:text-emerald-200',
'icon' => 'fa-badge-check',
'iconWrap' =>
'bg-emerald-500/10 text-emerald-600 dark:bg-emerald-500/10 dark:text-emerald-200',
],
[
'label' => 'أعضاء بيتا',
'value' => $stats['beta_members'] ?? '—',
'valueCls' => 'text-amber-600 dark:text-amber-200',
'icon' => 'fa-flask',
'iconWrap' =>
'bg-amber-500/10 text-amber-600 dark:bg-amber-500/10 dark:text-amber-200',
],
[
'label' => 'المتواجدون الآن',
'value' => $stats['online_users'] ?? '—',
'valueCls' => 'text-violet-600 dark:text-violet-200',
'icon' => 'fa-signal',
'iconWrap' =>
'bg-violet-500/10 text-violet-600 dark:bg-violet-500/10 dark:text-violet-200',
],
];
@endphp
@foreach ($kpis as $k)
@endforeach
{{-- كارد الأعضاء بعذر رسمي اليوم --}}
@if (isset($todayExcusedUsers) && $todayExcusedUsers->isNotEmpty())
الأعضاء اليوم عندهم عذر رسمي للغياب:
@foreach ($todayExcusedUsers as $u)
{{ $u->username ? '@' . $u->username : '' }}
@endforeach
@endif
{{-- مركز الأولويات الآن --}}
@php
$pendingRequests = (int) ($requestStats['pending'] ?? 0);
$newRequests = (int) ($requestStats['new'] ?? 0);
$pendingAbsences = (int) ($absenceStats['pending'] ?? 0);
$pendingEvals = (int) ($stats['pending_evaluations'] ?? 0);
$pendingViolations = (int) ($violationStats['pending'] ?? ($stats['pending_violations'] ?? 0));
$unreadTips = (int) ($stats['unread_tips'] ?? 0);
$scheduledLives = (int) ($stats['scheduled_lives'] ?? 0);
$urgentTotal =
$pendingRequests + $pendingAbsences + $pendingEvals + $pendingViolations + $unreadTips;
$pressure = 0;
$pressure += min(30, ($pendingRequests / 10) * 30);
$pressure += min(20, ($pendingAbsences / 10) * 20);
$pressure += min(20, ($pendingViolations / 10) * 20);
$pressure += min(20, ($pendingEvals / 30) * 20);
$pressure += min(10, ($unreadTips / 20) * 10);
$pressure += min(10, ($scheduledLives / 50) * 10);
$pressure = (int) round(min(100, $pressure));
$status = 'good';
$label = 'مستقر';
if ($pressure >= 75) {
$status = 'danger';
$label = 'حرج';
} elseif ($pressure >= 45) {
$status = 'warning';
$label = 'متوسط';
}
$barClass =
$status === 'danger'
? 'bg-gradient-to-r from-red-500 to-rose-500'
: ($status === 'warning'
? 'bg-gradient-to-r from-amber-400 to-orange-500'
: 'bg-gradient-to-r from-emerald-400 via-sky-400 to-violet-400');
$urlRequests = \Illuminate\Support\Facades\Route::has('live-activities.requests.index')
? route('live-activities.requests.index')
: '#';
$urlLivesToday = \Illuminate\Support\Facades\Route::has('superadmin.falcon-room.lives-new.confirm')
? route('superadmin.falcon-room.lives-new.confirm', ['date' => now()->toDateString()])
: '#';
$urlTemplates = \Illuminate\Support\Facades\Route::has(
'superadmin.falcon-room.lives-insights.templates.index',
)
? route('superadmin.falcon-room.lives-insights.templates.index')
: '#';
$urlFeedback = \Illuminate\Support\Facades\Route::has(
'superadmin.falcon-room.lives-insights.feedback.index',
)
? route('superadmin.falcon-room.lives-insights.feedback.index')
: '#';
$templatesTotal = (int) ($insightsStats['templates_total'] ?? 0);
$feedbackWeek = (int) ($insightsStats['feedback_week'] ?? 0);
$topAiTip = $aiProgramTips[0] ?? null;
@endphp
{{-- Left: Ramadan Priorities --}}
ملخص سريع لأهم ملفات النظام الرمضاني اليوم
— مسابقات • هدايا/ميزانية • جدول ساعات • تنبيهات • أرشيف.
المتواجدون الآن:
{{ $ramadanOnlineUsers ?? 0 }}
تنبيهات رمضان (معلّقة):
{{ $ramadanUrgentTotal ?? 0 }}
@if (!empty($ramadanNextSlot))
أقرب ساعة رمضان:
{{ $ramadanNextSlot->scheduled_date ?? '—' }}
• {{ $ramadanNextSlot->scheduled_time ?? '—' }}
@endif
{{-- ✅ مسابقات 9 و10 --}}
{{ $ramadanC9Title ?? 'المسابقة 9' }}:
{{ $ramadanC9Participants ?? 0 }}
مشارك
•
{{ $ramadanC9PointsSum ?? 0 }}
نقطة
{{ $ramadanC10Title ?? 'المسابقة 10' }}:
{{ $ramadanC10Participants ?? 0 }}
مشارك
•
{{ $ramadanC10PointsSum ?? 0 }}
نقطة
{{-- Right: Ramadan Pressure --}}
ضغط رمضان اليوم
{{ $ramadanPressure ?? 0 }} / 100 —
{{ $ramadanLabel ?? 'مستقر' }}
{{-- ✅ قول كمان: ضغط يومي/أسبوعي/شهري --}}
يومي:
{{ $ramadanPressureDaily ?? ($ramadanPressure ?? 0) }} /100
أسبوعي:
{{ $ramadanPressureWeekly ?? 0 }} /100
شهري:
{{ $ramadanPressureMonthly ?? 0 }} /100
البروجريس:
{{ $ramadanProgress ?? 0 }}%
{{-- ✅ Progress bar --}}
ملاحظة: البروجريس محسوب من ضغط الأسبوع + الشهر (كل ما الضغط أعلى يقل البروجريس).
{{-- Meta strip --}}
المشاركون: {{ $ramadanParticipantsTotal ?? 0 }}
مسابقات مربوطة: {{ $ramadanLinkedCompetitionsTotal ?? 0 }}
مشاركون بالمسابقات: {{ $ramadanParticipantsInComps ?? 0 }}
تقارير اليوم: {{ $ramadanReportsToday ?? 0 }}
{{-- Breakdown --}}
{{-- ✅ Competitions card (تسمية صحيحة حسب enum) --}}
مسابقات (مسودات)
مربوطة: {{ $ramadanLinkedCompetitionsTotal ?? 0 }}
{{ $ramadanPendingCompetitions ?? 0 }}
@if (($ramadanNewCompetitions ?? 0) > 0)
(+{{ $ramadanNewCompetitions }})
@endif
نشطة:
{{ $ramadanActiveCompetitions ?? 0 }}
{{-- ✅ اختياري: منتهية --}}
منتهية:
{{ $ramadanEndedCompetitions ?? 0 }}
{{-- Financial --}}
هدايا/ميزانية (Pending)
{{ $ramadanPendingFinancial ?? 0 }}
الإجمالي:
{{ $ramadanFinancialTotal ?? 0 }}
{{-- Schedule --}}
الجدول/الساعات (Pending)
{{ $ramadanPendingSchedule ?? 0 }}
اليوم:
{{ $ramadanScheduledToday ?? 0 }}
القادمة:
{{ $ramadanNextSlot->slot_label ?? '—' }}
@if (!empty($ramadanNextSlot))
({{ $ramadanNextSlot->scheduled_date ?? '' }} {{ $ramadanNextSlot->scheduled_time ?? '' }})
@endif
{{-- Archive + Alerts --}}
توثيق/أرشيف (Pending)
{{ $ramadanPendingArchive ?? 0 }}
تنبيهات عاجلة:
{{ $ramadanUrgentTotal ?? 0 }}
{{-- Ramadan quick links --}}
{{-- AI Ramadan Tip --}}
@if (!empty($ramadanTopAiTip))
توصية رمضان الذكية — {{ $ramadanTopAiTip['score'] ?? '' }}
{{ $ramadanTopAiTip['title'] ?? '—' }}
{{ $ramadanTopAiTip['body'] ?? '' }}
@endif
ملاحظة: مؤشر “ضغط رمضان” تقديري مبني على (تنبيهات + مسابقات مسودات + مالية + جدول ساعات + أرشيف + مشاركين + تقارير اليوم).
آخر تحديث عند تحميل الصفحة.
{{-- بطاقة رقم التعتير --}}
@if (isset($taateer) && $taateer)
@php
$issuedAt = \Carbon\Carbon::parse($taateer->issued_at)->locale('ar');
$expiresAt = \Carbon\Carbon::parse($taateer->expires_at)->locale('ar');
@endphp
هذا الرقم هو مفتاح دخولك الرسمي للنظام ووسيلة التحقق من عضويتك في
جيش الوفاء الذهبي .
الرجاء الحفاظ عليه وعدم مشاركته مع أي شخص.
رقم تعتيرك
{{ $taateer->code }}
تاريخ إنشاء المفتاح
{{ $issuedAt->isoFormat('D MMMM YYYY – h:mm A') }}
تاريخ انتهاء الصلاحية
عند انتهاء الصلاحية لن تتمكن من الدخول حتى يتم إصدار رقم جديد من قبل
الصقر .
@else
🚨 لا يوجد رقم تعتير فعّال لحسابك حالياً. الرجاء التواصل مع
للتحقق من حسابك.
@endif
{{-- رسائل الإدارة (AJAX) --}}
{{-- Panel: MEMBERS --}}
{{-- معدل التزامك بالاختبارات --}}
@if (isset($testGauge))
يوضّح مستوى مشاركتك ونجاحك في اختبارات نظام الوفاء الذهبي.
@php
$p = max(0, min(100, $testGauge->success_rate ?? 0));
@endphp
معدل الاختبارات
{{ $p }}%
ناجح في {{ $testGauge->passed_tests }}/{{ $testGauge->total_tests }} اختبار
هذا المعدّل يمثّل نسبة الاختبارات التي نجحت فيها من
كل الاختبارات التي شاركت بها. كل ما ارتفع المعدّل، زادت فرصتك بالحصول على
هدايا وتحفيزات خاصة من القائد سيف الوفاء والصقر
في الفترات القادمة.
@if ($testGauge->total_tests === 0)
لم تشارك بأي اختبار بعد. أول ما تبدأ تحل الاختبارات، رح يظهر معدل التزامك هنا.
@elseif($p < 60)
معدلّك حالياً منخفض شوي… حاول تحل الاختبارات القادمة بتركيز أعلى عشان ترفع نسبتك 💪
@elseif($p >= 60 && $p < 85)
أداء جيّد 👏 كم اختبار ناجح زيادة وبتصير من المميّزين اللي لهم أولوية في الهدايا.
@else
مستوى أسطوري 🔥 انت من نخبة الملتزمين، ترقّب مفاجآت خاصة من القيادة.
@endif
@endif
{{-- أعضاء يحتاجون متابعة — غرفة الصقر --}}
@if ($enableMemberCareWidget)
أعضاء يحتاجون متابعة — غرفة الصقر
إشارات متابعة حيّة
هذه القائمة تُظهر الأعضاء الذين تم وضعهم تحت المراقبة
أو يحتاجون اهتمام في نظام ملفات المتابعة.
يمكنك سحب البطاقات أفقيًا على الهاتف لرؤية باقي الأعضاء.
@endif
{{-- أفضل أعضاء الشباب والصبايا --}}
{{-- Top Males --}}
@if ($topMales->count() > 0)
@foreach ($topMales as $index => $user)
@if ($user->isOnline())
@endif
{{ $index + 1 }}
نقطة
@if ($user->ranks->count() > 0)
@foreach ($user->ranks as $rank)
{{ $rank->name }}
@endforeach
@endif
@if ($user->membership_status == 'official')
عضو رسمي
@elseif($user->membership_status == 'beta')
عضو بيتا
@endif
@endforeach
@else
لا يوجد أعضاء حالياً
@endif
{{-- Top Females --}}
@if ($topFemales->count() > 0)
@foreach ($topFemales as $index => $user)
@if ($user->isOnline())
@endif
{{ $index + 1 }}
نقطة
@if ($user->ranks->count() > 0)
@foreach ($user->ranks as $rank)
{{ $rank->name }}
@endforeach
@endif
@if ($user->membership_status == 'official')
عضو رسمي
@elseif($user->membership_status == 'beta')
عضو بيتا
@endif
@endforeach
@else
لا يوجد أعضاء حالياً
@endif
{{-- Panel: REQUESTS --}}
{{-- عنوان القسم --}}
مؤشرات سريعة عن عدد الأعضاء، حركة الطلبات، الاجتماعات وطلبات الغياب.
{{-- KPIs --}}
@php
$sysKpis = [
[
'title' => 'إجمالي المستخدمين',
'value' => $stats['total_users'] ?? 0,
'grad' => 'from-blue-500 to-blue-600',
'icon' => 'fa-users',
],
[
'title' => 'الأعضاء الرسميين',
'value' => $stats['official_members'] ?? 0,
'grad' => 'from-emerald-500 to-emerald-600',
'icon' => 'fa-badge-check',
],
[
'title' => 'أعضاء بيتا',
'value' => $stats['beta_members'] ?? 0,
'grad' => 'from-amber-400 to-amber-500',
'icon' => 'fa-flask',
],
[
'title' => 'المتواجدون الآن',
'value' => $stats['online_users'] ?? 0,
'grad' => 'from-violet-500 to-violet-600',
'icon' => 'fa-signal',
],
];
@endphp
@foreach ($sysKpis as $k)
@endforeach
{{-- الطلبات والاجتماعات والغياب --}}
{{-- طلبات الأعضاء --}}
طلبات الأعضاء
@if (($requestStats['new'] ?? 0) > 0)
جديد اليوم: {{ $requestStats['new'] }}
@endif
قيد المراجعة:
{{ $requestStats['pending'] ?? 0 }}
مقبول:
{{ $requestStats['approved'] ?? 0 }}
مرفوض:
{{ $requestStats['rejected'] ?? 0 }}
أُضيف اليوم: {{ $requestStats['today'] ?? 0 }}
@if (!empty($requestTablesStats ?? []))
@php
$labels = [
'high_level' => 'الإدارة العليا',
'absences' => 'الغيابات',
'live' => 'طلبات لايف/جولة',
'activities' => 'طلبات نشاط',
'moderator' => 'طلبات المشرف',
];
@endphp
@foreach ($requestTablesStats as $key => $row)
{{ $labels[$key] ?? $key }}
{{ $row['tot'] ?? 0 }} إجمالي •
{{ $row['pending'] ?? 0 }}
قيد المراجعة
@endforeach
@endif
{{-- الاجتماعات الإدارية --}}
الاجتماعات الإدارية
@if (($meetStats['new'] ?? 0) > 0)
جديد اليوم: {{ $meetStats['new'] }}
@endif
مجدولة:
{{ $meetStats['scheduled'] ?? 0 }}
قيد التنفيذ:
{{ $meetStats['ongoing'] ?? 0 }}
مكتملة:
{{ $meetStats['completed'] ?? 0 }}
ملغية:
{{ $meetStats['cancelled'] ?? 0 }}
أُضيف اليوم:
{{ $meetStats['today'] ?? 0 }}
@if (!empty($meetTypesStats ?? []))
@php
$labels = [
'high_level' => 'الإدارة العليا',
'moderators' => 'مجلس المشرفين',
'teams' => 'لجان/فرق',
'one_to_one' => 'مقابلات فردية',
'emergency' => 'طارئة',
];
@endphp
@foreach ($meetTypesStats as $key => $row)
{{ $labels[$key] ?? $key }}
{{ $row['tot'] ?? 0 }} إجمالي •
{{ $row['scheduled'] ?? 0 }}
مجدولة
@endforeach
@endif
{{-- طلبات الغياب --}}
@if (($absenceStats['today'] ?? 0) > 0)
جديد اليوم: {{ $absenceStats['today'] }}
@endif
قيد المراجعة:
{{ $absenceStats['pending'] ?? 0 }}
معتمدة:
{{ $absenceStats['approved'] ?? 0 }}
مرفوضة:
{{ $absenceStats['rejected'] ?? 0 }}
{{-- Panel: PRESENCE --}}
{{-- المتواجدون الآن بالتفصيل --}}
{{ $onlineSessions->count() ?? 0 }}
@forelse($onlineSessions as $s)
@php
$map = config('page_names', []);
$key = strtolower((string) ($s->current_page ?? ''));
$norm = \Illuminate\Support\Str::of($key)
->replace([' ', '.', '/'], '-')
->replaceMatches('/-+/', '-')
->trim('-')
->value();
$arabic = $map[$norm] ?? \Illuminate\Support\Str::of($norm)->replace('-', ' ')->title();
@endphp
@if (!empty($s->user->avatar_url))
@endif
{{ number_format(($s->accumulated_ms ?? 0) / 60000, 1) }} د
@empty
لا أحد متواجد الآن.
@endforelse
—
{{-- من تواجدوا اليوم --}}
{{-- Panel: ANALYTICS --}}
{{-- توزيع الذكور والإناث + حالة العضوية --}}
الذكور
{{ $genderStats['male_percentage'] }}%
الإناث
{{ $genderStats['female_percentage'] }}%
{{-- توزيع النقاط والنشاطات الأخيرة --}}
{{-- التقييمات والحضور والمخالفات --}}
{{-- Panel: PROACTIVE --}}
@if (!empty($aiProgramTips) || $latestFalconNotes->count() || $next)
ملخص سريع للفعاليات، النصايح والملاحظات بدون ما تاخذ مساحة كبيرة من الصفحة.
@if ($isToday)
فعالية اليوم
@elseif($next)
قريباً
@endif
نوع الفعالية
{{ $typeTxt }}
@php
$tipsCount =
!empty($aiProgramTips) && is_countable($aiProgramTips) ? count($aiProgramTips) : 0;
$notesCount = $latestFalconNotes->count();
@endphp
نصايح ProActive (آخر 30 يوم):
{{ $tipsCount }}
•
آخر ملاحظات مسجّلة:
{{ $notesCount }}
مواعيد ProActive
فتح لوحة ProActive الكاملة (نصائح + ملاحظات + بانر الفعالية)
{{-- نصايح برنامج ProActive الذكية --}}
@if (!empty($aiProgramTips))
هذه التوصيات مبنية على تقارير ProActive المسجّلة في آخر 30 يوم:
نسبة المشاكل، التقدّم، فعاليات PLUS، والدعوات والأصدقاء الجدد.
@foreach ($aiProgramTips as $tip)
@php
$level = $tip['level'] ?? 'medium';
$score = $tip['score'] ?? null;
$classes = match ($level) {
'high' => 'bg-rose-500/10 border-rose-300/60',
'positive' => 'bg-emerald-500/10 border-emerald-300/60',
'medium' => 'bg-amber-500/10 border-amber-300/60',
default => 'bg-slate-500/10 border-slate-300/60',
};
$badgeText = match ($level) {
'high' => 'أولوية عالية',
'positive' => 'خبر إيجابي',
'medium' => 'أولوية متوسطة',
default => 'معلومة عامة',
};
@endphp
@if ($level === 'high')
@elseif($level === 'positive')
@elseif($level === 'medium')
@else
@endif
{{ $badgeText }}
@if ($score !== null)
درجة الأهمية: {{ $score }}/100
@endif
{{ $tip['title'] ?? 'توصية من النظام' }}
{{ $tip['body'] ?? '' }}
@endforeach
@endif
{{-- ملاحظاتكم الميمونة --}}
@if ($latestFalconNotes->count())
@foreach ($latestFalconNotes as $note)
@php
$status = $note->program_status ?? 'pending';
$created = $note->created_at
? Carbon::parse($note->created_at)->diffForHumans()
: 'غير محدد';
if ($status === 'approved') {
$badgeText = '✅ تم القبول';
$badgeClass =
'bg-emerald-500/15 text-emerald-200 ring-1 ring-emerald-400/30';
$hint =
'سيتم أخذ الملاحظة بالحسبان في أوقات ProActive القادمة';
} elseif ($status === 'rejected') {
$badgeText = '❌ مرفوض';
$badgeClass =
'bg-rose-500/15 text-rose-100 ring-1 ring-rose-400/30';
$hint = 'راجع صياغة الملاحظة، الإملاء، والتاريخ في العنوان';
} else {
$badgeText = '🕓 قيد المراجعة';
$badgeClass =
'bg-amber-500/15 text-amber-100 ring-1 ring-amber-400/30';
$hint = 'بانتظار تقييم البرنامج لهذه الملاحظة';
}
@endphp
{{ $note->title }}
{{ $badgeText }}
{{ $hint }}
•
أضيفت {{ $created }}
@endforeach
@else
لا توجد ملاحظات مُسجلة حتى الآن في برنامج ProActive.
@endif
هذه الملاحظات تُستخدم كمدخلات لقرارات ProActive.
لوحة مراجعة رد البرنامج
{{-- بانر الفعالية --}}
@if ($isToday)
@else
@endif
{{ $title }} — تعزز النشاط وروح الفريق. التفاصيل تُحدّث من القيادة.
@if ($isToday)
فعالية اليوم {{ $typeTxt }} — يُرجى تجهيز الفريق والمتابعة الآن.
@endif
@endif
{{-- Panel: TIPS --}}
{{-- كارد إحصائيات النصائح --}}
غير مقروءة: {{ $stats['unread_tips'] }}
تم الرد: {{ $stats['replied_tips'] }}
*المخطط يظهر عند فتح تبويب "النصائح" لأول مرة.
{{-- أعلى المستشارين نشاطاً --}}
@forelse($topAdvisors as $index => $advisor)
{{ $index + 1 }}
{{ $advisor->role_name }}
@empty
لا يوجد مستشارين نشطين حالياً
@endforelse
{{-- آخر النصائح --}}
{{-- 🌟 Dock نقاطك - ثابت أسفل الشاشة --}}
{{-- Helpers --}}
@endsection
@push('scripts')
{{-- ApexCharts --}}
{{-- Encrypted Access Token --}}
{{-- Enterprise Tabs + Toasts + Global Refresh --}}
{{-- رسائل الإدارة (AJAX) --}}
{{-- المتواجدون الآن + من تواجدوا اليوم (AJAX) --}}
@if (auth()->check())
@endif
{{-- ApexCharts Lazy Render (Analytics + Tips) --}}
@endpush