@php $photoSections = [ 'rute_menuju_lokasi' => [ 'key' => 'rute_menuju_lokasi', 'name_prefix' => '', 'nested' => true, ], 'foto_rute_lainnya' => [ 'key' => 'name_rute_lainnya', 'name_prefix' => '', 'nested' => true, ], 'foto_lingkungan' => [ 'key' => 'foto_lingkungan', 'name_prefix' => '', 'nested' => true, ], 'single_photos' => [ 'foto_basement' => 'Basement', 'foto_gerbang' => 'Gerbang', 'pendamping' => 'Pendamping', ], 'object_jaminan' => [ 'key' => 'name_objek', 'name_prefix' => '', 'nested' => false, ], 'foto_lantai_unit' => [ 'key' => 'name', 'name_prefix' => 'Foto Lantai', 'nested' => true, ], ]; $hasPhotos = false; @endphp @foreach ($photoSections as $sectionKey => $sectionConfig) @if ($sectionKey === 'single_photos')
@php $counter = 0; @endphp @foreach ($sectionConfig as $photoKey => $photoName) @if (isset($formFoto[$photoKey]) && !empty($formFoto[$photoKey])) @php $imagePath = storage_path('app/public/' . $formFoto[$photoKey]); $hasPhotos = true; @endphp @if ($counter % 2 == 0)
@endif

{{ $photoName }}

@if ($statusLpj || file_exists($imagePath)) {{ $photoName }} @endif
@if ($counter % 2 == 1 || $loop->last)
@endif @php $counter++; @endphp @endif @endforeach
@else @php $sectionData = $formFoto[$sectionKey] ?? null; @endphp @if (!empty($sectionData)) @if ($sectionConfig['nested']) @if (isset($sectionData[$sectionConfig['key']][0]))
@php $counter = 0; @endphp @foreach ($sectionData[$sectionConfig['key']][0] as $index => $item) @php $imagePath = storage_path('app/public/' . $item['path']); $hasPhotos = true; @endphp @if ($counter % 2 == 0)
@endif

{{ $sectionConfig['name_prefix'] ? $sectionConfig['name_prefix'] . ' ' . ($index + 1) : $item['name'] ?? 'Foto ' . ($index + 1) }}

@if ($statusLpj || file_exists($imagePath)) {{ $item['path'] }} @endif
@if ($counter % 2 == 1 || $loop->last)
@endif @php $counter++; @endphp @endforeach
@endif @else
@php $counter = 0; @endphp @foreach ($sectionData as $index => $item) @php $name = $item[$sectionConfig['key']] ?? ''; $photoPath = $sectionKey === 'object_jaminan' ? $item['foto_objek'] ?? '' : $item['foto_rute_lainnya'] ?? ''; $imagePath = storage_path('app/public/' . $photoPath); @endphp @if (!empty($name) || !empty($photoPath)) @php $hasPhotos = true; @endphp @if ($counter % 2 == 0)
@endif
@if (!empty($name))

{{ $name }}

@endif @if ($statusLpj || (file_exists($imagePath) && !empty($photoPath))) {{ $name ?: 'Foto' }} @endif
@if ($counter % 2 == 1 || $loop->last)
@endif @php $counter++; @endphp @endif @endforeach
@endif @endif @endif @endforeach @if (!$hasPhotos)

Tidak ada foto yang tersedia

@endif