@extends('layouts.superadmin') @section('title','سقراط — ساعات ProActive') @section('page-title', $pageTitle ?? '⏱️ ساعات ProActive') @section('content') @php $rows = $rows ?? collect(); $stats = $stats ?? []; $view = $view ?? 'cards'; $clusterBy = $clusterBy ?? 'day'; $toHM = function(int $m){ $m = max(0,$m); return [intdiv($m,60), $m%60]; }; $statusMeta = function(string $st){ return match($st){ 'active','ongoing' => ['نشطة','bg-emerald-500/12 text-emerald-100 border border-emerald-300/15'], 'finished' => ['منتهية','bg-white/10 text-white/70 border border-white/12'], 'cancelled' => ['ملغاة','bg-rose-500/12 text-rose-100 border border-rose-300/15'], default => ['—','bg-white/10 text-white/70 border border-white/12'], }; }; $typeMeta = function(string $t){ return $t === 'plus' ? ['+Plus','bg-fuchsia-500/12 text-fuchsia-100 border border-fuchsia-300/15'] : ['عادية','bg-amber-500/10 text-amber-100 border border-amber-300/15']; }; @endphp
{{-- HERO --}}
سقراط • Hours • {{ $pageHint ?? '' }}

⏱️ {{ $pageTitle ?? 'ساعات ProActive' }}

هذه الصفحة تعتمد على جدول proactive_schedule_sessions للجلسات المنتهية/الملغاة، وتحسب النشطة لحظيًا من proactive_schedules.

الإجمالي: {{ $stats['sum_h'] ?? 0 }}س {{ $stats['sum_m'] ?? 0 }}د ({{ number_format($stats['sum_minutes'] ?? 0) }} دقيقة) عادي: {{ $stats['reg_h'] ?? 0 }}س {{ $stats['reg_m'] ?? 0 }}د بلس: {{ $stats['plus_h'] ?? 0 }}س {{ $stats['plus_m'] ?? 0 }}د جلسات: {{ number_format($stats['finished'] ?? 0) }} • ملغاة: {{ number_format($stats['cancelled'] ?? 0) }} • نشطة: {{ number_format($stats['active'] ?? 0) }}
@include('superadmin.proactive.socrates.partials._view-switch', ['view'=>$view]) @if($view === 'cluster') @include('superadmin.proactive.socrates.partials._cluster-by', ['clusterBy'=>$clusterBy]) @endif {{-- Filters --}}
{{-- CONTENT --}} @if($rows->isEmpty())
لا توجد بيانات ضمن هذا المدى.
@else {{-- TABLE --}} @if($view === 'table')
@foreach($rows as $i => $r) @php [$h,$m] = $toHM((int)$r['calc_minutes']); [$stLabel,$stCls] = $statusMeta((string)$r['status']); [$tyLabel,$tyCls] = $typeMeta((string)$r['event_type']); @endphp @endforeach
# النوع الحالة العنوان القائد المنصة التاريخ المدة
{{ $i+1 }} {{ $tyLabel }} {{ $stLabel }} {{ $r['event_title'] ?: '—' }} {{ $r['leader_name'] ?: '—' }} {{ strtoupper($r['platform'] ?: '—') }} {{ $r['event_date'] ?: '—' }} @if(!empty($r['event_time'])) — {{ \Carbon\Carbon::parse($r['event_time'])->format('H:i') }} @endif {{ $h }}س {{ $m }}د
{{-- CLUSTER --}} @elseif($view === 'cluster') @php $grouped = match($clusterBy){ 'leader' => $rows->groupBy(fn($r)=> ($r['leader_name'] ?: '—')), 'platform' => $rows->groupBy(fn($r)=> strtoupper($r['platform'] ?: '—')), default => $rows->groupBy(fn($r)=> ($r['event_date'] ?: '—')), }; @endphp
@foreach($grouped as $k => $items) @php $mins = (int)$items->sum('calc_minutes'); [$gh,$gm] = $toHM($mins); $count = $items->count(); @endphp
{{ $k }} {{ $count }} عنصر • {{ $gh }}س {{ $gm }}د
@foreach($items as $r) @php [$h,$m] = $toHM((int)$r['calc_minutes']); [$stLabel,$stCls] = $statusMeta((string)$r['status']); [$tyLabel,$tyCls] = $typeMeta((string)$r['event_type']); @endphp
{{ $r['row_type']==='active' ? 'LIVE (ACTIVE)' : 'SESSION' }}
{{ $r['event_title'] ?: '—' }}
{{ $tyLabel }} {{ $stLabel }} {{ strtoupper($r['platform'] ?: '—') }}
{{ $r['leader_name'] ?: '—' }}
{{ $r['event_date'] ?: '—' }} @if(!empty($r['event_time'])) — {{ \Carbon\Carbon::parse($r['event_time'])->format('H:i') }} @endif
المدة
{{ $h }}س {{ $m }}د
{{ number_format((int)$r['calc_minutes']) }} دقيقة
@endforeach
@endforeach
{{-- CARDS / GRID --}} @else @php $cols = $view === 'grid' ? 'grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4' : 'grid-cols-1 md:grid-cols-2 xl:grid-cols-3'; @endphp
@foreach($rows as $r) @php [$h,$m] = $toHM((int)$r['calc_minutes']); [$stLabel,$stCls] = $statusMeta((string)$r['status']); [$tyLabel,$tyCls] = $typeMeta((string)$r['event_type']); @endphp
{{ $r['row_type']==='active' ? 'LIVE (ACTIVE)' : 'SESSION' }}
{{ $r['event_title'] ?: '—' }}
{{ $tyLabel }} {{ $stLabel }}
{{ $r['leader_name'] ?: '—' }}
{{ $r['event_date'] ?: '—' }} @if(!empty($r['event_time'])) — {{ \Carbon\Carbon::parse($r['event_time'])->format('H:i') }} @endif
المنصة: {{ strtoupper($r['platform'] ?: '—') }}
المدة
{{ $h }}س {{ $m }}د
{{ number_format((int)$r['calc_minutes']) }} دقيقة
@endforeach
@endif @endif
@endsection