diff --git a/app/Helpers/Lpj.php b/app/Helpers/Lpj.php index 5262587..347d9c7 100644 --- a/app/Helpers/Lpj.php +++ b/app/Helpers/Lpj.php @@ -430,7 +430,8 @@ function getWilayahName($code, $type) } -function formatLabel($key) { +function formatLabel($key) +{ static $labelCache = []; if (isset($labelCache[$key])) { @@ -468,3 +469,35 @@ function calculateSLA($permohonan, $type) return $slaMap[$type] ?? null; } + + +/** + * Menghitung total nilai berdasarkan key dan jenis legalitas. + * + * @param array $detailsArray + * @param string $key + * @param int $jenisLegalitas + * @return int + */ +function calculateTotalLuas($detailsArray, $key, $jenisLegalitas) +{ + $total = 0; + + if ($detailsArray) { + foreach ($detailsArray as $item) { + if (isset($item->jenis_legalitas_jaminan_id) && $item->jenis_legalitas_jaminan_id === $jenisLegalitas) { + $details = json_decode($item->details, true); + + if (is_array($details)) { + foreach ($details as $detail) { + if (isset($detail[$key])) { + $total += (int) $detail[$key]; + } + } + } + } + } + } + + return $total; +} diff --git a/app/Http/Controllers/PenilaiController.php b/app/Http/Controllers/PenilaiController.php index 5727369..eee3260 100644 --- a/app/Http/Controllers/PenilaiController.php +++ b/app/Http/Controllers/PenilaiController.php @@ -1290,6 +1290,8 @@ class PenilaiController extends Controller // return $pdf; $cleanNomorLaporan = str_replace(['/', '\\'], '-', $nomorLaporan); $pdf->setPaper('A4', 'portrait'); + $pdf->set_option('isHtml5ParserEnabled', true); + $pdf->set_option('isPhpEnabled', true); return response($pdf->output(), 200) ->header('Content-Type', 'application/pdf') ->header('Content-Disposition', 'inline; filename="Laporan_' . $tipeLaporan . '_' . $permohonan->debiture->name . '_' . $cleanNomorLaporan . '.pdf"'); @@ -1317,6 +1319,8 @@ class PenilaiController extends Controller // return $pdf; $cleanNomorLaporan = str_replace(['/', '\\'], '-', $nomorLaporan); $pdf->setPaper('A4', 'portrait'); + $pdf->set_option('isHtml5ParserEnabled', true); + $pdf->set_option('isPhpEnabled', true); return $pdf->download('Laporan_' . $tipeLaporan . '_' . $permohonan->debiture->name . '_' . $cleanNomorLaporan . '_data.pdf'); } } catch (\Exception $e) { diff --git a/app/Http/Controllers/SurveyorController.php b/app/Http/Controllers/SurveyorController.php index 67e7e5b..be1fc09 100644 --- a/app/Http/Controllers/SurveyorController.php +++ b/app/Http/Controllers/SurveyorController.php @@ -2436,16 +2436,19 @@ class SurveyorController extends Controller $alamatKey = ($data['alamat_sesuai'] ?? null) === 'sesuai' ? 'sesuai' : 'tidak sesuai'; $alamat = []; + $jenis_asset_key = ($data['jenis_asset'] ?? null) === 'sesuai' ? 'sesuai' : 'tidak sesuai'; + $jenis_asset = []; + $jenis_hasil = $jenis_asset_key === 'sesuai' + ? ($data['jenis_asset_name'] ?? null) + : ($data['jenis_asset_tidak_sesuai'] ?? null); + $jenis_asset[$jenis_asset_key] = $jenis_hasil; + // Masukkan key baru yang sesuai $alamat[$alamatKey] = $alamatData; return [ 'asset' => [ 'debitur_perwakilan' => $data['debitur_perwakilan'] ?? [], - 'jenis_asset' => [ - $data['jenis_asset'] ?? null => ($data['jenis_asset'] ?? null) === 'sesuai' - ? ($data['jenis_asset_name'] ?? null) - : ($data['jenis_asset_tidak_sesuai'] ?? null) - ], + 'jenis_asset' => $jenis_asset, 'alamat' => $alamat, 'hub_cadeb' => [ $data['hub_cadeb'] ?? null => ($data['hub_cadeb'] ?? null) === 'sesuai' @@ -2470,7 +2473,6 @@ class SurveyorController extends Controller private function getTanahData(array $data): array { //luas tanah key - // Luas tanah key $luas_tanah_key = ($data['luas_tanah'] ?? null) === 'sesuai' ? 'sesuai' : 'tidak sesuai'; $luas_tanah = []; $hasil_tanah = $luas_tanah_key === 'sesuai' @@ -3644,7 +3646,8 @@ class SurveyorController extends Controller // Tentukan nama file PDF $namaDebiture = $permohonan->debiture->name . '-' . $permohonan->nomor_registrasi; $fileName = 'inspeksi-' . $namaDebiture . '-data.pdf'; - + $pdf->set_option('isHtml5ParserEnabled', true); + $pdf->set_option('isPhpEnabled', true); return $pdf->stream($fileName); } diff --git a/resources/views/component/print-out-dokument.blade.php b/resources/views/component/print-out-dokument.blade.php new file mode 100644 index 0000000..6faedd7 --- /dev/null +++ b/resources/views/component/print-out-dokument.blade.php @@ -0,0 +1,32 @@ + + @if (@isset($dokumen)) + @foreach ($dokumen->detail as $detail) + @if (isset($detail->dokumen_jaminan)) + + {{ $detail->name ?? '' }} + + @endif + + @if (isset($detail->details)) + @if (json_decode($detail->details)) + @foreach (json_decode($detail->details) as $value) + @foreach ($value as $key => $item) + + + {{ formatLabel($key) }} + + : + + {{ $item }} + @if ($key == 'luas_bangunan' || $key == 'luas_tanah') + m2 + @endif + + + @endforeach + @endforeach + @endif + @endif + @endforeach + @endif + diff --git a/resources/views/penilai/components/analisa/apartement-kantor.blade.php b/resources/views/penilai/components/analisa/apartement-kantor.blade.php index 77b57c5..78227a7 100644 --- a/resources/views/penilai/components/analisa/apartement-kantor.blade.php +++ b/resources/views/penilai/components/analisa/apartement-kantor.blade.php @@ -1,3 +1,4 @@ +
@@ -80,3 +81,4 @@
+
diff --git a/resources/views/penilai/components/analisa/bangunan.blade.php b/resources/views/penilai/components/analisa/bangunan.blade.php index b78af1c..9725588 100644 --- a/resources/views/penilai/components/analisa/bangunan.blade.php +++ b/resources/views/penilai/components/analisa/bangunan.blade.php @@ -1,3 +1,4 @@ +
@@ -143,3 +144,4 @@
+
diff --git a/resources/views/penilai/components/analisa/fakta.blade.php b/resources/views/penilai/components/analisa/fakta.blade.php index c5fc218..c9088cb 100644 --- a/resources/views/penilai/components/analisa/fakta.blade.php +++ b/resources/views/penilai/components/analisa/fakta.blade.php @@ -1,3 +1,4 @@ +
@@ -102,3 +103,4 @@
+
diff --git a/resources/views/penilai/components/analisa/informasi.blade.php b/resources/views/penilai/components/analisa/informasi.blade.php index 6357a32..bc711cf 100644 --- a/resources/views/penilai/components/analisa/informasi.blade.php +++ b/resources/views/penilai/components/analisa/informasi.blade.php @@ -1,3 +1,4 @@ +
@endif
Informasi Dinas Tata Ruang @@ -58,3 +59,4 @@
+
diff --git a/resources/views/penilai/components/analisa/lingkungan.blade.php b/resources/views/penilai/components/analisa/lingkungan.blade.php index 51c6200..cd37bdb 100644 --- a/resources/views/penilai/components/analisa/lingkungan.blade.php +++ b/resources/views/penilai/components/analisa/lingkungan.blade.php @@ -1,3 +1,4 @@ +
@endif
@@ -127,3 +128,4 @@
+
diff --git a/resources/views/penilai/components/analisa/tanah.blade.php b/resources/views/penilai/components/analisa/tanah.blade.php index 890bf71..371fc4b 100644 --- a/resources/views/penilai/components/analisa/tanah.blade.php +++ b/resources/views/penilai/components/analisa/tanah.blade.php @@ -1,3 +1,4 @@ +
@@ -149,3 +150,4 @@
+
diff --git a/resources/views/penilai/components/footer.blade.php b/resources/views/penilai/components/footer.blade.php index 84e9a94..1ded708 100644 --- a/resources/views/penilai/components/footer.blade.php +++ b/resources/views/penilai/components/footer.blade.php @@ -1,6 +1,110 @@ + +
+
+ + + + + + + + + + + + + + + + +
Nama Debitur:{{ $permohonan->debiture->name ?? '' }}
Nomor Laporan:{{ $nomorLaporan }}
Tanggal Laporan:{{ formatTanggalIndonesia($tanggalLaporan) ?? '' }} +
+ + + + +
+ PETA DAN BLAD TATA RUANG +
+
+ @php + $fotoTypes = [ + 'upload_gs', + 'foto_sentuh_tanahku', + 'foto_gistaru', + 'foto_bhumi', + 'foto_argis_region', + 'foto_tempat', + ]; + + $customLabels = [ + 'upload_gs' => 'Gambar Situasi', + 'foto_sentuh_tanahku' => 'Sentuh Tanahku', + 'foto_gistaru' => 'Gistaru', + 'foto_bhumi' => 'Bhumi', + 'foto_argis_region' => 'Blad Tata Ruang ', + 'foto_tempat' => 'Tempat', + ]; + // Memindahkan foto_tempat ke depan jika ada + if (($key = array_search('upload_gs', $fotoTypes)) !== false) { + unset($fotoTypes[$key]); + array_unshift($fotoTypes, 'upload_gs'); + } + // Filter fotoTypes untuk memastikan hanya yang memiliki imagePath valid + $validPhotoTypes = array_filter($fotoTypes, function ($type) use ($forminspeksi) { + return isset($forminspeksi[$type]) && + file_exists(storage_path('app/public/' . $forminspeksi[$type])); + }); + @endphp + + + @foreach ($validPhotoTypes as $type) + @php + $imagePath = $forminspeksi[$type] ?? null; + @endphp + @if ($imagePath && file_exists(storage_path('app/public/' . $imagePath))) + + + + @endif + @endforeach +
+

+ {{ $customLabels[$type] ?? '' }} +

+ {{ $imagePath }} +
+
+ + +
+ + + + +
+ FOTO JAMINAN +
+ @include('lpj::penilai.components.foto-jaminan') +
+ + + diff --git a/resources/views/surveyor/components/print-out/print.blade.php b/resources/views/surveyor/components/print-out/print.blade.php deleted file mode 100644 index a246b27..0000000 --- a/resources/views/surveyor/components/print-out/print.blade.php +++ /dev/null @@ -1,704 +0,0 @@ - - - - - - - - - Laporan Penilai Jaminan - - - - -@php - $data = ''; - $dokument = null; - foreach ($permohonan->documents as $dokumen) { - $data .= $dokumen->jenisJaminan->name . ', '; - $dokument = $dokumen; - } - $data = rtrim($data, ', '); - - $senior_officer = null; - if ($permohonan->debiture && $permohonan->documents) { - foreach ($permohonan->documents as $dokumen) { - $penilai = $permohonan->penilaian->userPenilai->where('role', 'penilai')->first(); - $teams = $permohonan->region->teams; - - if ($teams) { - foreach ($teams as $team) { - $team_users = $team->teamsUsers; - // print_r($team_users); - if ($team_users) { - foreach ($team_users as $team_user) { - $user = $team_user->user; - - if ($user && $user->hasRole('senior-officer')) { - $senior_officer = $user; - break 3; - } - } - } - } - } - } - } -@endphp - - - - - - - - -
-

- Tujuan Penilaian -

-
- - - - - {{-- - - - - - - - --}} - - {{-- - - - - - - - - - - - - - - - - - - --}} - - - {{-- - - - --}} - - - - - - - - {{--
- - - - - - - - - - - - - - - - -
Cabang/Pemohon: - {{ $permohonan->debiture->branch->name ?? '' }} -
Tujuan Penilai: - {{ $permohonan->jenisFasilitasKredit->name ?? '' }}
Ao:{{ $permohonan->user->name ?? '' }}
-
- - - --}} - - -
- @if (isset($basicData['tujuanPenilaian'])) - - - @foreach ($basicData['tujuanPenilaian'] as $index => $item) - @if ($index % 3 == 0 && $index > 0) - - - @endif - - @endforeach - -
- -
- @endif - - - - - - - - - - - - - -
Permintaan (A/O. Tlp/Hp){{ $permohonan->user->name }}Tanggal{{ formatTanggalIndonesia($permohonan->created_at) }}
Nama Debitur/ Wakil Debitur{{ $permohonan->debiture->name ?? '' }} - @if (isset($forminspeksi['asset']['debitur_perwakilan']) && !empty($forminspeksi['asset']['debitur_perwakilan'])) - @foreach ($forminspeksi['asset']['debitur_perwakilan'] as $key => $item) - {{ $item }} - @endforeach - @endif - Kunjungan Tanggal{{ formatTanggalIndonesia($permohonan->penilaian->tanggal_kunjungan) }}
-
- - - {{--
- B - - IDENTITAS DEBITUR -
- - - - - - - -
Nama Debitur{{ $permohonan->debiture->name ?? '' }}
-
- C - - JENIS DAN LOKASI JAMINAN + KORDINAT -
- - @if (isset($basicData['jenisJaminan'])) - - - - @foreach ($basicData['jenisJaminan'] as $index => $item) - @if ($index % 3 == 0 && $index > 0) - - - @endif - - @endforeach - -
- -
- @endif - - - - - - - - - - - - - - - - - - - - - - -
Terletak di {{ $alamat['address'] ?? '' }}
Kelurahan{{ $alamat['village_code'] ?? '' }}
Kecamatan{{ $alamat['district_code'] ?? '' }}
Kotamadya {{ $alamat['city_code'] ?? '' }}
Propinsi{{ $alamat['province_code'] ?? '' }}
- - - - - -
Titik Kordinat{{ isset($forminspeksi['asset']['kordinat_lat']) ? $forminspeksi['asset']['kordinat_lat'] : '' }} , - {{ isset($forminspeksi['asset']['kordinat_lng']) ? $forminspeksi['asset']['kordinat_lng'] : '' }}
-
- D - - STATUS KEPEMILIKAN, HUBUNGAN DAN PENGHUNI -
- - - - @if (@isset($dokumen)) - @foreach ($dokumen->detail as $detail) - @if (isset($detail->dokumen_jaminan)) - - - - - - - @endif - - @if (isset($detail->details)) - @if (json_decode($detail->details)) - @foreach (json_decode($detail->details) as $key => $value) - @if (!is_null($value) && $value !== '') - - - - - @endif - @endforeach - @endif - @endif - @endforeach - @endif - - - - - - - - - @php - // Ambil nilai hub_cadeb langsung - $hubCadeb = isset($forminspeksi['asset']['hub_cadeb']) - ? $forminspeksi['asset']['hub_cadeb'] - : null; - - // Jika nilai adalah array dengan key 'sesuai', ambil nilainya - if (is_array($hubCadeb) && isset($hubCadeb['sesuai'])) { - $hubCadeb = $hubCadeb['sesuai']; - } - @endphp - - - - - - @php - $statusKey = isset($forminspeksi['asset']['hub_cadeb_penghuni']['sesuai']) - ? 'sesuai' - : 'tidak sesuai'; - $selectedData = $forminspeksi['asset']['hub_cadeb_penghuni'][$statusKey] ?? null; - @endphp - - - - -
{{ $detail->name ?? '' }}
- @if (isset($detail->dokumen_jaminan)) - @php - $dokumen_jaminan = is_array(json_decode($detail->dokumen_jaminan)) - ? json_decode($detail->dokumen_jaminan) - : [$detail->dokumen_jaminan]; - $dokumen_nomor = is_array(json_decode($detail->dokumen_nomor)) - ? json_decode($detail->dokumen_nomor) - : ($detail->dokumen_nomor - ? [$detail->dokumen_nomor] - : []); - @endphp - - @foreach ($dokumen_jaminan as $index => $dokumen) -
- @if (!empty($dokumen_nomor[$index])) - {{ $dokumen_nomor[$index] }} - @endif -
- @endforeach - @endif -
- {{ ucwords(str_replace('_', ' ', $key)) ?? '' }} - - {{ $value }} - @if ($key == 'luas_bangunan' || $key == 'luas_tanah') - m2 - @endif -
Atas Nama{{ $dokument->pemilik->name ?? '' }}
Hubungan Pemilik Jaminan dengan Debitur - - @if (isset($basicData['hubCadeb'])) - - @php $count = 0; @endphp - - @foreach ($basicData['hubCadeb'] as $item) - - @php $count++; @endphp - - @if ($count % 3 === 0) - - - @endif - @endforeach - - @if ($count % 3 !== 0) - @for ($i = 0; $i < 3 - ($count % 3); $i++) - - @endfor - @endif - -
- -
- @endif -
Hubungan Penghuni Jaminan dengan Debitur - @if (isset($selectedData)) - - - - -
- {{ $selectedData ?? '' }} -
- @endif -
-
- G - - ASURANSI -
- - - - - - - - - - -
- Jakarta {{ formatTanggalIndonesia($permohonan->penilaian->waktu_penilaian) }} -
- TTD -
- - - @if (isset($forminspeksi['signature']['penilai']['image']) && !empty($forminspeksi['signature']['penilai']['image'])) - @php - $imagePath = $forminspeksi['signature']['penilai']['image']; - - $isBase64 = str_starts_with($imagePath, 'data:image'); - - if (!$isBase64) { - $relativePath = str_replace(url('storage') . '/', '', $imagePath); - $absolutePath = storage_path('app/public/' . $relativePath); - } else { - $absolutePath = $imagePath; - } - - @endphp - - @endif - - @if (isset($forminspeksi['signature']['cabang'])) - @php - $imagePath = $forminspeksi['signature']['cabang']['image']; - - $isBase64 = str_starts_with($imagePath, 'data:image'); - - if (!$isBase64) { - $relativePath = str_replace(url('storage') . '/', '', $imagePath); - $absolutePath = storage_path('app/public/' . $relativePath); - } else { - $absolutePath = $imagePath; - } - - @endphp - - @endif - - - @if (isset($forminspeksi['signature']['debitur'])) - - @endif - - - @if (isset($forminspeksi['signature']['kjjp'])) - - @endif - - - - - @if (isset($forminspeksi['signature']['penilai']['name'])) - - @endif - @if (isset($forminspeksi['signature']['cabang']['name'])) - - @endif - @if (isset($forminspeksi['signature']['debitur']['name'])) - - @endif - @if (isset($forminspeksi['signature']['kjjp']['name'])) - - @endif - -
- - - - - Debitur/Perwakilan - - KJPP -
- {{ ucwords(strtolower($forminspeksi['signature']['penilai']['name'])) }} -
- {{ ucwords(strtolower('PENILAI')) }} -
- {{ ucwords(strtolower($forminspeksi['signature']['cabang']['name'])) }} -
- {{ ucwords(strtolower('CABANG')) }} -
- {{ ucwords(strtolower($forminspeksi['signature']['debitur']['name'])) }} -
- {{ ucwords(strtolower('DEBITUR/PERWAKILAN')) }} -
- {{ ucwords(strtolower($forminspeksi['signature']['kjjp']['name'])) }} -
- {{ strtoupper('K.J.P.P') }} -
-
--}} - - - - - - diff --git a/resources/views/surveyor/components/tanah.blade.php b/resources/views/surveyor/components/tanah.blade.php index 3e856f6..3c8391b 100644 --- a/resources/views/surveyor/components/tanah.blade.php +++ b/resources/views/surveyor/components/tanah.blade.php @@ -10,28 +10,22 @@
+ @if (isset($permohonan->documents)) @foreach ($permohonan->documents as $item) @php - $luas_tanah = 0; + $total_luas_tanah = 0; $jenis_legalitas_jaminan_id = 0; - if ($item->detail) { - foreach ($item->detail as $luas) { - if (isset($luas->name) && $luas->jenis_legalitas_jaminan_id === 1) { - $jenis_legalitas_jaminan_id = $luas->jenis_legalitas_jaminan_id; - $details = json_decode($luas->details, true); - $luas_tanah = isset($details['luas_tanah']) ? $details['luas_tanah'] : 0; - break; - } - } + if (isset($item->detail)) { + $total_luas_tanah = calculateTotalLuas($item->detail, 'luas_tanah', 1); } @endphp - - -

{{ $luas_tanah }} m2

+ + +

{{ $total_luas_tanah }} m2

@endforeach @endif
@@ -283,14 +277,14 @@ {{ old('tusuk_sate') == 'Ya' || (isset($forminspeksi['tanah']['tusuk_sate']['Ya']) && $forminspeksi['tanah']['tusuk_sate']['Ya']) ? 'checked' : '' }}> Ya - @php - $statusKey = isset($forminspeksi['tanah']['tusuk_sate']['Ya']) ? 'Ya' : 'Tidak'; - $selectedData = $forminspeksi['tanah']['tusuk_sate'][$statusKey] ?? null; - @endphp - + @php + $statusKey = isset($forminspeksi['tanah']['tusuk_sate']['Ya']) ? 'Ya' : 'Tidak'; + $selectedData = $forminspeksi['tanah']['tusuk_sate'][$statusKey] ?? null; + @endphp +