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

UEPL | Employee Daily Attendance

{{ now()->format('l') }}, {{ now()->format('d') }} {{ now()->format('F') }} {{ now()->format('Y') }}
@if(session('success')) @endif @if(session('error')) @endif
Reset
Attendance Records ({{ $attendances->count() }})
@php function decimalToHoursMinutes($decimal) { $h = floor($decimal); $m = round(($decimal - $h) * 60); return sprintf('%02d:%02d', $h, $m); } @endphp @foreach($attendances as $row) @php // Check if fields are time strings or Carbon objects // Assuming model casts to H:i:s string or null $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; $workDuration = null; $workHours = 0; // Calculate display logic if not stored (fallback) // Ideally, we rely on controller calculation, but view calculation acts as backup if ($checkIn && $checkOut) { $total = $checkIn->diffInMinutes($checkOut); $break = ($breakIn && $breakOut) ? $breakOut->diffInMinutes($breakIn) : 0; $workMinutes = max(0, $total - $break); $workHours = round($workMinutes / 60, 2); $workDuration = sprintf('%02d:%02d', intdiv($workMinutes, 60), $workMinutes % 60); } // Use stored values if available (from enhance logic), else calc $ot = $row->ot_hours ?? ($workHours > 9 ? round($workHours - 9, 2) : 0); $shortage = $row->shortage_hours ?? ($workHours < 9 ? round(9 - $workHours, 2) : 0); @endphp @endforeach
Date Emp ID Name Check In Break Out Break In Check Out Work Hrs OT Shortage Actions
{{ \Carbon\Carbon::parse($row->date)->format('d-m-Y') }} {{ $row->employee_id }} {{ $row->employee_name }} {{ $row->check_in ? \Carbon\Carbon::parse($row->check_in)->format('H:i') : '-' }} {{ $row->break_out ? \Carbon\Carbon::parse($row->break_out)->format('H:i') : '-' }} {{ $row->break_in ? \Carbon\Carbon::parse($row->break_in)->format('H:i') : '-' }} {{ $row->check_out ? \Carbon\Carbon::parse($row->check_out)->format('H:i') : '-' }} @if($workDuration) {{ $workDuration }} @else - @endif @if($ot > 0) {{ decimalToHoursMinutes($ot) }} @else - @endif @if($shortage > 0) {{ decimalToHoursMinutes($shortage) }} @else - @endif
@csrf @method('DELETE')
@endsection @section('scripts') @endsection