fix(penilai/surveyor): perbaikkan print out dokument jaminan

This commit is contained in:
majid
2025-03-08 01:12:52 +07:00
committed by Daeng Deni Mardaeni
parent d52edb9481
commit 340dce7ed7
26 changed files with 1480 additions and 1478 deletions

View File

@@ -164,55 +164,7 @@
<td style=" padding: 2px; vertical-align: top;">{{ $alamat['province_code'] ?? '' }}</td>
</tr>
@if (@isset($dokumen))
@foreach ($dokumen->detail as $detail)
@if (isset($detail->dokumen_jaminan))
<tr>
<td style="padding: 2px; vertical-align: top;">{{ $detail->name ?? '' }}</td>
<td style="padding: 2px; vertical-align: top;">:</td>
<td style="padding: 2px; vertical-align: top;">
@php
$dokumen_jaminan = is_array(json_decode($detail->dokumen_jaminan))
? json_decode($detail->dokumen_jaminan)
: [$detail->dokumen_jaminan];
$dokumen_nomor = is_array(json_decode($detail->dokumen_nomor))
? json_decode($detail->dokumen_nomor)
: ($detail->dokumen_nomor
? [$detail->dokumen_nomor]
: []);
@endphp
@foreach ($dokumen_jaminan as $index => $dokumen)
<div>
@if (!empty($dokumen_nomor[$index]))
<span>{{ $dokumen_nomor[$index] }}</span>
@endif
</div>
@endforeach
</td>
</tr>
@endif
@if (isset($detail->details) && json_decode($detail->details))
@foreach (json_decode($detail->details) as $key => $value)
@if (!is_null($value) && $value !== '')
<tr>
<td style="padding: 2px; vertical-align: top;">
{{formatLabel($key)}}
</td>
<td style="padding: 2px; vertical-align: top;">:</td>
<td style="padding: 2px; vertical-align: top;">
{{ $value }}
@if ($key == 'luas_bangunan' || $key == 'luas_tanah')
<sup>m2</sup>
@endif
</td>
</tr>
@endif
@endforeach
@endif
@endforeach
@endif
@include('lpj::component.print-out-dokument')
@if (isset($forminspeksi['asset']['nomor_nib']))
<tr>
@@ -1087,88 +1039,5 @@
</td>
</tr>
</table>
<div class="section">
<div class="judul">
<h6 class="border" style="text-align: center;">
PETA
</h6>
</div>
<div class="photo-container">
@php
$fotoTypes = ['upload_gs','foto_sentuh_tanahku','foto_gistaru', 'foto_bhumi', 'foto_argis_region', 'foto_tempat'];
// Memindahkan foto_tempat ke depan jika ada
if (($key = array_search('foto_tempat', $fotoTypes)) !== false) {
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
<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>
@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
@endif
</tr>
</table>
</div>
</div>
<div class="page-break"></div>
<div class="section">
<div class="judul">
<h6 class="border" style="text-align: center">
FOTO JAMINAN
</h6>
</div>
@include('lpj::penilai.components.foto-jaminan')
</div>
</div>
</main>
@include('lpj::penilai.components.footer')