@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))

@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'] }}]({{ $imagePath }})
@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)))

@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