@php
$isLuring = strtolower($detail->konsultasi->jenisKonsultasi->nama_jenis ?? '') === 'luring';
$fields = [
'Jenis Konsultasi' => $isLuring ? 'Konsultasi Luring' : 'Konsultasi Daring',
'Topik' => $detail->topik->nama_topik ?? '-',
'Tanggal Dibuat' => $detail->created_at->format('d F Y H:i'),
];
if ($isLuring) {
$fields['Tanggal Konsultasi'] = \Carbon\Carbon::parse($detail->tanggal_konsultasi)->format('d F Y');
$fields['Sesi'] = $detail->sesi->nama_sesi ?? '-';
}
@endphp
@foreach ($fields as $label => $value)
{{ $label }}:
{{ $value }}
@endforeach
{{-- Status --}}
Status:
@php
$statusName = strtolower($detail->status->nama_status ?? '');
$statusClass = match($statusName) {
'diajukan' => 'bg-blue-100 text-blue-800',
'diproses' => 'bg-yellow-100 text-yellow-800',
'selesai' => 'bg-green-100 text-green-800',
'batal' => 'bg-red-100 text-red-800',
default => 'bg-gray-100 text-gray-800',
};
@endphp
{{ ucfirst($detail->status->nama_status ?? '-') }}
{{-- Catatan --}}
Catatan:
{!! $detail->catatan_konsultasi !!}
{{-- Lampiran --}}
Lampiran:
@php
$filePath = $detail->lampiran->lampiran ?? null;
$fileUrl = $filePath ? asset('storage/' . $filePath) : null;
$fileName = $filePath ? basename($filePath) : null;
$extension = strtolower(pathinfo($fileName, PATHINFO_EXTENSION));
$iconClass = match ($extension) {
'pdf' => 'fa-file-pdf text-red-600',
'doc', 'docx' => 'fa-file-word text-blue-600',
'xls', 'xlsx' => 'fa-file-excel text-green-600',
'ppt', 'pptx' => 'fa-file-powerpoint text-orange-500',
'jpg', 'jpeg', 'png', 'gif' => 'fa-file-image text-purple-500',
'zip', 'rar' => 'fa-file-archive text-yellow-600',
'txt' => 'fa-file-alt text-gray-600',
default => 'fa-file text-gray-500',
};
@endphp
@if($filePath)
{{ $fileName }}
@else
- Tidak ada lampiran -
@endif
{!! QrCode::size(250)->generate($detail->kode_konsultasi) !!}