From ea5f8dd3354ef803b0a5d0ea707dbc6718724a07 Mon Sep 17 00:00:00 2001 From: majid Date: Thu, 19 Dec 2024 10:14:34 +0700 Subject: [PATCH] perbaikan lampiran dokument, dan memo, lpj sederhana dan standart, resume --- app/Http/Controllers/PenilaiController.php | 222 ++++- .../lpj-sederhana-standard.blade.php | 294 ++++--- .../views/penilai/components/memo.blade.php | 817 ++++++++++-------- .../views/penilai/components/resume.blade.php | 534 +++++++----- resources/views/penilai/show.blade.php | 19 +- routes/web.php | 4 + 6 files changed, 1163 insertions(+), 727 deletions(-) diff --git a/app/Http/Controllers/PenilaiController.php b/app/Http/Controllers/PenilaiController.php index 7a69240..6290518 100644 --- a/app/Http/Controllers/PenilaiController.php +++ b/app/Http/Controllers/PenilaiController.php @@ -11,6 +11,7 @@ use Illuminate\Support\Facades\Auth; use Maatwebsite\Excel\Facades\Excel; use Modules\Lpj\Exports\KertasKerjaExport; use Modules\Lpj\Http\Controllers\SurveyorController; +use Modules\Location\Models\Province; class PenilaiController extends Controller { @@ -34,20 +35,21 @@ class PenilaiController extends Controller /** * Show the form for creating a new resource. */ - public function lampiran($id) + public function lampiran(Request $request, $id) { - $permohonan = Permohonan::with('debiture.documents')->find($id); + $permohonanId = $request->query('permohonanId'); $documentId = $request->query('documentId'); + $jaminanId = $request->query('jaminanId'); - $inpeksi = Inspeksi::where('permohonan_id', $id)->where('dokument_id', $jaminanId)->first(); + $permohonan = $this->surveyorController->getPermohonanJaminanId($id, $documentId, $jaminanId); + $inpeksi = Inspeksi::where('permohonan_id', $id)->where('dokument_id', $documentId)->first(); $formFoto = null; if ($inpeksi) { $formFoto = json_decode($inpeksi->foto_form, true); } - return view('lpj::penilai.lampiran', compact('permohonan', 'formFoto')); } @@ -64,7 +66,7 @@ class PenilaiController extends Controller // } - public function sederhana(Request $request,$id) + public function sederhana(Request $request, $id) { $basicData = $this->surveyorController->getCommonData(); @@ -78,11 +80,18 @@ class PenilaiController extends Controller $inspeksi = Inspeksi::where('permohonan_id', $id)->where('dokument_id', $documentId)->first(); - $forminspeksi = null; + $lpj = Penilai::where('permohonan_id', $id)->where('dokument_id', $documentId)->first(); + + $lpjData = null; if ($inspeksi) { $forminspeksi = json_decode($inspeksi->data_form, true); } - return view('lpj::penilai.components.lpj-sederhana-standard', compact('permohonan', 'basicData', 'forminspeksi', 'inspeksi')); + + if ($lpj) { + $lpjData = json_decode($lpj->lpj, true); + } + + return view('lpj::penilai.components.lpj-sederhana-standard', compact('permohonan', 'basicData', 'forminspeksi', 'inspeksi', 'lpjData')); } public function standard(Request $request, $id) @@ -95,22 +104,39 @@ class PenilaiController extends Controller $basicData = $this->surveyorController->getCommonData(); $inspeksi = Inspeksi::where('permohonan_id', $id)->where('dokument_id', $documentId)->first(); + $lpj = Penilai::where('permohonan_id', $id)->where('dokument_id', $documentId)->first(); + $forminspeksi = null; + $lpjData = null; if ($inspeksi) { $forminspeksi = json_decode($inspeksi->data_form, true); } + if ($lpj) { + $lpjData = json_decode($lpj->lpj, true); + } - - - return view('lpj::penilai.components.lpj-sederhana-standard', compact('permohonan', 'forminspeksi', 'basicData', 'inspeksi')); + return view('lpj::penilai.components.lpj-sederhana-standard', compact('permohonan', 'forminspeksi', 'basicData', 'inspeksi', 'lpjData')); } public function resume(Request $request) { $permohonanId = $request->query('permohonanId'); - $permohonan = Permohonan::with(['debiture.documents.jenisjaminan', 'region.teams.teamsUsers.user', 'penilaian'])->find($permohonanId); - return view('lpj::penilai.components.resume', compact('permohonan')); + $documentId = $request->query('documentId'); + $inspeksiId = $request->query('inspeksiId'); + $jaminanId = $request->query('jaminanId'); + + $permohonan = $this->surveyorController->getPermohonanJaminanId($permohonanId, $documentId, $jaminanId); + $inspeksi = Inspeksi::where('permohonan_id', $permohonanId)->where('dokument_id', $documentId)->first(); + + + $resume = Penilai::where('permohonan_id', $permohonanId)->where('dokument_id', $documentId)->first(); + $lpjData = null; + if ($resume) { + $resumeData = json_decode($resume->resume, true); + } + + return view('lpj::penilai.components.resume', compact('permohonan', 'resumeData')); } public function memo(Request $request) @@ -123,6 +149,9 @@ class PenilaiController extends Controller $permohonan = $this->surveyorController->getPermohonanJaminanId($permohonanId, $documentId, $jaminanId); $inspeksi = Inspeksi::where('permohonan_id', $permohonanId)->where('dokument_id', $documentId)->first(); + $provinces = Province::all(); + $basicData = $this->surveyorController->getCommonData(); + $formFoto = null; $formPeta = null; if ($inspeksi) { @@ -133,7 +162,7 @@ class PenilaiController extends Controller - return view('lpj::penilai.components.memo', compact('permohonan', 'formFoto', 'formPeta')); + return view('lpj::penilai.components.memo', compact('permohonan', 'formFoto', 'formPeta', 'provinces', 'basicData')); } @@ -280,39 +309,39 @@ class PenilaiController extends Controller public function import_kertas_kerja(Request $request) -{ + { - $validatedData = $request->validate([ - 'permohonan_id' => 'required|integer', - 'document_id' => 'required|integer', - 'inspeksi_id' => 'required|integer', - 'kertas_kerja' => 'required|file|mimes:pdf,doc,docx,xls,xlsx,xlsx', - ]); + $validatedData = $request->validate([ + 'permohonan_id' => 'required|integer', + 'document_id' => 'required|integer', + 'inspeksi_id' => 'required|integer', + 'kertas_kerja' => 'required|file|mimes:pdf,doc,docx,xls,xlsx,xlsx', + ]); - try { - // Simpan file kertas kerja - if ($request->hasFile('kertas_kerja')) { - $file = $request->file('kertas_kerja'); - $filePath = $this->surveyorController->uploadFile($file, 'kertas_kerja'); - Penilai::updateOrCreate( - [ - 'permohonan_id' => $validatedData['permohonan_id'], - 'dokument_id' => $validatedData['document_id'], - 'inspeksi_id' => $validatedData['inspeksi_id'], - ], - [ - 'kertas_kerja' => $filePath, - ] - ); + try { + // Simpan file kertas kerja + if ($request->hasFile('kertas_kerja')) { + $file = $request->file('kertas_kerja'); + $filePath = $this->surveyorController->uploadFile($file, 'kertas_kerja'); + Penilai::updateOrCreate( + [ + 'permohonan_id' => $validatedData['permohonan_id'], + 'dokument_id' => $validatedData['document_id'], + 'inspeksi_id' => $validatedData['inspeksi_id'], + ], + [ + 'kertas_kerja' => $filePath, + ] + ); - return response()->json(['success' => true, 'message' => 'Kertas kerja berhasil diunggah.']); + return response()->json(['success' => true, 'message' => 'Kertas kerja berhasil diunggah.']); + } + + return response()->json(['success' => false, 'message' => 'File kertas kerja tidak ditemukan.'], 400); + } catch (\Exception $e) { + return response()->json(['success' => false, 'message' => 'Terjadi kesalahan: ' . $e->getMessage()], 500); } - - return response()->json(['success' => false, 'message' => 'File kertas kerja tidak ditemukan.'], 400); - } catch (\Exception $e) { - return response()->json(['success' => false, 'message' => 'Terjadi kesalahan: ' . $e->getMessage()], 500); } -} public function status($id) @@ -353,7 +382,8 @@ class PenilaiController extends Controller } - public function storePenilaian($id){ + public function storePenilaian($id) + { try { $permohonan = Permohonan::findOrFail($id); $permohonan->update([ @@ -374,5 +404,113 @@ class PenilaiController extends Controller } } + public function storeResume(Request $request) + { + try { + + // dd($request->all()); + $validatedData = $request->validate([ + 'permohonan_id' => 'required', + 'document_id' => 'required', + 'inspeksi_id' => 'required', + 'resume' => 'required|array', + ]); + + // Simpan atau update data + Penilai::updateOrCreate( + [ + 'permohonan_id' => $validatedData['permohonan_id'], + 'dokument_id' => $validatedData['document_id'], + 'inspeksi_id' => $validatedData['inspeksi_id'], + ], + [ + 'resume' => json_encode($validatedData['resume']), + ] + ); + + + return response()->json([ + 'success' => true, + 'message' => 'Berhasil saved resume' + ], 200); + } catch (\Exception $e) { + return response()->json([ + 'success' => false, + 'message' => 'Terjadi kesalahan', + 'error' => $e->getMessage() + ], 500); + } + } + + + public function storeMemo(Request $request) + { + try { + + $validatedData = $request->validate([ + 'permohonan_id' => 'required|integer', + 'document_id' => 'required|integer', + 'inspeksi_id' => 'required|integer', + 'memo' => 'required', + ]); + Penilai::updateOrCreate( + [ + 'permohonan_id' => $validatedData['permohonan_id'], + 'dokument_id' => $validatedData['document_id'], + 'inspeksi_id' => $validatedData['inspeksi_id'], + ], + [ + 'memo' => json_encode($validatedData['memo']), + ] + ); + + + return response()->json([ + 'success' => true, + 'message' => 'Berhasil saved memo' + ], 200); + } catch (\Exception $e) { + return response()->json([ + 'success' => false, + 'message' => 'Terjadi kesalahan', + 'error' => $e->getMessage() + ], 500); + } + } + + public function storeLpjSederhanadanStandard(Request $request){ + + try { + + $validatedData = $request->validate([ + 'permohonan_id' => 'required|integer', + 'document_id' => 'required|integer', + 'inspeksi_id' => 'required|integer', + 'lpj' => 'required', + ]); + Penilai::updateOrCreate( + [ + 'permohonan_id' => $validatedData['permohonan_id'], + 'dokument_id' => $validatedData['document_id'], + 'inspeksi_id' => $validatedData['inspeksi_id'], + ], + [ + 'lpj' => json_encode($validatedData['lpj']), + ] + ); + + + return response()->json([ + 'success' => true, + 'message' => 'Berhasil saved lpj' + ], 200); + } catch (\Exception $e) { + return response()->json([ + 'success' => false, + 'message' => 'Terjadi kesalahan', + 'error' => $e->getMessage() + ], 500); + } + } } diff --git a/resources/views/penilai/components/lpj-sederhana-standard.blade.php b/resources/views/penilai/components/lpj-sederhana-standard.blade.php index 404c1c8..089ca48 100644 --- a/resources/views/penilai/components/lpj-sederhana-standard.blade.php +++ b/resources/views/penilai/components/lpj-sederhana-standard.blade.php @@ -331,130 +331,218 @@ -
-
-

- total nilai pasar wajar -

-
-
-
- -
-
-
- - +
+
+
+

+ total nilai pasar wajar +

+
+
+
+ +
+
+
+ + +
+
+ + +
+
+ + +
-
- - + +
+
+ + +
+
+ + +
+
+ + +
-
- - + +
+
+ + +
+
+ + +
+
+ + +
+
-
-
- - -
-
- - -
-
- - -
-
+
+ +
+
+
+ +
+
+ + +
+
+
+ + +
+
+ + +
+
-
-
- - -
-
- - -
-
- -
+
-
- -
-
-
- -
-
- - -
-
+
+
+

+ nilai asuransi +

+
+
+
+ +
+
- - + +
- +
+ +
+ + +
+ +
-
-
- -
-
-

- nilai asuransi -

+
+
-
-
- -
-
-
- - -
-
- - -
- -
- - -
- - -
-
-
-
-
-
- -
+
@endsection + +@include('lpj::surveyor.js.utils') + diff --git a/resources/views/penilai/components/memo.blade.php b/resources/views/penilai/components/memo.blade.php index e963b37..c3f596f 100644 --- a/resources/views/penilai/components/memo.blade.php +++ b/resources/views/penilai/components/memo.blade.php @@ -9,450 +9,529 @@ @section('content') @include('lpj::assetsku.includenya')
-
-
-

- Memo Antar Kantor -

- -
-
-
- -
- +
+
+
+

+ Memo Antar Kantor +

+
-
- -
- -
-
-
- -
- -
-
- - - -
- -
- -
-
- -
- -
- -
-
-
-
- -
-
-

Sehubungan dengan permintaan BAGI Cabang ............., untuk dilakukan survey untuk penilaian baru/review, calon debitur/debitur an …............., - dengan deskripsi sebagai berikut : -

-
-
-
+
- - -
- - - {{-- --}} - -
- - + +
+ +
-
-
-
- -
- -
-
- -
- -
- -
-
- -
- -
- -
-
- -
- -
- -
-
- -
- -
- -
-
- -
- -
- -
-
- -
- -
- -
-
- + +
+ +
+
+
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
-
+ +
+
+

Sehubungan dengan permintaan BAGI Cabang + ............., untuk dilakukan survey untuk penilaian baru/review, calon debitur/debitur an + …............., + dengan deskripsi sebagai berikut : +

+
+
+
+
+ + +
+ + +
-
-
-

- Dokument -

+ +
+ +
+
+
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+
+ + +
+
-
-
- -
+ + +
+
+

+ Dokument +

+
+
+ +
+ +
+
-
-
- -
- @if (!empty($forminspeksi['fakta']['hasil_survey'])) - @foreach ($forminspeksi['fakta']['hasil_survey'] as $index => $positif) +
+ +
+ @if (!empty($forminspeksi['hasil_survey'])) + @foreach ($forminspeksi['hasil_survey'] as $index => $positif) +
+ + +
+ @endforeach + @else
- -
- @endforeach - @else -
- - -
- @endif - + @endif + +
-
-
- -
- @if (!empty($forminspeksi['fakta']['fakta_negatif'])) - @foreach ($forminspeksi['fakta']['fakta_negatif'] as $index => $negatif) -
- - +
+ @endforeach + @else +
+ + +
- @endforeach - @else -
- - - -
- @endif - + @endif + +
-
-
-
-

- Peta lokasi -

-
-
-
-
-

- Rute Menuju Lokasi -

+
+
+

+ Peta lokasi +

+
+
+
+
+

+ Rute Menuju Lokasi +

+
+
+ @if (isset($formPeta)) + @php + $foto = ['foto_gistaru', 'foto_bhumi', 'foto_argis_region', 'foto_tempat']; + @endphp + + @foreach ($foto as $item) + @if (isset($formPeta[$item]) && $formPeta[$item]) +
+
+

+ {{ ucwords(str_replace('_', ' ', $item)) }} +

+
+ {{ $item }} +
+
+
+ @endif + @endforeach + @endif +
+
-
- @if (isset($formPeta)) - @php - $foto = [ - 'foto_gistaru', - 'foto_bhumi', - 'foto_argis_region', - 'foto_tempat', - ] - @endphp +
+
- @foreach ($foto as $item) - @if (isset($formPeta[$item]) && $formPeta[$item]) -
+ +
+
+

+ Foto jaminan +

+
+
+
+
+

+ Rute Menuju Lokasi +

+
+
+ @if (isset($formFoto)) + @foreach ($formFoto['rute_menuju_lokasi'] as $item) +

- {{ ucwords(str_replace('_', ' ', $item)) }} + {{ $item['name_rute'] . ' ' . $loop->index + 1 }}

-
- {{ $item }} +
+ + + +
- @endif - @endforeach - @endif + @endforeach + @endif +
-
-
-
+ +
+
+

+ Object Jaminan +

+
+
+ @if (isset($formFoto['object_jaminan'])) + @foreach ($formFoto['object_jaminan'] as $item) +
+
+

+ {{ $item['name_objek'] }} +

+
-
-
-

- Foto jaminan -

-
-
-
-
-

- Rute Menuju Lokasi -

-
-
- @if (isset($formFoto)) - @foreach ($formFoto['rute_menuju_lokasi'] as $item) -
-
-

- {{ $item['name_rute'] . ' ' . $loop->index + 1 }} -

-
- - - + +
-
- @endforeach - @endif + @endforeach + @endif +
-
- -
-
-

- Object Jaminan -

-
-
- @if (isset($formFoto['object_jaminan'])) - @foreach ($formFoto['object_jaminan'] as $item) + @if (isset($formFoto['foto_basement'])) +
+
+

+ Basement +

+
+

- {{ $item['name_objek'] }} + Basemnt

- +
- @endforeach - @endif -
+ +
+
+ @endif + + @if (isset($formFoto['foto_gerbang'])) +
+
+

+ Gerbang +

+
+
+ + +
+
+

+ Gerbang +

+
+ + + + +
+
+
+ +
+
+ @endif + + + @if (isset($formFoto['pendamping'])) +
+
+

+ Pendamping +

+
+
+ + +
+
+

+ Pendamping +

+
+ + + + +
+
+
+ +
+
+ @endif
- - @if (isset($formFoto['foto_basement'])) -
-
-

- Basement -

-
-
-
-
-

- Basemnt -

-
- - - - -
-
-
- -
-
- @endif - - @if (isset($formFoto['foto_gerbang'])) -
-
-

- Gerbang -

-
-
- - -
-
-

- Gerbang -

-
- - - - -
-
-
- -
-
- @endif - - - @if (isset($formFoto['pendamping'])) -
-
-

- Pendamping -

-
-
- - -
-
-

- Pendamping -

-
- - - - -
-
-
- -
-
- @endif
-
- + +
@endsection @include('lpj::surveyor.js.utils') diff --git a/resources/views/penilai/components/resume.blade.php b/resources/views/penilai/components/resume.blade.php index 745824d..6cec929 100644 --- a/resources/views/penilai/components/resume.blade.php +++ b/resources/views/penilai/components/resume.blade.php @@ -9,252 +9,255 @@ @section('content') @include('lpj::assetsku.includenya')
-
-
-

- Data Jaminan -

- -
-
-
- -
- @if (isset($permohonan->debiture)) -

{{ $permohonan->debiture->name }}

- @endif +
+ @csrf +
+
+

+ Data Jaminan +

+
-
- -
- @foreach ($permohonan->debiture->documents as $dokumen) - - {{ formatAlamat($dokumen->pemilik) }} - - @endforeach +
+
+ +
+ @if (isset($permohonan->debiture)) +

{{ $permohonan->debiture->name }}

+ @endif +
-
-
- -
-

{{ $permohonan->nomor_registrasi }}

+
+ +
+ @foreach ($permohonan->debiture->documents as $dokumen) + + {{ formatAlamat($dokumen->pemilik) }} + + @endforeach +
+
+
+ +
+

{{ $permohonan->nomor_registrasi }}

+
-
-
- -
- @if (isset($permohonan->branch)) -

{{ $permohonan->branch->name }}

- @endif +
+ +
+ @if (isset($permohonan->branch)) +

{{ $permohonan->branch->name }}

+ @endif +
-
-
- -
-

{{ $permohonan->nomor_registrasi }}

+
+ +
+

{{ $permohonan->nomor_registrasi }}

+
-
-
- -
- @if (isset($permohonan->user)) -

{{ $permohonan->user->name }}

- @endif +
+ +
+ @if (isset($permohonan->user)) +

{{ $permohonan->user->name }}

+ @endif +
-
+ @php + print_r($resumeData); + @endphp -
-
-

- faktor -

-
-
-
- -
- @if (!empty($forminspeksi['fakta']['fakta_positif'])) - @foreach ($forminspeksi['fakta']['fakta_positif'] as $index => $positif) +
+
+

+ faktor +

+
+
+
+ +
+ @if (!empty($resumeData['fakta']['fakta_positif'])) + @foreach ($resumeData['fakta']['fakta_positif'] as $index => $positif) +
+ + +
+ @endforeach + @else
- +
- @endforeach - @else -
- - -
- @endif - + @endif + +
-
-
- -
- @if (!empty($forminspeksi['fakta']['fakta_negatif'])) - @foreach ($forminspeksi['fakta']['fakta_negatif'] as $index => $negatif) +
+ +
+ @if (!empty($forminspeksi['fakta']['fakta_negatif'])) + @foreach ($forminspeksi['fakta']['fakta_negatif'] as $index => $negatif) +
+ + +
+ @endforeach + @else
- + +
- @endforeach - @else -
- - - -
- @endif - +
+
+
+
+ + +
+
+

+ KESIMPULAN NILAI PASAR WAJAR +

+
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + +
SertipikatLuas TanahLuas BangunanNilai Pasar Wajar
+ + + + + +
+
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
SertipikatLuas TanahLuas BangunanNilai Pasar Wajar
+ + + + + + + +
+
+
+ +
+
-
-
-
+
-
-
-

- KESIMPULAN NILAI PASAR WAJAR -

-
-
+
-
- -
- - - - - - - - - - - - - - - - - - - -
SertipikatLuas TanahLuas BangunanNilai Pasar Wajar
- - - - - -
+ +
+ +
-
- -
+ -
- -
- -
- -
- -
- - -
- -
+
- - - - -
+
@endsection @include('lpj::surveyor.js.utils') diff --git a/resources/views/penilai/show.blade.php b/resources/views/penilai/show.blade.php index b176782..fa4ab13 100644 --- a/resources/views/penilai/show.blade.php +++ b/resources/views/penilai/show.blade.php @@ -5,7 +5,7 @@ @endsection @section('content') -@include('lpj::assetsku.includenya') + @include('lpj::assetsku.includenya')
@@ -176,11 +176,17 @@
- + @php + $inspeksiId = null; + foreach ($dokumen->inspeksi as $item) { + $inspeksiId = $item->id; + } + @endphp