From 165042db38db8cc7e23f688c8315b614d521af48 Mon Sep 17 00:00:00 2001 From: majid Date: Tue, 4 Feb 2025 13:33:16 +0700 Subject: [PATCH 1/2] fix(print-out): perbaikan foto --- app/Http/Controllers/PenilaiController.php | 29 +++-- .../penilai/components/foto-jaminan.blade.php | 114 +++++++++++++++--- .../penilai/components/print-memo.blade.php | 14 +-- .../components/print-out-sederhana.blade.php | 19 ++- .../components/print-out-standard.blade.php | 17 ++- 5 files changed, 143 insertions(+), 50 deletions(-) diff --git a/app/Http/Controllers/PenilaiController.php b/app/Http/Controllers/PenilaiController.php index fe60a89..29ff6fd 100644 --- a/app/Http/Controllers/PenilaiController.php +++ b/app/Http/Controllers/PenilaiController.php @@ -248,7 +248,7 @@ class PenilaiController extends Controller public function edit($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'); $path = $file->store('public/file_paparan'); @@ -282,10 +282,10 @@ class PenilaiController extends Controller } 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) { - 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', - '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', // 'districts', // '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' )); // return $pdf; + $cleanNomorLaporan = str_replace(['/', '\\'], '-', $nomorLaporan); $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 { // $pdf = view('lpj::' . $viewLaporan, compact( $pdf = PDF::loadView('lpj::' . $viewLaporan, compact( diff --git a/resources/views/penilai/components/foto-jaminan.blade.php b/resources/views/penilai/components/foto-jaminan.blade.php index 1f29d95..dd9e8a6 100644 --- a/resources/views/penilai/components/foto-jaminan.blade.php +++ b/resources/views/penilai/components/foto-jaminan.blade.php @@ -9,7 +9,7 @@ 'foto_rute_lainnya' => [ 'key' => 'name_rute_lainnya', 'name_prefix' => '', - 'nested' => false, + 'nested' => true, ], 'foto_lingkungan' => [ 'key' => 'foto_lingkungan', @@ -36,33 +36,91 @@ $hasPhotos = false; @endphp - + @foreach ($photoSections as $sectionKey => $sectionConfig) @if ($sectionKey === 'single_photos')
+ @php $counter = 0; @endphp @foreach ($sectionConfig as $photoKey => $photoName) @if (isset($formFoto[$photoKey]) && !empty($formFoto[$photoKey])) @php $imagePath = storage_path('app/public/' . $formFoto[$photoKey]); $hasPhotos = true; @endphp + @if ($counter % 2 == 0) +
+ @endif

{{ $photoName }} @@ -71,6 +129,10 @@ {{ $photoName }} @endif

+ @if ($counter % 2 == 1 || $loop->last) +
+ @endif + @php $counter++; @endphp @endif @endforeach
@@ -83,11 +145,15 @@ @if ($sectionConfig['nested']) @if (isset($sectionData[$sectionConfig['key']][0]))
+ @php $counter = 0; @endphp @foreach ($sectionData[$sectionConfig['key']][0] as $index => $item) @php $imagePath = storage_path('app/public/' . $item['path']); $hasPhotos = true; @endphp + @if ($counter % 2 == 0) +
+ @endif

{{ $sectionConfig['name_prefix'] @@ -98,11 +164,16 @@ {{ $item['path'] }} @endif

+ @if ($counter % 2 == 1 || $loop->last) +
+ @endif + @php $counter++; @endphp @endforeach
@endif @else
+ @php $counter = 0; @endphp @foreach ($sectionData as $index => $item) @php $name = $item[$sectionConfig['key']] ?? ''; @@ -116,6 +187,9 @@ @if (!empty($name) || !empty($photoPath)) @php $hasPhotos = true; @endphp + @if ($counter % 2 == 0) +
+ @endif
@if (!empty($name))

@@ -126,6 +200,10 @@ {{ $name ?: 'Foto' }} @endif

+ @if ($counter % 2 == 1 || $loop->last) +
+ @endif + @php $counter++; @endphp @endif @endforeach
diff --git a/resources/views/penilai/components/print-memo.blade.php b/resources/views/penilai/components/print-memo.blade.php index 6448c1e..248905a 100644 --- a/resources/views/penilai/components/print-memo.blade.php +++ b/resources/views/penilai/components/print-memo.blade.php @@ -92,17 +92,7 @@ border: 1px solid #000; } - .photo-item { - text-align: center; - margin-bottom: 20px; - } - .photo-image { - max-width: 80%; - height: auto; - display: block; - margin: 0 auto; - } @@ -421,8 +411,8 @@ -