update service preview laporan and foto jaminan

This commit is contained in:
majid
2025-06-18 10:15:49 +07:00
parent daed7c5e48
commit db3ffacebe
2 changed files with 159 additions and 73 deletions

View File

@@ -69,6 +69,7 @@ use Modules\Lpj\Jobs\SendJadwalKunjunganEmailJob;
use App\Helpers\Lpj;
use Modules\Lpj\Models\Penilai;
use Barryvdh\DomPDF\Facade\Pdf;
class PreviewLaporanService
{
public function previewLaporan($permohonan_id, $dokumen_id, $jaminan_id, $back)
@@ -78,7 +79,12 @@ class PreviewLaporanService
$dokumen_id,
$jaminan_id
);
// $tipeLaporanResponse = $this->checkPrintOutLaporan($permohonan_id, $document_id);
// $tipeLaporan = $tipeLaporanResponse->getData();
// if (!$tipeLaporan->status) {
// return redirect()->back()->with('error', 'Laporan tidak valid');
// }
$basicData = $this->getCommonData();
$inspeksi = Inspeksi::where('permohonan_id', $permohonan_id)->where('dokument_id', $dokumen_id)->first();
@@ -90,20 +96,20 @@ class PreviewLaporanService
$lpjData = null;
$formFoto = null;
if ($inspeksi) {
$forminspeksi = json_decode($inspeksi->data_form, true);
$formFoto = json_decode($inspeksi->foto_form, true);
// $denahForm = json_decode($data->denah_form, true);
$dataPembanding = json_decode($inspeksi->data_pembanding, true);
}
// if ($inspeksi) {
$forminspeksi = json_decode($inspeksi?->data_form, true) ?? null;
$formFoto = json_decode($inspeksi?->foto_form, true) ?? null;
// $denahForm = json_decode($data->denah_form, true);
$dataPembanding = json_decode($inspeksi?->data_pembanding, true) ?? null;
// }
if ($lpj) {
$lpjData = json_decode($lpj->lpj, true);
$memo = json_decode($lpj->memo, true);
$resumeData = json_decode($lpj->resume, true);
$rap = json_decode($lpj->rap, true);
$report = json_decode($lpj->call_report, true);
}
// if ($lpj) {
$lpjData = json_decode($lpj?->lpj, true) ?? null;
$memo = json_decode($lpj?->memo, true) ?? null;
$resumeData = json_decode($lpj?->resume, true) ?? null;
$rap = json_decode($lpj?->rap, true);
$report = json_decode($lpj?->call_report, true) ?? null;
// }
$inputAddress = $forminspeksi['asset']['alamat']['sesuai'] ?? $forminspeksi['asset']['alamat']['tidak sesuai'] ?? [];
@@ -118,7 +124,7 @@ class PreviewLaporanService
$statusLpj = 0;
// $viewLaporan = $this->getViewLaporan($tipeLaporan);
return view('lpj::component.show-laporan-inspeksi', compact('permohonan', 'basicData', 'forminspeksi', 'alamat', 'lpjData', 'memo', 'resumeData', 'rap', 'report', 'lpj', 'formFoto', 'nomorLaporan', 'tanggalLaporan', 'dataPembanding', 'inspeksi', 'statusLpj', 'permohonan_id', 'back'));
return view('lpj::component.show-laporan-inspeksi', compact('permohonan', 'basicData', 'forminspeksi', 'alamat', 'lpjData', 'memo', 'resumeData', 'rap', 'report', 'lpj', 'formFoto', 'nomorLaporan', 'tanggalLaporan', 'dataPembanding', 'inspeksi', 'statusLpj', 'permohonan_id', 'back', ));
}
public function printOutLaporan($permohonan_id, $document_id, $jaminan_id)
@@ -230,7 +236,7 @@ class PreviewLaporanService
return $viewMap[$tipe] ?? 'penilai.components.print-resume';
}
public function checkPrintOutLaporan($permohonan_id, $dokumen_id)
public function checkPrintOutLaporan($permohonan_id, $dokumen_id)
{