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\Http\Controllers\SurveyorController;
|
||||
use Modules\Location\Models\Province;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class PenilaiController extends Controller
|
||||
{
|
||||
@@ -607,7 +608,7 @@ class PenilaiController extends Controller
|
||||
$lpjData = json_decode($lpj->lpj, true);
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
$pdf = PDF::loadView('lpj::penilai.components.print-out', compact(
|
||||
'permohonan',
|
||||
'forminspeksi',
|
||||
@@ -621,6 +622,10 @@ class PenilaiController extends Controller
|
||||
$pdf->setPaper('A4', 'portrait');
|
||||
|
||||
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(
|
||||
// 'permohonan',
|
||||
|
||||
@@ -454,7 +454,9 @@
|
||||
<table class="checkbox-table">
|
||||
<tr>
|
||||
@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
|
||||
</tr>
|
||||
</table>
|
||||
@@ -480,7 +482,9 @@
|
||||
<table class="checkbox-table">
|
||||
<tr>
|
||||
@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
|
||||
</tr>
|
||||
</table>
|
||||
@@ -920,7 +924,6 @@
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1038,8 +1041,10 @@
|
||||
$imagePath = $forminspeksi[$type];
|
||||
@endphp
|
||||
|
||||
@if($imagePath && file_exists(storage_path('app/public/'. $imagePath)))
|
||||
<img src="{{ storage_path('app/public/' . $imagePath) }}" alt="{{ $type }}"
|
||||
class="photo-image">
|
||||
@endif
|
||||
<p class="mt-2 text-sm">{{ Str::title(str_replace('_', ' ', $type)) }}</p>
|
||||
|
||||
</div>
|
||||
@@ -1064,8 +1069,10 @@
|
||||
{{ $item['name_rute'] . ' ' . $loop->index + 1 }}
|
||||
</h2>
|
||||
|
||||
@if(file_exists(storage_path('app/public/'. $item['foto_rute'])))
|
||||
<img src="{{ storage_path('app/public/' . $item['foto_rute']) }}"
|
||||
alt="{{ $item['foto_rute'] }}" class="photo-image">
|
||||
@endif
|
||||
</div>
|
||||
@endforeach
|
||||
@endif
|
||||
@@ -1077,8 +1084,10 @@
|
||||
{{ $item['name_objek'] }}
|
||||
</h2>
|
||||
|
||||
@if(file_exists(storage_path('app/public/'. $item['foto_objek'])))
|
||||
<img src="{{ storage_path('app/public/' . $item['foto_objek']) }}"
|
||||
alt="{{ $item['foto_objek'] }}" class="photo-image">
|
||||
@endif
|
||||
</div>
|
||||
@endforeach
|
||||
@endif
|
||||
@@ -1089,8 +1098,10 @@
|
||||
Basement
|
||||
</h2>
|
||||
|
||||
@if(file_exists(storage_path('app/public/'. $formFoto['foto_basement'])))
|
||||
<img src="{{ storage_path('app/public/' . $formFoto['foto_basement']) }}"
|
||||
alt="{{ $formFoto['foto_basement'] }}" class="photo-image">
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@@ -1100,8 +1111,10 @@
|
||||
Gerbang
|
||||
</h2>
|
||||
|
||||
@if(file_exists(storage_path('app/public/'. $formFoto['foto_gerbang'])))
|
||||
<img src="{{ storage_path('app/public/' . $formFoto['foto_gerbang']) }}"
|
||||
alt="{{ $formFoto['foto_gerbang'] }}" class="photo-image">
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
@if (isset($formFoto['pendamping']))
|
||||
@@ -1109,9 +1122,10 @@
|
||||
<h2 class="text-gray-600 font-semibold text-xl">
|
||||
Pendamping
|
||||
</h2>
|
||||
|
||||
@if(file_exists(storage_path('app/public/'. $formFoto['pendamping'])))
|
||||
<img src="{{ storage_path('app/public/' . $formFoto['pendamping']) }}"
|
||||
alt="{{ $formFoto['pendamping'] }}" class="photo-image">
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user