{{-- Employee Details Header --}}
{{ $attendance->user->firstname }} {{ $attendance->user->lastname }}

@if($attendance->user->employeeDetail && $attendance->user->employeeDetail->department) {{ $attendance->user->employeeDetail->department->name }} @endif

{{ __('Shift Schedule') }}

{{ $attendance->user->employeeDetail && $attendance->user->employeeDetail->start_time ? \Carbon\Carbon::parse($attendance->user->employeeDetail->start_time)->format('h:i A') : 'N/A' }} - {{ $attendance->user->employeeDetail && $attendance->user->employeeDetail->end_time ? \Carbon\Carbon::parse($attendance->user->employeeDetail->end_time)->format('h:i A') : 'N/A' }}
{{-- Remarks Inline Section --}} @php $canEditRemarks = auth()->user()->hasRole('Super Admin') || auth()->user()->hasRole('Pro') || auth()->user()->hasRole('HR'); @endphp
{{ __('Remarks') }}
{{-- VIEW MODE --}}
{{ $attendance->remarks ?: __('No remarks added.') }}
@if($canEditRemarks)
@endif
{{-- EDIT MODE --}} @if($canEditRemarks)
@endif
{{ __('Timesheet') }} {{ $attendance->attendance_date ? $attendance->attendance_date->format('Y-m-d') : ($attendance->created_at ? $attendance->created_at->format('Y-m-d') : 'N/A') }}
@if (!empty($attendance->check_in_time))
{{ __('Check In') }}

{{ $attendance->check_in_time->format('Y-m-d h:i:s A') }} @if(auth()->user()->hasRole('Super Admin') || auth()->user()->hasRole('Pro')) @endif

@php $lateText = ''; $lateColorClass = 'text-danger'; $gracePeriodMinutes = 15; if ($attendance->check_in_time && $attendance->user->employeeDetail && $attendance->user->employeeDetail->start_time) { $startTimeStr = $attendance->user->employeeDetail->start_time; $scheduleStartTime = \Carbon\Carbon::parse($attendance->check_in_time->format('Y-m-d') . ' ' . $startTimeStr); if ($attendance->check_in_time->gt($scheduleStartTime)) { $diffInMinutes = $scheduleStartTime->diffInMinutes($attendance->check_in_time); if ($diffInMinutes > 0) { // Turns red only if 16 minutes or more late if ($diffInMinutes >= 16) { $lateColorClass = 'text-danger'; } else { $lateColorClass = 'text-success'; } $hours = intdiv($diffInMinutes, 60); $minutes = $diffInMinutes % 60; if ($hours > 0) { $lateText = $minutes > 0 ? sprintf('%d hr %d min late', $hours, $minutes) : sprintf('%d hr late', $hours); } else { $lateText = sprintf('%d min late', $minutes); } } } } @endphp @if($lateText) {{ $lateText }} @endif
@elseif (!empty($attendance->created_at))
{{ __('First Punched In At') }}

{{ $attendance->created_at->format('Y-m-d h:i:s A') }}

@endif
{{ __('Check Out') }}

@if (!empty($attendance->check_out_time)) {{ $attendance->check_out_time->format('Y-m-d h:i:s A') }} @if(auth()->user()->hasRole('Super Admin') || auth()->user()->hasRole('Pro')) @endif @elseif (!empty($devicePunches) && $devicePunches->count() > 1) {{ \Carbon\Carbon::parse($devicePunches->last()->punch_time)->format('Y-m-d h:i:s A') }} @if(auth()->user()->hasRole('Super Admin') || auth()->user()->hasRole('Pro')) @endif @else ------- @if(auth()->user()->hasRole('Super Admin') || auth()->user()->hasRole('Pro')) @endif @endif

{{ __('Activity') }}
    @if (!empty($devicePunches) && $devicePunches->count() > 0) {{-- Show device punches if available --}} @foreach ($devicePunches as $punch)
  • {{ __('Device Punch') }}

    {{ \Carbon\Carbon::parse($punch->punch_time)->format('Y-m-d h:i A') }}

  • @endforeach @elseif (!empty($attendanceActivity)) {{-- Fallback to attendance timestamps --}} @foreach ($attendanceActivity as $item)
  • {{ __('Punch In at') }}

    {{ !empty($item->startTime) ? $item->startTime->format('H:i A'): '' }}

  • @if (!empty($item->endTime))
  • {{ __('Punch Out at') }}

    {{ !empty($item->endTime) ? $item->endTime->format('H:i A'): '' }}


  • @endif @endforeach @else
  • {{ __('No activity recorded') }}

  • @endif
@if($canEditRemarks) @endif