diff --git a/app/Http/Controllers/ActivityController.php b/app/Http/Controllers/ActivityController.php index 1008d7d..bfb447f 100644 --- a/app/Http/Controllers/ActivityController.php +++ b/app/Http/Controllers/ActivityController.php @@ -9,6 +9,7 @@ use Illuminate\Http\Request; use Modules\Lpj\Models\Permohonan; use Modules\Lpj\Models\Penilaian; use Modules\Lpj\Models\TeamsUsers; +use Modules\Lpj\Models\PenilaianTeam; use Modules\Lpj\Models\StatusPermohonan; use Modules\Lpj\Exports\PermohonanExport; use Maatwebsite\Excel\Facades\Excel; @@ -65,10 +66,33 @@ class ActivityController extends Controller }) ->get(); + + + return view('lpj::activity.progres_activity.index', compact('teamsActivity')); } + function updateTeamAssingment(Request $request) { + + try { + $id = $request->input('id'); + $user = PenilaianTeam::where('penilaian_id', $id)->get(); + if ($user) { + foreach ($user as $item) { + if($item->role == 'surveyor') { + $item->update(['user_id' => $request->surveyor_id]); + } + } + return redirect()->route('activity.progres.index')->with('success', 'Surveyor berhasil diganti'); + } + + } catch (\Throwable $th) { + return redirect()->route('activity.progres.index')->with('success', $th->getMessage()); + } + } + + public function senior() { diff --git a/app/Http/Controllers/SurveyorController.php b/app/Http/Controllers/SurveyorController.php index 2844358..6b48f91 100644 --- a/app/Http/Controllers/SurveyorController.php +++ b/app/Http/Controllers/SurveyorController.php @@ -48,11 +48,14 @@ use Modules\Lpj\Models\MerupakanDaerah; use Modules\Lpj\Models\ObjekJaminan; use Modules\Lpj\Models\ModelAlatBerat; use Modules\Lpj\Models\JenisPesawat; +use Modules\Lpj\Models\DokumenJaminan; +use Modules\Lpj\Models\DetailDokumenJaminan; use Modules\Lpj\Models\JenisKapal; use Modules\Lpj\Models\JenisKendaraan; use Modules\Lpj\Models\RuteJaminan; use Modules\Lpj\Models\JenisJaminan; use Modules\Lpj\Models\HubunganPemilikJaminan; +use Modules\Lpj\Models\HubunganPenghuniJaminan; use Modules\Lpj\Models\AnalisaUnit; use Modules\Lpj\Models\GolonganMasySekitar; use Modules\Lpj\Models\TingkatKeramaian; @@ -176,6 +179,8 @@ class SurveyorController extends Controller { $data = $request->validated(); + + if (!$data) { return response()->json(['success' => false, 'message' => 'Invalid data'], 400); } @@ -188,20 +193,20 @@ class SurveyorController extends Controller $inspeksi = Inspeksi::where('permohonan_id', $request->input('permohonan_id'))->where('jenis_jaminan_id', $request->input('jenis_jaminan_id'))->first(); - if ($inspeksi) { - $inspeksi->update(['data_form' => json_encode($rules)]); - } else { + if (!$inspeksi) { Inspeksi::create([ - 'permohonan_id' => $request->permohonan_id, + 'permohonan_id' => $request->input('permohonan_id'), 'data_form' => json_encode($rules), - 'name' => $request->type, - 'jenis_jaminan_id' => $request->input('jenis_jaminan_id'), + 'name' => $request->input('type'), + 'jenis_jaminan_id' => $request->input('jenis_jaminan_id'), ]); + } else { + $inspeksi->update(['data_form' => json_encode($rules)]); } DB::commit(); - return response()->json(['success' => true, 'message' => 'Data saved successfully', 'data' => $rules], 200); + return response()->json(['success' => true, 'message' => 'Data saved successfully', 'data' => $data], 200); } catch (Exception $e) { DB::rollBack(); return response()->json(['success' => false, 'message' => 'Failed to save data: ' . $e->getMessage()], 500); @@ -529,6 +534,43 @@ class SurveyorController extends Controller ->with('error', 'Gagal membuat jadwal: ' . $e->getMessage()); } } + + + public function storeDataPembanding(Request $request) + { + $data = $request->all(); + if (!$data) { + return response()->json(['success' => false, 'message' => 'Invalid data'], 400); + } + + try { + DB::beginTransaction(); + + // $action = $request->input('type'); + // $rules = $this->getActionSpecificRules($data, $action, $request); + + $inspeksi = Inspeksi::where('permohonan_id', $request->input('permohonan_id'))->where('jenis_jaminan_id', $request->input('jenis_jaminan_id'))->first(); + + if (!$inspeksi) { + Inspeksi::create([ + 'permohonan_id' => $request->input('permohonan_id'), + 'data_pembanding' => json_encode($data), + 'name' => $request->input('type'), + 'jenis_jaminan_id' => $request->input('jenis_jaminan_id'), + ]); + } else { + $inspeksi->update(['data_pembanding' => json_encode($data)]); + } + + DB::commit(); + + return response()->json(['success' => true, 'message' => 'Data saved successfully', 'data' => json_encode($data)], 200); + } catch (Exception $e) { + DB::rollBack(); + return response()->json(['success' => false, 'message' => 'Failed to save data: ' . $e->getMessage()], 500); + } + } + /** * Form inspeksi. */ @@ -574,6 +616,7 @@ class SurveyorController extends Controller $jenisPesawat = JenisPesawat::all(); $modelAlatBerat = ModelAlatBerat::all(); $hubCadeb = HubunganPemilikJaminan::all(); + $hubPenghuni = HubunganPenghuniJaminan::all(); $jenisJaminan = JenisJaminan::all(); $fasilitasObjek = FasilitasObjek::all(); $merupakanDaerah = MerupakanDaerah::all(); @@ -622,7 +665,8 @@ class SurveyorController extends Controller 'merupakanDaerah', 'terletakDiArea', 'posisiUnit', - 'bentukUnit' + 'bentukUnit', + 'hubPenghuni' )); } @@ -697,6 +741,7 @@ class SurveyorController extends Controller $branches = Branch::all(); $provinces = Province::all(); + $data = $this->getCommonData(); $inpeksi = Inspeksi::where('permohonan_id', $id)->where('jenis_jaminan_id', $jaminanId)->first(); $forminspeksi = null; @@ -706,7 +751,7 @@ class SurveyorController extends Controller } // return response()->json($forminspeksi); - return view('lpj::surveyor.components.data-pembanding', compact('permohonan', 'surveyor', 'branches', 'provinces', 'forminspeksi')); + return view('lpj::surveyor.components.data-pembanding', compact('permohonan', 'surveyor', 'branches', 'provinces', 'forminspeksi', 'data')); } @@ -852,8 +897,92 @@ class SurveyorController extends Controller ->route('basicdata.' . $type . '.index') ->with('success', 'Updated successfully'); } + } + public function update_analisa($id, Request $request) + { + try { + $permohonan = Permohonan::with([ + 'user', + 'debiture.province', + 'debiture.city', + 'debiture.district', + 'debiture.village', + 'branch', + 'tujuanPenilaian', + 'penilaian', + 'documents', + ])->findOrFail($id); + + $jenisAssetUpdated = false; + if ($request->input('types') == 'jenis_asset') { + $this->updateJenisAsset($permohonan, $request); + $jenisAssetUpdated = true; + } + + if (in_array($request->input('types'), ['analisa_tanah', 'analisa_bangunan', 'analisa_unit'])) { + $key = match ($request->input('types')) { + 'analisa_tanah' => 'luas_tanah', + 'analisa_bangunan' => 'luas_bangunan', + 'analisa_unit' => 'luas_unit', + }; + + $this->updateDetails($permohonan, $key, $request->input($key)); + } + + return response()->json([ + 'success' => true, + 'message' => 'Data berhasil disimpan', + 'jenis_asset' => $jenisAssetUpdated, + ], 200); + } catch (\Exception $e) { + return response()->json(['error' => 'Something went wrong', 'message' => $e->getMessage()], 500); + } + } + + + private function updateJenisAsset($permohonan, $request) + { + $jenis_jaminan_id = $permohonan->debiture->documents->first()->jenis_jaminan_id; + DokumenJaminan::where('permohonan_id', $permohonan->id) + ->where('jenis_jaminan_id', $jenis_jaminan_id) + ->update([ + 'jenis_jaminan_id' => $request->input('jenis_asset'), + ]); + } + + private function updateDetails($permohonan, $key, $newValue) + { + $document = $permohonan->debiture->documents->first(); + + if (!$document) { + throw new \Exception("Document not found"); + } + + $detailsUpdate = DetailDokumenJaminan::where('dokumen_jaminan_id', $document->id)->first(); + + if (!$detailsUpdate) { + throw new \Exception("DetailDokumenJaminan not found"); + } + + $datas = json_decode($detailsUpdate->details, true) ?? []; + + if (is_numeric($newValue)) { + $newValue = [$key => $newValue]; + } + + if (!is_array($newValue)) { + throw new \InvalidArgumentException("'{$key}' must be an array or valid JSON string"); + } + + foreach ($newValue as $subKey => $value) { + $datas[$subKey] = $value; // Update atau tambahkan key baru + } + + $detailsUpdate->update([ + 'details' => json_encode($datas), + ]); } @@ -1132,6 +1261,13 @@ class SurveyorController extends Controller 'modelAlatBerat' => ModelAlatBerat::all(), 'jenisKapal' => JenisKapal::all(), 'jenisKendaraan' => JenisKendaraan::all(), + 'terletakArea' => TerletakArea::all(), + 'posisiUnit' => PosisiUnit::all(), + 'bentukUnit' => BentukUnit::all(), + 'fasilitasObjek' => FasilitasObjek::all(), + 'merupakanDaerah' => MerupakanDaerah::all(), + 'jenisUnit' => JenisUnit::all(), + ]; } @@ -1215,16 +1351,26 @@ class SurveyorController extends Controller private function getBangunanData($data, $request): array { - // $kategori_bangunan = []; - // if ($request->has('spek_kategori_bagunan')) { - // foreach ($request->input('spek_kategori_bagunan', []) as $value) { - // $kategori_bangunan[] = [ - // 'value' => [ - // 'data' => $data['spek_bangunan'] ?? [], - // ], - // ]; - // } - // } + $data = $request->all(); + $result = []; + + // foreach ($data['nama_bagunan'] as $index => $bangunan) { + // $bangunanData = [ + // 'bangunan' => $bangunan, + // 'kategori' => [] + // ]; + + // foreach ($data['spek_kategori_bangunan'] as $kategoriIndex => $kategori) { + // if (isset($data['spek_bangunan'][$kategori])) { + // $bangunanData['kategori'][] = [ + // 'kategori' => $kategori, + // 'spesifikasi' => $data['spek_bangunan'][$kategori] + // ]; + // } + // } + + // $result[] = $bangunanData; + // } return [ 'bangunan' => [ @@ -1233,8 +1379,8 @@ class SurveyorController extends Controller 'kondisi_bangunan' => $data['kondisi_bangunan'] ?? null, 'sifat_bangunan' => $data['sifat_bangunan'] ?? null, 'sifat_bangunan_input' => $data['sifat_bangunan_input'] ?? null, - 'spek_kategori_bagunan' => $data['spek_kategori_bagunan'] ?? null, - 'spek_bangunan' => $data['spek_bangunan'] ?? [], + 'spesifikasi_bangunan' => $result ?? null, + // 'spek_bangunan' => $data['spek_bangunan'] ?? [], 'sarana_pelengkap' => $data['sarana_pelengkap'] ?? [], 'sarana_pelengkap_input' => $data['sarana_pelengkap_input'] ?? null, ], @@ -1740,6 +1886,3 @@ class SurveyorController extends Controller } - - - diff --git a/app/Http/Requests/FormSurveyorRequest.php b/app/Http/Requests/FormSurveyorRequest.php index 719b695..0a3245b 100644 --- a/app/Http/Requests/FormSurveyorRequest.php +++ b/app/Http/Requests/FormSurveyorRequest.php @@ -100,9 +100,9 @@ class FormSurveyorRequest extends FormRequest 'kondisi_bangunan' => 'nullable', 'sifat_bangunan' => 'required|array', 'sifat_bangunan_input' => 'nullable|array', - 'nama_bagunan' => 'required|array', - 'spek_kategori_bangunan' => 'required|array', - 'spek_kategori_bangunan.*' => 'required|string', + 'nama_bagunan' => 'required', + 'spek_kategori_bangunan.*' => 'required', + 'spek_bangunan.*' => 'required', 'sarana_pelengkap' => 'required', 'sarana_pelengkap_input' => 'nullable|array', ]; diff --git a/database/migrations/2024_11_27_214423_update_inspeksi_table.php b/database/migrations/2024_11_27_214423_update_inspeksi_table.php new file mode 100644 index 0000000..e954dbc --- /dev/null +++ b/database/migrations/2024_11_27_214423_update_inspeksi_table.php @@ -0,0 +1,28 @@ +json('data_pembanding')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('inspeksi', function (Blueprint $table) { + $table->dropColumn('data_pembanding'); + }); + } +}; diff --git a/resources/views/activity/progres_activity/index.blade.php b/resources/views/activity/progres_activity/index.blade.php index 3884136..2e4189f 100644 --- a/resources/views/activity/progres_activity/index.blade.php +++ b/resources/views/activity/progres_activity/index.blade.php @@ -118,12 +118,11 @@ Paparan Approve Keterangan + Action - - No data available - + @@ -151,6 +150,13 @@ @endsection @push('scripts') + + + @endpush + + + diff --git a/resources/views/surveyor/components/apartemen-kantor.blade.php b/resources/views/surveyor/components/apartemen-kantor.blade.php index b5493cd..654f2d0 100644 --- a/resources/views/surveyor/components/apartemen-kantor.blade.php +++ b/resources/views/surveyor/components/apartemen-kantor.blade.php @@ -27,10 +27,10 @@
- - +
@@ -80,9 +80,6 @@ - - -
diff --git a/resources/views/surveyor/components/bangunan.blade.php b/resources/views/surveyor/components/bangunan.blade.php index 7dee989..b78b11b 100644 --- a/resources/views/surveyor/components/bangunan.blade.php +++ b/resources/views/surveyor/components/bangunan.blade.php @@ -5,7 +5,20 @@
- + +
+ + @if (isset($permohonan->debiture->documents)) + @foreach ($permohonan->debiture->documents as $item) + @php + $luas = $item->detail; + $details = json_decode($luas[0]->details, true); + $luas_bangunan = isset($details['luas_bangunan']) ? $details['luas_bangunan'] : 'N/A'; + @endphp +

{{ $luas_bangunan }} m2

+ @endforeach + + @endif
+
@@ -139,7 +153,7 @@ @if (@isset($spekKategoriBagunan)) @foreach ($spekKategoriBagunan as $item)
- @@ -149,7 +163,7 @@ @if ($spek->spek_kategori_bangunan_id == $item->id) @@ -235,33 +249,39 @@ document.getElementById('addBagunan').addEventListener('click', function() { const newDiv = spekBangunanContainer.querySelector('.spek-bangunan').cloneNode(true); - console.log('Building label'); - // Clear the selected values and input fields of the cloned input fields - newDiv.querySelectorAll('select, input').forEach(input => { + + // Update input fields + newDiv.querySelectorAll('select, input').forEach((input, index) => { if (input.type === 'checkbox' || input.type === 'radio') { input.checked = false; } else { input.value = ''; } + + // Update name attribute + if (input.name) { + const baseName = input.name.split('[')[0]; // Get the base name + const count = spekBangunanContainer.querySelectorAll('.spek-bangunan').length + 1; + input.name = `${baseName}[${count}]`; + } }); - // Append the cloned div to the container + // Append the cloned div spekBangunanContainer.appendChild(newDiv); // Add event listener to the delete button in the cloned div newDiv.querySelector('.delete-button').addEventListener('click', function() { spekBangunanContainer.removeChild(newDiv); updateDeleteButtonsVisibility(); - updateBuildingLabels(); // Update the labels after removing - console.log('Building label'); + updateBuildingLabels(); }); - // Update delete buttons visibility and labels + // Update UI updateDeleteButtonsVisibility(); updateBuildingLabels(); - console.log('Building label'); }); + // Initial setup: Ensure "Bangunan 1" is labeled document.addEventListener('DOMContentLoaded', () => { updateDeleteButtonsVisibility(); diff --git a/resources/views/surveyor/components/data-pembanding.blade.php b/resources/views/surveyor/components/data-pembanding.blade.php index b86f5dc..28b7f41 100644 --- a/resources/views/surveyor/components/data-pembanding.blade.php +++ b/resources/views/surveyor/components/data-pembanding.blade.php @@ -5,7 +5,8 @@ @endsection --}} @section('content') -
+ @include('lpj::assetsku.includenya') +
@@ -13,7 +14,9 @@ Data Pembanding
- Back @@ -25,548 +28,671 @@
-
-
- - -
-
-
- - - - - - - - - - - - - - - -
- Nama - - - Objek Penilaian - - - Data Pembanding 1 -
- Foto - - @php - $formFoto = json_decode($forminspeksi['foto_form'], true); - $formIns = json_decode($forminspeksi['data_form'], true); - @endphp +
+ @csrf + + + + +
+
+ + +
+
- @if (isset($formFoto['object_jaminan']) && - count($formFoto['object_jaminan']) > 0 && - isset($formFoto['object_jaminan'][0]['foto_object'])) - Gambar Pendamping - @else - - @endif +
+ + + + + + + + + + + + - - - - + + + + + + + + + + + + + + - - + + + + - - - - - - - + + + + + - - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + - - - - - - - - - - + name="luas_tanah" /> + + + + + + + + + + + + + - - - - + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + - + - - - + - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - + + + + + + + + + + - - - + + + - - + + - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Nama + + + Objek Penilaian + + + Data Pembanding 1 +
+ Foto + + @php + $formFoto = json_decode($forminspeksi['foto_form'], true); + $formIns = json_decode($forminspeksi['data_form'], true); + @endphp - - - - -
-

Alamat

+ @if (isset($formFoto['object_jaminan']) && + count($formFoto['object_jaminan']) > 0 && + isset($formFoto['object_jaminan'][0]['foto_object'])) + Gambar Pendamping + @else + + @endif -
+ + +
+

Alamat

-
- + + + + +
Desa + + + +
- +
Kecamatan + + + +
Desa - - - -
Kabupaten + + + +
Kecamatan - - - -
Provinsi + + + +
Kabupaten - - - -
Provinsi - - - -
- Tahun Penilaian - - - - -
- Luas Tanah - - - - -
- Luas Bangunan - - - - -
- Tahun Bangunan - - - - -
- Estimasi Tahun Visual - - - - -
- Kepemilikan - - - - -
- Harga - - - - -
- Tinggi Lantai - - - - -
- Lebar Depan - - - - -
- Lebar Jalan - - - - -
- Sumber - - - - -
- Nomor tlp - - - - -
- Titik Lokasi - -
+
+ Tahun Penilaian + + name="tahun" /> + + +
+ Luas Tanah + - - -
- - -
-
- Link Internet - - - - -
Lokasi
+ +
+ Luas Bangunan + + + + +
+ Tahun Bangunan + + + + +
-

Jarak Ke jalan utama

-
- - - +
+ Estimasi Tahun Visual + + + + +
+ Kepemilikan + + + + +
+ Harga + + + + +
+ Tinggi Lantai + + + + +
+ Lebar Depan + + + + +
+ Lebar Jalan + + + + +
+ Sumber + + + + +
+ Nomor tlp + + + + +
+ Titik Lokasi +
+ Koordinat Lat + + + -
-

Lebar jalan depan aset (m)

-
- - - + -
-

Posisi kavling

-
- +
- +
+ Koordinat Lng + -
- -

Tingkat Keramaian (Occupancy)

-
- - - - -
Karakteristik Fisik
-

Kondisi Fisik Tanah

- -
- - - - - -
-

Beda Ketinggian dengan Jalan

-
- - - - -
-

Bentuk Tanah

-
- - - - - - -
-

Lebar Depan

-
- - - -
- -

Fasos Fasum

- -
- - - - - - -
- -

Lain-lain

-
- - - - - -
- Karakteristik Ekonomi - - - - -
Pengunaan
- Zonasi/Tata Kota - - - - -
- KDB - - - - - - -
-
- KLB - - + - - -
+ Link Internet + + + + +
Lokasi
- KTB - - +
+

Jarak Ke jalan utama

+
+ + + - - -
- KDH - - - - -
- Peraturan - - +
+

Lebar jalan depan aset (m)

+
+ + + + +
+

Posisi kavling

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

Tingkat Keramaian (Occupancy)

+
+ + + +
Karakteristik Fisik
+

Kondisi Fisik Tanah

+ +
+ + + + + +
+

Beda Ketinggian dengan Jalan

+
+ + + +
+

Bentuk Tanah

+
+ + + + + +
+

Lebar Depan

+
+ + + +
+ +

Fasos Fasum

+ +
+ + + + + + +
+ +

Lain-lain

+
+ + + + + +
+ Karakteristik Ekonomi + + + + +
Pengunaan
+ Zonasi/Tata Kota + + + + +
+ KDB + + + + + + +
+ KLB + + + + + +
+ KTB + + + + + +
+ KDH + + + + + +
+ Peraturan + + + + + +
+
-
- -
-
+ +
+ +
+
+
diff --git a/resources/views/surveyor/components/denah.blade.php b/resources/views/surveyor/components/denah.blade.php index d7fcc67..4e848de 100644 --- a/resources/views/surveyor/components/denah.blade.php +++ b/resources/views/surveyor/components/denah.blade.php @@ -5,6 +5,7 @@ @endsection --}} @section('content') +@include('lpj::assetsku.includenya')
@@ -234,6 +235,7 @@ if (response.success) { window.location.href = '{{ route('surveyor.show', ['id' => $permohonan->id]) }}?form=denah'; + toastrSuccessBuild(response.message); } console.log(response); }, @@ -249,6 +251,8 @@ console.log('Status:', status); console.log('Response:', xhr.responseText); console.log(errors); + toastrErrorBuild(error); + }, complete: function() { // Re-enable the button and hide the spinner diff --git a/resources/views/surveyor/components/foto.blade.php b/resources/views/surveyor/components/foto.blade.php index 53ca8b4..43e38cb 100644 --- a/resources/views/surveyor/components/foto.blade.php +++ b/resources/views/surveyor/components/foto.blade.php @@ -5,6 +5,7 @@ @endsection --}} @section('content') +@include('lpj::assetsku.includenya')
@@ -588,104 +589,14 @@
- - + @include('lpj::surveyor.components.modal-kamera') @endsection @push('scripts') @include('lpj::surveyor.js.camera-editor') - - - @endpush diff --git a/resources/views/surveyor/components/header.blade.php b/resources/views/surveyor/components/header.blade.php index ea20501..bc3a953 100644 --- a/resources/views/surveyor/components/header.blade.php +++ b/resources/views/surveyor/components/header.blade.php @@ -1,4 +1,4 @@ -
+

Order Penilaian

@@ -79,7 +79,7 @@
-
+

Deskripsi Aset jaminan

@@ -99,36 +99,36 @@
-
- - -
+
+ + +
@@ -139,7 +139,6 @@
- @foreach ($permohonan->debiture->documents as $dokumen) {{ formatAlamat($dokumen) }} @@ -148,207 +147,136 @@
- - +
+ + +
+
- - - -
+
@@ -363,12 +291,15 @@ @@ -477,21 +408,23 @@
@foreach ($permohonan->debiture->documents as $dokumen) - {{ $dokumen->pemilik->hubungan_pemilik->name?? "" }} + {{ $dokumen->pemilik->hubungan_pemilik->name ?? '' }} @endforeach
@@ -524,24 +457,26 @@
-
-
+
+
@foreach ($permohonan->debiture->documents as $dokumen) - {{ $dokumen->penghuni->hubungan_penghuni->name?? "" }} + {{ $dokumen->penghuni->hubungan_penghuni->name ?? 'N/A' }} @endforeach
@@ -551,8 +486,8 @@ name="hub_cadeb_Penghuni_tidak_sesuai" style="{{ old('hub_cadeb', $forminspeksi['asset']['hub_cadeb'] ?? '') == 'tidak sesuai' ? '' : 'display: none;' }}"> - @if (isset($hubCadeb)) - @foreach ($hubCadeb as $item) + @if (isset($hubPenghuni)) + @foreach ($hubPenghuni as $item)
- - diff --git a/resources/views/surveyor/components/informasi.blade.php b/resources/views/surveyor/components/informasi.blade.php index 0b986ec..5864fa5 100644 --- a/resources/views/surveyor/components/informasi.blade.php +++ b/resources/views/surveyor/components/informasi.blade.php @@ -165,30 +165,44 @@ @endif
-
-
- + +
+ -
+
+
+ +
- Foto Argis Region
-
77r7777 + -
-
-

Catatan yang Perlu Diperhatikan -

+
+ + +
-
+
+ +@include('lpj::surveyor.components.modal-kamera') + +@push('scripts') +@include('lpj::surveyor.js.camera-editor') +@endpush + diff --git a/resources/views/surveyor/components/inspeksi.blade.php b/resources/views/surveyor/components/inspeksi.blade.php index 41d17e0..2074d39 100644 --- a/resources/views/surveyor/components/inspeksi.blade.php +++ b/resources/views/surveyor/components/inspeksi.blade.php @@ -5,6 +5,7 @@ @endsection --}} @section('content') + @include('lpj::assetsku.includenya')
@@ -124,6 +125,22 @@ } + function toggleAlamatVisibility(idSesuai, idTidakSesuai, selectedValue) { + // Ambil elemen berdasarkan ID + const alamatSesuai = document.getElementById(idSesuai); + const alamatTidakSesuai = document.getElementById(idTidakSesuai); + + // Periksa nilai yang dipilih dan tampilkan elemen yang sesuai + if (selectedValue === 'sesuai') { + alamatSesuai.style.display = 'grid'; // Tampilkan "Alamat Sesuai" + alamatTidakSesuai.style.display = 'none'; // Sembunyikan "Alamat Tidak Sesuai" + } else if (selectedValue === 'tidak sesuai') { + alamatSesuai.style.display = 'none'; // Sembunyikan "Alamat Sesuai" + alamatTidakSesuai.style.display = 'grid'; // Tampilkan "Alamat Tidak Sesuai" + } +} + + function submitData() { const formElement = $('#formInspeksi')[0]; @@ -144,10 +161,12 @@ 'X-CSRF-TOKEN': '{{ csrf_token() }}' }, success: function(response) { - if (response.success) { - window.location.href = - '{{ route('surveyor.show', ['id' => $permohonan->id]) }}?form=inspeksi'; - } + // if (response.success) { + // toastrSuccessBuild(response.message) + // window.location.href = + // '{{ route('surveyor.show', ['id' => $permohonan->id]) }}?form=inspeksi'; + // } + console.log(response); }, error: function(xhr, status, error) { @@ -162,6 +181,7 @@ console.log('Status:', status); console.log('Response:', xhr.responseText); console.log(errors); + toastrErrorBuild(error); }, complete: function() { // Re-enable the button and hide the spinner @@ -211,8 +231,53 @@ container.appendChild(newElement); } + + + function updateAnalisa(params) { + const inputMap = { + jenis_asset: 'jenis_asset_tidak_sesuai', + analisa_tanah: 'analisa_tanah_tidak_sesuai', + analisa_unit: 'analisa_luas_unit_tidak_sesuai', + analisa_bangunan: 'analisa_bangunan_tidak_sesuai', + }; + + // Pastikan elemen ID ada di inputMap + if (!inputMap[params]) { + console.error('Parameter tidak valid:', params); + return; + } + + // Ambil nilai berdasarkan parameter + const inputValue = document.getElementById(inputMap[params]).value; + const data = { + [params === 'jenis_asset' ? 'jenis_asset' : params.replace('analisa_', 'luas_')]: inputValue, + types: params + }; + + $.ajax({ + url: '{{ route('surveyor.update_analisa', ['id' => $permohonan->id]) }}', + type: 'POST', + data: data, + headers: { + 'X-CSRF-TOKEN': '{{ csrf_token() }}' + }, + success: function(response) { + console.log(response); + if (response.success) { + if (response.jenis_asset) { + window.location.href = + '{{ route('surveyor.show', ['id' => $permohonan->id]) }}?form=inspeksi'; + } + toastrSuccessBuild(response.message); + } + }, + error: function(xhr, status, error) { + console.error('Terjadi error:', error); + console.log('Status:', status); + console.log('Response:', xhr.responseText); + toastrErrorBuild(error); + } + }); + } @endpush - - - diff --git a/resources/views/surveyor/components/modal-kamera.blade.php b/resources/views/surveyor/components/modal-kamera.blade.php new file mode 100644 index 0000000..30ed8d3 --- /dev/null +++ b/resources/views/surveyor/components/modal-kamera.blade.php @@ -0,0 +1,88 @@ + \ No newline at end of file diff --git a/resources/views/surveyor/components/tanah.blade.php b/resources/views/surveyor/components/tanah.blade.php index 63d76d7..90e490f 100644 --- a/resources/views/surveyor/components/tanah.blade.php +++ b/resources/views/surveyor/components/tanah.blade.php @@ -13,13 +13,15 @@
@if (isset($permohonan->debiture->documents)) - @foreach ($permohonan->debiture->documents as $item) - @php - $details = json_decode($item->detail); - $luas_tanah = isset($details['luas_tanah']) ? $details['luas_tanah'] : 'N/A'; - @endphp -

{{ $luas_tanah }} m2

- @endforeach + @foreach ($permohonan->debiture->documents as $item) + @php + $luas = $item->detail; + $details = json_decode($luas[0]->details, true); + $luas_tanah = isset($details['luas_tanah']) ? $details['luas_tanah'] : 'N/A'; + @endphp +

{{ $luas_tanah }} m2

+ @endforeach + @endif
@@ -38,10 +40,10 @@
- - +
@@ -63,7 +65,7 @@
diff --git a/resources/views/surveyor/index.blade.php b/resources/views/surveyor/index.blade.php index ec9b573..b95b630 100644 --- a/resources/views/surveyor/index.blade.php +++ b/resources/views/surveyor/index.blade.php @@ -200,8 +200,6 @@ function jadwal(id){ return `${day}-${month}-${year}`; } -ihfdksfjhjfjbkdfkdsfdsjkjdjdsgjjgdgjhgdgjkhdshggkhgkhdghskghkjkhjsdgjkgdjhg - @endpush diff --git a/resources/views/surveyor/js/camera-editor.blade.php b/resources/views/surveyor/js/camera-editor.blade.php index d0ff300..f37caf5 100644 --- a/resources/views/surveyor/js/camera-editor.blade.php +++ b/resources/views/surveyor/js/camera-editor.blade.php @@ -1,4 +1,304 @@ @push('scripts') + +