update print out sederhana, resume, memo dan paparan dan penambahan breadcrumbs
This commit is contained in:
@@ -10,6 +10,7 @@ use Modules\Lpj\Models\Penilai;
|
||||
use Modules\Lpj\Models\Laporan;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use Modules\Lpj\Exports\KertasKerjaExport;
|
||||
use Modules\Lpj\Http\Controllers\SurveyorController;
|
||||
@@ -153,7 +154,7 @@ class PenilaiController extends Controller
|
||||
$permohonan = $data['permohonan'];
|
||||
|
||||
$inspeksi = Inspeksi::where('permohonan_id', $req['permohonanId'])->where('dokument_id', $req['documentId'])->first();
|
||||
$penilai = Penilai::where('permohonan_id', $req['permohonanId'])->where('dokument_id', $req['documentId'])->firstska();
|
||||
$penilai = Penilai::where('permohonan_id', $req['permohonanId'])->where('dokument_id', $req['documentId'])->first();
|
||||
$provinces = Province::all();
|
||||
$basicData = $this->surveyorController->getCommonData();
|
||||
|
||||
@@ -582,6 +583,7 @@ class PenilaiController extends Controller
|
||||
|
||||
public function storeLpjSederhanadanStandard(Request $request)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$validatedRequest = app(FormSurveyorRequest::class);
|
||||
$this->surveyorController->store($validatedRequest);
|
||||
@@ -634,13 +636,14 @@ class PenilaiController extends Controller
|
||||
'lpj' => json_encode($data),
|
||||
]
|
||||
);
|
||||
|
||||
DB::commit();
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'message' => 'Berhasil menyimpan LPJ',
|
||||
'data' => $penilai
|
||||
'data' => $validatedRequest
|
||||
], 200);
|
||||
} catch (\Throwable $e) {
|
||||
DB::rollBack();
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'Terjadi kesalahan saat menyimpan LPJ',
|
||||
@@ -654,14 +657,16 @@ class PenilaiController extends Controller
|
||||
|
||||
public function print_out(Request $request)
|
||||
{
|
||||
|
||||
|
||||
$documentId = $request->query('documentId');
|
||||
$jaminanId = $request->query('jaminanId');
|
||||
$permohonanId = $request->query('permohonanId');
|
||||
$statusLpj = $request->query('statusLpj');
|
||||
$tipeLaporan = $request->query('tipe');
|
||||
|
||||
$permohonan = $this->surveyorController->getPermohonanJaminanId($permohonanId,
|
||||
$documentId,
|
||||
$jaminanId);
|
||||
|
||||
$permohonan = $this->surveyorController->getPermohonanJaminanId($permohonanId, $documentId, $jaminanId);
|
||||
$basicData = $this->surveyorController->getCommonData();
|
||||
|
||||
$inspeksi = Inspeksi::where('permohonan_id', $permohonanId)->where('dokument_id', $documentId)->first();
|
||||
@@ -676,19 +681,17 @@ class PenilaiController extends Controller
|
||||
'nomor_laporan' => generateLpjUniqueCode(6),
|
||||
]
|
||||
);
|
||||
$nomorLaporan = $laporan->nomor_laporan;
|
||||
|
||||
$nomorLaporan = $laporan->nomor_laporan;
|
||||
$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) {
|
||||
@@ -706,22 +709,7 @@ class PenilaiController extends Controller
|
||||
'province_code' => $this->getWilayahName($inputAddress['province_code'] ?? null, 'province')
|
||||
];
|
||||
|
||||
['sederhana', 'resume'];
|
||||
|
||||
['memo'];
|
||||
['rap'];
|
||||
|
||||
|
||||
// $laporan = $lpj->type == ;
|
||||
|
||||
// $laporanPenilai = $lpj
|
||||
$viewLaporan = null;
|
||||
|
||||
// $viewLaporan = 'penilai.components.print-out-sederhana';
|
||||
// $viewLaporan = 'penilai.components.print-out-standard';
|
||||
// $viewLaporan = 'penilai.components.print-resume';
|
||||
// $viewLaporan = 'penilai.components.print-memo';
|
||||
// $viewLaporan = 'penilai.components.print-rap';
|
||||
$viewLaporan = $this->getViewLaporan($tipeLaporan);
|
||||
try {
|
||||
|
||||
if ($statusLpj) {
|
||||
@@ -741,7 +729,6 @@ class PenilaiController extends Controller
|
||||
|
||||
$pdf->setPaper('A4', 'portrait');
|
||||
return $pdf->stream();
|
||||
|
||||
} else {
|
||||
$pdf = view('lpj::' . $viewLaporan, compact(
|
||||
// $pdf = PDF::loadView('lpj::' . $viewLaporan, compact(
|
||||
@@ -771,6 +758,19 @@ class PenilaiController extends Controller
|
||||
|
||||
}
|
||||
|
||||
private function getViewLaporan($tipe)
|
||||
{
|
||||
$viewMap = [
|
||||
'sederhana' => 'penilai.components.print-out-sederhana',
|
||||
'standard' => 'penilai.components.print-out-standard',
|
||||
'resume' => 'penilai.components.print-resume',
|
||||
'memo' => 'penilai.components.print-memo',
|
||||
'rap' => 'penilai.components.print-rap'
|
||||
];
|
||||
|
||||
return $viewMap[$tipe] ?? 'penilai.components.print-resume';
|
||||
}
|
||||
|
||||
public function getWilayahName($code, $type)
|
||||
{
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user