fix: tampilan detail laporan, dan ganti route print out, penambahan service

This commit is contained in:
majid
2025-06-13 09:56:42 +07:00
parent 4405760df4
commit daed7c5e48
22 changed files with 1021 additions and 706 deletions

View File

@@ -10,7 +10,7 @@ use Modules\Lpj\Models\StatusPermohonan;
use Modules\Lpj\Exports\LaporanPenilaiJaminanExport;
use Maatwebsite\Excel\Facades\Excel;
use Modules\Lpj\Models\Branch;
use Modules\Lpj\Http\Controllers\SurveyorController;
use Modules\Lpj\Services\PreviewLaporanService;
use Modules\Lpj\Models\Inspeksi;
use Modules\Lpj\Models\Penilai;
@@ -21,11 +21,11 @@ class LaporanPenilaiJaminanController extends Controller
* Display a listing of the resource.
*/
protected $surveyorController;
protected $previewLaporanService;
public function __construct(SurveyorController $surveyorController)
public function __construct(PreviewLaporanService $previewLaporanService)
{
$this->surveyorController = $surveyorController;
$this->previewLaporanService = $previewLaporanService;
}
public function index()
@@ -40,54 +40,8 @@ class LaporanPenilaiJaminanController extends Controller
*/
public function show($permohonan_id, $dokumen_id, $jaminan_id)
{
$permohonan = $this->surveyorController->getPermohonanJaminanId(
$permohonan_id,
$dokumen_id,
$jaminan_id
);
$basicData = $this->surveyorController->getCommonData();
$inspeksi = Inspeksi::where('permohonan_id', $permohonan_id)->where('dokument_id', $dokumen_id)->first();
$lpj = Penilai::where('permohonan_id', $permohonan_id)->where('dokument_id', $dokumen_id)->first();
$nomorLaporan = getNomorLaporan($permohonan_id, $dokumen_id);
$tanggalLaporan = $lpj->created_at ?? null;
$forminspeksi = null;
$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 ($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);
}
$inputAddress = $forminspeksi['asset']['alamat']['sesuai'] ?? $forminspeksi['asset']['alamat']['tidak sesuai'] ?? [];
$alamat = [
'address' => $inputAddress['address'] ?? null,
'village_code' => getWilayahName($inputAddress['village_code'] ?? null, 'village'),
'district_code' => getWilayahName($inputAddress['district_code'] ?? null, 'district'),
'city_code' => getWilayahName($inputAddress['city_code'] ?? null, 'city'),
'province_code' => getWilayahName($inputAddress['province_code'] ?? null, 'province')
];
$statusLpj = 0;
// $viewLaporan = $this->getViewLaporan($tipeLaporan);
return view('lpj::laporan-penilai-jaminan.show', compact('permohonan', 'basicData', 'forminspeksi', 'alamat', 'lpjData', 'memo', 'resumeData', 'rap', 'report', 'lpj', 'formFoto', 'nomorLaporan', 'tanggalLaporan', 'dataPembanding', 'inspeksi', 'statusLpj'));
$back = route('laporan-penilai-jaminan.index');
return $this->previewLaporanService->previewLaporan($permohonan_id, $dokumen_id, $jaminan_id, $back);
}