diff --git a/app/Http/Controllers/PenilaiController.php b/app/Http/Controllers/PenilaiController.php index 6fec085..a367667 100644 --- a/app/Http/Controllers/PenilaiController.php +++ b/app/Http/Controllers/PenilaiController.php @@ -90,7 +90,7 @@ class PenilaiController extends Controller 'inspeksi_id' => $inspeksiId, ], [ - 'type_penilai' => 'standard', + 'type_penilai' => 'sederhana', ] ); @@ -1047,6 +1047,25 @@ class PenilaiController extends Controller // Tentukan tipe berdasarkan kondisi $type = $statusLpj->type_penilai ?? null; + if ($type === 'memo') { + return $this->checkDataMemo($type, $statusLpj); + } + + if ($type === 'resume') { + return $this->checkDataResume($type, $statusLpj); + } + + + if ($type === 'standard' || $type === 'sederhana') { + return $this->checkDataLpj($type, $statusLpj); + } + + if ($type === 'rap') { + return $this->checkDataRap($type, $statusLpj); + } + + + // Kembalikan respons dengan tipe yang sesuai return response()->json(['status' => $type]); } @@ -1089,5 +1108,242 @@ class PenilaiController extends Controller } +public function checkDataMemo($type, $statusLpj) +{ + // Ambil data JSON dari statusLpj + $data = json_decode($statusLpj->memo, true) ?? []; + + $validationRules = [ + 'memo' => [ + 'kepada', + 'dari', + 'nomor_memo', + 'tanggal', + 'perihal', + 'jenis_asset_tidak_sesuai', + 'lokasi.lokasi', + 'lokasi.address', + 'lokasi.province_code', + 'lokasi.city_code', + 'lokasi.district_code', + 'lokasi.village_code', + 'lokasi.penilai', + 'terlampir', + 'hasil_survey', + 'kesimpulan_saran', + ], + ]; + + // Validasi data JSON + if (isset($validationRules[$type])) { + $missingFields = []; + + foreach ($validationRules[$type] as $field) { + $keys = explode('.', $field); + $value = $data; + + foreach ($keys as $key) { + if (!isset($value[$key])) { + $missingFields[] = $field; + break; + } + $value = $value[$key]; + } + } + + // Jika ada field yang kosong, kembalikan error + if (!empty($missingFields)) { + return response()->json([ + 'status' => null, + 'message' => "Silahkan lengkapi data memo terlebih dahulu.", + 'missing_fields' => $missingFields, + ], 400); + } + } + + // Jika data valid + return response()->json([ + 'status' => $type, + 'message' => "Data memo valid.", + ]); +} + + + + +public function checkDataResume($type, $statusLpj) +{ + // Ambil data JSON dari statusLpj + $data = json_decode($statusLpj->resume, true) ?? []; + + $validationRules = [ + 'resume' => [ + 'fakta.fakta_positif', + 'fakta.fakta_negatif', + 'fisik', + 'sesuai_imb', + 'keterangan' + ], + ]; + + // Validasi data JSON + if (isset($validationRules[$type])) { + $missingFields = []; + + foreach ($validationRules[$type] as $field) { + $keys = explode('.', $field); + $value = $data; + + foreach ($keys as $key) { + if (!isset($value[$key])) { + $missingFields[] = $field; + break; + } + $value = $value[$key]; + } + + // Validasi khusus untuk array fisik dan sesuai_imb + if ($field === 'fisik' || $field === 'sesuai_imb') { + if (empty($value) || !is_array($value)) { + $missingFields[] = $field; + continue; + } + + // Validasi struktur data di dalam array + foreach ($value as $item) { + $requiredKeys = ['sertifikat', 'luas_tanah', 'luas_bangunan', 'nilai']; + foreach ($requiredKeys as $requiredKey) { + if (!isset($item[$requiredKey])) { + $missingFields[] = $field . '.' . $requiredKey; + } + } + } + } + } + + // Jika ada field yang kosong, kembalikan error + if (!empty($missingFields)) { + return response()->json([ + 'status' => null, + 'message' => "Silahkan lengkapi data resume terlebih dahulu.", + 'missing_fields' => $missingFields, + ], 400); + } + } + + // Jika data valid + return response()->json([ + 'status' => $type, + 'message' => "Data resume valid.", + ]); +} + +public function checkDataLpj($type, $statusLpj) +{ + // Ambil data JSON dari statusLpj + $data = json_decode($statusLpj->lpj, true) ?? []; + + $validationRules = [ + 'lpj' => [ + 'luas_tanah', + 'nilai_tanah_1', + 'nilai_tanah_2', + 'luas_bangunan', + 'nilai_bangunan_1', + 'nilai_bangunan_2', + 'total_nilai_pasar_wajar', + 'likuidasi', + 'likuidasi_nilai_1', + 'likuidasi_nilai_2', + 'asuransi_luas_bangunan', + 'asuransi_nilai_1', + 'asuransi_nilai_2', + 'npw_tambahan' + ], + ]; + + // Validasi data JSON + if (isset($validationRules[$type])) { + $missingFields = []; + + foreach ($validationRules[$type] as $field) { + // Penanganan khusus untuk field yang boleh null + if (in_array($field, ['sarana_pelengkap_penilai', 'nilai_sarana_pelengkap_1', 'nilai_sarana_pelengkap_2'])) { + continue; + } + + if (!isset($data[$field])) { + $missingFields[] = $field; + continue; + } + + // Validasi khusus untuk npw_tambahan + if ($field === 'npw_tambahan' && is_array($data[$field])) { + foreach ($data[$field] as $index => $item) { + $requiredKeys = ['name', 'luas', 'nilai_1', 'nilai_2']; + foreach ($requiredKeys as $key) { + if (!isset($item[$key])) { + $missingFields[] = "npw_tambahan[$index].$key"; + } + } + } + } + } + + + // Jika ada field yang kosong, kembalikan error + if (!empty($missingFields)) { + return response()->json([ + 'status' => null, + 'message' => "Silahkan lengkapi data LPJ terlebih dahulu.", + 'missing_fields' => $missingFields, + ], 400); + } + } + + // Jika data valid + return response()->json([ + 'status' => $type, + 'message' => "Data LPJ valid.", + ]); +} + +public function checkDataRap($type, $statusLpj) +{ + // Ambil data JSON dari statusLpj + $data = json_decode($statusLpj->rap, true) ?? []; + + $requiredFields = [ + 'dari', + 'kepada', + 'perihal', + 'tanggal', + 'nomor_rap' + ]; + + // Cek apakah ada field yang kosong + $missingFields = []; + foreach ($requiredFields as $field) { + if (!isset($data[$field]) || empty($data[$field])) { + $missingFields[] = $field; + } + } + + // Jika ada field yang kosong, kembalikan error + if (!empty($missingFields)) { + return response()->json([ + 'status' => null, + 'message' => "Silahkan lengkapi data RAP terlebih dahulu.", + 'missing_fields' => $missingFields + ], 400); + } + + // Jika semua data terisi + return response()->json([ + 'status' => $type, + 'message' => "Data RAP valid." + ]); +} + } diff --git a/resources/views/penilai/components/lpj-sederhana-standard.blade.php b/resources/views/penilai/components/lpj-sederhana-standard.blade.php index cbd230f..3149280 100644 --- a/resources/views/penilai/components/lpj-sederhana-standard.blade.php +++ b/resources/views/penilai/components/lpj-sederhana-standard.blade.php @@ -25,6 +25,7 @@
+ @include('lpj::component.form-penilai')
@@ -48,7 +49,7 @@ href="{{ route('penilai.lampiran') }}?permohonanId={{ request('permohonanId') }}&documentId={{ request('documentId') }}&inspeksiId={{ request('inspeksiId') }}&jaminanId={{ request('jaminanId') }}&statusLpj=1"> LAMPIRAN FOTO DAN DOKUMEN - + Print diff --git a/resources/views/penilai/components/print-out-rap.blade.php b/resources/views/penilai/components/print-out-rap.blade.php index 649efb5..9ec7a7d 100644 --- a/resources/views/penilai/components/print-out-rap.blade.php +++ b/resources/views/penilai/components/print-out-rap.blade.php @@ -146,7 +146,8 @@ Tanggal : - {{ formatTanggalIndonesia($permohonan->penilaian->tanggal_kunjungan) }} + + {{ formatTanggalIndonesia($permohonan->penilaian->tanggal_kunjungan) }} Perihal @@ -159,12 +160,30 @@

Copy Dokumen yang Dilampirkan

+ $senior_officer = null; @foreach ($permohonan->debiture->documents as $dokumen) @php $penilai = $permohonan->penilaian->userPenilai->where('role', 'penilai')->first(); $teams = $permohonan->region->teams; + $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 @if (isset($dokumen)) @@ -219,7 +238,8 @@ - - - - - +
{{ $forminspeksi['kontraktor'] ?? '' }}
@isset($forminspeksi['kerjasama_dengan_bank']) + + @isset($forminspeksi['kerjasama_dengan_bank']) @foreach ($forminspeksi['kerjasama_dengan_bank'] as $item)
{{ $item }}
@endforeach @@ -234,7 +254,8 @@
@isset($forminspeksi['harga_unit']) + + @isset($forminspeksi['harga_unit']) @foreach ($forminspeksi['harga_unit'] as $item)
{{ $item }}
@endforeach @@ -249,7 +270,8 @@
@isset($forminspeksi['fasus_fasum']) + + @isset($forminspeksi['fasus_fasum']) @foreach ($forminspeksi['fasus_fasum'] as $item)
{{ $item }}
@endforeach @@ -257,7 +279,8 @@
@isset($forminspeksi['target_market']) + + @isset($forminspeksi['target_market']) @foreach ($forminspeksi['target_market'] as $item)
{{ $item }}
@endforeach @@ -302,25 +325,53 @@

Demikian kami sampaikan, atas perhatiannya kami ucapkan terima kasih.

- - - - - - @php use Modules\Usermanagement\Models\User; + $penilaiUser = User::where('id', $penilai->userPenilaiTeam->id)->first(); + $imagePathPenilai = storage_path( + 'app/public/signatures/' . $penilaiUser->id . '/' . $penilaiUser->sign, + ); + $soUser = User::where('id', $senior_officer->id)->first(); + $imagePathSo = storage_path('app/public/signatures/' . $soUser->id . '/' . $soUser->sign); + + $imagePathDD = storage_path( + 'app/public/signatures/' . + User::role('DD Appraisal')->first()->id . + '/' . + User::role('DD Appraisal')->first()->sign, + ); @endphp + + + + + + + +
+ @if (file_exists($imagePathDD)) + {{ $imagePathDD }} + @endif + + @if (file_exists($imagePathSo)) + {{ $imagePathSo }} + @endif + + @if (file_exists($imagePathPenilai)) + {{ $imagePathPenilai }} + @endif +
{{ User::role('DD Appraisal')->first()->name ?? '' }} -
Deputy Director +
DEPUTY DIRECTOR
-
SO Region + {{ $senior_officer->name ?? '' }} +
SENIOR OFFICER
{{ $penilai->userPenilaiTeam->name ?? '' }} -
Appraisal +
PENILAI
diff --git a/resources/views/penilai/components/print-out-sederhana.blade.php b/resources/views/penilai/components/print-out-sederhana.blade.php index 7377caf..8321009 100644 --- a/resources/views/penilai/components/print-out-sederhana.blade.php +++ b/resources/views/penilai/components/print-out-sederhana.blade.php @@ -195,6 +195,7 @@ if ($permohonan->debiture && $permohonan->debiture->documents) { foreach ($permohonan->debiture->documents as $dokumen) { $penilai = $permohonan->penilaian->userPenilai->where('role', 'penilai')->first(); + $surveyor = $permohonan->penilaian->userPenilai->where('role', 'surveyor')->first(); $teams = $permohonan->region->teams; if ($teams) { @@ -241,7 +242,8 @@
Waktu Penyelesaian :{{hitungHariKerja($permohonan->penilaian->tanggal_kunjungan, $tanggalLaporan)}} + {{ hitungHariKerja($permohonan->penilaian->tanggal_kunjungan, $tanggalLaporan) }}
@@ -293,7 +295,7 @@ @foreach ($dokumen->detail as $details) - {{ $details->jenisLegalitasJaminan->name ?? '' }} + {{ $details->jenisLegalitasJaminan->name ?? '' }} : @@ -1030,26 +1032,83 @@ + + + +
+ +
+
    + +
  1. PENILAIAN INI DIBUAT BERDASARKAN ATURAN YANG + BERLAKU DI SUBDIT APPRAISAL
  2. +
  3. LAPORAN INI DIBUAT BERDASARKAN DATA FOTOCOPY + DOKUMEN YANG DITERIMA PENILAI DENGAN ASUMSI BAHWA DATA TERSEBUT SESUAI DENGAN + DOKUMEN ASLINYA
  4. +
  5. PENILAI TIDAK MELAKUKAN PEMBUKTIAN LEBIH RINCI ATAU + PENGAKUAN TERTULIS DARI PIHAK YANG DITEMUI SAAT PENILAIAN, ATAS INFORMASI YANG + DIBERIKAN SECARA LISAN SEHUBUNGAN DENGAN IDENTITAS DIRI DAN HUBUNGAN DI ANTARA + PIHAK TERKAIT SAAT MELAKUKAN INSPEKSI OBJEK YANG DINILAI
  6. +
  7. LAPORAN INI DIGUNAKAN HANYA UNTUK KEPENTINGAN + INTERNAL DAN DILARANG MENYEBARKAN KEPADA PIHAK KETIGA
  8. +
+
+
+ +
+ + + Demikian laporan penilai jaminan ini di buat secara objektif, tanpa adanya pengaruh baik intern maupun extern - +
+ @php + use Modules\Usermanagement\Models\User; + @endphp - - - - - - - - - - + + + + + + + + +
Penilai DibuatDi periksa dan menyutujui
{{ $penilai->userPenilaiTeam->name ?? '' }}
- Penilai Jaminan +
+ {{ $senior_officer->name ?? '' }}
- Senior Officer +
+ @php + $imagePath = storage_path('app/public/signature/' . User::role('EO Appraisal')->first()->id . '/'. User::role('EO Appraisal')->first()->sign); + + @endphp + @if (file_exists($imagePath)) + {{ $imagePath }} + @endif +
+ {{ $penilai->userPenilaiTeam->name ?? '' }}
+ + PENILAI + +
{{ $senior_officer->name ?? '' }}
+ + SENIOR OFFICER + + +
+ {{ User::role('EO Appraisal')->first()->name ?? '' }}
+ + EXECUTIVE OFFICER + +
+ {{ User::role('DD Appraisal')->first()->name ?? '' }}
+ + DEPUTY DIRECTOR +
@@ -1057,7 +1116,7 @@
- +
@@ -1071,11 +1130,12 @@ - +
Nama Debitur :
Tanggal Laporan :{{ formatTanggalIndonesia($tanggalLaporan) ?? '' }}{{ formatTanggalIndonesia($tanggalLaporan) ?? '' }} +
-
+
PETA
@@ -1099,8 +1159,7 @@ @if ($imagePath && file_exists(storage_path('app/public/' . $imagePath)))
- {{ $type }}

{{ Str::title(str_replace('_', ' ', $type)) }} diff --git a/resources/views/penilai/components/print-out-standard.blade.php b/resources/views/penilai/components/print-out-standard.blade.php index 321eff4..1066e31 100644 --- a/resources/views/penilai/components/print-out-standard.blade.php +++ b/resources/views/penilai/components/print-out-standard.blade.php @@ -1524,43 +1524,98 @@ + +
+ +
+
    +
  1. PENILAIAN INI DIBUAT BERDASARKAN ATURAN YANG + BERLAKU DI SUBDIT APPRAISAL
  2. +
  3. LAPORAN INI DIBUAT BERDASARKAN DATA FOTOCOPY + DOKUMEN YANG DITERIMA PENILAI DENGAN ASUMSI BAHWA DATA TERSEBUT SESUAI DENGAN + DOKUMEN ASLINYA
  4. +
  5. PENILAI TIDAK MELAKUKAN PEMBUKTIAN LEBIH RINCI ATAU + PENGAKUAN TERTULIS DARI PIHAK YANG DITEMUI SAAT PENILAIAN, ATAS INFORMASI YANG + DIBERIKAN SECARA LISAN SEHUBUNGAN DENGAN IDENTITAS DIRI DAN HUBUNGAN DI ANTARA + PIHAK TERKAIT SAAT MELAKUKAN INSPEKSI OBJEK YANG DINILAI
  6. +
  7. LAPORAN INI DIGUNAKAN HANYA UNTUK KEPENTINGAN + INTERNAL DAN DILARANG MENYEBARKAN KEPADA PIHAK KETIGA
  8. +
+
+
-
+
+ + + + @php + use Modules\Usermanagement\Models\User; + + $penilaiUser = User::where('id', $penilai->userPenilaiTeam->id)->first(); + $imagePathPenilai = storage_path('app/public/signatures/' . $penilaiUser->id . '/' . $penilaiUser->sign); + + $soUser = User::where('id', $senior_officer->id)->first(); + $imagePathSo = storage_path('app/public/signatures/' . $soUser->id . '/' . $soUser->sign); + + + $imagePathEO = storage_path('app/public/signatures/' . User::role('EO Appraisal')->first()->id . '/'. User::role('EO Appraisal')->first()->sign); + + $imagePathDD = storage_path('app/public/signatures/' . User::role('DD Appraisal')->first()->id . '/'. User::role('DD Appraisal')->first()->sign); + @endphp - - - + + + + - - - - - - - - +
Penilai DibuatDi periksaMenyutujui + @if (file_exists($imagePathPenilai)) + {{ $imagePathPenilai }} + @endif + + @if (file_exists($imagePathSo)) + {{ $imagePathSo }} + @endif + + @if (file_exists($imagePathEO)) + {{ $imagePathEO }} + @endif + + @if (file_exists($imagePathDD)) + {{ $imagePathDD }} + @endif +
{{ $penilai->userPenilaiTeam->name ?? '' }}
+
{{ $penilai->userPenilaiTeam->name ?? '' }}
- PENILAI JAMINAN + PENILAI
{{ $senior_officer->name ?? '' }}
+
{{ $senior_officer->name ?? '' }}
SENIOR OFFICER
- {{ $permohonan->user->name ?? '' }}
+ +
+ {{ User::role('EO Appraisal')->first()->name ?? '' }}
EXECUTIVE OFFICER
+ {{ User::role('DD Appraisal')->first()->name ?? '' }}
+ + DEPUTY DIRECTOR + +

- +
diff --git a/resources/views/penilai/components/print-resume.blade.php b/resources/views/penilai/components/print-resume.blade.php index 4b43a1e..522b33e 100644 --- a/resources/views/penilai/components/print-resume.blade.php +++ b/resources/views/penilai/components/print-resume.blade.php @@ -376,7 +376,6 @@
Nama Debitur :
-
diff --git a/resources/views/penilai/components/rap-penilai.blade.php b/resources/views/penilai/components/rap-penilai.blade.php index 79fd193..cf35412 100644 --- a/resources/views/penilai/components/rap-penilai.blade.php +++ b/resources/views/penilai/components/rap-penilai.blade.php @@ -8,6 +8,7 @@