{{-- 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'; // Tabs $tab = $tab ?? request('tab','reports'); // reports|schedules if (!in_array($tab, ['reports','schedules'], true)) $tab = 'reports'; // View $view = $view ?? request('view','table'); // table|cards if (!in_array($view, ['table','cards'], true)) $view = 'table'; // UI time $ui = $ui ?? [ 'tz_mode' => request('tz','local'), 'clock' => request('clock','24'), ]; $tzOptions = $tzOptions ?? [ 'local' => 'توقيت النظام', 'jordan' => 'توقيت الأردن', ]; $clockOptions = $clockOptions ?? [ '24' => '24 ساعة', '12' => '12 ساعة', ]; // Filters $q = $q ?? request('q',''); $type = $type ?? request('type',''); $plat = $plat ?? request('platform',''); $from = $from ?? request('from',''); $to = $to ?? request('to',''); $status = $status ?? request('status',''); $platforms = $platforms ?? [ '' => 'كل المنصّات', 'tiktok' => 'تيك توك', 'instagram' => 'إنستغرام', 'youtube' => 'يوتيوب', 'other' => 'أخرى', ]; // Controller: rows + stats $rows = $rows ?? collect(); $stats = $stats ?? []; // labels $typeLabel = [ 'regular' => 'عادية', 'plus' => 'Plus', ]; $statusLabelReports = [ 'pending' => 'بانتظار', 'approved' => 'مقبول', 'rejected' => 'مرفوض', ]; $statusLabelSchedules = [ 'upcoming' => 'قادم', 'active' => 'نشط', 'finished' => 'منتهي', 'cancelled' => 'ملغي', ]; $gradeLabel = [ 'good' => 'جيد', 'very_good' => 'جيد جدًا', 'excellent' => 'ممتاز', ]; // safe create urls (بدون Route errors) $createReportUrl = null; if (Route::has('superadmin.proactive.reports.create')) $createReportUrl = route('superadmin.proactive.reports.create'); elseif (Route::has('superadmin.proactive.report.create')) $createReportUrl = route('superadmin.proactive.report.create'); $createScheduleUrl = null; if (Route::has('superadmin.proactive.schedules.create')) $createScheduleUrl = route('superadmin.proactive.schedules.create'); elseif (Route::has('superadmin.proactive.schedule.create')) $createScheduleUrl = route('superadmin.proactive.schedule.create'); $qs = request()->query(); // header summary line $periodLine = ($from && $to) ? "{$from} → {$to}" : 'حسب الفلاتر الحالية'; @endphp
{{-- Header (نفس روح members-marks) --}}
ProActive • تقارير • مواعيد • تحليل

ProActive — المواعيد والتقارير

الفترة: {{ $periodLine }} • التوقيت: {{ $tzOptions[$ui['tz_mode']] ?? 'توقيت النظام' }} • نظام الساعة: {{ $clockOptions[$ui['clock']] ?? '24 ساعة' }}

{{-- switch view --}} جدول كروت
{{-- Tabs --}} {{-- Filters --}}
تصفير
{{-- Summary --}}
{{ $tab==='reports' ? 'إجمالي التقارير' : 'إجمالي المواعيد' }}
{{ (int)($stats['total'] ?? 0) }}
@if($tab==='reports')
آخر 7 أيام
{{ (int)($stats['last7'] ?? 0) }}
عادية
{{ (int)($stats['regular'] ?? 0) }}
Plus
{{ (int)($stats['plus'] ?? 0) }}
فيها مشاكل
{{ (int)($stats['issues'] ?? 0) }}
فيها تقدم
{{ (int)($stats['progress'] ?? 0) }}
@else
قادم
{{ (int)($stats['upcoming'] ?? 0) }}
نشط
{{ (int)($stats['active'] ?? 0) }}
منتهي
{{ (int)($stats['finished'] ?? 0) }}
ملغي
{{ (int)($stats['cancelled'] ?? 0) }}
عادي
{{ (int)($stats['regular'] ?? 0) }}
Plus
{{ (int)($stats['plus'] ?? 0) }}
@endif
{{-- Content --}} @if(($rows->count() ?? 0) === 0)
لا توجد نتائج ضمن هذه الفلاتر.
@else @if($view === 'cards')
@foreach($rows as $r) @php $platformText = $platforms[$r->platform ?? ''] ?? ($r->platform ?? '—'); $creator = $r->creator_name ?? '—'; if($tab==='reports'){ $rowType = $typeLabel[$r->activity_type ?? 'regular'] ?? ($r->activity_type ?? '—'); $rowStatus = $statusLabelReports[$r->program_status ?? ''] ?? ($r->program_status ?? '—'); $rowGrade = $gradeLabel[$r->live_grade ?? ''] ?? ($r->live_grade ?? '—'); $when = $r->activity_datetime_display ?? ($r->activity_date ?? '—'); } else { $rowType = $typeLabel[$r->event_type ?? 'regular'] ?? ($r->event_type ?? '—'); $rowStatus = $statusLabelSchedules[$r->status ?? ''] ?? ($r->status ?? '—'); $rowGrade = '—'; $when = $r->event_datetime_display ?? (($r->event_date ?? '—') . ' • ' . ($r->event_time_display ?? ($r->event_time ?? '—'))); } // payload for modal $payload = [ 'tab' => $tab, 'id' => $r->id ?? null, 'when'=> $when, 'platform' => $platformText, 'type' => $rowType, 'status' => $rowStatus, 'creator' => $creator, // reports 'live_host' => $r->live_host ?? null, 'live_owner_name' => $r->live_owner_name ?? null, 'live_link' => $r->live_link ?? null, 'short_summary' => $r->short_summary ?? null, 'grade' => $rowGrade, 'had_issues' => (int)($r->had_issues ?? 0), 'issues_text' => $r->issues_text ?? null, 'had_progress' => (int)($r->had_progress ?? 0), 'progress_text' => $r->progress_text ?? null, 'positive_notes' => $r->positive_notes ?? null, 'negative_notes' => $r->negative_notes ?? null, 'general_issues' => $r->general_issues ?? null, 'new_friends' => $r->new_friends ?? null, 'invitations_sent' => $r->invitations_sent ?? null, // schedules 'title' => $r->event_title ?? null, 'leader_name' => $r->leader_name ?? null, 'description' => $r->event_description ?? null, 'notes' => $r->notes ?? null, ]; @endphp
@if($tab==='reports') {{ $r->live_host ?? '—' }} @else {{ $r->event_title ?? '—' }} @endif
{{ $when }} • {{ $platformText }}
{{ $rowType }}
الحالة
{{ $rowStatus }}
{{ $tab==='reports' ? 'التقدير' : 'القائد' }}
@if($tab==='reports') {{ $rowGrade }} @else {{ $r->leader_name ?? '—' }} @endif
@if($tab==='reports')
صاحب اللايف: {{ $r->live_owner_name ?? '—' }}
ملخص: {{ $r->short_summary ?? '—' }}
@if((int)($r->had_issues ?? 0) === 1) مشاكل @endif @if((int)($r->had_progress ?? 0) === 1) تقدم @endif
@else
ملاحظات: {{ $r->notes ?? '—' }}
@endif
مُسجّل: {{ $creator }}
@endforeach
@else
@foreach($rows as $i => $r) @php $platformText = $platforms[$r->platform ?? ''] ?? ($r->platform ?? '—'); $creator = $r->creator_name ?? '—'; if($tab==='reports'){ $rowType = $typeLabel[$r->activity_type ?? 'regular'] ?? ($r->activity_type ?? '—'); $rowStatus = $statusLabelReports[$r->program_status ?? ''] ?? ($r->program_status ?? '—'); $rowGrade = $gradeLabel[$r->live_grade ?? ''] ?? ($r->live_grade ?? '—'); $when = $r->activity_datetime_display ?? ($r->activity_date ?? '—'); $main = $r->live_host ?? '—'; $sub = $r->live_owner_name ?? '—'; } else { $rowType = $typeLabel[$r->event_type ?? 'regular'] ?? ($r->event_type ?? '—'); $rowStatus = $statusLabelSchedules[$r->status ?? ''] ?? ($r->status ?? '—'); $rowGrade = '—'; $when = $r->event_datetime_display ?? (($r->event_date ?? '—') . ' • ' . ($r->event_time_display ?? ($r->event_time ?? '—'))); $main = $r->event_title ?? '—'; $sub = $r->leader_name ?? '—'; } $payload = [ 'tab' => $tab, 'id' => $r->id ?? null, 'when'=> $when, 'platform' => $platformText, 'type' => $rowType, 'status' => $rowStatus, 'creator' => $creator, 'live_host' => $r->live_host ?? null, 'live_owner_name' => $r->live_owner_name ?? null, 'live_link' => $r->live_link ?? null, 'short_summary' => $r->short_summary ?? null, 'grade' => $rowGrade, 'had_issues' => (int)($r->had_issues ?? 0), 'issues_text' => $r->issues_text ?? null, 'had_progress' => (int)($r->had_progress ?? 0), 'progress_text' => $r->progress_text ?? null, 'positive_notes' => $r->positive_notes ?? null, 'negative_notes' => $r->negative_notes ?? null, 'general_issues' => $r->general_issues ?? null, 'new_friends' => $r->new_friends ?? null, 'invitations_sent' => $r->invitations_sent ?? null, 'title' => $r->event_title ?? null, 'leader_name' => $r->leader_name ?? null, 'description' => $r->event_description ?? null, 'notes' => $r->notes ?? null, ]; @endphp @endforeach
# {{ $tab==='reports' ? 'التاريخ/الوقت' : 'التاريخ/الوقت' }} {{ $tab==='reports' ? 'المضيف' : 'العنوان' }} {{ $tab==='reports' ? 'صاحب اللايف' : 'القائد' }} المنصة النوع الحالة {{ $tab==='reports' ? 'التقدير' : '—' }} مُسجّل إجراء
{{ (method_exists($rows,'firstItem') ? ($rows->firstItem() ?? 1) : 1) + $i }}
{{ $when }}
@if(!empty($r->created_at_display ?? null))
سجّل: {{ $r->created_at_display }}
@endif
{{ $main }}
@if($tab==='reports')
{{ $r->short_summary ?? '—' }}
@else
{{ $r->notes ?? '—' }}
@endif
{{ $sub }} {{ $platformText }} {{ $rowType }} {{ $rowStatus }} @if($tab==='reports') {{ $rowGrade }} @if((int)($r->had_issues ?? 0)===1) مشاكل @endif @if((int)($r->had_progress ?? 0)===1) تقدم @endif @else @endif {{ $creator }}
@if(is_object($rows) && method_exists($rows,'links'))
{{ $rows->links() }}
@endif
@endif @endif
{{-- =========================== مودال تفاصيل كامل (Reports/Schedules) =========================== --}} {{-- Scoped JS (بدون تعارض) --}} @endsection