@extends('layouts.app') @section('title', 'Manajemen Pencabutan') @section('subtitle', 'Monitoring dan eksekusi pencabutan hak akses') @section('breadcrumb')
  • Pencabutan Akses
  • @endsection @section('actions') @endsection @section('content') @php // Helper function untuk format overdue time function formatOverdueTime($daysUntilExpiry) { if (!$daysUntilExpiry || $daysUntilExpiry >= 0) { return null; } $hoursOverdue = abs($daysUntilExpiry) * 24; $daysOverdue = abs($daysUntilExpiry); if ($hoursOverdue < 1) { // Kurang dari 1 jam - hitung menit $minutesOverdue = ceil($hoursOverdue * 60); return $minutesOverdue . ' menit'; } elseif ($hoursOverdue < 24) { // Kurang dari 24 jam - tampilkan jam return ceil($hoursOverdue) . ' jam'; } else { // Lebih dari 24 jam - tampilkan hari return ceil($daysOverdue) . ' hari'; } } // Helper function untuk format time remaining (untuk this week) function formatTimeRemaining($date) { if (!$date) return null; $now = now(); if ($date->isPast()) { return ['label' => 'Sudah lewat', 'color' => 'text-gray-500', 'urgent' => false]; } $diffInHours = $now->diffInHours($date, false); $diffInDays = $now->diffInDays($date, false); $diffInMinutes = $now->diffInMinutes($date, false); if ($diffInMinutes < 60) { return [ 'label' => ceil($diffInMinutes) . ' menit lagi', 'color' => 'text-rose-600', 'urgent' => true ]; } elseif ($diffInHours < 24) { return [ 'label' => ceil($diffInHours) . ' jam lagi', 'color' => 'text-rose-600', 'urgent' => true ]; } else { return [ 'label' => ceil($diffInDays) . ' hari lagi', 'color' => $diffInDays <= 2 ? 'text-rose-500' : 'text-amber-600', 'urgent' => $diffInDays <= 3 ]; } } @endphp @if(app()->environment('local'))
    Loaded at: {{ now()->format('H:i:s') }} | Overdue: {{ $overdue->count() ?? 0 }} | This Week: {{ $thisWeek->count() ?? 0 }} | Revoked Today: {{ $revokedToday->count() ?? 0 }}
    @endif
    Overdue
    This Week
    Completed

    Overdue (Belum Dicabut)

    {{ $overdue->count() ?? 0 }}

    Proses sekarang

    Minggu Ini

    {{ $thisWeek->count() ?? 0 }}

    Akses yang akan dicabut minggu ini

    Dicabut Hari Ini

    {{ $revokedToday->count() ?? 0 }}

    Sudah diproses hari ini

    @if(isset($overdue) && $overdue->count() > 0)

    Prioritas: Overdue Access

    @foreach($overdue as $access) @php $overdueTime = formatOverdueTime($access->daysUntilExpiry()); $hoursOverdue = abs($access->daysUntilExpiry() ?? 0) * 24; // Determine urgency color if ($hoursOverdue < 1) { $overdueColor = 'bg-rose-600 text-white'; // Very urgent - minutes $overdueIcon = 'fa-bolt'; } elseif ($hoursOverdue < 24) { $overdueColor = 'bg-rose-500 text-white'; // Urgent - hours $overdueIcon = 'fa-fire'; } else { $overdueColor = 'bg-rose-100 text-rose-700'; // Days $overdueIcon = 'fa-exclamation'; } @endphp @endforeach
    Pegawai Akses Expired Date Overdue Aksi
    {{ isset($access->employee) ? substr($access->employee->name ?? '??', 0, 2) : '??' }}

    {{ $access->employee->name ?? 'Unknown' }}

    {{ $access->employee->nip ?? '-' }}

    {{ $access->accessCatalog->name ?? 'Unknown' }}

    {{ $access->accessCatalog->code ?? '-' }}

    {{ isset($access->current_expiry_date) ? $access->current_expiry_date->format('d M Y') : '-' }}

    {{ isset($access->current_expiry_date) ? $access->current_expiry_date->format('H:i') : '' }}

    @if($overdueTime) {{ $overdueTime }} overdue @else - @endif
    @csrf
    @endif

    Jadwal Pencabutan Minggu Ini

    {{ $thisWeek->count() ?? 0 }} akses terjadwal

    @forelse($thisWeek ?? [] as $schedule) @php $access = $schedule->employeeAccessDetail ?? null; if (!$access) continue; @endphp @empty @endforelse
    Pegawai Akses Tanggal Status Aksi
    {{ isset($access->employee) ? substr($access->employee->name ?? '??', 0, 2) : '??' }}

    {{ $access->employee->name ?? 'Unknown' }}

    {{ $access->employee->department->name ?? '-' }}

    {{ $access->accessCatalog->name ?? 'Unknown' }}

    {{ $access->accessCatalog->category ?? '-' }}
    {{ isset($schedule->scheduled_date) ? $schedule->scheduled_date->format('d M Y') : '-' }}

    {{ isset($schedule->scheduled_date) ? $schedule->scheduled_date->diffForHumans() : '-' }}

    Scheduled
    @csrf

    Tidak ada jadwal pencabutan minggu ini

    Semua akses aman atau sudah dicabut

    @push('scripts') @endpush @endsection