@extends('layouts.app') @section('title', 'My Attendance') @section('breadcrumbs') @endsection @section('content')
{{-- Header with Month Selector --}}

My Attendance

{{ \Carbon\Carbon::createFromDate($year, $month, 1)->format('F Y') }}

{{-- Summary Cards --}}
{{ $summary['present'] }}
Present
{{ $summary['absent'] }}
Absent
{{ $summary['half_day'] }}
Half Day
{{ $summary['leave'] }}
Leave
{{ $summary['late_days'] }}
Late Days
{{ $summary['total_hours'] }}h
Total Hours
{{ $summary['total_overtime'] }}h
Overtime
{{-- Calendar Grid --}}

{{ \Carbon\Carbon::createFromDate($year, $month, 1)->format('F Y') }}

Present Absent Leave/Half Weekend
@foreach(['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'] as $dayName)
{{ $dayName }}
@endforeach @for($i = 0; $i < $startOfMonth->dayOfWeek; $i++)
@endfor @for($day = 1; $day <= $daysInMonth; $day++) @php $dateKey = \Carbon\Carbon::createFromDate($year, $month, $day)->format('Y-m-d'); $record = $records->get($dateKey); $bgClass = 'bg-gray-50'; $textClass = 'text-gray-600'; if ($record) { switch ($record->status) { case 'present': $bgClass = $record->is_late ? 'bg-orange-100 border border-orange-300' : 'bg-success-100 border border-success-500/30'; $textClass = $record->is_late ? 'text-orange-700' : 'text-success-700'; break; case 'absent': $bgClass = 'bg-danger-100 border border-danger-500/30'; $textClass = 'text-danger-600'; break; case 'half_day': $bgClass = 'bg-warning-100 border border-warning-500/30'; $textClass = 'text-warning-700'; break; case 'leave': $bgClass = 'bg-primary-100 border border-primary-500/30'; $textClass = 'text-primary-700'; break; case 'weekend': case 'holiday': $bgClass = 'bg-gray-100'; $textClass = 'text-gray-400'; break; } } @endphp
{{ $day }}
@endfor
{{-- Records Table --}}

Daily Records

@for($day = 1; $day <= $daysInMonth; $day++) @php $dateObj = \Carbon\Carbon::createFromDate($year, $month, $day); $dateKey = $dateObj->format('Y-m-d'); $record = $records->get($dateKey); if ($dateObj->isFuture()) continue; @endphp @endfor
Date Clock In Clock Out Hours Overtime Status Late
{{ $dateObj->format('d M, D') }} {{ $record ? $record->formatted_clock_in : '—' }} {{ $record ? $record->formatted_clock_out : '—' }} {{ $record ? $record->formatted_total_hours : '—' }} {{ $record && $record->overtime_hours > 0 ? $record->overtime_hours . 'h' : '—' }} @if($record) {{ $record->status_label }} @else @endif @if($record && $record->is_late) {{ $record->late_minutes }}m @else @endif
@endsection