@extends('master') @push('styles') @endpush @section('content') @php $initials = 'N/A'; $role = 'N/A'; if ($checkIn->user) { $initials = collect(explode(' ', $checkIn->user->name)) ->take(2) ->map(fn($w) => strtoupper(substr($w, 0, 1))) ->join(''); $role = $checkIn->user->role->name ?? 'N/A'; } $checkinAt = \Carbon\Carbon::parse($checkIn->check_in); $checkoutAt = $checkIn->check_out ? \Carbon\Carbon::parse($checkIn->check_out) : null; $durationMinutes = $checkoutAt ? $checkinAt->diffInMinutes($checkoutAt) : null; $durationLabel = $durationMinutes ? floor($durationMinutes / 60) . ' jam ' . ($durationMinutes % 60) . ' menit' : '—'; $durationPercent = $durationMinutes ? min(100, round(($durationMinutes / (9 * 60)) * 100)) : 0; @endphp
@if($checkIn->user) {{-- ── Section 1: Informasi Pengguna ── --}}
Informasi Pengguna
Nama {{ $initials }} {{ $checkIn->user->name ?? '—' }}
Role {{ $role ?: '—' }}
Tanggal {{ $checkinAt->translatedFormat('l, d F Y') }}
@endif {{-- ── Section 2: Detail Check In & Check Out ── --}}
Detail Check In & Check Out
{{-- Check In --}}
Check In
{{ $checkinAt->format('H:i') }}
{{ $checkinAt->translatedFormat('d M Y') }}
{{ $checkIn->checkin_address ?? '—' }}
{{-- Check Out --}}
Check Out
@if($checkoutAt)
{{ $checkoutAt->format('H:i') }}
{{ $checkoutAt->translatedFormat('d M Y') }}
{{ $checkIn->checkout_address ?? '—' }}
@else
Belum check out
@endif
{{-- Duration bar --}}
Total durasi kerja {{ $durationLabel }}
{{-- ── Section 3: Riwayat Kunjungan ── --}}
Riwayat Kunjungan
No. Nama Customer Tipe Catatan Waktu (Dibuat)
@endsection @push('scripts') @vite(['resources/js/report-detail.js']) @endpush