Files
lpj/resources/views/penilai/components/foto-jaminan.blade.php

182 lines
5.5 KiB
PHP

<style>
/* General Styles */
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
}
.photo-container {
width: 100%;
margin-bottom: 10px;
clear: both;
page-break-inside: avoid;
}
.photo-row {
width: 100%;
clear: both;
page-break-inside: avoid;
}
.photo-item {
width: 48%;
margin-right: 2%;
float: left;
padding: 5px;
box-sizing: border-box;
page-break-inside: avoid;
}
.photo-item:nth-child(2n) {
margin-right: 0;
}
/* Image Styling */
.photo-item img {
max-width: 100%;
height: auto;
object-fit: contain;
page-break-inside: avoid;
}
/* Clearfix */
.clearfix::after {
content: "";
clear: both;
display: table;
}
/* Media Print */
@media print {
.photo-item {
width: 48%;
margin-right: 2%;
float: left;
padding: 5px;
box-sizing: border-box;
page-break-inside: avoid;
}
width: 48%;
margin-right: 2%;
float: left;
padding: 5px;
box-sizing: border-box;
page-break-inside: avoid;
}
.photo-item img {
max-width: 100%;
max-width: 100%;
height: auto;
object-fit: contain;
}
h2 {
font-size: 14px;
margin-bottom: 5px;
}
}
</style>
@isset($basicData['foto'])
@php
$photos = $formFoto['upload_foto'] ?? [];
if (!is_array($photos)) {
$photos = [];
}
$groupedPhotos = collect($photos)->groupBy('category');
$mainPhotos = $groupedPhotos->filter(fn($_, $key) => $key !== 'Lainnya');
$otherPhotos = $groupedPhotos->get('Lainnya', collect());
@endphp
@if ($groupedPhotos->isEmpty())
<p class="text-gray-500">Tidak ada foto yang tersedia.</p>
@else
<div class="photo-container">
@foreach ($mainPhotos as $category => $photos)
<h2 class="text-gray-800 font-bold text-lg">{{ $category }}</h2>
@php
$groupedBySubcategory = $photos->groupBy('sub');
@endphp
@if ($groupedBySubcategory->isEmpty())
<p class="text-gray-500">Tidak ada subkategori yang tersedia.</p>
@else
@foreach ($groupedBySubcategory as $subcategory => $subPhotos)
<h3 class="text-gray-600 font-semibold text-md">
{{ $subcategory ?: '' }}
</h3>
<div class="photo-row clearfix">
@foreach ($subPhotos as $index => $item)
@php
$imagePath = storage_path('app/public/' . $item['path']);
@endphp
@if ($counter % 2 == 0)
<div class="photo-row clearfix">
@endif
<div class="photo-item border">
<h4 class="text-gray-600 font-semibold text-sm">{{ $item['name'] }}</h4>
@if ($statusLpj || file_exists($imagePath))
<img src="{{ $imagePath }}" alt="{{ $item['path'] }}" class="photo-image">
@else
<p class="text-gray-400">Foto tidak ditemukan.</p>
@endif
</div>
@if (($index + 1) % 2 == 0 && !$loop->last)
</div>
<div class="photo-row clearfix">
@endif
@endforeach
</div>
@endforeach
@endif
@endforeach
@if (!$otherPhotos->isEmpty())
<h2 class="text-gray-800 font-bold text-lg">Lainnya</h2>
@php
$groupedBySubcategory = $otherPhotos->groupBy('sub');
@endphp
@if ($groupedBySubcategory->isEmpty())
<p class="text-gray-500">Tidak ada subkategori yang tersedia.</p>
@else
@foreach ($groupedBySubcategory as $subcategory => $subPhotos)
<h3 class="text-gray-600 font-semibold text-md">
{{ $subcategory ?: '' }}
</h3>
<div class="photo-row clearfix">
@foreach ($subPhotos as $index => $item)
@php
$imagePath = storage_path('app/public/' . $item['path']);
@endphp
<div class="photo-item border">
<h4 class="text-gray-600 font-semibold text-sm">{{ $item['name'] }}</h4>
@if ($statusLpj || file_exists($imagePath))
<img src="{{ $imagePath }}" alt="{{ $item['path'] }}" class="photo-image">
@else
<p class="text-gray-400">Foto tidak ditemukan.</p>
@endif
</div>
@if (($index + 1) % 2 == 0 && !$loop->last)
</div>
<div class="photo-row clearfix">
@endif
@endforeach
</div>
@endforeach
@endif
@endif
</div>
@endif
@endisset