fix(print-out): perbaikan print out foto dan sederhana dan standard

This commit is contained in:
majid
2025-02-07 11:25:55 +07:00
parent 7c6059d479
commit 36a8b0bb15
3 changed files with 230 additions and 131 deletions

View File

@@ -115,7 +115,7 @@
</tr>
</table>
</td>
<td>
<td style="vertical-align: top">
<table style="width: 100%; border-collapse: collapse;">
<tr>
<td style=" padding: 2px; vertical-align: top;">Fasilitas Kredit</td>
@@ -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)
<div class="photo-row clearfix"
>
@endif
<div class="photo-item border"
>
<img src="{{ storage_path('app/public/' . $imagePath) }}" alt="{{ $type }}"
class="photo-image">
<p style="margin: 0; font-size: 14px;">
<table width="100%" border="0">
<tr>
@if (count($validPhotoTypes) === 1)
@php
$type = reset($validPhotoTypes);
$imagePath = $forminspeksi[$type] ?? null;
@endphp
<td style="width: 100%; vertical-align: top; text-align: center" colspan="2" class="photo-item border">
<p style="margin: 0; font-size: 10px; text-align: center;">
{{ Str::title(str_replace('_', ' ', $type)) }}
</p>
</div>
@if ($counter % 2 == 1 || $loop->last)
</div>
@if ($imagePath)
<img src="{{ storage_path('app/public/' . $imagePath) }}" alt="{{ $imagePath }}"
class="photo-image" style="width: 100%; max-width: 300px;">
@endif
</td>
@else
@foreach ($fotoTypes as $index => $type)
@php
$imagePath = $forminspeksi[$type] ?? null;
@endphp
@isset($imagePath)
<td style="width: 50%; vertical-align: top; text-align: center" class="photo-item border">
<p style="margin: 0; font-size: 10px; text-align: center;">
{{ Str::title(str_replace('_', ' ', $type)) }}
</p>
@if ($imagePath && file_exists(storage_path('app/public/' . $imagePath)))
<img src="{{ storage_path('app/public/' . $imagePath) }}" alt="{{ $imagePath }}"
class="photo-image" style="width: 100%; max-width: 300px;">
@endif
</td>
@endisset
@if (($index + 1) % 2 == 0)
</tr>
<tr>
@endif
@endforeach
@if (count($fotoTypes) % 2 != 0)
<td style="width: 50%;"></td>
@endif
@php $counter++; @endphp
@endif
@endforeach
@endif
</tr>
</table>
</div>
</div>
@@ -1214,7 +1236,7 @@
FOTO JAMINAN
</h6>
</div>
@include('lpj::penilai.components.foto-jaminan')
@include('lpj::penilai.components.foto')
</div>
</div>