{{-- Pengajuan Progress Tracker ─────────────────────────── Menampilkan progress 9 tahap sesuai BA LOS BPDLH. Menggantikan inline progress tracker yang terduplikasi di show.blade.php. Usage: Props: status PengajuanStatus enum | ApplicationStatus enum | string required --}} @props(['status']) @php $value = $status instanceof \BackedEnum ? $status->value : (string) $status; // Map status → step number (1-based) // Sesuai alur BA: Inisiasi(1-2) → DA PL(3) → DA Penelaah(4) → Approval(5) → FA(6) → Review FA(7) → Keputusan(8) → Hasil(9) $stepMap = [ // New BA flow 'draft' => 1, 'da_pl' => 3, 'waiting_da_penelaah' => 4, 'waiting_approval_da' => 5, 'fa' => 6, 'waiting_review_fa' => 7, 'waiting_keputusan' => 8, 'approved' => 9, 'rejected' => 9, // Legacy 'submitted' => 2, 'fa_pending' => 3, 'fa_inprogress' => 3, 'fa_submitted' => 4, 'da_review' => 5, 'verifikasi_final' => 6, 'signature' => 7, 'disetujui' => 8, 'bersyarat' => 8, 'ditolak' => 8, ]; $currentStep = $stepMap[$value] ?? 0; $isFinal = in_array($value, ['approved', 'rejected', 'disetujui', 'ditolak', 'bersyarat']); $stages = [ ['step' => 1, 'label' => 'Inisiasi', 'icon' => 'bi-folder-plus'], ['step' => 3, 'label' => 'Desk Analysis', 'icon' => 'bi-clipboard-check'], ['step' => 5, 'label' => 'Approval DA', 'icon' => 'bi-person-check'], ['step' => 6, 'label' => 'Field Analysis','icon' => 'bi-geo-alt'], ['step' => 7, 'label' => 'Review FA', 'icon' => 'bi-search'], ['step' => 8, 'label' => 'Keputusan', 'icon' => 'bi-award'], ['step' => 9, 'label' => 'Hasil', 'icon' => $isFinal && str_contains($value, 'reject') || str_contains($value, 'tolak') ? 'bi-x-circle' : 'bi-check-circle'], ]; @endphp
@foreach($stages as $stage) @php $done = $currentStep > $stage['step']; $active = $currentStep === $stage['step'] || ($stage['step'] <= $currentStep && $stage['step'] + 2 > $currentStep); // More precise: done if current > stage, active if current == stage $done = $currentStep > $stage['step']; $active = $currentStep === $stage['step']; $state = $done ? 'done' : ($active ? 'active' : 'pending'); @endphp
@if($done) @elseif($active && $isFinal && $stage['step'] === 9) @else {{ $loop->iteration }} @endif
{{ $stage['label'] }}
@endforeach