{{-- resources/views/superadmin/iman-room/proactive.blade.php --}} @extends('layouts.superadmin') @section('title', 'ProActive — المواعيد والتقارير') @section('page-title', 'ProActive — المواعيد والتقارير') @section('content') @php use Illuminate\Support\Facades\Route; $section = $section ?? 'proactive'; $tab = $tab ?? request('tab', 'reports'); // reports | schedules if (!in_array($tab, ['reports','schedules'], true)) $tab = 'reports'; $view = request('view', 'table'); // table | cards if (!in_array($view, ['table','cards'], true)) $view = 'table'; // from controller: // - reports tab: rows=reports (pagination), stats=reports stats // - schedules tab: rows=schedules (pagination), stats=schedules stats $rows = $rows ?? null; $stats = $stats ?? []; $platforms = $platforms ?? [ '' => 'كل المنصّات', 'tiktok' => 'تيك توك', 'instagram' => 'إنستغرام', 'youtube' => 'يوتيوب', 'other' => 'أخرى', ]; $q = $q ?? request('q',''); $type = $type ?? request('type',''); $plat = $plat ?? request('platform',''); $from = $from ?? request('from',''); $to = $to ?? request('to',''); $status = $status ?? request('status',''); $ui = $ui ?? [ 'tz_mode' => request('tz','local'), // local | jordan 'clock' => request('clock','24'), // 24 | 12 ]; $tzOptions = $tzOptions ?? [ 'local' => 'توقيت النظام', 'jordan' => 'توقيت الأردن', ]; $clockOptions = $clockOptions ?? [ '24' => '24 ساعة', '12' => '12 ساعة', ]; // Safe URLs (no hard dependency on routes) $baseUrl = url()->current(); // Optional: if you have separate proactive routes, we use them safely $reportsCreateUrl = (Route::has('superadmin.proactive.reports.create')) ? route('superadmin.proactive.reports.create') : null; $schedulesCreateUrl = (Route::has('superadmin.proactive.schedules.create')) ? route('superadmin.proactive.schedules.create') : null; @endphp
{{-- HERO --}}
ProActive — مركز المواعيد والتقارير
إدارة التقارير + المواعيد — مع عرض التوقيت (الأردن/النظام) ونظام الساعة 12/24 بدون لمس قاعدة البيانات.
{{-- STATS --}}
@php $cards = []; if ($tab === 'reports') { $cards = [ ['k'=>'total','t'=>'إجمالي التقارير','i'=>'fa-solid fa-layer-group'], ['k'=>'last7','t'=>'آخر 7 أيام','i'=>'fa-solid fa-calendar-week'], ['k'=>'regular','t'=>'عادية','i'=>'fa-solid fa-circle'], ['k'=>'plus','t'=>'Plus','i'=>'fa-solid fa-circle-plus'], ['k'=>'issues','t'=>'فيها مشاكل','i'=>'fa-solid fa-triangle-exclamation'], ['k'=>'progress','t'=>'فيها تقدم','i'=>'fa-solid fa-arrow-trend-up'], ]; } else { $cards = [ ['k'=>'total','t'=>'إجمالي المواعيد','i'=>'fa-solid fa-calendar-days'], ['k'=>'upcoming','t'=>'قادمة','i'=>'fa-solid fa-clock'], ['k'=>'active','t'=>'نشطة','i'=>'fa-solid fa-bolt'], ['k'=>'finished','t'=>'منتهية','i'=>'fa-solid fa-check'], ['k'=>'cancelled','t'=>'ملغاة','i'=>'fa-solid fa-ban'], ['k'=>'plus','t'=>'Plus','i'=>'fa-solid fa-circle-plus'], ]; } @endphp @foreach($cards as $c)
{{ $c['t'] }}
{{ (int)($stats[$c['k']] ?? 0) }}
@endforeach
{{-- TOP CONTROLS --}}
{{-- Search --}}
{{-- Type --}}
{{-- Platform --}}
{{-- Status (reports) --}}
{{-- Dates --}}
{{-- Time UI --}}
{{-- Tabs + View --}}
التوقيت/نظام الساعة يؤثر على العرض فقط.
تصفير @if($tab==='reports' && $reportsCreateUrl) تقرير جديد @endif @if($tab==='schedules' && $schedulesCreateUrl) موعد جديد @endif
{{-- CONTENT --}}
{{ $tab==='reports' ? 'تقارير ProActive' : 'مواعيد ProActive' }}
{{ $tzOptions[$ui['tz_mode']] ?? '' }} • {{ $clockOptions[$ui['clock']] ?? '' }}
@if(!$rows || (method_exists($rows,'count') && $rows->count()===0))
لا يوجد بيانات ضمن هذه الفلاتر
جرّب تغيّر الفترة أو البحث.
@else {{-- TABLE --}} @if($view === 'table')
@if($tab==='reports') @else @endif @foreach($rows as $r) @if($tab==='reports') @php $platText = $platforms[$r->platform ?? ''] ?? ($r->platform ?? '—'); $gradeMap = ['good'=>'جيد','very_good'=>'جيد جدًا','excellent'=>'ممتاز']; $gradeText = $gradeMap[$r->live_grade ?? ''] ?? ($r->live_grade ?? '—'); $dtDisp = $r->activity_datetime_display ?? (($r->activity_date ?? '—')); $creator = $r->creator_name ?? '—'; $payload = [ 'id' => $r->id ?? null, 'dt' => $dtDisp, 'created' => $r->created_at_display ?? ($r->created_at ?? '—'), 'host' => $r->live_host ?? '—', 'owner' => $r->live_owner_name ?? '—', 'platform' => $platText, 'grade' => $gradeText, 'summary' => $r->short_summary ?? '—', 'positive' => $r->positive_notes ?? '—', 'negative' => $r->negative_notes ?? '—', 'issues' => ((int)($r->had_issues ?? 0)===1) ? ($r->issues_text ?? '—') : null, 'progress' => ((int)($r->had_progress ?? 0)===1) ? ($r->progress_text ?? '—') : null, 'general_issues' => $r->general_issues ?? null, 'creator' => $creator, 'link' => $r->live_link ?? null, 'type' => $r->activity_type ?? null, 'status' => $r->program_status ?? null, 'friends' => $r->new_friends ?? null, 'inv' => $r->invitations_sent ?? null, ]; @endphp @else @php $platText = $platforms[$r->platform ?? ''] ?? ($r->platform ?? '—'); $dtDisp = $r->event_datetime_display ?? (($r->event_date ?? '—') . ' • ' . ($r->event_time_display ?? ($r->event_time ?? '—'))); $creator = $r->creator_name ?? '—'; @endphp @endif @endforeach
التاريخ/الوقت المضيف صاحب اللايف المنصّة التقدير مسجّل التقرير إجراءاتالتاريخ/الوقت العنوان القائد المنصّة الحالة مسجّل الموعد
{{ $dtDisp }}
سجّل: {{ $r->created_at_display ?? ($r->created_at ?? '—') }}
{{ $r->live_host ?? '—' }} {{ $r->live_owner_name ?? '—' }} {{ $platText }} {{ $gradeText }} @if((int)($r->had_issues ?? 0)===1) مشاكل @endif @if((int)($r->had_progress ?? 0)===1) تقدّم @endif {{ $creator }}
{{ $dtDisp }} {{ $r->event_title ?? '—' }} {{ $r->leader_name ?? '—' }} {{ $platText }} {{ match($r->status ?? '') { 'upcoming' => 'قادم', 'active' => 'نشط', 'finished' => 'منتهي', 'cancelled' => 'ملغي', default => ($r->status ?? '—'), } }} {{ $creator }}
{{-- CARDS --}} @else
@foreach($rows as $r) @if($tab==='reports') @php $platText = $platforms[$r->platform ?? ''] ?? ($r->platform ?? '—'); $gradeMap = ['good'=>'جيد','very_good'=>'جيد جدًا','excellent'=>'ممتاز']; $gradeText = $gradeMap[$r->live_grade ?? ''] ?? ($r->live_grade ?? '—'); $dtDisp = $r->activity_datetime_display ?? (($r->activity_date ?? '—')); $creator = $r->creator_name ?? '—'; $payload = [ 'id' => $r->id ?? null, 'dt' => $dtDisp, 'created' => $r->created_at_display ?? ($r->created_at ?? '—'), 'host' => $r->live_host ?? '—', 'owner' => $r->live_owner_name ?? '—', 'platform' => $platText, 'grade' => $gradeText, 'summary' => $r->short_summary ?? '—', 'positive' => $r->positive_notes ?? '—', 'negative' => $r->negative_notes ?? '—', 'issues' => ((int)($r->had_issues ?? 0)===1) ? ($r->issues_text ?? '—') : null, 'progress' => ((int)($r->had_progress ?? 0)===1) ? ($r->progress_text ?? '—') : null, 'general_issues' => $r->general_issues ?? null, 'creator' => $creator, 'link' => $r->live_link ?? null, 'type' => $r->activity_type ?? null, 'status' => $r->program_status ?? null, 'friends' => $r->new_friends ?? null, 'inv' => $r->invitations_sent ?? null, ]; @endphp
{{ $r->live_host ?? '—' }}
{{ $gradeText }}
{{ $dtDisp }} • {{ $platText }}
صاحب اللايف: {{ $r->live_owner_name ?? '—' }}
ملخص: {{ $r->short_summary ?? '—' }}
مسجّل التقرير: {{ $creator }}
@if((int)($r->had_issues ?? 0)===1) مشاكل @endif @if((int)($r->had_progress ?? 0)===1) تقدّم @endif
@else @php $platText = $platforms[$r->platform ?? ''] ?? ($r->platform ?? '—'); $dtDisp = $r->event_datetime_display ?? (($r->event_date ?? '—') . ' • ' . ($r->event_time_display ?? ($r->event_time ?? '—'))); $statusText = match($r->status ?? '') { 'upcoming' => 'قادم', 'active' => 'نشط', 'finished' => 'منتهي', 'cancelled' => 'ملغي', default => ($r->status ?? '—'), }; @endphp
{{ $r->event_title ?? '—' }}
{{ $statusText }}
{{ $dtDisp }} • {{ $platText }}
القائد: {{ $r->leader_name ?? '—' }}
@if(!empty($r->notes))
{{ $r->notes }}
@endif
@endif @endforeach
@endif {{-- Pagination --}} @if(is_object($rows) && method_exists($rows,'links'))
{!! $rows->links() !!}
@endif @endif
{{-- REPORT VIEW MODAL --}}
{{-- Scoped JS (NO GLOBALS, NO conflicts) --}} @endsection