129 lines
5.9 KiB
PHP
129 lines
5.9 KiB
PHP
@isset($basicData['foto'])
|
|
@php
|
|
$photos = $formFoto['upload_foto'] ?? [];
|
|
if (!is_array($photos)) {
|
|
$photos = [];
|
|
}
|
|
$groupedPhotos = collect($photos)->groupBy('category');
|
|
@endphp
|
|
|
|
@if ($groupedPhotos->isEmpty())
|
|
<p class="text-gray-500">Tidak ada foto yang tersedia.</p>
|
|
@else
|
|
@foreach ($groupedPhotos as $category => $photos)
|
|
<div class="mt-5">
|
|
<h2 class="text-gray-800 font-bold text-xl mb-3">{{ $category ?? 'Tanpa Kategori' }}</h2>
|
|
<div class="grid gap-5">
|
|
@php
|
|
$groupedBySubcategory = $photos->groupBy('sub');
|
|
@endphp
|
|
|
|
@if ($groupedBySubcategory->isEmpty())
|
|
|
|
@foreach ($photos as $index => $item)
|
|
<div class="flex items-center justify-between">
|
|
<div class="grid gap-5">
|
|
<h3 class="text-gray-600 font-semibold text-lg">
|
|
{{ $item['name'] ?? 'Foto - ' . ($index + 1) }}
|
|
</h3>
|
|
<div class="flex items-center">
|
|
@if (isset($item['path']))
|
|
<img src="{{ asset('storage/' . $item['path']) }}" alt="Gambar {{ $index + 1 }}"
|
|
class="w-full h-auto object-cover rounded-md">
|
|
@else
|
|
<p class="text-gray-500">Gambar tidak tersedia</p>
|
|
@endif
|
|
</div>
|
|
<p class="text-gray-500 text-sm">{{ $item['description'] ?? '-' }}</p>
|
|
</div>
|
|
</div>
|
|
@endforeach
|
|
@else
|
|
<!-- Jika ada subkategori, tampilkan berdasarkan subkategori -->
|
|
@foreach ($groupedBySubcategory as $subcategory => $subPhotos)
|
|
<div class="mb-4">
|
|
<!-- Judul Subkategori -->
|
|
<h4 class="text-gray-700 font-semibold text-lg mb-2">
|
|
@if ($subcategory)
|
|
{{ $subcategory }}
|
|
@endif
|
|
</h4>
|
|
<div class="grid gap-5">
|
|
@foreach ($subPhotos as $index => $item)
|
|
<div class="flex items-center justify-between">
|
|
<div class="grid gap-5">
|
|
<h3 class="text-gray-600 font-semibold text-lg">
|
|
{{ $item['name'] ?? 'Foto - ' . ($index + 1) }}
|
|
</h3>
|
|
<div class="flex items-center">
|
|
@if (isset($item['path']))
|
|
<img src="{{ asset('storage/' . $item['path']) }}" alt="Gambar {{ $index + 1 }}"
|
|
class="w-full h-auto object-cover rounded-md">
|
|
@else
|
|
<p class="text-gray-500">Gambar tidak tersedia</p>
|
|
@endif
|
|
</div>
|
|
<p class="text-gray-500 text-sm">{{ $item['description'] ?? '-' }}</p>
|
|
</div>
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
</div>
|
|
@endforeach
|
|
@endif
|
|
</div>
|
|
</div>
|
|
@endforeach
|
|
@endif
|
|
@endisset
|
|
|
|
@php
|
|
$fotoTypes = ['foto_gistaru', 'foto_bhumi', 'foto_argis_region', 'foto_tempat'];
|
|
if (($key = array_search('foto_tempat', $fotoTypes)) !== false) {
|
|
unset($fotoTypes[$key]);
|
|
array_unshift($fotoTypes, 'foto_tempat');
|
|
}
|
|
$adaFoto = false;
|
|
if (isset($forminspeksi)) {
|
|
foreach ($fotoTypes as $type) {
|
|
$imagePath = $forminspeksi[$type] ?? null;
|
|
if ($imagePath && file_exists(storage_path('app/public/' . $imagePath))) {
|
|
$adaFoto = true;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
@endphp
|
|
|
|
@if ($adaFoto)
|
|
<div class="card">
|
|
<div class="card-header bg-agi-50" id="basic_settings">
|
|
<h3 class="card-title">
|
|
Peta
|
|
</h3>
|
|
</div>
|
|
<div class="card-body">
|
|
|
|
<div>
|
|
@if (isset($forminspeksi))
|
|
@forelse ($fotoTypes as $type)
|
|
<div class="border photo-item">
|
|
@php
|
|
$imagePath = $forminspeksi[$type] ?? null;
|
|
@endphp
|
|
|
|
@if ($imagePath && file_exists(storage_path('app/public/' . $imagePath)))
|
|
<img src="{{ asset('storage/' . $imagePath) }}" alt="{{ $type }}"
|
|
class="w-full h-auto object-cover">
|
|
@endif
|
|
<p class="mt-2 text-sm">{{ Str::title(str_replace('_', ' ', $type)) }}</p>
|
|
</div>
|
|
@empty
|
|
<p>Tidak ada tipe foto yang tersedia</p>
|
|
@endforelse
|
|
@endif
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endif
|