@php use Illuminate\Support\Facades\Storage; // Daftar kunci informasi dan tipe foto yang akan ditampilkan $informasi = [ 'peruntukan', 'kdb', 'kdh', 'gsb', 'max_lantai', 'klb', 'gss', 'pelebaran_jalan', 'nama_petugas', ]; $fotoTypes = [ 'upload_gs', 'foto_sentuh_tanahku', 'foto_gistaru', 'foto_bhumi', 'foto_argis_region', 'foto_tempat', ]; $customLabels = [ 'upload_gs' => 'Gambar Situasi', 'foto_sentuh_tanahku' => 'Sentuh Tanahku', 'foto_gistaru' => 'Gistaru', 'foto_bhumi' => 'Bhumi', 'foto_argis_region' => 'Blad Tata Ruang', 'foto_tempat' => 'Peta Lokasi', ]; // Periksa apakah ada informasi dinas tata ruang yang valid $hasInformasi = collect($informasi)->some(fn ($key) => isset($forminspeksi['fakta'][$key]) && $forminspeksi['fakta'][$key] !== '-'); // Periksa apakah ada foto yang valid (menggunakan Storage disk public) $hasValidPhotos = collect($fotoTypes)->some(function ($type) use ($forminspeksi) { $imagePath = $forminspeksi[$type] ?? null; return is_string($imagePath) && Storage::disk('public')->exists($imagePath); }); // Siapkan catatan sebagai array, kemudian periksa apakah ada catatan yang perlu diperhatikan $notes = (array) ($forminspeksi['fakta']['keterangan'] ?? []); $hasNotes = count($notes) > 0; // Log render status untuk debugging \Log::info('Render print-out informasi tata ruang', [ 'hasInformasi' => $hasInformasi, 'hasValidPhotos' => $hasValidPhotos, 'hasNotes' => $hasNotes, ]); @endphp @if ($hasInformasi || $hasValidPhotos || $hasNotes)
Informasi Dinas Tata Ruang |
| Informasi Dinas Tata Ruang | : |
@foreach ($informasi as $key)
@if (($val = $forminspeksi['fakta'][$key] ?? null) && $val !== '-')
- {{ strlen($key) === 3 ? strtoupper($key) : ucfirst(str_replace('_', ' ', $key)) }}: {{ $val }} @endif @endforeach |
| {{ $customLabels[$type] ?? '' }} |
|
|
| Catatan yang Perlu Diperhatikan | : |
@foreach ($notes as $note)
{!! nl2br(e($note)) !!} @endforeach |