feat(lpj-module): tambah tampilan laporan inspeksi & refactor detail lokasi

Ringkasan:
- Menambahkan halaman hasil inspeksi dan tampilan cetak laporan.
- Mengekstrak komponen detail lokasi ke partial baru agar reusable.
- Menambahkan null-safe access dan perbaikan binding data di view.
- Merapikan tombol cetak dan navigasi agar konsisten antar halaman.

Perubahan utama:
1. activitydetail.blade.php → ubah tombol print jadi route, tambah null-safe user/branch.
2. detail-lokasi.blade.php (baru) → komponen reusable untuk detail lokasi dengan formatLabel & tanggal.
3. form-penilai.blade.php → refactor luas menggunakan match, hapus fungsi debug & Swal loading.
4. print-out-dokument.blade.php → gunakan partial lpj::component.detail-lokasi untuk detail lokasi.
5. show-laporan-inspeksi.blade.php (baru) → tab 'Laporan' & 'Hasil Inspeksi' + tombol cetak dan back.
6. print-out-sederhana / print-out-standar → penyesuaian tampilan & binding data.
7. signature-approval.blade.php → perbaikan layout area tanda tangan.
8. surveyor/components/* → normalisasi tampilan, validasi gambar, dan penyelarasan fakta/lingkungan.
9. routes/web.php → tambah dan ubah rute untuk laporan inspeksi dan cetak laporan.

Catatan:
- Tidak ada perubahan query database; semua modifikasi bersifat tampilan.
- Logging tambahan untuk observabilitas proses render laporan.
This commit is contained in:
Daeng Deni Mardaeni
2025-11-09 21:19:58 +07:00
parent 535be2cff3
commit 0d5b6b1529
31 changed files with 2193 additions and 1865 deletions

View File

@@ -1,103 +1,99 @@
<div class="no-break" >
<table
style="width: 100%; border: 1px solid #000; border-collapse: collapse; ">
<tr>
<td style="text-align: center; margin-top: 5px;">
<h2 style="text-transform: uppercase; text-align: center; margin: 0;">Informasi Dinas Tata Ruang</h2>
</td>
</tr>
</table>
<table>
@php
use Illuminate\Support\Facades\Storage;
// Daftar kunci informasi dan tipe foto yang akan ditampilkan
$informasi = [
'peruntukan', 'kdb', 'kdh', 'gsb', 'max_lantai', 'klb', 'gss', 'pelebaran_jalan', 'nama_petugas',
];
<tr>
<td width="20%" style="vertical-align: top;">Informasi Dinas Tata Ruang </td>
<td width="1%" style="vertical-align: top;">:</td>
<td style="vertical-align: top;">
@php
$informasi = [
'peruntukan',
'kdb',
'kdh',
'gsb',
'max_lantai',
'klb',
'gss',
'pelebaran_jalan',
'nama_petugas',
];
@endphp
$fotoTypes = [
'upload_gs', 'foto_sentuh_tanahku', 'foto_gistaru', 'foto_bhumi', 'foto_argis_region', 'foto_tempat',
];
@foreach ($informasi as $key)
@if (isset($forminspeksi['fakta'][$key]) && $forminspeksi['fakta'][$key] !== '-')
@php
$displayKey = ucfirst(str_replace('_', ' ', $key));
if (strlen($key) == 3) {
$displayKey = strtoupper($key);
}
@endphp
<p> - {{ $displayKey }}: {{ $forminspeksi['fakta'][$key] }}</p>
@endif
@endforeach
</td>
</tr>
$customLabels = [
'upload_gs' => 'Gambar Situasi',
'foto_sentuh_tanahku' => 'Sentuh Tanahku',
'foto_gistaru' => 'Gistaru',
'foto_bhumi' => 'Bhumi',
'foto_argis_region' => 'Blad Tata Ruang',
'foto_tempat' => 'Peta Lokasi',
];
@php
$fotoTypes = [
'upload_gs',
'foto_sentuh_tanahku',
'foto_gistaru',
'foto_bhumi',
'foto_argis_region',
'foto_tempat',
];
// Periksa apakah ada informasi dinas tata ruang yang valid
$hasInformasi = collect($informasi)->some(fn ($key) => isset($forminspeksi['fakta'][$key]) && $forminspeksi['fakta'][$key] !== '-');
$customLabels = [
'upload_gs' => 'Gambar Situasi',
'foto_sentuh_tanahku' => 'Sentuh Tanahku',
'foto_gistaru' => 'Gistaru',
'foto_bhumi' => 'Bhumi',
'foto_argis_region' => 'Blad Tata Ruang ',
'foto_tempat' => 'Peta Lokasi',
];
// Memindahkan foto_tempat ke depan jika ada
if (($key = array_search('upload_gs', $fotoTypes)) !== false) {
unset($fotoTypes[$key]);
array_unshift($fotoTypes, 'upload_gs');
}
// Filter fotoTypes untuk memastikan hanya yang memiliki imagePath valid
$validPhotoTypes = array_filter($fotoTypes, function ($type) use ($forminspeksi) {
return isset($forminspeksi[$type]) && !empty($forminspeksi[$type]) && is_string($forminspeksi[$type]);
});
@endphp
@foreach ($validPhotoTypes as $type)
@php
$imagePath = $forminspeksi[$type] ?? null;
$imageUrl = is_string($imagePath) ? asset('storage/' . $imagePath) : null;
// Periksa apakah ada foto yang valid (menggunakan Storage disk public)
$hasValidPhotos = collect($fotoTypes)->some(function ($type) use ($forminspeksi) {
$imagePath = $forminspeksi[$type] ?? null;
return is_string($imagePath) && Storage::disk('public')->exists($imagePath);
});
@endphp
@if ($imagePath && file_exists(storage_path('app/public/' . $imagePath)))
// Siapkan catatan sebagai array, kemudian periksa apakah ada catatan yang perlu diperhatikan
$notes = (array) ($forminspeksi['fakta']['keterangan'] ?? []);
$hasNotes = count($notes) > 0;
// Log render status untuk debugging
\Log::info('Render print-out informasi tata ruang', [
'hasInformasi' => $hasInformasi,
'hasValidPhotos' => $hasValidPhotos,
'hasNotes' => $hasNotes,
]);
@endphp
@if ($hasInformasi || $hasValidPhotos || $hasNotes)
<div class="no-break">
<table style="width: 100%; border: 1px solid #000; border-collapse: collapse;">
<tr>
<td style="text-align: center; margin-top: 5px;">
<h2 style="text-transform: uppercase; text-align: center; margin: 0;">Informasi Dinas Tata Ruang</h2>
</td>
</tr>
</table>
<table>
@if ($hasInformasi)
<tr>
<td style="20%"> {{ $customLabels[$type] ?? '' }}</td>
<td width="1%" style="vertical-align: top;"></td>
<td style="width: 79%">
<img src="{{ storage_path('app/public/' . $imagePath) }}" alt="{{ $imageUrl }}"
style="max-height: 400px; height: auto; max-width: 100%;">
<td width="20%" style="vertical-align: top;">Informasi Dinas Tata Ruang</td>
<td width="1%" style="vertical-align: top;">:</td>
<td style="vertical-align: top;">
@foreach ($informasi as $key)
@if (($val = $forminspeksi['fakta'][$key] ?? null) && $val !== '-')
<p>- {{ strlen($key) === 3 ? strtoupper($key) : ucfirst(str_replace('_', ' ', $key)) }}: {{ $val }}</p>
@endif
@endforeach
</td>
</tr>
@endif
@endforeach
<tr>
<td width="20%" style="vertical-align: top;">Catatan yang Perlu Diperhatikan </td>
<td width="1%" style="vertical-align: top;">:</td>
<td style="vertical-align: top;">
@foreach ($forminspeksi['fakta']['keterangan'] ?? [] as $informasi)
<p>{!! nl2br(e($informasi)) !!}</p>
@if ($hasValidPhotos)
@foreach ($fotoTypes as $type)
@php
$imagePath = $forminspeksi[$type] ?? null;
@endphp
@if (is_string($imagePath) && Storage::disk('public')->exists($imagePath))
<tr>
<td width="20%" style="vertical-align: top;">{{ $customLabels[$type] ?? '' }}</td>
<td width="1%" style="vertical-align: top;"></td>
<td style="width: 79%">
<img src="{{ asset('storage/' . $imagePath) }}" alt="{{ $customLabels[$type] ?? '' }}"
style="max-height: 400px; height: auto; max-width: 100%;">
</td>
</tr>
@endif
@endforeach
@endif
</td>
</tr>
</table>
</div>
@if ($hasNotes)
<tr>
<td width="20%" style="vertical-align: top;">Catatan yang Perlu Diperhatikan</td>
<td width="1%" style="vertical-align: top;">:</td>
<td style="vertical-align: top;">
@foreach ($notes as $note)
<p>{!! nl2br(e($note)) !!}</p>
@endforeach
</td>
</tr>
@endif
</table>
</div>
@endif