{{-- resources/views/superadmin/iman-room/members-goals.blade.php --}} @extends('layouts.superadmin') @section('title','أهداف الأعضاء — غرفة إيمان الملكاوي') @section('content') @php $view = $view ?? (string)request('view','cards'); // cards|table $cmpMode = $compare_mode ?? (string)request('compare_mode','prev_month'); $cmpEnabled = (bool)($compare_enabled ?? false); $goalsTeam = $goalsTeam ?? ['total_hours'=>0,'guest_count'=>0,'live_hours'=>0,'sahra_hours'=>0]; $goalsMember = $goalsMember ?? ['mix_hours'=>0,'sahra_hours'=>0]; $team = $team ?? ['members'=>0,'live_hours'=>0,'sahra_hours'=>0,'guest_hours'=>0,'guest_count'=>0,'total_hours'=>0,'hit_total'=>null,'hit_guest'=>null,'hit_live'=>null,'hit_sahra'=>null]; $teamCmp = $teamCmp ?? null; $rows = $rows ?? collect(); $pct = function($now, $goal){ $goal = (float)$goal; $now = (float)$now; if ($goal <= 0) return 0; return max(0, min(100, round(($now/$goal)*100, 1))); }; $toneBadge = function($hit){ if ($hit === null) return 'bg-white/5 border-white/10 text-white/70'; return $hit ? 'bg-emerald-500/15 border-emerald-400/20 text-emerald-200' : 'bg-rose-500/15 border-rose-400/20 text-rose-200'; }; $deltaCls = function($v){ if ($v === null) return 'text-white/60'; if ($v > 0) return 'text-emerald-200'; if ($v < 0) return 'text-rose-200'; return 'text-white/70'; }; $fmt = function($v, $suf=''){ if ($v === null) return '—'; $n = is_numeric($v) ? (float)$v : null; if ($n === null) return e((string)$v); $t = rtrim(rtrim(number_format($n, 2, '.', ''), '0'), '.'); return $t.$suf; }; @endphp
{{-- HERO --}}
members_goals — أهداف + مقارنة + تحليل AI

أهداف الأعضاء ProMission

متابعة ساعات (لايف بدون سهرة + قستات) + ساعات السهرة + مؤشرات إنجاز الفريق والأعضاء.
الفترة: {{ $from ?? request('from') }} → {{ $to ?? request('to') }} هدف الفريق الكلي: {{ $fmt($team['total_hours'] ?? 0,'س') }} / {{ $fmt($goalsTeam['total_hours'] ?? 0,'س') }}
{{-- TOOLS --}}
{{-- FILTER FORM --}}
فلترة الفترة
أهداف الأعضاء
{{-- TEAM KPIs --}}
إجمالي ساعات الفريق
{{ $fmt($team['total_hours'] ?? 0,'س') }}
هدف: {{ $fmt($goalsTeam['total_hours'] ?? 0,'س') }} • إنجاز: {{ $pct($team['total_hours'] ?? 0, $goalsTeam['total_hours'] ?? 0) }}%
@if($cmpEnabled && $teamCmp)
مقارنة: {{ $fmt($teamCmp['delta_total'] ?? null,'س') }} {{ ($teamCmp['pct_total'] ?? null) !== null ? ($teamCmp['pct_total'].'%') : '—' }}
@endif
لايف (بدون سهرة)
{{ $fmt($team['live_hours'] ?? 0,'س') }}
هدف: {{ $fmt($goalsTeam['live_hours'] ?? 0,'س') }} • {{ $pct($team['live_hours'] ?? 0, $goalsTeam['live_hours'] ?? 0) }}%
@if($cmpEnabled && $teamCmp)
مقارنة: {{ $fmt($teamCmp['delta_live'] ?? null,'س') }} {{ ($teamCmp['pct_live'] ?? null) !== null ? ($teamCmp['pct_live'].'%') : '—' }}
@endif
السهرات
{{ $fmt($team['sahra_hours'] ?? 0,'س') }}
هدف: {{ $fmt($goalsTeam['sahra_hours'] ?? 0,'س') }} • {{ $pct($team['sahra_hours'] ?? 0, $goalsTeam['sahra_hours'] ?? 0) }}%
@if($cmpEnabled && $teamCmp)
مقارنة: {{ $fmt($teamCmp['delta_sahra'] ?? null,'س') }} {{ ($teamCmp['pct_sahra'] ?? null) !== null ? ($teamCmp['pct_sahra'].'%') : '—' }}
@endif
القستات
{{ (int)($team['guest_count'] ?? 0) }}
هدف: {{ (int)($goalsTeam['guest_count'] ?? 0) }} • {{ $pct($team['guest_count'] ?? 0, $goalsTeam['guest_count'] ?? 0) }}%
@if($cmpEnabled && $teamCmp)
مقارنة: {{ $teamCmp['delta_guest_count'] ?? '—' }} {{ ($teamCmp['pct_guest_count'] ?? null) !== null ? ($teamCmp['pct_guest_count'].'%') : '—' }}
@endif
{{-- AI Analysis --}}
تحليل AI
{{ $ai['summary'] ?? ('تحليل ذكي للفترة '.$from.' → '.$to) }}
@foreach(($ai['tips'] ?? []) as $tip)
{{ $tip }}
@endforeach @if(empty($ai['tips']))
لا يوجد Tips حالياً — سيتم تعبئتها لاحقاً.
@endif
أهداف العضو
Targets
Mix (لايف بدون سهرة + قست): {{ $fmt($goalsMember['mix_hours'] ?? 0,'س') }}
سهرة: {{ $fmt($goalsMember['sahra_hours'] ?? 0,'س') }}
أعضاء ضمن الفترة: {{ (int)($team['members'] ?? 0) }}
{{-- HR --}}
{{-- ROWS --}} @if($view === 'cards')
@forelse($rows as $r) @php $avatar = $r['avatar'] ?? null; $name = $r['name'] ?? ($r['username'] ?? ('#'.($r['id'] ?? ''))); $mix = (float)($r['mix_hours'] ?? 0); $sah = (float)($r['sahra_hours'] ?? 0); $tot = (float)($r['total_hours'] ?? 0); $hitMix = $r['hit_member_mix'] ?? null; $hitSah = $r['hit_member_sahra'] ?? null; @endphp
@if($avatar) avatar @else
@endif
{{ $name }}
{{ $r['username'] ?? '' }} #{{ $r['id'] ?? '—' }}
الإجمالي
{{ $fmt($tot,'س') }}
@if($cmpEnabled)
{{ $fmt($r['delta_total'] ?? null,'س') }} {{ ($r['pct_total'] ?? null) !== null ? ($r['pct_total'].'%') : '—' }}
@endif
Mix (لايف+قست) {{ $fmt($mix,'س') }}
سهرة {{ $fmt($sah,'س') }}
قستات {{ (int)($r['guest_count'] ?? 0) }}
هدف Mix هدف السهرة
@empty
لا يوجد بيانات ضمن الفترة الحالية.
@endforelse
@else
جدول أهداف الأعضاء
Scroll أفقي للهاتف • مقارنة: {{ $cmpEnabled ? 'مفعّلة' : 'لا' }}
@if($cmpEnabled) @endif @forelse($rows as $r) @php $avatar = $r['avatar'] ?? null; $name = $r['name'] ?? ($r['username'] ?? ('#'.($r['id'] ?? ''))); $hitMix = $r['hit_member_mix'] ?? null; $hitSah = $r['hit_member_sahra'] ?? null; @endphp @if($cmpEnabled) @endif @empty @endforelse
العضو Mix (س) سهرة (س) قست (س) عدد القستات الإجمالي (س)Δ إجمالي % إجماليHit Mix Hit Sahra
@if($avatar) avatar @else
@endif
{{ $name }}
{{ $r['username'] ?? '' }} #{{ $r['id'] ?? '—' }}
{{ $fmt($r['mix_hours'] ?? 0) }} {{ $fmt($r['sahra_hours'] ?? 0) }} {{ $fmt($r['guest_hours'] ?? 0) }} {{ (int)($r['guest_count'] ?? 0) }} {{ $fmt($r['total_hours'] ?? 0) }}{{ $fmt($r['delta_total'] ?? null) }} {{ ($r['pct_total'] ?? null) !== null ? ($r['pct_total'].'%') : '—' }} {{ $hitMix === null ? '—' : ($hitMix ? '✅' : '❌') }} {{ $hitSah === null ? '—' : ($hitSah ? '✅' : '❌') }}
لا يوجد بيانات ضمن الفترة الحالية.
@endif
@endsection