Attendance Report

@foreach ($attendance as $key => $classSection)

{{ $classSection['Grade'] }} ({{ $classSection['Gate'] }} {{ $classSection['Campus'] }}):

@foreach ($dateRange as $datenew) @php $currentDate = \Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $datenew); $formattedDate = $currentDate->format('Y-m-d'); $weekDay = $currentDate->dayOfWeek; $key = $classSection['class_id'] . '_' . $classSection['section_id'] . '_' . $classSection['campus_id']; $sectionHolidays = $holidays[$key] ?? []; $sectionOpenWeekends = $weekends[$key] ?? []; $isHoliday = in_array($formattedDate, $sectionHolidays); $isWeekend = in_array($weekDay, [0, 6]); // Sunday=0, Saturday=6 $isOpenWeekend = in_array($formattedDate, $sectionOpenWeekends); $dateKey = $currentDate->copy()->setTime(0, 0, 0)->format('Y-m-d H:i:s'); $hasAttendance = !empty($classSection['DateWiseCounts'][$dateKey] ?? null); @endphp @if ($isHoliday) @elseif ($isWeekend && !$isOpenWeekend) @elseif ($isOpenWeekend && !$hasAttendance) @elseif ($hasAttendance) @php $counts = $classSection['DateWiseCounts'][$dateKey]; @endphp @else @endif @endforeach
Date Present Absent Total
{{ $currentDate->format('d M Y') }}HolidayWeekendNot Marked{{ $counts['total_present'] }} {{ $counts['total_absent'] }} {{ $counts['total_count'] }}Not Marked
@endforeach