@extends('layouts.superadmin') @section('title','تصنيف الأعضاء الذكي - ProMission') @section('page-title','تصنيف الأعضاء الذكي (AI Roles) - ProMission') @section('content') @php $from = $from ?? request('from'); $to = $to ?? request('to'); $rows = collect($rows ?? []); $isCards = (request('view','cards') === 'cards'); $roleBadge = function($role){ $role = (string)$role; return match(true) { str_contains($role,'🔥') => 'bg-emerald-500/15 text-emerald-200 border-emerald-500/25', str_contains($role,'🧱') => 'bg-sky-500/15 text-sky-200 border-sky-500/25', str_contains($role,'🚀') => 'bg-purple-500/15 text-purple-200 border-purple-500/25', str_contains($role,'⚠️') => 'bg-amber-500/15 text-amber-200 border-amber-500/25', default => 'bg-slate-500/15 text-slate-200 border-slate-500/25', }; }; $roleText = function($role){ $role = (string)$role; return match(true) { str_contains($role,'🔥') => 'محرّك (يقود التيم)', str_contains($role,'🧱') => 'ثابت (مستقر ومفيد)', str_contains($role,'🚀') => 'صاعد (تحسّن واضح)', str_contains($role,'⚠️') => 'متذبذب (يحتاج تثبيت)', default => 'خامد (يحتاج دفعة)', }; }; // Stats by role $counts = $rows->countBy('role')->all(); $total = $rows->count(); $avgMix = round((float)($rows->avg('mix_hours') ?? 0), 2); $avgSahra = round((float)($rows->avg('sahra_hours') ?? 0), 2); $maxStreak= (int)($rows->max('streak_days') ?? 0); // Top by total contribution $top = $rows->sortByDesc(fn($r)=> (float)$r['mix_hours'] + (float)$r['sahra_hours'])->take(8)->values(); @endphp
{{-- Header --}}

تصنيف الأعضاء الذكي (AI Roles)

تصنيف تلقائي مبني على: ساعات (لايف+قست) + ساعات السهرة + الاستمرارية (Streak). الهدف: معرفة “مين محرّك” و“مين يحتاج دعم”.

{{-- Toggle --}}
{{-- Summary cards --}}
عدد الأعضاء
{{ $total }}
متوسط (لايف+قست)
{{ $avgMix }}س
متوسط السهرة
{{ $avgSahra }}س
أعلى Streak
{{ $maxStreak }} يوم
توزيع الأدوار
@foreach($counts as $k => $v)
{{ $k }} {{ $v }}
@endforeach
{{-- Filters --}}
إعادة ضبط الذكاء هنا heuristics — سريع ومفيد للقيادة.
{{-- Top contributors --}}
أعلى مساهمين (Top 8)
مجموع = (لايف+قست) + سهرة
@foreach($top as $r) @php $totalH = round((float)$r['mix_hours'] + (float)$r['sahra_hours'], 2); @endphp
{{ $r['name'] }}
{{ $r['username'] ? '@'.$r['username'] : '' }}
{{ $r['role'] }} {{ $totalH }}س
Mix: {{ $r['mix_hours'] }}س • Sahra: {{ $r['sahra_hours'] }}س
Streak: {{ $r['streak_days'] }}
@endforeach
{{-- Cards --}} @if($isCards)
@forelse($rows as $r) @php $role = (string)$r['role']; $roleDesc = $roleText($role); $totalH = round((float)$r['mix_hours'] + (float)$r['sahra_hours'], 2); @endphp
{{ $r['name'] }}
{{ $r['username'] ? '@'.$r['username'] : '' }}
{{ $role }}
الوصف: {{ $roleDesc }}
Mix
{{ $r['mix_hours'] }}س
Sahra
{{ $r['sahra_hours'] }}س
Streak
{{ $r['streak_days'] }}ي
Total
{{ $totalH }}س
@php $bar = max(0, min(100, $totalH * 2)); @endphp
@empty
لا يوجد بيانات ضمن الفلاتر الحالية.
@endforelse
{{-- Table --}} @else

جدول تصنيف الأعضاء

Mix + Sahra + Streak → Role

صفوف: {{ $rows->count() }}
@forelse($rows as $r) @php $role = (string)$r['role']; @endphp @empty @endforelse
العضو Mix (س) Sahra (س) Streak Role وصف
{{ $r['name'] }}
{{ $r['username'] ? '@'.$r['username'] : '' }}
{{ $r['mix_hours'] }} {{ $r['sahra_hours'] }} {{ $r['streak_days'] }} {{ $role }} {{ $roleText($role) }}
لا يوجد بيانات.
@endif
هذا التصنيف يساعد الإدارة: من يُقود، من ثابت، ومن يحتاج تدخل سريع.
@endsection