@extends('layouts.app') @php $headerUser = auth()->user(); $headerRole = $headerUser->hasRole('keuangan') ? 'keuangan' : ($headerUser->hasRole('yayasan') ? 'yayasan' : 'pengaju'); $headerContext = $context ?? request('context'); $legacyHeaderStatusContext = request('status'); if (($headerContext === null || $headerContext === '') && in_array($legacyHeaderStatusContext, ['lpj', 'verifikasi', 'laporan', \App\Models\Pencairan::STATUS_LPJ_DIUNGGAH], true)) { $headerContext = $legacyHeaderStatusContext === \App\Models\Pencairan::STATUS_LPJ_DIUNGGAH ? 'lpj' : $legacyHeaderStatusContext; } $detailPageTitle = $headerContext === 'lpj' ? 'Detail LPJ' : 'Detail Pencairan'; $parentPageTitle = match (true) { $headerRole === 'keuangan' && $headerContext === 'verifikasi' => 'Verifikasi Pencairan', $headerRole === 'keuangan' && $headerContext === 'laporan' => 'Laporan Pencairan', $headerRole === 'keuangan' && $headerContext === 'lpj' => 'Verifikasi LPJ', $headerRole === 'yayasan' && $headerContext === 'lpj' => 'Monitoring LPJ', $headerRole === 'yayasan' => 'Monitoring Pencairan', $headerRole === 'pengaju' && $headerContext === 'lpj' => 'LPJ', default => 'Daftar Pencairan', }; $parentRouteParams = $headerContext ? ['context' => $headerContext] : []; @endphp @section('title', $detailPageTitle) @section('page-title', $detailPageTitle) @section('breadcrumb') @endsection @section('content') @php $user = auth()->user(); $role = $user->hasRole('keuangan') ? 'keuangan' : ($user->hasRole('yayasan') ? 'yayasan' : 'pengaju'); $lpjStatuses = [ \App\Models\Pencairan::STATUS_DICAIRKAN, \App\Models\Pencairan::STATUS_LPJ_DIUNGGAH, \App\Models\Pencairan::STATUS_LPJ_DITERIMA, \App\Models\Pencairan::STATUS_LPJ_DITOLAK, \App\Models\Pencairan::STATUS_SELESAI, ]; $context = $context ?? request('context'); $legacyStatusContext = request('status'); if (($context === null || $context === '') && in_array($legacyStatusContext, ['lpj', 'verifikasi', 'laporan', \App\Models\Pencairan::STATUS_LPJ_DIUNGGAH], true)) { $context = $legacyStatusContext === \App\Models\Pencairan::STATUS_LPJ_DIUNGGAH ? 'lpj' : $legacyStatusContext; } $isLpjContext = $context === 'lpj'; $lpjDoc = $pencairan->getDocument('lpj'); $backParams = $context ? ['context' => $context] : []; $canShowPengajuPencairanAction = $role === 'pengaju' && $context === 'pencairan' && $pencairan->isEditable(); $canShowPengajuLpjAction = $role === 'pengaju' && $isLpjContext && in_array($pencairan->status, [ \App\Models\Pencairan::STATUS_DICAIRKAN, \App\Models\Pencairan::STATUS_LPJ_DITOLAK, ], true); $canShowKeuanganPencairanAction = $role === 'keuangan' && $context === 'verifikasi' && in_array($pencairan->status, [ \App\Models\Pencairan::STATUS_PROSES, \App\Models\Pencairan::STATUS_DIAJUKAN, \App\Models\Pencairan::STATUS_ACC, ], true); $canShowKeuanganLpjAction = $role === 'keuangan' && $isLpjContext && $pencairan->status === \App\Models\Pencairan::STATUS_LPJ_DIUNGGAH; $isInfoOnlyDetail = !$canShowPengajuPencairanAction && !$canShowPengajuLpjAction && !$canShowKeuanganPencairanAction && !$canShowKeuanganLpjAction; $showActionCard = !$isInfoOnlyDetail; $showHistoryCard = true; $showNoteCard = $pencairan->catatan_list->isNotEmpty(); $usesPengajuLpjLayout = $role === 'pengaju' && $isLpjContext; $showHistoryBelowInfo = $showHistoryCard && $usesPengajuLpjLayout; $showHistoryInSidebar = $showHistoryCard && !$usesPengajuLpjLayout; $hasSidePanel = $showActionCard || $showHistoryInSidebar || $showNoteCard; @endphp
@if($isLpjContext) @endif {{-- Detail --}} {{-- Timeline --}} @if($showHistoryBelowInfo) @endif {{-- Nominal --}} @unless($isLpjContext) @endunless {{-- Supporting Documents for Pencairan Outside RKAT --}} @if(!$isLpjContext && $pencairan->luar_rkat) @endif {{-- Pencairan Info --}} @unless($isLpjContext) @endunless {{-- LPJ Verification --}} @if($pencairan->verifikasi_list->isNotEmpty()) @endif
@if($hasSidePanel)
{{-- Actions --}} @if($showActionCard) @endif {{-- Timeline --}} @if($showHistoryInSidebar) @endif {{-- Catatan --}} @if($showNoteCard) @endif
@endif
@if($canShowKeuanganPencairanAction) @php $canSetDetailNominal = $pencairan->luar_rkat && $pencairan->status === \App\Models\Pencairan::STATUS_PROSES; $jumlahCair = (int) ($pencairan->disetujui ?: $pencairan->diminta); @endphp @endif {{-- Revisi Modal --}} @if($canShowKeuanganPencairanAction && $pencairan->status === \App\Models\Pencairan::STATUS_PROSES) @endif @if($canShowKeuanganPencairanAction && $pencairan->status === \App\Models\Pencairan::STATUS_PROSES) @endif {{-- Tolak LPJ Modal --}} @if($canShowKeuanganLpjAction) @endif @endsection