@extends('layouts.superadmin') @section('title','المتواجدون على البرنامج') @section('page-title','المتواجدون على البرنامج') @section('content') @php $search = $search ?? request('search',''); $type = $type ?? request('type'); $status = $status ?? request('status'); $view = $view ?? request('view','table'); // table|cards if(!in_array($view,['table','cards'],true)) $view='table'; $now = $now ?? now(); $totalOnline = $totalOnline ?? 0; $onlineActive = $onlineActive ?? 0; $onlineSusp = $onlineSusp ?? 0; $byType = $byType ?? []; // اختياري إذا بعتهم من الكنترول: $summaryDay = $summaryDay ?? ['users'=>0,'time_sec'=>null]; $summaryWeek = $summaryWeek ?? ['users'=>0,'time_sec'=>null]; $summaryMonth = $summaryMonth ?? ['users'=>0,'time_sec'=>null]; $fmtTime = function($sec){ if($sec === null) return '—'; $sec=(int)$sec; if($sec<0) $sec=0; $h=intdiv($sec,3600); $m=intdiv($sec%3600,60); return $h>0 ? ($h.' س '.$m.' د') : ($m.' د'); }; $badge = [ 'active' => ['t'=>'نشط','c'=>'border-emerald-400/30 bg-emerald-500/15 text-emerald-200'], 'suspended' => ['t'=>'معلّق','c'=>'border-rose-400/30 bg-rose-500/15 text-rose-200'], '' => ['t'=>'—','c'=>'border-slate-600/40 bg-white/5 text-slate-200'], ]; @endphp
{{-- HERO --}}
Live Presence • Falcon Room

المتواجدون على البرنامج الآن

تحديث تلقائي + تصفية حسب النوع/الحالة + عرض جدول/كروت

الآن
{{ (int)$totalOnline }}
نشط
{{ (int)$onlineActive }}
معلّق
{{ (int)$onlineSusp }}
آخر تحديث
{{ $now->format('H:i:s') }}
{{-- Day / Week / Month summary --}}
آخر 24 ساعة
{{ (int)($summaryDay['users'] ?? 0) }}
{{ $fmtTime($summaryDay['time_sec'] ?? null) }}
آخر أسبوع
{{ (int)($summaryWeek['users'] ?? 0) }}
{{ $fmtTime($summaryWeek['time_sec'] ?? null) }}
آخر شهر
{{ (int)($summaryMonth['users'] ?? 0) }}
{{ $fmtTime($summaryMonth['time_sec'] ?? null) }}
{{-- Filters --}}
حسب النوع: @forelse($byType as $k=>$c) {{ $k }} {{ (int)$c }} @empty @endforelse
تصفير
{{-- LIST --}}
قائمة المتواجدين
تحديث تلقائي كل 10 ثواني
@if($view === 'table')
@forelse(($onlineUsers ?? []) as $u) @php $st = $badge[$u->account_status ?? ''] ?? $badge['']; $avatar = $u->avatar_url ?? ($u->avatar ?? null); @endphp @empty @endforelse
عضو اليوزر النوع الحالة المكان آخر ظهور
@if($avatar) @else @endif
{{ $u->name }}
#{{ $u->id }}
{{ $u->username }} {{ $u->membership_status ?? '—' }} {{ $st['t'] }} {{ $u->current_place ?? '—' }} {{ !empty($u->last_visit) ? \Carbon\Carbon::parse($u->last_visit)->format('Y-m-d H:i') : '—' }}
لا يوجد متواجدون الآن.
{{-- SAFE pagination --}} @if(isset($onlineUsers) && is_object($onlineUsers) && method_exists($onlineUsers,'links'))
{{ $onlineUsers->links() }}
@endif @else {{-- CARDS --}}
@forelse(($onlineUsers ?? []) as $u) @php $st = $badge[$u->account_status ?? ''] ?? $badge['']; $avatar = $u->avatar_url ?? ($u->avatar ?? null); @endphp
@if($avatar) @else @endif
{{ $u->name }}
{{ $u->username }} • #{{ $u->id }}
{{ $st['t'] }}
{{ $u->membership_status ?? '—' }} {{ $u->current_place ?? '—' }} آخر ظهور: {{ !empty($u->last_visit) ? \Carbon\Carbon::parse($u->last_visit)->format('H:i') : '—' }}
@empty
لا يوجد متواجدون الآن.
@endforelse
@endif
@endsection