@extends('layouts.dashboard.superadminapp') @section('title', 'Employee Attendance Calendar') @section('styles') @endsection @section('content')

UEPL | Employee Attendance Calendar

day, 00 month 0000
@if(session('success')) @endif @if(session('error')) @endif
Filter Options
Attendance Calendar
Matrix View Daily Reports
Present CL/SL/PL LOP Absent
Monthly Summary
@php $totalDays = 0; $present = 0; $absent = 0; $lop = 0; $cl = 0; $sl = 0; $pl = 0; $totalOt = 0; $totalShortage = 0; foreach($attendanceMap as $day => $status) { $totalDays++; if($status === 'Present') $present++; elseif($status === 'Absent') $absent++; elseif(strtoupper($status) === 'LOP') $lop++; elseif(strtoupper($status) === 'CL') $cl++; elseif(strtoupper($status) === 'SL') $sl++; elseif(strtoupper($status) === 'PL') $pl++; } // Calculate OT and Shortage hours from $attendanceData if available if(isset($attendanceData)) { foreach($attendanceData as $row) { $checkIn = $row->check_in ? \Carbon\Carbon::parse($row->check_in) : null; $breakOut = $row->break_out ? \Carbon\Carbon::parse($row->break_out) : null; $breakIn = $row->break_in ? \Carbon\Carbon::parse($row->break_in) : null; $checkOut = $row->check_out ? \Carbon\Carbon::parse($row->check_out) : null; $workMinutes = 0; if ($checkIn && $checkOut) { $total = $checkIn->diffInMinutes($checkOut); $break = ($breakIn && $breakOut) ? $breakOut->diffInMinutes($breakIn) : 0; $workMinutes = max(0, $total - $break); } $workHours = round($workMinutes / 60, 2); $requiredHours = 9; $ot = $workHours > $requiredHours ? $workHours - $requiredHours : 0; $shortage = $workHours < $requiredHours ? $requiredHours - $workHours : 0; $totalOt += $ot; $totalShortage += $shortage; } } $attendanceRate = $totalDays > 0 ? round(($present / $totalDays) * 100, 1) : 0; @endphp @if(request('employee_id'))

{{ $attendanceRate }}%

Attendance Rate
Present {{ $present }}
CL (Casual Leave) {{ $cl }}
SL (Sick Leave) {{ $sl }}
PL (Privilege Leave) {{ $pl }}
LOP {{ $lop }}
Absent {{ $absent }}

OT Hours {{ number_format($totalOt, 2) }}
Shortage Hours {{ number_format($totalShortage, 2) }}

Total Days {{ $totalDays }}
@else

Select an employee to view their monthly summary

@endif
@if(request('employee_id'))
Quick Stats

{{ $present + $cl + $sl + $pl }}

Total Present + Leaves

{{ $absent + $lop }}

Absent + LOP
@php $netHours = $totalOt - $totalShortage; @endphp
Net Hours Balance:
{{ $netHours >= 0 ? '+' : '' }}{{ number_format($netHours, 2) }} hrs
@endif
@endsection @section('scripts') @endsection