@php
$currentEmployee = $employees->firstWhere('user_id', auth()->user()->id);
$todayAttendance = $currentEmployee?->attendances()->where('date', $today)->first();
@endphp
@if (auth()->user()->hasRole('Super-Admin') || auth()->user()->hasRole('admin'))
@else
{{-- Left: Check-In Time --}}
Check In Time
{{ $todayAttendance?->check_in?->format('h:i A') ?? '—' }}
@if (!$todayAttendance || !$todayAttendance->check_in)
@elseif(!$todayAttendance->check_out)
@else
@endif
{{-- Right: Check-Out Time --}}
Check Out Time
{{ $todayAttendance?->check_out?->format('h:i A') ?? '—' }}
@endif
{{-- Attendance Table --}}
| Employee |
Date |
Check-In |
Check-Out |
Status |
Notes |
@foreach ($employees as $employee)
@foreach ($employee->attendances as $att)
date == $today) class="table-success" @endif>
|
{{ $employee->first_name }} {{ $employee->last_name }}
|
{{ \Carbon\Carbon::parse($att->date)->format('d-m-Y') }} |
{{ $att->check_in?->format('h:i A') ?? '—' }} |
{{ $att->check_out?->format('h:i A') ?? '—' }} |
{{ ucfirst($att->status ?? '—') }}
|
{{ $att->notes ?? '-' }} |
@endforeach
@endforeach