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

Attendance Calendar

Matrix View
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) { // Parse times $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; } } @endphp
Present {{ $present }}
CL {{ $cl }}
SL {{ $sl }}
PL {{ $pl }}
LOP {{ $lop }}
Absent {{ $absent }}
OT (hrs) {{ number_format($totalOt,2) }}
Shortage (hrs) {{ number_format($totalShortage,2) }}
Total Days {{ $totalDays }}
@endsection @section('scripts') @endsection