✨ feat(lpj): perbaikan controller & view penilai, validasi, dan MIG toggle
- Controllers: DokumenJaminan tangani array kosong saat diff legalitas. - Controllers: Laporan sederhanakan query status list laporan. - Controllers: PersetujuanPenawaran simpan NOC ke variabel $noc. - Requests: DebitureRequest longgarkan 'nomor_rekening' max 50. - Views: Informasi & Lingkungan tampilkan array/string aman dan rapi. - Views: Header rapikan CSS page-break, nonaktifkan blok PHP komentar. - Views: Foto Jaminan/Lampiran tambah link unduh & perbaikan layout. - Views: LPJ sederhana: tombol kondisional saat MIG, include analisa. - Views: Print-out sederhana kirim parameter ke signature-approval.
This commit is contained in:
@@ -30,6 +30,8 @@
|
||||
|
||||
/* Image Styling */
|
||||
.photo-item img {
|
||||
display: block;
|
||||
margin: auto;
|
||||
width: auto;
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
@@ -79,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
|
||||
|
||||
@@ -86,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
|
||||
@@ -93,36 +124,117 @@
|
||||
@foreach ($groupedBySubcategory as $subcategory => $subPhotos)
|
||||
@if (count($subPhotos) > 0)
|
||||
@foreach ($subPhotos->chunk(2) as $chunkedPhotos)
|
||||
@if(!$loop->first)
|
||||
<div class="page-break"></div>
|
||||
@endif
|
||||
<table width="100%" border="0"
|
||||
style="align-content: center; text-align: center; margin-bottom: 20px">
|
||||
@foreach ($chunkedPhotos as $item)
|
||||
@php
|
||||
$imagePath = storage_path('app/public/' . $item['path']);
|
||||
// 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/' . $pathToUse)
|
||||
: asset('storage/' . $pathToUse);
|
||||
|
||||
$extension = strtolower(pathinfo($pathToUse, PATHINFO_EXTENSION));
|
||||
$isImage = in_array($extension, [
|
||||
'jpg',
|
||||
'jpeg',
|
||||
'png',
|
||||
'gif',
|
||||
'bmp',
|
||||
'svg',
|
||||
'webp',
|
||||
'tiff',
|
||||
]);
|
||||
$isPdf = $extension === 'pdf';
|
||||
@endphp
|
||||
<tr>
|
||||
<td style="width: 100%; padding: 10px;" class="photo-item border">
|
||||
<p style="font-weight: medium; font-size: 10px">{{ $category }} -
|
||||
@isset($subcategory)
|
||||
@if (trim($subcategory) !== '')
|
||||
{{ $subcategory }} -
|
||||
@if ($statusLpj == 1)
|
||||
@if ($isImage && $filePath)
|
||||
<tr>
|
||||
<td style="width: 100%; padding: 10px; align-content: center; text-align: center"
|
||||
class="border photo-item">
|
||||
<p style="font-weight: medium; font-size: 10px">{{ $category }} -
|
||||
@isset($subcategory)
|
||||
@if (trim($subcategory) !== '')
|
||||
{{ $subcategory }} -
|
||||
@endif
|
||||
@endisset
|
||||
{{ $item['name'] ?? '' }}
|
||||
</p>
|
||||
<img src="{{ $filePath }}" alt="{{ $pathToUse }}" class="photo-image"
|
||||
style="align-content: center; text-align: center; max-width: 100%; height: auto;">
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
@elseif ($statusLpj != 1)
|
||||
<tr>
|
||||
<td style="width: 100%; padding: 10px; align-content: center; text-align: center"
|
||||
class="border photo-item">
|
||||
|
||||
<p style="font-weight: medium; font-size: 10px">{{ $category }} -
|
||||
@isset($subcategory)
|
||||
@if (trim($subcategory) !== '')
|
||||
{{ $subcategory }} -
|
||||
@endif
|
||||
@endisset
|
||||
|
||||
{{ $item['name'] ?? '' }}
|
||||
|
||||
</p>
|
||||
@if ($statusLpj || file_exists(public_path('storage/' . $item['path'])))
|
||||
@if ($isImage)
|
||||
<img src="{{ $filePath }}" alt="{{ $item['path'] }}"
|
||||
class="photo-image"
|
||||
style="align-content: center; text-align: center;">
|
||||
@elseif ($isPdf)
|
||||
<a href="{{ $filePath }}" download="{{ basename($filePath) }}"
|
||||
style="font-size:12px; color:#1a73e8; text-decoration: underline;">
|
||||
⬇️ Unduh File PDF
|
||||
</a>
|
||||
@else
|
||||
<a href="{{ $filePath }}" download="{{ basename($filePath) }}"
|
||||
style="font-size:12px; color:#1a73e8; text-decoration: underline;">
|
||||
⬇️ Unduh File
|
||||
</a>
|
||||
@endif
|
||||
@endif
|
||||
|
||||
@isset($item['description'])
|
||||
<p style="font-size:9px">{{ $item['description'] }}</p>
|
||||
@endisset
|
||||
{{ $item['name'] ?? '' }}
|
||||
</p>
|
||||
@if ($statusLpj || file_exists($imagePath))
|
||||
<img src="{{ $imagePath }}" alt="{{ $item['path'] }}" class="photo-image">
|
||||
@endif
|
||||
@isset($item['description'])
|
||||
<p style="font-size:9px">{{ $item['description'] }}</p>
|
||||
@endisset
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
@endforeach
|
||||
@if (count($chunkedPhotos) < 2)
|
||||
<tr style="width: 100%;"></tr>
|
||||
@endif
|
||||
</table>
|
||||
<div class="page-break"></div>
|
||||
@endforeach
|
||||
@endif
|
||||
@endforeach
|
||||
@@ -136,27 +248,78 @@
|
||||
style="align-content: center; text-align: center; margin-bottom: 20px">
|
||||
@foreach ($chunkedPhotos as $item)
|
||||
@php
|
||||
$imagePath = storage_path('app/public/' . $item['path']);
|
||||
$filePath =
|
||||
$statusLpj == 1
|
||||
? storage_path('app/public/' . $item['path'])
|
||||
: asset('storage/' . $item['path']);
|
||||
|
||||
$extension = strtolower(pathinfo($item['path'], PATHINFO_EXTENSION));
|
||||
$isImage = in_array($extension, [
|
||||
'jpg',
|
||||
'jpeg',
|
||||
'png',
|
||||
'gif',
|
||||
'bmp',
|
||||
'svg',
|
||||
'webp',
|
||||
'tiff',
|
||||
]);
|
||||
$isPdf = $extension === 'pdf';
|
||||
@endphp
|
||||
<tr>
|
||||
<td style="width: 100%; padding: 10px;" class="photo-item border">
|
||||
<p style="font-weight: medium; font-size: 10px">Lainnya -
|
||||
@isset($subcategory)
|
||||
@if (trim($subcategory) !== '')
|
||||
{{ $subcategory }} -
|
||||
@if ($statusLpj == 1)
|
||||
@if ($isImage && $filePath)
|
||||
<tr>
|
||||
<td style="width: 100%; padding: 10px; align-content: center; text-align: center"
|
||||
class="border photo-item">
|
||||
<p style="font-weight: medium; font-size: 10px">{{ $category }} -
|
||||
@isset($subcategory)
|
||||
@if (trim($subcategory) !== '')
|
||||
{{ $subcategory }} -
|
||||
@endif
|
||||
@endisset
|
||||
{{ $item['name'] ?? '' }}
|
||||
</p>
|
||||
<img src="{{ $filePath }}" alt="{{ $item['path'] }}" class="photo-image"
|
||||
style="align-content: center; text-align: center; max-width: 100%; height: auto;">
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
@elseif ($statusLpj != 1)
|
||||
<tr>
|
||||
<td style="width: 100%; padding: 10px;" class="border photo-item">
|
||||
<p style="font-weight: medium; font-size: 10px">Lainnya -
|
||||
@isset($subcategory)
|
||||
@if (trim($subcategory) !== '')
|
||||
{{ $subcategory }} -
|
||||
@endif
|
||||
@endisset
|
||||
{{ $item['name'] ?? '' }}
|
||||
</p>
|
||||
@if ($statusLpj || file_exists(public_path('storage/' . $item['path'])))
|
||||
@if ($isImage)
|
||||
<img src="{{ $filePath }}" alt="{{ $item['path'] }}"
|
||||
class="photo-image" style="text-align: center;">
|
||||
@elseif ($isPdf)
|
||||
<a href="{{ $filePath }}" download="{{ basename($filePath) }}"
|
||||
style="font-size:12px; color:#1a73e8; text-decoration: underline;">
|
||||
⬇️ Unduh File PDF
|
||||
</a>
|
||||
@else
|
||||
<a href="{{ $filePath }}" download="{{ basename($filePath) }}"
|
||||
style="font-size:12px; color:#1a73e8; text-decoration: underline;">
|
||||
⬇️ Unduh File
|
||||
</a>
|
||||
@endif
|
||||
@endif
|
||||
|
||||
@isset($item['description'])
|
||||
<p style="font-size:9px">{{ $item['description'] }}</p>
|
||||
@endisset
|
||||
{{ $item['name'] ?? '' }}
|
||||
</p>
|
||||
@if ($statusLpj || file_exists($imagePath))
|
||||
<img src="{{ $imagePath }}" alt="{{ $item['path'] }}" class="photo-image">
|
||||
@endif
|
||||
@isset($item['description'])
|
||||
<p style="font-size:9px">{{ $item['description'] }}</p>
|
||||
@endisset
|
||||
</td>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
@endforeach
|
||||
</tr>
|
||||
@if (count($chunkedPhotos) < 2)
|
||||
<tr style="width: 100%;"></tr>
|
||||
@endif
|
||||
|
||||
Reference in New Issue
Block a user