Tambah logging untuk penanganan error saat generate PDF
- Menambahkan fungsi try-catch di `PenilaiController` untuk menangani kesalahan saat proses pembuatan file PDF. - Menggunakan `Illuminate\Support\Facades\Log` untuk mencatat error yang terjadi. - Memperbaiki format dan layout pada file blade `print-out.blade.php` agar lebih konsisten.
This commit is contained in:
@@ -13,6 +13,7 @@ use Maatwebsite\Excel\Facades\Excel;
|
|||||||
use Modules\Lpj\Exports\KertasKerjaExport;
|
use Modules\Lpj\Exports\KertasKerjaExport;
|
||||||
use Modules\Lpj\Http\Controllers\SurveyorController;
|
use Modules\Lpj\Http\Controllers\SurveyorController;
|
||||||
use Modules\Location\Models\Province;
|
use Modules\Location\Models\Province;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
class PenilaiController extends Controller
|
class PenilaiController extends Controller
|
||||||
{
|
{
|
||||||
@@ -607,7 +608,7 @@ class PenilaiController extends Controller
|
|||||||
$lpjData = json_decode($lpj->lpj, true);
|
$lpjData = json_decode($lpj->lpj, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
$pdf = PDF::loadView('lpj::penilai.components.print-out', compact(
|
$pdf = PDF::loadView('lpj::penilai.components.print-out', compact(
|
||||||
'permohonan',
|
'permohonan',
|
||||||
'forminspeksi',
|
'forminspeksi',
|
||||||
@@ -621,6 +622,10 @@ class PenilaiController extends Controller
|
|||||||
$pdf->setPaper('A4', 'portrait');
|
$pdf->setPaper('A4', 'portrait');
|
||||||
|
|
||||||
return $pdf->download('laporan.pdf');
|
return $pdf->download('laporan.pdf');
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Log::error('PDF generation failed: ' . $e->getMessage());
|
||||||
|
return response()->json(['error' => 'Failed to generate PDF. Please check the log for details.'], 500);
|
||||||
|
}
|
||||||
|
|
||||||
// return view('lpj::penilai.components.print-out', compact(
|
// return view('lpj::penilai.components.print-out', compact(
|
||||||
// 'permohonan',
|
// 'permohonan',
|
||||||
|
|||||||
@@ -214,7 +214,7 @@
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<h4>LAPORAN PENILAIAN ATAS TANAH DAN/ATAU BANGUNAN</h4>
|
<h4>LAPORAN PENILAIAN ATAS TANAH DAN/ATAU BANGUNAN</h4>
|
||||||
<p>NO: {{ $permohonan->nomor_registrasi }}</p>
|
<p>NO: {{ $permohonan->nomor_registrasi }}</p>
|
||||||
@@ -454,7 +454,9 @@
|
|||||||
<table class="checkbox-table">
|
<table class="checkbox-table">
|
||||||
<tr>
|
<tr>
|
||||||
@foreach ($basicData['hubCadeb'] as $item)
|
@foreach ($basicData['hubCadeb'] as $item)
|
||||||
<td><input type="checkbox" {{ $item->name === $hubCadeb ? 'checked' : '' }} > {{ $item->name }}</td>
|
<td>
|
||||||
|
<input type="checkbox" {{ $item->name === $hubCadeb ? 'checked' : '' }} > {{ $item->name }}
|
||||||
|
</td>
|
||||||
@endforeach
|
@endforeach
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
@@ -480,7 +482,9 @@
|
|||||||
<table class="checkbox-table">
|
<table class="checkbox-table">
|
||||||
<tr>
|
<tr>
|
||||||
@foreach ($basicData['hubPenghuni'] as $item)
|
@foreach ($basicData['hubPenghuni'] as $item)
|
||||||
<td><input type="checkbox" {{ $item->name === $hubCadeb ? 'checked' : '' }} > {{ $item->name }}</td>
|
<td>
|
||||||
|
<input type="checkbox" {{ $item->name === $hubCadeb ? 'checked' : '' }} > {{ $item->name }}
|
||||||
|
</td>
|
||||||
@endforeach
|
@endforeach
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
@@ -579,7 +583,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
@endif
|
@endif
|
||||||
<td>
|
<td>
|
||||||
<input type="checkbox" > {{ $item->name }}
|
<input type="checkbox"> {{ $item->name }}
|
||||||
</td>
|
</td>
|
||||||
@endforeach
|
@endforeach
|
||||||
</tr>
|
</tr>
|
||||||
@@ -920,7 +924,6 @@
|
|||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
@@ -1038,8 +1041,10 @@
|
|||||||
$imagePath = $forminspeksi[$type];
|
$imagePath = $forminspeksi[$type];
|
||||||
@endphp
|
@endphp
|
||||||
|
|
||||||
|
@if($imagePath && file_exists(storage_path('app/public/'. $imagePath)))
|
||||||
<img src="{{ storage_path('app/public/' . $imagePath) }}" alt="{{ $type }}"
|
<img src="{{ storage_path('app/public/' . $imagePath) }}" alt="{{ $type }}"
|
||||||
class="photo-image">
|
class="photo-image">
|
||||||
|
@endif
|
||||||
<p class="mt-2 text-sm">{{ Str::title(str_replace('_', ' ', $type)) }}</p>
|
<p class="mt-2 text-sm">{{ Str::title(str_replace('_', ' ', $type)) }}</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -1064,8 +1069,10 @@
|
|||||||
{{ $item['name_rute'] . ' ' . $loop->index + 1 }}
|
{{ $item['name_rute'] . ' ' . $loop->index + 1 }}
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
@if(file_exists(storage_path('app/public/'. $item['foto_rute'])))
|
||||||
<img src="{{ storage_path('app/public/' . $item['foto_rute']) }}"
|
<img src="{{ storage_path('app/public/' . $item['foto_rute']) }}"
|
||||||
alt="{{ $item['foto_rute'] }}" class="photo-image">
|
alt="{{ $item['foto_rute'] }}" class="photo-image">
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
@endforeach
|
@endforeach
|
||||||
@endif
|
@endif
|
||||||
@@ -1077,8 +1084,10 @@
|
|||||||
{{ $item['name_objek'] }}
|
{{ $item['name_objek'] }}
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
@if(file_exists(storage_path('app/public/'. $item['foto_objek'])))
|
||||||
<img src="{{ storage_path('app/public/' . $item['foto_objek']) }}"
|
<img src="{{ storage_path('app/public/' . $item['foto_objek']) }}"
|
||||||
alt="{{ $item['foto_objek'] }}" class="photo-image">
|
alt="{{ $item['foto_objek'] }}" class="photo-image">
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
@endforeach
|
@endforeach
|
||||||
@endif
|
@endif
|
||||||
@@ -1089,8 +1098,10 @@
|
|||||||
Basement
|
Basement
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
@if(file_exists(storage_path('app/public/'. $formFoto['foto_basement'])))
|
||||||
<img src="{{ storage_path('app/public/' . $formFoto['foto_basement']) }}"
|
<img src="{{ storage_path('app/public/' . $formFoto['foto_basement']) }}"
|
||||||
alt="{{ $formFoto['foto_basement'] }}" class="photo-image">
|
alt="{{ $formFoto['foto_basement'] }}" class="photo-image">
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@@ -1100,8 +1111,10 @@
|
|||||||
Gerbang
|
Gerbang
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
@if(file_exists(storage_path('app/public/'. $formFoto['foto_gerbang'])))
|
||||||
<img src="{{ storage_path('app/public/' . $formFoto['foto_gerbang']) }}"
|
<img src="{{ storage_path('app/public/' . $formFoto['foto_gerbang']) }}"
|
||||||
alt="{{ $formFoto['foto_gerbang'] }}" class="photo-image">
|
alt="{{ $formFoto['foto_gerbang'] }}" class="photo-image">
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
@if (isset($formFoto['pendamping']))
|
@if (isset($formFoto['pendamping']))
|
||||||
@@ -1109,19 +1122,20 @@
|
|||||||
<h2 class="text-gray-600 font-semibold text-xl">
|
<h2 class="text-gray-600 font-semibold text-xl">
|
||||||
Pendamping
|
Pendamping
|
||||||
</h2>
|
</h2>
|
||||||
|
@if(file_exists(storage_path('app/public/'. $formFoto['pendamping'])))
|
||||||
<img src="{{ storage_path('app/public/' . $formFoto['pendamping']) }}"
|
<img src="{{ storage_path('app/public/' . $formFoto['pendamping']) }}"
|
||||||
alt="{{ $formFoto['pendamping'] }}" class="photo-image">
|
alt="{{ $formFoto['pendamping'] }}" class="photo-image">
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const datas = @json($forminspeksi);
|
const datas = @json($forminspeksi);
|
||||||
console.log(datas);
|
console.log(datas);
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user