diff --git a/resources/views/penilai/components/foto-jaminan.blade.php b/resources/views/penilai/components/foto-jaminan.blade.php index 65ba464..1888478 100644 --- a/resources/views/penilai/components/foto-jaminan.blade.php +++ b/resources/views/penilai/components/foto-jaminan.blade.php @@ -19,10 +19,7 @@ } .photo-item { - width: 48%; - margin-right: 2%; - float: left; - padding: 5px; + box-sizing: border-box; page-break-inside: avoid; } @@ -38,7 +35,6 @@ object-fit: contain; background-color: #f0f0f0; border-radius: 5px; - page-break-inside: avoid; } /* Clearfix */ @@ -90,7 +86,7 @@ } $groupedPhotos = collect($photos)->groupBy('category'); - $mainPhotos = $groupedPhotos->filter(fn($_, $key) => $key !== 'lainnya'); + $mainPhotos = $groupedPhotos->filter(fn($_, $key) => strtolower($key) !== 'lainnya'); $otherPhotos = $groupedPhotos->get('lainnya', collect()); @endphp @@ -98,91 +94,148 @@
Tidak ada foto yang tersedia.
@else @foreach ($mainPhotos as $category => $photos) -Tidak ada subkategori yang tersedia.
- @else - @foreach ($groupedBySubcategory as $subcategory => $subPhotos) - @isset($subcategory) -|
+ {{ $category }} - + + @isset($subcategory) + @if (trim($subcategory) !== '') + {{ $subcategory }} - + @endif + @endisset + + {{ $item['name'] ?? '' }} + @if ($statusLpj || file_exists($imagePath)) -Foto tidak ditemukan. +{{ $item['description'] }} @endisset - + |
+ @else
+ @foreach ($subPhotos as $index => $item)
+ @php
+ $imagePath = storage_path('app/public/' . $item['path']);
+ @endphp
+
+ {{ $category }} - - @if (($index + 1) % 2 == 0 && !$loop->last) - -
- @endif
- @endforeach
-
- @endforeach
- @endif
-
- @endforeach
+ @isset($subcategory)
+ @if (trim($subcategory) !== '')
+ {{ $subcategory }} -
+ @endif
+ @endisset
- @if (!$otherPhotos->isEmpty())
-
- Lainnya- - @php - $groupedBySubcategory = $otherPhotos->groupBy('sub'); - @endphp - - @if ($groupedBySubcategory->isEmpty()) -Tidak ada subkategori yang tersedia. - @else - @foreach ($groupedBySubcategory as $subcategory => $subPhotos) - @isset($subcategory) -- {{ $subcategory ?: '' }} -- @endisset - -
- @foreach ($subPhotos as $index => $item)
- @php
- $imagePath = storage_path('app/public/' . $item['path']);
- @endphp
-
-
-
-
- @if (($index + 1) % 2 == 0 && !$loop->last)
- {{ $item['name'] }}- @if ($statusLpj || file_exists($imagePath)) -Foto tidak ditemukan. - @endif -
+ {{ $item['name'] ?? '' }}
+
+ @if ($statusLpj || file_exists($imagePath))
+ {{ $item['description'] }} + @endisset + |
+ @if (($index + 1) % 2 == 0)
+ |
| + @endif + @endif + | ||
|
+ {{ $category }} - + + @isset($subcategory) + @if (trim($subcategory) !== '') + {{ $subcategory }} - + @endif + @endisset + + {{ $item['name'] ?? '' }} + + @if ($statusLpj || file_exists($imagePath)) +{{ $item['description'] }} + @endisset + |
+ @else
+ @foreach ($subPhotos as $index => $item)
+ @php
+ $imagePath = storage_path('app/public/' . $item['path']);
+ @endphp
+
+ {{ $category }} - + + @isset($subcategory) + @if (trim($subcategory) !== '') + {{ $subcategory }} - + @endif + @endisset + + {{ $item['name'] ?? '' }} + + @if ($statusLpj || file_exists($imagePath)) +{{ $item['description'] }} + @endisset + |
+ @if (($index + 1) % 2 == 0)
+ |
| + @endif @endif + | ||
| Fasilitas Kredit | @@ -1175,35 +1175,57 @@ unset($fotoTypes[$key]); array_unshift($fotoTypes, 'foto_tempat'); } + // Filter fotoTypes untuk memastikan hanya yang memiliki imagePath valid + $validPhotoTypes = array_filter($fotoTypes, function ($type) use ($forminspeksi) { + return isset($forminspeksi[$type]) && file_exists(storage_path('app/public/' . $forminspeksi[$type])); + }); @endphp - @if (isset($forminspeksi)) - @php $counter = 0; @endphp - @foreach ($fotoTypes as $type) - @php - $imagePath = $forminspeksi[$type] ?? null; - @endphp - @if ($imagePath && file_exists(storage_path('app/public/' . $imagePath))) - @if ($counter % 2 == 0) -||||||||||
|
+ {{ Str::title(str_replace('_', ' ', $type)) }} - - @if ($counter % 2 == 1 || $loop->last) - + @if ($imagePath) + |
+ @else
+ @foreach ($fotoTypes as $index => $type)
+ @php
+ $imagePath = $forminspeksi[$type] ?? null;
+ @endphp
+ @isset($imagePath)
+
+ + {{ Str::title(str_replace('_', ' ', $type)) }} + + @if ($imagePath && file_exists(storage_path('app/public/' . $imagePath))) + |
+ @endisset
+ @if (($index + 1) % 2 == 0)
+ |
| @endif - @php $counter++; @endphp @endif - @endforeach - @endif + | ||
+
|
+ {{ Str::title(str_replace('_', ' ', $type)) }} - - @if ($counter % 2 == 1 || $loop->last) + @if ($imagePath) + |
+ @else
+ @foreach ($fotoTypes as $index => $type)
+ @php
+ $imagePath = $forminspeksi[$type] ?? null;
+ @endphp
+ @isset($imagePath)
+
+ + {{ Str::title(str_replace('_', ' ', $type)) }} + + @if ($imagePath && file_exists(storage_path('app/public/' . $imagePath))) + |
+ @endisset
+ @if (($index + 1) % 2 == 0)
+ |
| + @endif + @endif + | ||
| - FOTO JAMINAN - | -
| + FOTO JAMINAN + | +