@if($attendance->count() > 0)
| التاريخ |
اليوم |
وقت الحضور |
وقت الانصراف |
ساعات العمل |
الحالة |
ملاحظات |
@foreach($attendance as $att)
@php
$dayNames = ['Sunday'=>'الأحد','Monday'=>'الاثنين','Tuesday'=>'الثلاثاء','Wednesday'=>'الأربعاء','Thursday'=>'الخميس','Friday'=>'الجمعة','Saturday'=>'السبت'];
$dayEn = \Carbon\Carbon::parse($att->date)->format('l');
$dayAr = $dayNames[$dayEn] ?? $dayEn;
$hours = '';
if ($att->check_in && $att->check_out) {
$diff = \Carbon\Carbon::parse($att->check_in)->diffInMinutes(\Carbon\Carbon::parse($att->check_out));
$hours = floor($diff/60) . ':' . str_pad($diff%60, 2, '0', STR_PAD_LEFT);
}
$statusMap = [
'present' => ['حاضر', 'status-active'],
'absent' => ['غائب', 'status-expired'],
'late' => ['متأخر', 'status-pending'],
'leave' => ['إجازة', 'status-draft'],
];
$s = $statusMap[$att->status] ?? [$att->status, ''];
@endphp
| {{ \Carbon\Carbon::parse($att->date)->format('d/m/Y') }} |
{{ $dayAr }} |
{{ $att->check_in ? \Carbon\Carbon::parse($att->check_in)->format('h:i A') : '—' }} |
{{ $att->check_out ? \Carbon\Carbon::parse($att->check_out)->format('h:i A') : '—' }} |
{{ $hours ?: '—' }} |
{{ $s[0] }} |
{{ $att->notes ?? '—' }} |
@endforeach
@else
لا توجد سجلات حضور لهذا الشهر
@endif