@extends('dashlayouts.app') @section('content')

Class Attendance

Student Information

Student ID: {{ $student->student_id }}

{{--

MARA No.: {{ $student->account_no }}

--}}

Student Name: {{ $student->student_name }}

School: {{ $student->nama_pusat }}

Form: {{ $student->tingkatan }}

Attendance Status: @if ($student->attendance_status == 0) Active @elseif ($student->attendance_status == 1) 1/3 @elseif ($student->attendance_status == 2) 2/3 @elseif ($student->attendance_status == 3) 3/3 - WARNING @endif

Attendance Records

@php $currentWeek = null; $currentTableStarted = false; @endphp @foreach($attendance as $att) @php // Convert the attendance date to a Carbon instance $attendanceDate = \Carbon\Carbon::parse($att->mula_kelas); // Get the week of the year for the current attendance record $weekOfYear = $attendanceDate->weekOfYear; // Calculate Monday and Friday for the current week $monday = $attendanceDate->startOfWeek()->toDateString(); $friday = $attendanceDate->startOfWeek()->addDays(4)->toDateString(); @endphp @if($currentWeek !== $weekOfYear) @if($currentTableStarted)
@endif

Week {{ $weekOfYear }}

Date Range: {{ $monday }} - {{ $friday }}

@endif @php $currentWeek = $weekOfYear; $currentTableStarted = true; @endphp @endforeach @if($currentTableStarted)
No. Subject Class Period
{{ $loop->iteration }}. {{ $att->subjek }} {{ \Carbon\Carbon::parse($att->class_date)->format('l') }} {{ \Carbon\Carbon::parse($att->class_date)->format('d-m-Y') }},
{{ \Carbon\Carbon::parse($att->class_start)->format('h:i A') }} - {{ \Carbon\Carbon::parse($att->class_end)->format('h:i A') }}
@endif {{ $attendance->links() }}
@endsection