@extends('layouts.superadmin') @section('title','مؤشر الالتزام - ProMission') @section('page-title','مؤشر الالتزام - ProMission') @section('content') @php $from = $from ?? request('from'); $to = $to ?? request('to'); $badge = function($pct){ $pct = (float)$pct; if ($pct >= 70) return 'bg-emerald-500/15 text-emerald-200 border-emerald-500/25'; if ($pct >= 40) return 'bg-amber-500/15 text-amber-200 border-amber-500/25'; return 'bg-rose-500/15 text-rose-200 border-rose-500/25'; }; $label = function($pct, $streak){ $pct = (float)$pct; $streak = (int)$streak; if ($pct >= 70 || $streak >= 7) return 'ملتزم ✅'; if ($pct >= 40 || $streak >= 3) return 'متذبذب ⚠️'; return 'متقطع 🧊'; }; $rows = collect($rows ?? []); $avgCommit = round((float)($rows->avg('commitment_pct') ?? 0), 1); $maxStreak = (int)($rows->max('streak_days') ?? 0); $avgActive = round((float)($rows->avg('active_days') ?? 0), 1); $countGood = $rows->filter(fn($r)=> ((float)$r['commitment_pct'] >= 70) || ((int)$r['streak_days'] >= 7))->count(); $countMid = $rows->filter(fn($r)=> (((float)$r['commitment_pct'] >= 40) && ((float)$r['commitment_pct'] < 70)) || (((int)$r['streak_days'] >= 3) && ((int)$r['streak_days'] < 7)))->count(); $countLow = max(0, $rows->count() - $countGood - $countMid); $isCards = (request('view','table') === 'cards'); @endphp
يعرض الالتزام + الأيام النشطة + أعلى سلسلة (streak).
| العضو | الالتزام % | أيام نشطة | أيام الفترة | Streak | وضعه |
|---|---|---|---|---|---|
|
{{ $r['name'] }}
{{ $r['username'] ? '@'.$r['username'] : '' }}
|
{{ $pct }}% | {{ (int)$r['active_days'] }} | {{ (int)$r['period_days'] }} | {{ (int)$r['streak_days'] }} | {{ $lbl }} |
| لا يوجد بيانات. | |||||