@extends('layouts.dashboard.superadminapp') @section('title', 'Attendance Matrix') @section('styles') @endsection @section('content')
| Employee | @foreach($dates as $date) @php $dayOfWeek = \Carbon\Carbon::parse($date)->dayOfWeek; $isSunday = $dayOfWeek === 0; @endphp
{{ \Carbon\Carbon::parse($date)->format('d') }}
{{ \Carbon\Carbon::parse($date)->format('D')[0] }} |
@endforeach
P | L | A |
|---|---|---|---|---|
|
{{ $emp->name }}
{{ $emp->employee_id }} |
@foreach($dates as $date)
@php
$status = $matrix[$emp->employee_id][$date] ?? '';
$dayOfWeek = \Carbon\Carbon::parse($date)->dayOfWeek;
$isSunday = $dayOfWeek === 0;
$class = 'unknown';
if ($status == 'Present') {
$class = 'present';
$presentCount++;
} elseif (in_array($status, ['CL','SL','PL'])) {
$class = 'leave';
$leaveCount++;
} elseif ($status == 'LOP') {
$class = 'lop';
$absentCount++;
} elseif ($status == 'Absent') {
$class = 'absent';
$absentCount++;
}
if ($isSunday && $class == 'unknown') {
$class = '';
}
@endphp
@if($status == 'Present') @elseif(in_array($status, ['CL','SL','PL'])) {{ $status }} @elseif($status == 'LOP') L @elseif($status == 'Absent') @else @if($isSunday) S @else – @endif @endif | @endforeach{{ $presentCount }} | {{ $leaveCount }} | {{ $absentCount }} |