🔧(penilai): Perbaikan tampilan dan logika fallback foto jaminan
Implementasi berbagai perbaikan pada komponen penilai dan foto jaminan: **Detail Lokasi (detail-lokasi.blade.php):** - Menambahkan logika untuk menghindari duplikasi label yang sama - Implementasi tracking currentKey untuk mencegah label berulang - Perbaikan tampilan tabel dengan label yang lebih bersih **Footer (footer.blade.php):** - Perbaikan indentasi dan formatting kode - Reorganisasi array customLabels untuk konsistensi - Perbaikan struktur conditional untuk upload_gs **Foto Jaminan (foto-jaminan.blade.php):** - Implementasi sistem fallback path untuk file foto yang tidak ditemukan - Logika fallback: surveyor/2025/APRIL/26042025/251051/251051_2_2.png → surveyor/001/251051/251051_2_2.png - Penambahan urutan kategori foto yang diinginkan (BLAD TATA KOTA sebelum FOTO JAMINAN) - Skip kategori DOKUMEN PENDUKUNG dari tampilan utama - Perbaikan class ordering (border photo-item) - Update alt attribute untuk menggunakan pathToUse - Penambahan debug @dd untuk otherPhotos (sementara) **Print Out Sederhana (print-out-sederhana.blade.php):** - Perbaikan tampilan Total Nilai Pasar Wajar dengan colspan yang benar - Restructuring tabel NPW tambahan dengan width yang tepat - Perbaikan alignment dan formatting nilai - Update parameter signature-approval dengan npw - Perbaikan tampilan Total Nilai Likuidasi - Penambahan tanda '--' pada SARANA PELENGKAP DAN LINGKUNGAN **Print Out Standar (print-out-standar.blade.php):** - Implementasi logika untuk menghindari duplikasi label - Perbaikan struktur tabel dengan width 100% - Update tracking currentLabel untuk konsistensi tampilan
This commit is contained in:
@@ -81,6 +81,32 @@
|
||||
$groupedPhotos = collect($photos)->groupBy('category');
|
||||
|
||||
$mainPhotos = $groupedPhotos->filter(fn($_, $key) => strtolower($key) !== 'lainnya');
|
||||
|
||||
// Definisikan urutan yang diinginkan
|
||||
$desiredOrder = [
|
||||
'PETA LOKASI',
|
||||
'GAMBAR SITUASI / SURAT UKUR',
|
||||
'BLAD TATA KOTA',
|
||||
'FOTO JAMINAN',
|
||||
'DOKUMEN PENDUKUNG'
|
||||
];
|
||||
|
||||
// Urutkan ulang $mainPhotos sesuai urutan yang diinginkan
|
||||
$orderedMainPhotos = collect();
|
||||
foreach ($desiredOrder as $category) {
|
||||
if ($mainPhotos->has($category)) {
|
||||
$orderedMainPhotos->put($category, $mainPhotos->get($category));
|
||||
}
|
||||
}
|
||||
|
||||
// Tambahkan kategori lain yang tidak ada dalam urutan yang diinginkan
|
||||
foreach ($mainPhotos as $category => $photos) {
|
||||
if (!in_array($category, $desiredOrder)) {
|
||||
$orderedMainPhotos->put($category, $photos);
|
||||
}
|
||||
}
|
||||
|
||||
$mainPhotos = $orderedMainPhotos;
|
||||
$otherPhotos = $groupedPhotos->get('lainnya', collect());
|
||||
@endphp
|
||||
|
||||
@@ -88,6 +114,9 @@
|
||||
<p class="text-gray-500">Tidak ada foto yang tersedia.</p>
|
||||
@else
|
||||
@foreach ($mainPhotos as $category => $photos)
|
||||
@if($category=='DOKUMEN PENDUKUNG')
|
||||
@php continue; @endphp
|
||||
@endif
|
||||
@php
|
||||
$groupedBySubcategory = $photos->groupBy('sub');
|
||||
@endphp
|
||||
@@ -99,12 +128,35 @@
|
||||
style="align-content: center; text-align: center; margin-bottom: 20px">
|
||||
@foreach ($chunkedPhotos as $item)
|
||||
@php
|
||||
// Logika fallback untuk path file
|
||||
$originalPath = $item['path'];
|
||||
$fallbackPath = null;
|
||||
|
||||
// Jika file asli tidak ditemukan, buat fallback path
|
||||
if ($statusLpj == 1) {
|
||||
$fullOriginalPath = storage_path('app/public/' . $originalPath);
|
||||
|
||||
if (!file_exists($fullOriginalPath)) {
|
||||
// Ekstrak bagian akhir path (contoh: 251051/251051_2_2.png)
|
||||
$pathParts = explode('/', $originalPath);
|
||||
if (count($pathParts) >= 2) {
|
||||
$lastTwoParts = array_slice($pathParts, -2);
|
||||
$fallbackPath = 'surveyor/001/' . implode('/', $lastTwoParts);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Tentukan path yang akan digunakan
|
||||
$pathToUse = ($fallbackPath && $statusLpj == 1 && file_exists(storage_path('app/public/' . $fallbackPath)))
|
||||
? $fallbackPath
|
||||
: $originalPath;
|
||||
|
||||
$filePath =
|
||||
$statusLpj == 1
|
||||
? storage_path('app/public/' . $item['path'])
|
||||
: asset('storage/' . $item['path']);
|
||||
? storage_path('app/public/' . $pathToUse)
|
||||
: asset('storage/' . $pathToUse);
|
||||
|
||||
$extension = strtolower(pathinfo($item['path'], PATHINFO_EXTENSION));
|
||||
$extension = strtolower(pathinfo($pathToUse, PATHINFO_EXTENSION));
|
||||
$isImage = in_array($extension, [
|
||||
'jpg',
|
||||
'jpeg',
|
||||
@@ -118,10 +170,10 @@
|
||||
$isPdf = $extension === 'pdf';
|
||||
@endphp
|
||||
@if ($statusLpj == 1)
|
||||
@if ($isImage && $filePath)
|
||||
@if ($isImage && $filePath)
|
||||
<tr>
|
||||
<td style="width: 100%; padding: 10px; align-content: center; text-align: center"
|
||||
class="photo-item border">
|
||||
class="border photo-item">
|
||||
<p style="font-weight: medium; font-size: 10px">{{ $category }} -
|
||||
@isset($subcategory)
|
||||
@if (trim($subcategory) !== '')
|
||||
@@ -130,7 +182,7 @@
|
||||
@endisset
|
||||
{{ $item['name'] ?? '' }}
|
||||
</p>
|
||||
<img src="{{ $filePath }}" alt="{{ $item['path'] }}" class="photo-image"
|
||||
<img src="{{ $filePath }}" alt="{{ $pathToUse }}" class="photo-image"
|
||||
style="align-content: center; text-align: center; max-width: 100%; height: auto;">
|
||||
</td>
|
||||
</tr>
|
||||
@@ -138,7 +190,7 @@
|
||||
@elseif ($statusLpj != 1)
|
||||
<tr>
|
||||
<td style="width: 100%; padding: 10px; align-content: center; text-align: center"
|
||||
class="photo-item border ">
|
||||
class="border photo-item">
|
||||
|
||||
<p style="font-weight: medium; font-size: 10px">{{ $category }} -
|
||||
@isset($subcategory)
|
||||
@@ -187,6 +239,7 @@
|
||||
@endforeach
|
||||
|
||||
@if (!$otherPhotos->isEmpty())
|
||||
@dd(!$otherPhotos->isEmpty())
|
||||
@foreach ($otherPhotos->groupBy('sub') as $subcategory => $subPhotos)
|
||||
@if (count($subPhotos) > 0)
|
||||
@foreach ($subPhotos->chunk(2) as $chunkedPhotos)
|
||||
@@ -216,7 +269,7 @@
|
||||
@if ($isImage && $filePath)
|
||||
<tr>
|
||||
<td style="width: 100%; padding: 10px; align-content: center; text-align: center"
|
||||
class="photo-item border">
|
||||
class="border photo-item">
|
||||
<p style="font-weight: medium; font-size: 10px">{{ $category }} -
|
||||
@isset($subcategory)
|
||||
@if (trim($subcategory) !== '')
|
||||
@@ -232,7 +285,7 @@
|
||||
@endif
|
||||
@elseif ($statusLpj != 1)
|
||||
<tr>
|
||||
<td style="width: 100%; padding: 10px;" class="photo-item border">
|
||||
<td style="width: 100%; padding: 10px;" class="border photo-item">
|
||||
<p style="font-weight: medium; font-size: 10px">Lainnya -
|
||||
@isset($subcategory)
|
||||
@if (trim($subcategory) !== '')
|
||||
|
||||
Reference in New Issue
Block a user