fix(print-out): perbaikan print out foto dan sederhana dan standard
This commit is contained in:
@@ -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 @@
|
||||
<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
|
||||
@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)
|
||||
@foreach ($groupedBySubcategory as $subcategory => $subPhotos)
|
||||
@if (count($subPhotos) > 0)
|
||||
<table width="100%" border="0" style="align-content: center; text-align: center">
|
||||
<tr>
|
||||
@if (count($subPhotos) === 1)
|
||||
@php
|
||||
$item = $subPhotos->first();
|
||||
$imagePath = storage_path('app/public/' . $item['path']);
|
||||
@endphp
|
||||
<div class="photo-item border">
|
||||
<p style="text-align: center" >{{ $item['name'] }}</p>
|
||||
<td style="width: 100%; vertical-align: top; text-align: center" colspan="2"
|
||||
class="photo-item border">
|
||||
<p style="font-weight: medium; font-size: 10px">{{ $category }} -
|
||||
|
||||
@isset($subcategory)
|
||||
@if (trim($subcategory) !== '')
|
||||
{{ $subcategory }} -
|
||||
@endif
|
||||
@endisset
|
||||
|
||||
{{ $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>
|
||||
<img src="{{ $imagePath }}" alt="{{ $item['path'] }}" class="photo-image"
|
||||
style="width: 100%; max-width: 300px;">
|
||||
@endif
|
||||
@isset($item['description'])
|
||||
<p style="font-size:9px">{{ $item['description'] }}</p>
|
||||
@endisset
|
||||
</div>
|
||||
</td>
|
||||
@else
|
||||
@foreach ($subPhotos as $index => $item)
|
||||
@php
|
||||
$imagePath = storage_path('app/public/' . $item['path']);
|
||||
@endphp
|
||||
<td style="width: 50%; vertical-align: top; text-align: center"
|
||||
class="photo-item border">
|
||||
<p style="font-weight: medium; font-size: 10px">{{ $category }} -
|
||||
|
||||
@if (($index + 1) % 2 == 0 && !$loop->last)
|
||||
</div>
|
||||
<div class="photo-row clearfix">
|
||||
@endif
|
||||
@endforeach
|
||||
</div>
|
||||
@endforeach
|
||||
@endif
|
||||
</div>
|
||||
@endforeach
|
||||
@isset($subcategory)
|
||||
@if (trim($subcategory) !== '')
|
||||
{{ $subcategory }} -
|
||||
@endif
|
||||
@endisset
|
||||
|
||||
@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">
|
||||
{{ $item['name'] ?? '' }}
|
||||
</p>
|
||||
@if ($statusLpj || file_exists($imagePath))
|
||||
<img src="{{ $imagePath }}" alt="{{ $item['path'] }}" class="photo-image"
|
||||
style="width: 100%; max-width: 300px;">
|
||||
@endif
|
||||
@isset($item['description'])
|
||||
<p style="font-size:9px">{{ $item['description'] }}</p>
|
||||
@endisset
|
||||
</td>
|
||||
@if (($index + 1) % 2 == 0)
|
||||
</tr>
|
||||
<tr>
|
||||
@endif
|
||||
@endforeach
|
||||
</div>
|
||||
@if (count($subPhotos) % 2 != 0)
|
||||
<td style="width: 50%;"></td>
|
||||
@endif
|
||||
@endif
|
||||
</tr>
|
||||
</table>
|
||||
@endif
|
||||
@endforeach
|
||||
@endforeach
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="page-break"></div>
|
||||
|
||||
@if (!$otherPhotos->isEmpty())
|
||||
@foreach ($otherPhotos->groupBy('sub') as $subcategory => $subPhotos)
|
||||
@if (count($subPhotos) > 0)
|
||||
<table width="100%" border="0" style="align-content: center; text-align: center">
|
||||
<tr>
|
||||
@if (count($subPhotos) === 1)
|
||||
@php
|
||||
$item = $subPhotos->first();
|
||||
$imagePath = storage_path('app/public/' . $item['path']);
|
||||
@endphp
|
||||
<td style="width: 100%; vertical-align: top; text-align: center" colspan="2"
|
||||
class="photo-item border">
|
||||
<p style="font-weight: medium; font-size: 10px">{{ $category }} -
|
||||
|
||||
@isset($subcategory)
|
||||
@if (trim($subcategory) !== '')
|
||||
{{ $subcategory }} -
|
||||
@endif
|
||||
@endisset
|
||||
|
||||
{{ $item['name'] ?? '' }}
|
||||
</p>
|
||||
@if ($statusLpj || file_exists($imagePath))
|
||||
<img src="{{ $imagePath }}" alt="{{ $item['path'] }}" class="photo-image"
|
||||
style="width: 100%; max-width: 300px;">
|
||||
@endif
|
||||
@isset($item['description'])
|
||||
<p style="font-size:9px">{{ $item['description'] }}</p>
|
||||
@endisset
|
||||
</td>
|
||||
@else
|
||||
@foreach ($subPhotos as $index => $item)
|
||||
@php
|
||||
$imagePath = storage_path('app/public/' . $item['path']);
|
||||
@endphp
|
||||
<td style="width: 50%; vertical-align: top; text-align: center" class="photo-item border">
|
||||
<p style="font-weight: medium; font-size: 10px">{{ $category }} -
|
||||
|
||||
@isset($subcategory)
|
||||
@if (trim($subcategory) !== '')
|
||||
{{ $subcategory }} -
|
||||
@endif
|
||||
@endisset
|
||||
|
||||
{{ $item['name'] ?? '' }}
|
||||
</p>
|
||||
@if ($statusLpj || file_exists($imagePath))
|
||||
<img src="{{ $imagePath }}" alt="{{ $item['path'] }}" class="photo-image"
|
||||
style="width: 100%; max-width: 300px;">
|
||||
@endif
|
||||
@isset($item['description'])
|
||||
<p style="font-size:9px">{{ $item['description'] }}</p>
|
||||
@endisset
|
||||
</td>
|
||||
@if (($index + 1) % 2 == 0)
|
||||
</tr>
|
||||
<tr>
|
||||
@endif
|
||||
@endforeach
|
||||
@if (count($subPhotos) % 2 != 0)
|
||||
<td style="width: 50%;"></td>
|
||||
@endif
|
||||
@endif
|
||||
</tr>
|
||||
</table>
|
||||
@endif
|
||||
@endforeach
|
||||
@endif
|
||||
@endisset
|
||||
|
||||
Reference in New Issue
Block a user