fix(print-out): perbaikan foto

This commit is contained in:
majid
2025-02-04 13:33:16 +07:00
parent 075567f84c
commit 165042db38
5 changed files with 143 additions and 50 deletions

View File

@@ -248,7 +248,7 @@ class PenilaiController extends Controller
public function edit($id) public function edit($id)
{ {
$permohonan = Permohonan::with('debiture')->find($id); $permohonan = Permohonan::with('debiture')->find($id);
return view('lpj::penilai.edit',compact('permohonan')); return view('lpj::penilai.edit', compact('permohonan'));
} }
@@ -272,7 +272,7 @@ class PenilaiController extends Controller
] ]
); );
if($request->hasFile('file_paparan')) { if ($request->hasFile('file_paparan')) {
$file = $request->file('file_paparan'); $file = $request->file('file_paparan');
$path = $file->store('public/file_paparan'); $path = $file->store('public/file_paparan');
@@ -282,10 +282,10 @@ class PenilaiController extends Controller
} }
return redirect() return redirect()
->route('penilai.show',['id'=>$id])->with('success', 'diperbarui ke status paparan dan dikirim ke So untuk proses lebih lanjut.'); ->route('penilai.show', ['id' => $id])->with('success', 'diperbarui ke status paparan dan dikirim ke So untuk proses lebih lanjut.');
} catch (\Exception $e) { } catch (\Exception $e) {
return redirect()->route('penilai.show',['id'=>$id])->with('error', 'Terjadi kesalahan saat memproses permohonan.'); return redirect()->route('penilai.show', ['id' => $id])->with('error', 'Terjadi kesalahan saat memproses permohonan.');
} }
} }
@@ -379,9 +379,18 @@ class PenilaiController extends Controller
} }
} }
return view('lpj::penilai.components.rap-penilai', compact('permohonan', 'rap', 'provinces', 'cities', return view('lpj::penilai.components.rap-penilai', compact(
'permohonan',
'rap',
'provinces',
'cities',
'districts', 'districts',
'villages','forminspeksi', 'nomorLaporan', 'basicData','cekAlamat')); 'villages',
'forminspeksi',
'nomorLaporan',
'basicData',
'cekAlamat'
));
} }
@@ -453,7 +462,7 @@ class PenilaiController extends Controller
// return view('lpj::penilai.components.call-report', compact('permohonan', 'rap', 'provinces', 'cities', // return view('lpj::penilai.components.call-report', compact('permohonan', 'rap', 'provinces', 'cities',
// 'districts', // 'districts',
// 'villages','forminspeksi', 'noLpRAP', 'basicData','cekAlamat')); // 'villages','forminspeksi', 'noLpRAP', 'basicData','cekAlamat'));
return view('lpj::penilai.components.call-report', compact('permohonan')); return view('lpj::penilai.components.call-report', compact('permohonan'));
} }
/** /**
@@ -1052,8 +1061,12 @@ class PenilaiController extends Controller
'rap' 'rap'
)); ));
// return $pdf; // return $pdf;
$cleanNomorLaporan = str_replace(['/', '\\'], '-', $nomorLaporan);
$pdf->setPaper('A4', 'portrait'); $pdf->setPaper('A4', 'portrait');
return $pdf->stream(); return response($pdf->output(), 200)
->header('Content-Type', 'application/pdf')
->header('Content-Disposition', 'inline; filename="Laporan_' . $tipeLaporan . '_' .$permohonan->debiture->name . '_' . $cleanNomorLaporan .'.pdf"');
// return $pdf->stream();
} else { } else {
// $pdf = view('lpj::' . $viewLaporan, compact( // $pdf = view('lpj::' . $viewLaporan, compact(
$pdf = PDF::loadView('lpj::' . $viewLaporan, compact( $pdf = PDF::loadView('lpj::' . $viewLaporan, compact(

View File

@@ -9,7 +9,7 @@
'foto_rute_lainnya' => [ 'foto_rute_lainnya' => [
'key' => 'name_rute_lainnya', 'key' => 'name_rute_lainnya',
'name_prefix' => '', 'name_prefix' => '',
'nested' => false, 'nested' => true,
], ],
'foto_lingkungan' => [ 'foto_lingkungan' => [
'key' => 'foto_lingkungan', 'key' => 'foto_lingkungan',
@@ -36,33 +36,91 @@
$hasPhotos = false; $hasPhotos = false;
@endphp @endphp
<style> <style>
.photo-container { /* General Styles */
display: flex; body {
flex-wrap: wrap; font-family: Arial, sans-serif;
justify-content: space-between; margin: 0;
margin-bottom: 20px; padding: 0;
} }
.photo-item {
width: 100%; /* Adjust to fit two photos per row */
margin-bottom: 10px;
}
.photo-item img {
width: 80%;
height: auto;
border-radius: 5px;
}
</style>
.photo-container {
width: 100%;
margin-bottom: 10px;
clear: both;
page-break-inside: avoid;
}
.photo-row {
width: 100%;
clear: both;
page-break-inside: avoid;
}
.photo-item {
width: 48%;
margin-right: 2%;
float: left;
padding: 5px;
box-sizing: border-box;
page-break-inside: avoid;
}
.photo-item:nth-child(2n) {
margin-right: 0;
}
/* Image Styling */
.photo-item img {
max-width: 100%;
height: auto;
object-fit: cover;
}
/* Clearfix */
.clearfix::after {
content: "";
clear: both;
display: table;
}
/* Media Print */
@media print {
.photo-item {
width: 48%;
margin-right: 2%;
float: left;
padding: 5px;
box-sizing: border-box;
page-break-inside: avoid;
}
.photo-item img {
max-width: 100%;
height: auto;
object-fit: contain;
}
h2 {
font-size: 14px;
margin-bottom: 5px;
}
}
</style>
@foreach ($photoSections as $sectionKey => $sectionConfig) @foreach ($photoSections as $sectionKey => $sectionConfig)
@if ($sectionKey === 'single_photos') @if ($sectionKey === 'single_photos')
<div class="photo-container"> <div class="photo-container">
@php $counter = 0; @endphp
@foreach ($sectionConfig as $photoKey => $photoName) @foreach ($sectionConfig as $photoKey => $photoName)
@if (isset($formFoto[$photoKey]) && !empty($formFoto[$photoKey])) @if (isset($formFoto[$photoKey]) && !empty($formFoto[$photoKey]))
@php @php
$imagePath = storage_path('app/public/' . $formFoto[$photoKey]); $imagePath = storage_path('app/public/' . $formFoto[$photoKey]);
$hasPhotos = true; $hasPhotos = true;
@endphp @endphp
@if ($counter % 2 == 0)
<div class="photo-row clearfix">
@endif
<div class="photo-item border"> <div class="photo-item border">
<h2 class="text-gray-600 font-semibold text-xl"> <h2 class="text-gray-600 font-semibold text-xl">
{{ $photoName }} {{ $photoName }}
@@ -71,6 +129,10 @@
<img src="{{ $imagePath }}" alt="{{ $photoName }}" class="photo-image"> <img src="{{ $imagePath }}" alt="{{ $photoName }}" class="photo-image">
@endif @endif
</div> </div>
@if ($counter % 2 == 1 || $loop->last)
</div> <!-- Tutup baris setelah 2 item atau di akhir loop -->
@endif
@php $counter++; @endphp
@endif @endif
@endforeach @endforeach
</div> </div>
@@ -83,11 +145,15 @@
@if ($sectionConfig['nested']) @if ($sectionConfig['nested'])
@if (isset($sectionData[$sectionConfig['key']][0])) @if (isset($sectionData[$sectionConfig['key']][0]))
<div class="photo-container"> <div class="photo-container">
@php $counter = 0; @endphp
@foreach ($sectionData[$sectionConfig['key']][0] as $index => $item) @foreach ($sectionData[$sectionConfig['key']][0] as $index => $item)
@php @php
$imagePath = storage_path('app/public/' . $item['path']); $imagePath = storage_path('app/public/' . $item['path']);
$hasPhotos = true; $hasPhotos = true;
@endphp @endphp
@if ($counter % 2 == 0)
<div class="photo-row clearfix">
@endif
<div class="photo-item border"> <div class="photo-item border">
<h2 class="text-gray-600 font-semibold text-xl"> <h2 class="text-gray-600 font-semibold text-xl">
{{ $sectionConfig['name_prefix'] {{ $sectionConfig['name_prefix']
@@ -98,11 +164,16 @@
<img src="{{ $imagePath }}" alt="{{ $item['path'] }}" class="photo-image"> <img src="{{ $imagePath }}" alt="{{ $item['path'] }}" class="photo-image">
@endif @endif
</div> </div>
@if ($counter % 2 == 1 || $loop->last)
</div> <!-- Tutup baris setelah 2 item atau di akhir loop -->
@endif
@php $counter++; @endphp
@endforeach @endforeach
</div> </div>
@endif @endif
@else @else
<div class="photo-container"> <div class="photo-container">
@php $counter = 0; @endphp
@foreach ($sectionData as $index => $item) @foreach ($sectionData as $index => $item)
@php @php
$name = $item[$sectionConfig['key']] ?? ''; $name = $item[$sectionConfig['key']] ?? '';
@@ -116,6 +187,9 @@
@if (!empty($name) || !empty($photoPath)) @if (!empty($name) || !empty($photoPath))
@php $hasPhotos = true; @endphp @php $hasPhotos = true; @endphp
@if ($counter % 2 == 0)
<div class="photo-row clearfix">
@endif
<div class="photo-item border"> <div class="photo-item border">
@if (!empty($name)) @if (!empty($name))
<h2 class="text-gray-600 font-semibold text-xl"> <h2 class="text-gray-600 font-semibold text-xl">
@@ -126,6 +200,10 @@
<img src="{{ $imagePath }}" alt="{{ $name ?: 'Foto' }}" class="photo-image"> <img src="{{ $imagePath }}" alt="{{ $name ?: 'Foto' }}" class="photo-image">
@endif @endif
</div> </div>
@if ($counter % 2 == 1 || $loop->last)
</div> <!-- Tutup baris setelah 2 item atau di akhir loop -->
@endif
@php $counter++; @endphp
@endif @endif
@endforeach @endforeach
</div> </div>

View File

@@ -92,17 +92,7 @@
border: 1px solid #000; border: 1px solid #000;
} }
.photo-item {
text-align: center;
margin-bottom: 20px;
}
.photo-image {
max-width: 80%;
height: auto;
display: block;
margin: 0 auto;
}
</style> </style>
</head> </head>
@@ -421,8 +411,8 @@
</main> </main>
<footer> <footer id="footer">
Cabang : {{ $permohonan->debiture->branch->name ?? '' }}
</footer> </footer>
<script> <script>

View File

@@ -1299,8 +1299,7 @@
PETA PETA
</h6> </h6>
</div> </div>
<div class="photo-container">
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 15px;">
@php @php
$fotoTypes = ['foto_gistaru', 'foto_bhumi', 'foto_argis_region', 'foto_tempat']; $fotoTypes = ['foto_gistaru', 'foto_bhumi', 'foto_argis_region', 'foto_tempat'];
// Memindahkan foto_tempat ke depan jika ada // Memindahkan foto_tempat ke depan jika ada
@@ -1309,28 +1308,36 @@
array_unshift($fotoTypes, 'foto_tempat'); array_unshift($fotoTypes, 'foto_tempat');
} }
@endphp @endphp
@if (isset($forminspeksi)) @if (isset($forminspeksi))
@php $counter = 0; @endphp
@foreach ($fotoTypes as $type) @foreach ($fotoTypes as $type)
@php @php
$imagePath = $forminspeksi[$type] ?? null; $imagePath = $forminspeksi[$type] ?? null;
@endphp @endphp
@if ($imagePath && file_exists(storage_path('app/public/' . $imagePath))) @if ($imagePath && file_exists(storage_path('app/public/' . $imagePath)))
<div style="border: 1px solid #ddd; padding: 10px; text-align: center;"> @if ($counter % 2 == 0)
<div class="photo-row clearfix">
@endif
<div class="photo-items" style="float: left; width: 48%; margin-right: 2%; padding: 5px; text-align: center; border: 1px solid #ddd; page-break-inside: avoid;">
<img src="{{ storage_path('app/public/' . $imagePath) }}" <img src="{{ storage_path('app/public/' . $imagePath) }}"
alt="{{ $type }}" alt="{{ $type }}"
style="max-width: 100%; height: auto; margin-bottom: 10px;"> style="width: 50%; height: 40%; object-fit: contain; margin-bottom: 10px;">
<p style="margin: 0; font-size: 14px;"> <p style="margin: 0; font-size: 14px;">
{{ Str::title(str_replace('_', ' ', $type)) }} {{ Str::title(str_replace('_', ' ', $type)) }}
</p> </p>
</div> </div>
@if ($counter % 2 == 1 || $loop->last)
</div>
@endif
@php $counter++; @endphp
@endif @endif
@endforeach @endforeach
@endif @endif
</div> </div>
</div> </div>
<div class="page-break"></div>
<div class="section"> <div class="section">
<div class="judul"> <div class="judul">
<h6 class="border" style="text-align: center"> <h6 class="border" style="text-align: center">

View File

@@ -13,7 +13,7 @@
} }
* { * {
font-size: 10px; font-size: 8px;
font-weight: bold; font-weight: bold;
} }
@@ -1331,14 +1331,14 @@
<tr> <tr>
<td style="">Harga</td> <td style="">Harga</td>
<td style=""> <td style="">Rp.
{{ formatRupiah($lpjData['asuransi_nilai_1']) ?? '' }}</td> {{ $lpjData['asuransi_nilai_1'] ?? '' }}</td>
</tr> </tr>
<tr> <tr>
<td style="">Nilai Pasar Wajar (Rp)</td> <td style="">Nilai Pasar Wajar (Rp)</td>
<td style=""> <td style="">Rp.
{{ formatRupiah($lpjData['asuransi_nilai_2']) ?? '' }}</td> {{$lpjData['asuransi_nilai_2'] ?? '' }}</td>
</tr> </tr>
@else @else
<tr> <tr>
@@ -1583,6 +1583,11 @@
'pesawat' => 'Luas Pesawat', 'pesawat' => 'Luas Pesawat',
'kapal' => 'Luas Kapal', 'kapal' => 'Luas Kapal',
]; ];
// if (strcasecmp($jenisAset, 'RUKO/RUKAN') === 0) {
// $labelNilai['bangunan'] = 'Luas Unit';
// unset($labelNilai['tanah']);
// }
@endphp @endphp
@foreach ($labelNilai as $key => $label) @foreach ($labelNilai as $key => $label)
@if (isset($lpjData['luas_' . $key])) @if (isset($lpjData['luas_' . $key]))
@@ -1848,7 +1853,7 @@
@endif @endif
</div> </div>
</div> </div>
<div class="page-break"></div>
<div class="section"> <div class="section">
<div class="judul"> <div class="judul">
<h6 class="border"> <h6 class="border">