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

189 lines
5.8 KiB
PHP

<style>
/* General Styles */
body {
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 {
width: 300px;
height: 300px;
object-fit: contain;
background-color: #f0f0f0;
border-radius: 5px;
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;
}
.photo-item img {
width: 300px;
height: 300px;
object-fit: contain;
background-color: #f0f0f0;
border-radius: 5px;
page-break-inside: avoid;
}
h2 {
font-size: 14px;
}
.photo-container {
page-break-inside: avoid;
}
.photo-row {
page-break-inside: avoid;
}
}
</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
@foreach ($mainPhotos as $category => $photos)
<div class="photo-container">
<h2>{{ $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)
@isset($subcategory)
<h6 style="font-size:10px">
{{ $subcategory ?: '' }}
</h6>
@endisset
<div class="photo-row clearfix">
@foreach ($subPhotos as $index => $item)
@php
$imagePath = storage_path('app/public/' . $item['path']);
@endphp
<div class="photo-item border">
<p style="text-align: center" >{{ $item['name'] }}</p>
@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
@isset($item['description'])
<p style="font-size:9px">{{ $item['description'] }}</p>
@endisset
</div>
@if (($index + 1) % 2 == 0 && !$loop->last)
</div>
<div class="photo-row clearfix">
@endif
@endforeach
</div>
@endforeach
@endif
</div>
@endforeach
@if (!$otherPhotos->isEmpty())
<div class="photo-container">
<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)
@isset($subcategory)
<h6 style="font-size:10px">
{{ $subcategory ?: '' }}
</h6>
@endisset
<div class="photo-row clearfix">
@foreach ($subPhotos as $index => $item)
@php
$imagePath = storage_path('app/public/' . $item['path']);
@endphp
<div class="photo-item border">
<h6 style="text-align: center" >{{ $item['name'] }}</h6>
@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
</div>
@endif
@endif
@endisset