@php use Illuminate\Support\Carbon; $selectedDate = Carbon::parse($date ?? ($week ?? $month))->settings(['formatFunction' => 'translatedFormat']); $showUserDetail = !$month || $week || $date; // is week or day filter $isPerDayFilter = isset($date); $datesWithoutWeekend = ''; @endphp Absensi | {{ $date ?? ($week ?? $month) }}

Data Absensi

@if ($division) @endif @if ($jobTitle) @endif
Divisi : {{ $division ? App\Models\Division::find($division)->name : '-' }}
Jabatan : {{ $jobTitle ? App\Models\JobTitle::find($jobTitle)->name : '-' }}
@if ($month) Bulan: {{ $selectedDate->format('F Y') }} @elseif ($week) Tanggal: {{ $start->format('l, d/m/Y') }} - {{ $end->format('l, d/m/Y') }} @elseif ($date) Tanggal: {{ $selectedDate->format('d/m/Y') }} @endif
@if ($showUserDetail) @if ($isPerDayFilter) @endif @endif @foreach ($dates as $date) @endforeach @if (!$isPerDayFilter) @foreach (['H', 'T', 'I', 'S', 'A'] as $_st) @endforeach @endif @foreach ($employees as $employee) @php $attendances = $employee->attendances; $attendance = $employee->attendances->isEmpty() ? null : $employee->attendances->first(); @endphp @if ($showUserDetail) @if ($isPerDayFilter) @endif @endif @php $presentCount = 0; $lateCount = 0; $excusedCount = 0; $sickCount = 0; $absentCount = 0; @endphp @foreach ($dates as $date) @php $isWeekend = $date->isWeekend(); $status = ($attendances->firstWhere(fn($v, $k) => $v['date'] === $date->format('Y-m-d')) ?? [ 'status' => $isWeekend || !$date->isPast() ? '-' : 'absent', ])['status']; switch ($status) { case 'present': $shortStatus = 'H'; $presentCount++; break; case 'late': $shortStatus = 'T'; $lateCount++; break; case 'excused': $shortStatus = 'I'; $excusedCount++; break; case 'sick': $shortStatus = 'S'; $sickCount++; break; case 'absent': $shortStatus = 'A'; $absentCount++; break; default: $shortStatus = '-'; break; } @endphp @endforeach @if (!$isPerDayFilter) @foreach ([$presentCount, $lateCount, $excusedCount, $sickCount, $absentCount] as $statusCount) @endforeach @endif @endforeach
No. {{ $showUserDetail ? __('Name') : __('Name') . '/' . __('Date') }} {{ __('NIP') }} {{ __('Division') }} {{ __('Job Title') }} {{ __('Shift') }} @if ($isPerDayFilter) Status @elseif (!$month) {{ $date->format('d/m') }} @else {{ $date->format('d') }} @endif {{ $_st }}
{{ $loop->iteration }} {{ $employee->name }} {{ $employee->nip }} {{ $employee->division?->name ?? '-' }} {{ $employee->jobTitle?->name ?? '-' }} {{ $attendance['shift'] ?? '-' }} {{ $isPerDayFilter ? __($status) : $shortStatus }} {{ $statusCount }}
@if ($employees->isEmpty())
Tidak ada data
@endif