@forelse ($shifts as $index => $shift) @empty @endforelse
No Karyawan Posisi Jenis Shift Tanggal Hari Jam Kerja Status Keterangan Aksi
{{ $index + 1 }}
{{ strtoupper(substr($shift->employee->user->name ?? 'N', 0, 2)) }}
{{ $shift->employee->user->name ?? 'N/A' }}
{{ $shift->employee->employee_id ?? 'N/A' }}
{{ $shift->employee->position ?? 'Staff' }}
@php // Dynamic icon based on time $shiftIcon = 'ri-time-line text-primary'; if ($shift->shift && $shift->shift->time_in) { $hour = (int) substr($shift->shift->time_in, 0, 2); if ($hour >= 6 && $hour < 12) { $shiftIcon = 'ri-sun-line text-warning'; } elseif ($hour >= 12 && $hour < 18) { $shiftIcon = 'ri-sun-cloudy-line text-info'; } elseif ($hour >= 18 || $hour < 6) { $shiftIcon = 'ri-moon-line text-dark'; } } @endphp
{{ $shift->shift->name ?? 'N/A' }}
{{ $shift->shift->time_in ?? '00:00' }} - {{ $shift->shift->time_out ?? '00:00' }}
{{ \Carbon\Carbon::parse($shift->date)->format('d M Y') }} {{ \Carbon\Carbon::parse($shift->date)->translatedFormat('l') }}
@if($shift->shift && $shift->shift->time_in && $shift->shift->time_out) @php try { $timeIn = \Carbon\Carbon::createFromFormat('H:i:s', $shift->shift->time_in); $timeOut = \Carbon\Carbon::createFromFormat('H:i:s', $shift->shift->time_out); // Handle overnight shifts if ($timeOut->lessThan($timeIn)) { $timeOut->addDay(); } $duration = $timeIn->diffInHours($timeOut, false); $duration = abs($duration); } catch (\Exception $e) { $duration = 0; } @endphp {{ $duration }} Jam
{{ $shift->shift->time_in }} - {{ $shift->shift->time_out }} @else - @endif
@php $today = \Carbon\Carbon::today(); $shiftDate = \Carbon\Carbon::parse($shift->date); if ($shiftDate->isPast()) { $statusClass = 'bg-success'; $statusText = 'Selesai'; $statusIcon = 'ri-check-line'; } elseif ($shiftDate->isToday()) { $statusClass = 'bg-warning'; $statusText = 'Berlangsung'; $statusIcon = 'ri-play-line'; } else { $statusClass = 'bg-label-primary'; $statusText = 'Dijadwalkan'; $statusIcon = 'ri-calendar-line'; } @endphp {{ $statusText }} @if($shift->notes) Ada Catatan @else - @endif
Belum Ada Jadwal Shift

Mulai buat jadwal shift untuk karyawan