@extends('layouts.superadmin') @section('title','ملف العضو - الغيابات') @section('content') @php use Carbon\Carbon; $from = $from ?? now()->subDays(90)->toDateString(); $to = $to ?? now()->toDateString(); $absences = $absences ?? collect(); $evaluations = $evaluations ?? collect(); $stats = $stats ?? [ 'approved' => $absences->where('status','approved')->count(), 'pending' => $absences->where('status','pending')->count(), 'rejected' => $absences->where('status','rejected')->count(), 'present' => $evaluations->where('attendance_status','present')->count(), 'excused' => $evaluations->where('attendance_status','absent_with_excuse')->count(), 'noexcuse' => $evaluations->where('attendance_status','absent_without_excuse')->count(), ]; $uName = $user->name ?? $user->username ?? 'عضو'; $uInitial = mb_substr($uName,0,1); // ===== ADD: LED state ===== $led = $ledState ?? 'clear'; $ledClass = $led === 'excused_today' ? 'bg-rose-500' : ($led === 'pending' ? 'bg-amber-500' : 'bg-emerald-500'); // ===== END ADD ===== @endphp
{{-- HERO --}}
{{ $uInitial }}
نظام الغيابات — ملف عضو

ملف العضو: {{ $uName }}

هنا تتابع الغيابات + التقييمات (الحضور) للعضو ضمن فترة محددة، مع كروت تلخيصية وجدولين احترافيين، وإمكانية التبديل بين عرض كروت و جدول.

{{-- AERO / Filters + Toggle --}}
{{-- ===== ADD: اختيار عضو + LED + بحث ===== --}}
{{-- LED --}}
اختيار عضو
@if($led === 'excused_today') غياب رسمي اليوم @elseif($led === 'pending') طلبات معلّقة @else الوضع طبيعي @endif
عند تغيير العضو سيتم الانتقال تلقائيًا مع الحفاظ على (من/إلى).
{{-- ===== END ADD ===== --}}
{{-- Key / Guide --}}
مفتاح الإرشاد
حضور
present
غياب بعذر
absent_with_excuse
غياب بدون عذر
absent_without_excuse
{{-- Toggle --}}
طريقة العرض
فترة العرض: {{ $from }}{{ $to }}
{{-- KPI Cards --}}
حضور
{{ $stats['present'] ?? 0 }}
غياب بعذر
{{ $stats['excused'] ?? 0 }}
غياب بدون عذر
{{ $stats['noexcuse'] ?? 0 }}
طلبات معتمدة
{{ $stats['approved'] ?? 0 }}
طلبات معلقة
{{ $stats['pending'] ?? 0 }}
طلبات مرفوضة
{{ $stats['rejected'] ?? 0 }}
{{-- CARDS VIEW --}}
{{-- Absences Cards --}}
غيابات العضو
كل طلبات الغياب ضمن الفترة.
@if($absences->isEmpty())
لا يوجد غيابات ضمن الفترة.
@else
@foreach($absences as $a) @php $badge = $a->status === 'approved' ? 'emerald' : ($a->status === 'pending' ? 'amber' : 'rose'); $badgeText = $a->status === 'approved' ? 'معتمد' : ($a->status === 'pending' ? 'معلّق' : 'مرفوض'); @endphp
{{ Carbon::parse($a->from_date)->toDateString() }} → {{ Carbon::parse($a->to_date)->toDateString() }}
{{ $a->excuse_reason }}
{{ $badgeText }}
ID: {{ $a->id }}
@endforeach
@endif
{{-- Evaluations Cards --}}
تقييمات الحضور
سجل حضور/غياب حسب جدول Evaluation.
@if($evaluations->isEmpty())
لا يوجد تقييمات ضمن الفترة.
@else
@foreach($evaluations as $e) @php $st = $e->attendance_status; $color = $st==='present' ? 'emerald' : ($st==='absent_with_excuse' ? 'amber' : 'rose'); $txt = $st==='present' ? 'حضور' : ($st==='absent_with_excuse' ? 'غياب بعذر' : 'غياب بدون عذر'); @endphp
{{ Carbon::parse($e->evaluation_date)->toDateString() }}
{{ $txt }}
@endforeach
@endif
{{-- TABLE VIEW --}} {{-- Footer --}}
Golden Loyalty Army · Falcon Room · Absences Member Profile
@endsection