diff --git a/app/Http/Controllers/SurveyorController.php b/app/Http/Controllers/SurveyorController.php index cc1822a..36b9ae2 100644 --- a/app/Http/Controllers/SurveyorController.php +++ b/app/Http/Controllers/SurveyorController.php @@ -5,6 +5,7 @@ namespace Modules\Lpj\Http\Controllers; use App\Http\Controllers\Controller; use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; +use Illuminate\Support\Facades\DB; use Illuminate\Http\Response; use Modules\Lpj\Models\Permohonan; use Modules\Lpj\Models\Branch; @@ -22,7 +23,21 @@ use Modules\Lpj\Models\SpekBangunan; use Modules\Lpj\Models\SpekKategoritBangunan; use Modules\Lpj\Models\SaranaPelengkap; use Modules\Lpj\Models\ArahMataAngin; +use Modules\Lpj\Models\Analisa; +use Modules\Lpj\Models\AnalisaFakta; +use Modules\Lpj\Models\AnalisaLingkungan; +use Modules\Lpj\Models\AnalisaTanahBagunan; +use Modules\Lpj\Models\SpekBangunanAnalisa; +use Modules\Lpj\Models\Denah; +use Modules\Lpj\Models\FotoJaminan; +use Modules\Lpj\Models\Lingkungan; +use Modules\Lpj\Models\LantaiUnit; +use Modules\Lpj\Models\ObjekJaminan; +use Modules\Lpj\Models\RuteJaminan; +use Modules\Lpj\Models\AnalisaUnit; +use Modules\Lpj\Models\SpekBagunanAnalisaDetail; use Modules\Lpj\Http\Requests\SurveyorRequest; +use Modules\Lpj\Http\Requests\FormSurveyorRequest; class SurveyorController extends Controller { @@ -35,29 +50,25 @@ class SurveyorController extends Controller return view('lpj::surveyor.index'); } - - /** * Show the specified resource. */ public function show($id) { - $permohonan = Permohonan::with( - [ - 'user', - 'debiture.province', - 'debiture.city', - 'debiture.district', - 'debiture.village', - 'branch', - 'tujuanPenilaian', - 'penilaian', - 'documents', - ], - )->findOrFail($id); + $permohonan = Permohonan::with([ + 'user', + 'debiture.province', + 'debiture.city', + 'debiture.district', + 'debiture.village', + 'branch', + 'tujuanPenilaian', + 'penilaian', + 'documents', + ])->findOrFail($id); $surveyor = $id; - $branches = Branch::all(); + $branches = Branch::all(); $provinces = Province::all(); $bentukTanah = BentukTanah::all(); $konturTanah = KonturTanah::all(); @@ -72,8 +83,41 @@ class SurveyorController extends Controller $saranaPelengkap = SaranaPelengkap::all(); $arahMataAngin = ArahMataAngin::all(); + $jenisJaminanIds = $permohonan->debiture->documents; + + $buttonDisable = false; + + foreach ($jenisJaminanIds as $jenisJaminanId) { + $denah = Denah::where('permohonan_id', $id) + ->where('jenis_jaminan_id', $jenisJaminanId->jenis_jaminan_id) + ->first(); + + $fotojaminan = FotoJaminan::where('permohonan_id', $id) + ->where('jenis_jaminan_id', $jenisJaminanId->jenis_jaminan_id) + ->first(); + + $analisa = Analisa::where('permohonan_id', $id) + ->where('jenis_jaminan_id', $jenisJaminanId->jenis_jaminan_id) + ->first(); + + // cek jika tidak ada + if (!$denah || !$fotojaminan || !$analisa) { + $buttonDisable = true; + break; + } + } + + $denah = Denah::where('permohonan_id', $id)->get(); + $fotojaminan = FotoJaminan::where('permohonan_id', $id)->get(); + $analisa = Analisa::with('analisaUnit', 'analisaTanahBangunan', 'analisaLingkungan', 'analisaFakta', 'jenisJaminan') + ->where('permohonan_id', $id) + ->get(); return view('lpj::surveyor.detail', compact( + 'buttonDisable', + 'fotojaminan', + 'denah', + 'analisa', 'permohonan', 'surveyor', 'branches', @@ -89,26 +133,358 @@ class SurveyorController extends Controller 'spekKategoriBagunan', 'spekBangunan', 'saranaPelengkap', - 'arahMataAngin', + 'arahMataAngin' )); } - /** - * Show the form for editing the specified resource. + * Store form inspeksi. */ - public function edit($id) + public function store(FormSurveyorRequest $request) { - return view('lpj::edit'); + $validatedData = $request->validated(); + DB::beginTransaction(); + try { + $analisa = Analisa::create($validatedData); + + if ($analisa) { + $validatedData['analisa_id'] = $analisa->id; + + switch ($validatedData['action']) { + case 'tanah_bangunan': + $this->handleTanahBangunan($validatedData, $request); + break; + case 'unit': + $this->handleUnit($validatedData); + break; + default: + throw new \Exception('Invalid action type'); + } + + AnalisaLingkungan::create($validatedData); + $validatedData['foto_tempat'] = $this->uploadFile($request->file('foto_tempat'), 'foto_tempat'); + AnalisaFakta::create($validatedData); + } + + DB::commit(); + return redirect()->route('surveyor.show', [ + 'id' => $validatedData['permohonan_id'], + 'form' => 'inspeksi' + ])->with('success', 'Data form surveyor berhasil disimpan'); + } catch (Exception $e) { + DB::rollback(); + return response()->json(['error' => 'Failed to save data', 'details' => $e->getMessage()], 500); + } } - /** - * Update the specified resource in storage. - */ - public function update(Request $request, $id): RedirectResponse + private function handleTanahBangunan(array $validatedData, FormSurveyorRequest $request) { - // + $analisaTanahBangunan = AnalisaTanahBagunan::create($validatedData); + if ($analisaTanahBangunan) { + $this->createSpekBangunanAnalisa($request, $analisaTanahBangunan); + } } + private function handleUnit(array $validatedData) + { + AnalisaUnit::create($validatedData); + } + + private function createSpekBangunanAnalisa($request, $analisaTanahBangunan) + { + foreach ($request->input('kategori', []) as $spek) { + $spek['analisa_tanah_bangunan_id'] = $analisaTanahBangunan->id; + $spekBangunan = SpekBangunanAnalisa::create($spek); + + if ($spekBangunan) { + $this->createSpekBangunanAnalisaDetails($request, $spekBangunan); + } + } + } + + private function createSpekBangunanAnalisaDetails($request, $spekBangunan) + { + foreach ($request->input('name', []) as $detail) { + $detail['spek_bangunan_analisa_id'] = $spekBangunan->id; + SpekBagunanAnalisaDetail::create($detail); + } + } + + public function storeDenah(Request $request) + { + + try { + $validatedData = $request->validate([ + 'foto_denah' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:2048', + 'luas' => 'required|numeric', + 'permohonan_id' => 'required', + 'jenis_jaminan_id' => 'required' + ]); + + + $validatedData['foto_denah'] = $this->uploadFile($request->file('foto_denah'), 'foto_denah'); + + + Denah::create($validatedData); + return redirect()->route('surveyor.show', [ + 'id' => $validatedData['permohonan_id'], + 'form' => 'denah' + ])->with('success', 'Data foto berhasil disimpan'); + } catch (Exception $e) { + $failureRedirectUrl = route('surveyor.denah', [ + 'id' => $validatedData['permohonan_id'], + 'jenis_jaminan_id' => $validatedData['jenis_jaminan_id'] + ]); + + $failureRedirectUrl .= '?form=create-denah&denah=' . $validatedData['permohonan_id'] . '&jenis_jaminan=' . $validatedData['jenis_jaminan_id']; + + return redirect($failureRedirectUrl) + ->withInput() + ->with(['error' => 'Gagal menyimpan data: ' . $e->getMessage()]); + } + + } + + + public function storeFoto(Request $request) + { + $validatedData = $request->validate([ + 'permohonan_id' => 'required', + 'jenis_jaminan_id' => 'required', + 'analisa_type' => 'required|in:tanah_bangunan,unit', + 'pendamping' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:2048', + 'foto_objek.*' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:2048', + 'name_objek.*' => 'required|string|max:255', + 'foto_lingkungan.*' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:2048', + 'name_lingkungan.*' => 'required|string|max:255', + 'foto_rute.*' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:2048', + 'name_rute.*' => 'required|string|max:255', + 'lantai.*' => 'nullable|image|mimes:jpeg,png,jpg,gif,svg|max:2048', + 'name_lantai_unit.*' => 'nullable|string|max:255', + 'foto_lantai_unit.*' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:2048', + ]); + + DB::beginTransaction(); + + try { + $pendampingPath = $this->uploadFile($request->file('pendamping'), 'pendamping'); + + $fotojaminan = FotoJaminan::create([ + 'pendamping' => $pendampingPath, + 'permohonan_id' => $validatedData['permohonan_id'], + 'jenis_jaminan_id' => $validatedData['jenis_jaminan_id'], + ]); + + $this->processObjekUploads($request, $fotojaminan); + $this->processLantaiUnitUploads($request, $fotojaminan); + $this->processUploads('rute', $request, $fotojaminan); + $this->processUploads('lingkungan', $request, $fotojaminan); + + DB::commit(); + return redirect()->route('surveyor.show', [ + 'id' => $validatedData['permohonan_id'], + 'form' => 'foto' + ])->with('success', 'Data foto berhasil disimpan'); + } catch (Exception $e) { + DB::rollBack(); + return response()->json(['success' => false, 'message' => 'Failed to upload: ' . $e->getMessage()], 500); + } + } + + + + public function update(FormSurveyorRequest $request, $id) + { + $validatedData = $request->validated(); + + DB::beginTransaction(); + + try { + // Update Analisa entity + $analisa = Analisa::findOrFail($id); + $analisa->update($validatedData); + + if ($analisa) { + $validatedData['analisa_id'] = $analisa->id; + $analisaTanahBangunan = AnalisaTanahBagunan::where('analisa_id', $analisa->id)->firstOrFail(); + $analisaTanahBangunan->update($validatedData); + + if ($analisaTanahBangunan) { + $this->updateSpekBangunanAnalisa($request, $analisaTanahBangunan); + } + + $analisaLingkungan = AnalisaLingkungan::where('analisa_id', $analisa->id)->firstOrFail(); + $analisaLingkungan->update($validatedData); + + if ($request->hasFile('foto_tempat')) { + $validatedData['foto_tempat'] = $this->uploadFile($request->file('foto_tempat'), 'foto_tempat'); + } + + $analisaFakta = AnalisaFakta::where('analisa_id', $analisa->id)->firstOrFail(); + $analisaFakta->update($validatedData); + } + + DB::commit(); + return redirect()->route('surveyor.show', [ + 'id' => $validatedData['permohonan_id'], + 'form' => 'inspeksi' + ])->with('success', 'Data form surveyor berhasil diperbarui'); + } catch (Exception $e) { + DB::rollback(); + return response()->json(['error' => 'Failed to update data', 'details' => $e->getMessage()], 500); + } + } + + private function updateSpekBangunanAnalisa($request, $analisaTanahBangunan) + { + + SpekBangunanAnalisa::where('analisa_tanah_bangunan_id', $analisaTanahBangunan->id)->delete(); + + foreach ($request->input('kategori', []) as $spek) { + $spek['analisa_tanah_bangunan_id'] = $analisaTanahBangunan->id; + $spekBangunan = SpekBangunanAnalisa::create($spek); + + if ($spekBangunan) { + $this->updateSpekBangunanAnalisaDetails($request, $spekBangunan); + } + } + } + + private function updateSpekBangunanAnalisaDetails($request, $spekBangunan) + { + // Delete existing SpekBagunanAnalisaDetail records + SpekBagunanAnalisaDetail::where('spek_bangunan_analisa_id', $spekBangunan->id)->delete(); + + // Create new SpekBagunanAnalisaDetail records + foreach ($request->input('name', []) as $detail) { + $detail['spek_bangunan_analisa_id'] = $spekBangunan->id; + SpekBagunanAnalisaDetail::create($detail); + } + } + + + public function updateDenah(Request $request, $id): RedirectResponse + { + + } + private function processObjekUploads(Request $request, FotoJaminan $fotojaminan) + { + $fotoObjek = $request->file('foto_objek'); + $nameObjek = $request->input('name_objek'); + $analisaType = $request->input('analisa_type'); // Tambahkan input untuk tipe analisa + + if (!is_array($fotoObjek) || !is_array($nameObjek) || count($fotoObjek) !== count($nameObjek)) { + throw new Exception("Mismatched foto_objek and name_objek inputs"); + } + + // Definisikan labels berdasarkan tipe analisa + $objekLabels = []; + if ($analisaType === 'tanah_bangunan') { + $objekLabels = [ + 'Tampak Samping Kiri', + 'Tampak Samping Kanan', + 'Nomor Rumah/Unit' + ]; + } elseif ($analisaType === 'unit') { + $objekLabels = [ + 'Tampak Loby', + 'Tampak Lift', + 'Tampak Samping Kiri Unit', + 'Tampak Samping Kanan Unit', + 'Tampak Depan Unit', + 'Nomor Unit' + ]; + } + + foreach ($fotoObjek as $index => $foto) { + if (!isset($nameObjek[$index])) { + throw new Exception("Missing description for foto_objek at index {$index}"); + } + + // Pastikan index ada dalam objekLabels + $label = isset($objekLabels[$index]) ? $objekLabels[$index] : "Foto {$index}"; + + $path = $this->uploadFile($foto, 'objek'); + ObjekJaminan::create([ + 'foto_jaminan_id' => $fotojaminan->id, + 'name_objek' => $label . ': ' . $nameObjek[$index], + 'foto_objek' => $path, + ]); + } + } + + private function processUploads($type, Request $request, FotoJaminan $fotojaminan) + { + $files = $request->file("foto_{$type}"); + $names = $request->input("name_{$type}"); + + if (!is_array($files) || !is_array($names) || count($files) !== count($names)) { + throw new Exception("Mismatched foto_{$type} and name_{$type} inputs"); + } + + foreach ($files as $index => $file) { + if (!isset($names[$index])) { + throw new Exception("Missing description for {$type} at index {$index}"); + } + + $path = $this->uploadFile($file, $type); + + $data = [ + 'foto_jaminan_id' => $fotojaminan->id, + "name_{$type}" => $names[$index], + "foto_{$type}" => $path, + ]; + + switch ($type) { + case 'rute': + RuteJaminan::create($data); + break; + case 'lingkungan': + Lingkungan::create($data); + break; + } + } + } + + private function processLantaiUnitUploads(Request $request, FotoJaminan $fotojaminan) + { + $lantaiFiles = $request->file('foto_lantai_unit'); + $lantaiNames = $request->input('name_lantai_unit'); + + if (!$lantaiFiles) { + return; + } + + if (!is_array($lantaiFiles) || !is_array($lantaiNames) || count($lantaiFiles) !== count($lantaiNames)) { + throw new Exception("Mismatched foto_lantai_unit and name_lantai_unit inputs"); + } + + foreach ($lantaiFiles as $index => $file) { + $path = $this->uploadFile($file, 'lantai'); + LantaiUnit::create([ + 'objek_jaminan_id' => $fotojaminan->id, + 'name_lantai_unit' => "Lantai " . ($index + 1), + 'foto_lantai_unit' => $path, + ]); + } + } + + private function uploadFile($file, $type) + { + if (!$file->isValid()) { + throw new Exception("Invalid file upload for {$type}"); + } + + $fileName = time() . '_' . $file->getClientOriginalName(); + $path = $file->storeAs("public/surveyor/{$type}", $fileName); + + if ($path === false) { + throw new Exception("Failed to store file for {$type}"); + } + + return str_replace('public/', '', $path); + } + + public function dataForDatatables(Request $request) { if (is_null($this->user) || !$this->user->can('debitur.view')) { @@ -172,74 +548,88 @@ class SurveyorController extends Controller * Form inspeksi. */ - public function formInspeksi($id) + public function formInspeksi($id, $jaminanId) { - $permohonan = Permohonan::with( - [ - 'user', - 'debiture.province', - 'debiture.city', - 'debiture.district', - 'debiture.village', - 'branch', - 'tujuanPenilaian', - 'penilaian' - ], - )->findOrFail($id); + $permohonan = $this->getPermohonanJaminanId($id, $jaminanId); + $branches = Branch::all(); $provinces = Province::all(); - return view('lpj::surveyor.detail', compact('permohonan', 'branches', 'provinces')); + $surveyor = $id; + $branches = Branch::all(); + $provinces = Province::all(); + $bentukTanah = BentukTanah::all(); + $konturTanah = KonturTanah::all(); + $posisiKavling = PosisiKavling::all(); + $ketinggianTanah = KetinggianTanah::all(); + $kondisiFisikTanah = KondisiFisikTanah::all(); + $jenisBangunan = JenisBangunan::all(); + $kondisiBangunan = KondisiBangunan::all(); + $sifatBangunan = SifatBangunan::all(); + $spekKategoriBagunan = SpekKategoritBangunan::all(); + $spekBangunan = SpekBangunan::all(); + $saranaPelengkap = SaranaPelengkap::all(); + $arahMataAngin = ArahMataAngin::all(); + + + $analisa = Analisa::with('analisaTanahBangunan', 'analisaLingkungan', 'analisaFakta', 'jenisJaminan') + ->where('permohonan_id', $id) + ->where('jenis_jaminan_id', $jaminanId) + ->first(); + + + + return view('lpj::surveyor.components.inspeksi', compact( + 'analisa', + 'permohonan', + 'surveyor', + 'branches', + 'provinces', + 'bentukTanah', + 'konturTanah', + 'posisiKavling', + 'kondisiFisikTanah', + 'ketinggianTanah', + 'kondisiBangunan', + 'jenisBangunan', + 'sifatBangunan', + 'spekKategoriBagunan', + 'spekBangunan', + 'saranaPelengkap', + 'arahMataAngin', + )); } /** * Denah. */ - public function denah($id) + public function denah($id, $jaminanId) { - $permohonan = Permohonan::with( - [ - 'user', - 'debiture.province', - 'debiture.city', - 'debiture.district', - 'debiture.village', - 'branch', - 'tujuanPenilaian', - 'penilaian' - ], - )->findOrFail($id); - $surveyor = $id; - $branches = Branch::all(); - $provinces = Province::all(); + $permohonan = $this->getPermohonanJaminanId($id, $jaminanId); - return view('lpj::surveyor.detail', compact('permohonan', 'surveyor', 'branches', 'provinces')); + $denah = Denah::where('permohonan_id', $id)->where('jenis_jaminan_id', $jaminanId)->first(); + + return view('lpj::surveyor.components.denah', compact('permohonan', 'denah')); } /** * Foto. */ - public function foto($id) + public function foto($id, $jaminanId) { - $permohonan = Permohonan::with( - [ - 'user', - 'debiture.province', - 'debiture.city', - 'debiture.district', - 'debiture.village', - 'branch', - 'tujuanPenilaian', - 'penilaian' - ], - )->findOrFail($id); + $permohonan = $this->getPermohonanJaminanId($id, $jaminanId); $surveyor = $id; $branches = Branch::all(); $provinces = Province::all(); - return view('lpj::surveyor.detail', compact('permohonan', 'surveyor', 'branches', 'provinces')); + $fotoJaminan = FotoJaminan::with(['objekJaminan', 'lantaiUnit' ,'ruteJaminan', 'lingkungan'])->where('permohonan_id', $id)->where('jenis_jaminan_id', $jaminanId)->first(); + + // return response()->json([ + // 'data' => $fotoJaminan, + // ]); + return view('lpj::surveyor.components.foto', compact('permohonan', 'surveyor', 'branches', 'provinces', 'fotoJaminan')); } /** @@ -537,4 +927,58 @@ class SurveyorController extends Controller } + private function getPermohonanJaminanId($id, $jaminanId) + { + return Permohonan::with([ + 'user', + 'debiture.province', + 'debiture.city', + 'debiture.district', + 'debiture.village', + 'branch', + 'tujuanPenilaian', + 'penilaian', + 'debiture.documents' => function ($query) use ($jaminanId) { + $query->where('jenis_jaminan_id', $jaminanId); + } + ]) + ->whereHas('debiture.documents', function ($query) use ($jaminanId) { + $query->where('jenis_jaminan_id', $jaminanId); + }) + ->findOrFail($id); + } + + private function getCommonData() + { + return [ + 'branches' => Branch::all(), + 'provinces' => Province::all(), + 'bentukTanah' => BentukTanah::all(), + 'konturTanah' => KonturTanah::all(), + 'posisiKavling' => PosisiKavling::all(), + 'ketinggianTanah' => KetinggianTanah::all(), + 'kondisiFisikTanah' => KondisiFisikTanah::all(), + 'jenisBangunan' => JenisBangunan::all(), + 'kondisiBangunan' => KondisiBangunan::all(), + 'sifatBangunan' => SifatBangunan::all(), + 'spekKategoriBangunan' => SpekKategoritBangunan::all(), + 'spekBangunan' => SpekBangunan::all(), + 'saranaPelengkap' => SaranaPelengkap::all(), + 'arahMataAngin' => ArahMataAngin::all() + ]; + } + + + public function submitSurveyor(Request $request, $id) + { + $permohonan = Permohonan::find($id); + $permohonan->update([ + 'status' => 'done', + ]); + return redirect() + ->route('surveyor.index') + ->with('success', 'form surveyor submitted successfully'); + + } + } diff --git a/app/Http/Requests/FormSurveyorRequest.php b/app/Http/Requests/FormSurveyorRequest.php new file mode 100644 index 0000000..b79014a --- /dev/null +++ b/app/Http/Requests/FormSurveyorRequest.php @@ -0,0 +1,133 @@ +getCommonRules(); + $actionSpecificRules = $this->getActionSpecificRules(); + + return array_merge($commonRules, $actionSpecificRules); + } + + /** + * Get common rules that apply to all actions. + */ + private function getCommonRules(): array + { + return [ + 'jenis_jaminan_id' => 'required', + 'type' => 'required', + 'permohonan_id' => 'required', + 'luas' => 'required', + 'jarak_jalan_utama' => 'required', + 'alamat' => 'required', + 'jarak_cbd_point' => 'required', + 'lebar_perkerasan_jalan' => 'required', + 'perkerasan_jalan' => 'required', + 'lalu_lintas' => 'required', + 'gol_mas_sekitar' => 'required', + 'tingkat_keramaian' => 'required', + 'terletak_diarea' => 'required', + 'disekitar_lokasi' => 'required', + 'dekat_makam' => 'required', + 'dekat_tps' => 'required', + 'merupakan_daerah' => 'required', + 'fasilitas_dekat_object' => 'required', + 'fakta_positif' => 'required', + 'fakta_negatif' => 'required', + 'rute_menuju' => 'required', + 'batas_batas' => 'required', + 'kondisi_linkungan' => 'required', + 'kondisi_lain_bangunan' => 'required', + 'informasi_dokument' => 'required', + 'peruntukan' => 'required', + 'kdb' => 'required', + 'kdh' => 'required', + 'gsb' => 'required', + 'max_lantai' => 'required', + 'klb' => 'required', + 'gss' => 'required', + 'pelebaran_jalan' => 'required', + 'nama_petugas' => 'required', + 'lat' => 'required|numeric', + 'lng' => 'required|numeric', + 'foto_tempat' => 'required', + 'keterangan' => 'required', + ]; + } + + /** + * Get rules specific to the action. + */ + private function getActionSpecificRules(): array + { + $action = $this->input('action'); + + switch ($action) { + case 'tanah_bangunan': + return $this->getTanahBangunanRules(); + case 'unit': + return $this->getUnitRules(); + default: + return []; + } + } + + /** + * Get rules specific to tanah_bangunan action. + */ + private function getTanahBangunanRules(): array + { + return [ + 'action' => 'required', + 'bentuk_tanah' => 'required', + 'kontur_tanah' => 'required', + 'posisi_kavling' => 'required', + 'ketinggian_jalan' => 'required', + 'kondisi_fisik_tanah' => 'required', + 'kontur_jalan' => 'required', + 'kondisi_bangunan' => 'required', + 'sifat_bangunan' => 'required', + 'sarana_pelengkap' => 'required', + 'luas_tanah_bagunan' => 'required', + 'tusuk_sate' => 'required', + 'name.*' => 'required|string', + 'kategori.*' => 'required|string', + 'lockland' => 'required', + 'jenis_bangunan' => 'required', + 'kondisi_bangunan' => 'required', + ]; + } + + /** + * Get rules specific to unit action. + */ + private function getUnitRules(): array + { + return [ + 'action' => 'required', + 'jenis_unit' => 'required', + 'kondisi_unit' => 'required', + 'posisi_unit' => 'required', + 'lantai' => 'required', + 'view' => 'required', + 'bentuk_unit' => 'required', + ]; + } +} diff --git a/app/Http/Requests/SurveyorRequest.php b/app/Http/Requests/SurveyorRequest.php index c86fb8a..b986f8e 100644 --- a/app/Http/Requests/SurveyorRequest.php +++ b/app/Http/Requests/SurveyorRequest.php @@ -22,6 +22,7 @@ class SurveyorRequest extends FormRequest 'ketinggian-tanah' => 'ketinggian_tanah', 'kondisi-fisik-tanah' => 'kondisi_fisik_tanah', 'kondisi-bangunan' => 'kondisi_bangunan', + 'jenis-bangunan' => 'jenis_bangunan', 'sifat-bangunan' => 'sifat_bangunan', 'sarana-pelengkap' => 'sarana_pelengkap', 'lalu_lintas_lokasi' => 'lalu_lintas_lokasi', diff --git a/app/Models/Analisa.php b/app/Models/Analisa.php new file mode 100644 index 0000000..4134384 --- /dev/null +++ b/app/Models/Analisa.php @@ -0,0 +1,46 @@ +hasOne(AnalisaTanahBagunan::class, 'analisa_id'); + } + + + public function analisaLingkungan(){ + return $this->hasOne(AnalisaLingkungan::class, 'analisa_id'); + } + + + public function analisaFakta(){ + return $this->hasOne(AnalisaFakta::class, 'analisa_id'); + } + + public function jenisJaminan(){ + return $this->belongsTo(JenisJaminan::class, 'jenis_jaminan_id'); + } + + public function analisaUnit(){ + return $this->hasOne(AnalisaUnit::class, 'analisa_id'); + } + + + protected static function newFactory(): AnalisaFactory + { + //return AnalisaFactory::new(); + } +} diff --git a/app/Models/AnalisaFakta.php b/app/Models/AnalisaFakta.php new file mode 100644 index 0000000..63015a6 --- /dev/null +++ b/app/Models/AnalisaFakta.php @@ -0,0 +1,29 @@ +belongsTo(Analisa::class); + } + + public function spekBangunanAnalisa() + { + return $this->hasMany(SpekBangunanAnalisa::class, 'analisa_tanah_bangunan_id'); + } + + public function spekBagunanAnalisaDetail() + { + return $this->hasMany(SpekBagunanAnalisaDetail::class, 'analisa_tanah_bangunan_id'); + } + + protected static function newFactory(): AnalisaTanahBagunanFactory + { + //return AnalisaTanahBagunanFactory::new(); + } +} diff --git a/app/Models/AnalisaUnit.php b/app/Models/AnalisaUnit.php new file mode 100644 index 0000000..4c0b3a7 --- /dev/null +++ b/app/Models/AnalisaUnit.php @@ -0,0 +1,23 @@ +belongsTo(JenisJaminan::class, 'jenis_jaminan_id'); + } + + protected static function newFactory(): DenahFactory + { + //return DenahFactory::new(); + } +} diff --git a/app/Models/FotoJaminan.php b/app/Models/FotoJaminan.php new file mode 100644 index 0000000..940ecfe --- /dev/null +++ b/app/Models/FotoJaminan.php @@ -0,0 +1,41 @@ +hasMany(ObjekJaminan::class, 'foto_jaminan_id'); + } + + + public function ruteJaminan(){ + return $this->hasMany(RuteJaminan::class, 'foto_jaminan_id'); + } + + + public function lingkungan(){ + return $this->hasMany(Lingkungan::class, 'foto_jaminan_id'); + } + + + public function lantaiUnit(){ + return $this->hasMany(lantaiUnit::class, 'objek_jaminan_id', 'id'); + } +} diff --git a/app/Models/LantaiUnit.php b/app/Models/LantaiUnit.php new file mode 100644 index 0000000..b40a5c3 --- /dev/null +++ b/app/Models/LantaiUnit.php @@ -0,0 +1,24 @@ +hasMany(LantaiUnit::class, 'objek_jaminan_id', 'foto_jaminan_id'); + } + + protected static function newFactory(): ObjekJaminanFactory + { + //return ObjekJaminanFactory::new(); + } +} diff --git a/app/Models/RuteJaminan.php b/app/Models/RuteJaminan.php new file mode 100644 index 0000000..9b88940 --- /dev/null +++ b/app/Models/RuteJaminan.php @@ -0,0 +1,24 @@ +id(); + $table->enum('type', ['unit', 'tanah_bangunan']); + $table->unsignedBigInteger('permohonan_id'); + $table->foreign('permohonan_id')->references('id')->on('permohonan'); + $table->string('luas'); + $table->char('authorized_status', 1)->nullable(); + $table->timestamp('authorized_at')->nullable(); + $table->unsignedBigInteger('authorized_by')->nullable(); + $table->timestamps(); + $table->unsignedBigInteger('created_by')->nullable(); + $table->unsignedBigInteger('updated_by')->nullable(); + $table->timestamp('deleted_at')->nullable(); + $table->unsignedBigInteger('deleted_by')->nullable(); + }); +} + + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('analisa'); + } +}; diff --git a/database/migrations/2024_10_16_153558_create_analisa_tanah_bangunan_table.php b/database/migrations/2024_10_16_153558_create_analisa_tanah_bangunan_table.php new file mode 100644 index 0000000..585dbf4 --- /dev/null +++ b/database/migrations/2024_10_16_153558_create_analisa_tanah_bangunan_table.php @@ -0,0 +1,51 @@ +id(); + + $table->unsignedBigInteger('analisa_id'); + $table->foreign('analisa_id')->references('id')->on('analisa'); + $table->string('bentuk_tanah'); + $table->string('kontur_tanah'); + $table->string('ketinggian_jalan'); + $table->string('kontur_jalan'); + $table->string('posis_kavling'); + $table->enum('tusuk_sate', ['yes', 'no']); + $table->enum('lockland', ['yes', 'no']); + $table->string('kondisi_fisik_tanah'); + $table->string('jenis_bangunan'); + $table->string('kondisi_bangunan'); + $table->string('sifat_bangunan'); + $table->string('sarana_pelengkap'); + $table->char('authorized_status', 1)->nullable(); + $table->timestamp('authorized_at')->nullable(); + $table->unsignedBigInteger('authorized_by')->nullable(); + + $table->timestamps(); + $table->unsignedBigInteger('created_by')->nullable(); + $table->unsignedBigInteger('updated_by')->nullable(); + + $table->timestamp('deleted_at')->nullable(); + $table->unsignedBigInteger('deleted_by')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('analisa_tanah_bangunan'); + } +}; diff --git a/database/migrations/2024_10_16_153613_create_analisa_unit_table.php b/database/migrations/2024_10_16_153613_create_analisa_unit_table.php new file mode 100644 index 0000000..7638518 --- /dev/null +++ b/database/migrations/2024_10_16_153613_create_analisa_unit_table.php @@ -0,0 +1,47 @@ +id(); + + $table->unsignedBigInteger('analisa_id'); + $table->foreign('analisa_id')->references('id')->on('analisa'); + + $table->string('jenis_unit'); + $table->string('kondisi_unit'); + $table->string('posisi_unit'); + $table->string('lantai'); + $table->string('view'); + $table->string('bentuk_unit'); + + $table->char('authorized_status', 1)->nullable(); + $table->timestamp('authorized_at')->nullable(); + $table->unsignedBigInteger('authorized_by')->nullable(); + + $table->timestamps(); + $table->unsignedBigInteger('created_by')->nullable(); + $table->unsignedBigInteger('updated_by')->nullable(); + + $table->timestamp('deleted_at')->nullable(); + $table->unsignedBigInteger('deleted_by')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('analisa_unit'); + } +}; diff --git a/database/migrations/2024_10_16_153727_create_spek_bagunan_analisa_table.php b/database/migrations/2024_10_16_153727_create_spek_bagunan_analisa_table.php new file mode 100644 index 0000000..9da658b --- /dev/null +++ b/database/migrations/2024_10_16_153727_create_spek_bagunan_analisa_table.php @@ -0,0 +1,42 @@ +id(); + $table->string('name'); + + // Foreign key to analisa_tanah_bangunan + $table->unsignedBigInteger('analisa_tanah_bangunan_id'); + $table->foreign('analisa_tanah_bangunan_id')->references('id')->on('analisa_tanah_bangunan'); + + $table->char('authorized_status', 1); + $table->timestamp('authorized_at')->nullable(); + $table->unsignedBigInteger('authorized_by')->nullable(); + + $table->timestamps(); + $table->unsignedBigInteger('created_by'); + $table->unsignedBigInteger('updated_by')->nullable(); + + $table->timestamp('deleted_at')->nullable(); + $table->unsignedBigInteger('deleted_by')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('spek_bagunan_analisa'); + } +}; diff --git a/database/migrations/2024_10_16_153743_create_spek_bagunan_analisa_detail_table.php b/database/migrations/2024_10_16_153743_create_spek_bagunan_analisa_detail_table.php new file mode 100644 index 0000000..e3f190b --- /dev/null +++ b/database/migrations/2024_10_16_153743_create_spek_bagunan_analisa_detail_table.php @@ -0,0 +1,42 @@ +id(); + $table->string('kategori'); + $table->string('name'); + + // Foreign key to spek_bangunan_analisa + $table->unsignedBigInteger('spek_bangunan_analisa_id'); + $table->foreign('spek_bangunan_analisa_id')->references('id')->on('spek_bagunan_analisa'); + + $table->char('authorized_status', 1); + $table->timestamp('authorized_at')->nullable(); + $table->unsignedBigInteger('authorized_by')->nullable(); + + $table->timestamps(); + $table->unsignedBigInteger('created_by'); + $table->unsignedBigInteger('updated_by')->nullable(); + + $table->timestamp('deleted_at')->nullable(); + $table->unsignedBigInteger('deleted_by')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('spek_bagunan_analisa_detail'); + } +}; diff --git a/database/migrations/2024_10_16_153811_create_analisa_fakta_table.php b/database/migrations/2024_10_16_153811_create_analisa_fakta_table.php new file mode 100644 index 0000000..7e05782 --- /dev/null +++ b/database/migrations/2024_10_16_153811_create_analisa_fakta_table.php @@ -0,0 +1,60 @@ +id(); + // Foreign key to analisa table + $table->unsignedBigInteger('analisa_id'); + $table->foreign('analisa_id')->references('id')->on('analisa'); + + $table->text('fakta_positif'); + $table->text('fakta_negatif'); + $table->text('rute_menju'); + $table->string('batas_batas'); + $table->text('kondisi_linkungan'); + $table->text('kondisi_lain_bangunan'); + $table->text('informasi_dokument'); + $table->string('peruntukan'); + $table->string('kdb'); + $table->string('kdh'); + $table->string('gsb'); + $table->string('max_lantai'); + $table->string('klb'); + $table->string('gss'); + $table->string('pelebaran_jalan'); + $table->string('nama_petugas'); + $table->string('foto_tempat'); + $table->string('lat'); + $table->string('lng'); + $table->text('keterangan'); + + $table->char('authorized_status', 1); + $table->timestamp('authorized_at')->nullable(); + $table->unsignedBigInteger('authorized_by')->nullable(); + + $table->timestamps(); // created_at and updated_at + $table->unsignedBigInteger('created_by'); + $table->unsignedBigInteger('updated_by')->nullable(); + + $table->timestamp('deleted_at')->nullable(); + $table->unsignedBigInteger('deleted_by')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('analisa_fakta'); + } +}; diff --git a/database/migrations/2024_10_16_153831_create_analisa_lingkungan_table.php b/database/migrations/2024_10_16_153831_create_analisa_lingkungan_table.php new file mode 100644 index 0000000..e0c5e22 --- /dev/null +++ b/database/migrations/2024_10_16_153831_create_analisa_lingkungan_table.php @@ -0,0 +1,53 @@ +id(); + $table->unsignedBigInteger('analisa_id'); + $table->foreign('analisa_id')->references('id')->on('analisa'); + + $table->string('jarak_jalan_utama'); + $table->string('alamat'); + $table->string('jarak_cbd_point'); + $table->string('lebar_perkerasan_jalan'); + $table->string('perkerasan_jalan'); + $table->string('lalu_lintas'); + $table->string('gol_mas_sekitar'); + $table->string('tingkat_keramaian'); + $table->string('terletak_diarea'); + $table->string('disekitar_lokasi'); + $table->string('dekat_makam'); + $table->enum('dekat_tps', ['yes', 'no']); + $table->string('merupakan_daerah'); + $table->string('fasilitas_dekat_object'); + + $table->char('authorized_status', 1); + $table->timestamp('authorized_at')->nullable(); + $table->unsignedBigInteger('authorized_by')->nullable(); + + $table->timestamps(); // created_at and updated_at + $table->unsignedBigInteger('created_by'); + $table->unsignedBigInteger('updated_by')->nullable(); + + $table->timestamp('deleted_at')->nullable(); + $table->unsignedBigInteger('deleted_by')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('analisa_lingkungan'); + } +}; diff --git a/database/migrations/2024_10_16_153841_create_denah_table.php b/database/migrations/2024_10_16_153841_create_denah_table.php new file mode 100644 index 0000000..308a7ad --- /dev/null +++ b/database/migrations/2024_10_16_153841_create_denah_table.php @@ -0,0 +1,42 @@ +id(); + // Foreign key to permohonan table + $table->unsignedBigInteger('permohonan_id'); + $table->foreign('permohonan_id')->references('id')->on('permohonan'); + + $table->string('foto_denah'); + $table->string('luas'); + + $table->char('authorized_status', 1)->nullable(); + $table->timestamp('authorized_at')->nullable(); + $table->unsignedBigInteger('authorized_by')->nullable(); + + $table->timestamps(); // created_at and updated_at + $table->unsignedBigInteger('created_by')->nullable(); + $table->unsignedBigInteger('updated_by')->nullable(); + + $table->timestamp('deleted_at')->nullable(); + $table->unsignedBigInteger('deleted_by')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('denah'); + } +}; diff --git a/database/migrations/2024_10_16_153902_create_foto_jaminan_table.php b/database/migrations/2024_10_16_153902_create_foto_jaminan_table.php new file mode 100644 index 0000000..f0e1000 --- /dev/null +++ b/database/migrations/2024_10_16_153902_create_foto_jaminan_table.php @@ -0,0 +1,40 @@ +id(); + $table->unsignedBigInteger('permohonan_id'); + $table->foreign('permohonan_id')->references('id')->on('permohonan'); + + $table->string('pendamping'); + + $table->char('authorized_status', 1)->nullable(); + $table->timestamp('authorized_at')->nullable(); + $table->unsignedBigInteger('authorized_by')->nullable(); + + $table->timestamps(); // created_at and updated_at + $table->unsignedBigInteger('created_by')->nullable(); + $table->unsignedBigInteger('updated_by')->nullable(); + + $table->timestamp('deleted_at')->nullable(); + $table->unsignedBigInteger('deleted_by')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('foto_jaminan'); + } +}; diff --git a/database/migrations/2024_10_16_153918_create_objek_jaminan_table.php b/database/migrations/2024_10_16_153918_create_objek_jaminan_table.php new file mode 100644 index 0000000..b55f7eb --- /dev/null +++ b/database/migrations/2024_10_16_153918_create_objek_jaminan_table.php @@ -0,0 +1,42 @@ +id(); + // Foreign key to foto_jaminan table + $table->unsignedBigInteger('foto_jaminan_id'); + $table->foreign('foto_jaminan_id')->references('id')->on('foto_jaminan'); + + $table->string('name'); + $table->string('foto_objek'); + + $table->char('authorized_status', 1)->nullable(); + $table->timestamp('authorized_at')->nullable(); + $table->unsignedBigInteger('authorized_by')->nullable(); + + $table->timestamps(); // created_at and updated_at + $table->unsignedBigInteger('created_by')->nullable(); + $table->unsignedBigInteger('updated_by')->nullable(); + + $table->timestamp('deleted_at')->nullable(); + $table->unsignedBigInteger('deleted_by')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('objek_jaminan'); + } +}; diff --git a/database/migrations/2024_10_16_153945_create_lingkungan_table.php b/database/migrations/2024_10_16_153945_create_lingkungan_table.php new file mode 100644 index 0000000..58f4289 --- /dev/null +++ b/database/migrations/2024_10_16_153945_create_lingkungan_table.php @@ -0,0 +1,42 @@ +id(); + // Foreign key to foto_jaminan table + $table->unsignedBigInteger('foto_jaminan_id'); + $table->foreign('foto_jaminan_id')->references('id')->on('foto_jaminan'); + + $table->string('name_lingkungan'); + $table->string('foto_linkungan'); + + $table->char('authorized_status', 1)->nullable(); + $table->timestamp('authorized_at')->nullable(); + $table->unsignedBigInteger('authorized_by')->nullable(); + + $table->timestamps(); + $table->unsignedBigInteger('created_by')->nullable(); + $table->unsignedBigInteger('updated_by')->nullable(); + + $table->timestamp('deleted_at')->nullable(); + $table->unsignedBigInteger('deleted_by')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('lingkungan'); + } +}; diff --git a/database/migrations/2024_10_16_155227_create_rute_jaminan_table.php b/database/migrations/2024_10_16_155227_create_rute_jaminan_table.php new file mode 100644 index 0000000..6db988e --- /dev/null +++ b/database/migrations/2024_10_16_155227_create_rute_jaminan_table.php @@ -0,0 +1,43 @@ +id(); + + // Foreign key to foto_jaminan table + $table->unsignedBigInteger('foto_jaminan_id'); + $table->foreign('foto_jaminan_id')->references('id')->on('foto_jaminan'); + + $table->string('name'); + $table->string('foto_rute'); + + $table->char('authorized_status', 1)->nullable(); + $table->timestamp('authorized_at')->nullable(); + $table->unsignedBigInteger('authorized_by')->nullable(); + + $table->timestamps(); // created_at and updated_at + $table->unsignedBigInteger('created_by')->nullable(); + $table->unsignedBigInteger('updated_by')->nullable(); + + $table->timestamp('deleted_at')->nullable(); + $table->unsignedBigInteger('deleted_by')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('rute_jaminan'); + } +}; diff --git a/database/migrations/2024_10_22_064209_create_lantai_unit_table.php b/database/migrations/2024_10_22_064209_create_lantai_unit_table.php new file mode 100644 index 0000000..bf3c8c0 --- /dev/null +++ b/database/migrations/2024_10_22_064209_create_lantai_unit_table.php @@ -0,0 +1,40 @@ +id(); + $table->unsignedBigInteger('objek_jaminan_id'); + $table->string('name_lantai_unit'); + $table->string('foto_lantai_unit'); + + $table->char('authorized_status', 1)->nullable(); + $table->timestamp('authorized_at')->nullable(); + $table->unsignedBigInteger('authorized_by')->nullable(); + $table->timestamps(); + $table->unsignedBigInteger('created_by')->nullable(); + $table->unsignedBigInteger('updated_by')->nullable(); + + $table->timestamp('deleted_at')->nullable(); + $table->unsignedBigInteger('deleted_by')->nullable(); + + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('lantai_unit'); + } +}; diff --git a/resources/views/surveyor/components/apartemen-kantor.blade.php b/resources/views/surveyor/components/apartemen-kantor.blade.php index b9c021a..05e0adb 100644 --- a/resources/views/surveyor/components/apartemen-kantor.blade.php +++ b/resources/views/surveyor/components/apartemen-kantor.blade.php @@ -10,16 +10,18 @@
- @error('bentuk_tanah') + @error('luas') {{ $message }} @enderror
@@ -30,37 +32,41 @@
- @error('bentuk_tanah') + @error('jenis_unit') {{ $message }} @enderror
- +
- @error('konturTanah') + @error('kondisi_unit') {{ $message }} @enderror
@@ -72,17 +78,17 @@
- @error('ketinggianTanah') + @error('posisi_unit') {{ $message }} @enderror
@@ -95,17 +101,17 @@
- @error('posisiKavling') + @error('lantai') {{ $message }} @enderror
@@ -117,17 +123,17 @@
- @error('kondisiFisikTanah') + @error('view') {{ $message }} @enderror
@@ -137,17 +143,17 @@
- @error('kondisiFisikTanah') + @error('bentuk_unit') {{ $message }} @enderror
diff --git a/resources/views/surveyor/components/card-tambah.blade.php b/resources/views/surveyor/components/card-tambah.blade.php new file mode 100644 index 0000000..a0494ef --- /dev/null +++ b/resources/views/surveyor/components/card-tambah.blade.php @@ -0,0 +1,164 @@ +
+ @foreach ($permohonan->debiture->documents as $dokumen) + @php + $jenisAnalisa = null; + $perbandingan = null; + if (request()->has('form') && request('form') === 'denah' && isset($denah)) { + $denahIds = []; + $permohonaDenahId = []; + foreach ($denah as $item) { + $denahIds[] = $item->jenis_jaminan_id; + $permohonaDenahId[] = $item->permohonan_id; + } + $perbandingan = + in_array($dokumen->jenisJaminan->id, $denahIds) && in_array($permohonan->id, $permohonaDenahId); + } elseif (request()->has('form') && request('form') === 'foto' && isset($fotojaminan)) { + $fotoIds = []; + $permohonanFotoId = []; + foreach ($fotojaminan as $item) { + $fotoIds[] = $item->jenis_jaminan_id; + $permohonanFotoId[] = $item->permohonan_id; + } + $perbandingan = + in_array($permohonan->id, $permohonanFotoId) && in_array($dokumen->jenisJaminan->id, $fotoIds); + } elseif (request()->has('form') && request('form') === 'inspeksi' && isset($analisa)) { + $jenisIds = []; + foreach ($analisa as $item) { + $jenisIds[] = $item->jenis_jaminan_id; + } + + $perbandingan = isset($analisa) && in_array($dokumen->jenisJaminan->id, $jenisIds); + } + @endphp + @if ($perbandingan) +
+
+
+
+ + + + +
+ +
+
+
+ +
+
+ {{-- Display your analisa data here --}} +
Tipe Analisa +

+ {{-- {{ $analisa->type }} --}} +

+
+ {{-- Add more fields as needed --}} + + {{-- @endif + @if ($analisa->analisaLingkungan) --}} +
+
+ Analisa Lingkungan +

+ {{-- Display relevant analisaLingkungan data --}} +

+
+ {{-- @endif --}} + {{-- @if ($analisa->analisaFakta) --}} +
+
+ Analisa Fakta +

{{-- Display relevant analisaFakta data --}} +

+
+ {{-- @endif --}} +
+
+ @else + @if (request()->has('form') && request('form') === 'denah') + + @elseif(request()->has('form') && request('form') === 'foto') + + @elseif(request()->has('form') && request('form') === 'inspeksi') + + @endif + +
+
+
+
+ + + + +
+ +
+
+
+
+ + Tambah {{ request('form') }} + + + Inspeksi {{ $dokumen->jenisJaminan->name ?? '' }} + +
+ +
+
+
+ @endif + @endforeach +
diff --git a/resources/views/surveyor/components/data-pembanding.blade.php b/resources/views/surveyor/components/data-pembanding.blade.php index 09d6684..f054469 100644 --- a/resources/views/surveyor/components/data-pembanding.blade.php +++ b/resources/views/surveyor/components/data-pembanding.blade.php @@ -1,117 +1,30 @@ -
- @if(isset($debitur->id)) - - @method('PUT') - @endif - @csrf -
- -
-
-
- - @error('province_code') - {{ $message }} - @enderror -
-
- - @error('city_code') - {{ $message }} - @enderror -
-
-
- - @error('district_code') - {{ $message }} - @enderror -
-
- - @error('district_code') - {{ $message }} - @enderror -
-
- - @error('postal_code') - {{ $message }} - @enderror -
-
-
- - @error('address') - {{ $message }} - @enderror
-
diff --git a/resources/views/surveyor/components/denah.blade.php b/resources/views/surveyor/components/denah.blade.php index 07b158a..e922fa5 100644 --- a/resources/views/surveyor/components/denah.blade.php +++ b/resources/views/surveyor/components/denah.blade.php @@ -1,25 +1,184 @@ -
- @if(isset($debitur->id)) - - @method('PUT') - @endif - @csrf +@extends('layouts.main') -
-
- -
-
+{{-- @section('breadcrumbs') + {{ Breadcrumbs::render(request()->route()->getName()) }} +@endsection --}} - - +@section('content') +
+
+
+
+

+ Data Jaminan +

+ +
+
+ @foreach ($permohonan->debiture->documents as $dokumen) +
+ + +
+ @endforeach
-
+ + +
+
+ + @if (isset($debitur->id)) + + @method('PUT') + @endif + @csrf + + + +
+
+ +
+
+
+
+ + +
+
+ @error('foto_denah') + {{ $message }} + @enderror +
+ +
+ +
+
+ +
+
+ + + +
+ +
+ @error('luas') + {{ $message }} + @enderror +
+
+
+ +
+ + + +
+
- + @endsection diff --git a/resources/views/surveyor/components/form-inspeksi.blade.php b/resources/views/surveyor/components/form-inspeksi.blade.php deleted file mode 100644 index 009e534..0000000 --- a/resources/views/surveyor/components/form-inspeksi.blade.php +++ /dev/null @@ -1,600 +0,0 @@ -@push('scripts') - {{-- --}} -@endpush - - -
- @if (isset($debitur->id)) - - @method('PUT') - @endif - @csrf - - - @if (false) - @include('lpj::surveyor.components.apartemen-kantor') - @else - @include('lpj::surveyor.components.tanah-bangunan') - @endif - - -
-
-

Analisis Lingkungan

-
-
- -
-
-
- - -
-
- - -
-
- - -
-
-
- -
- -
- - - @error('perkerasanJalan') - {{ $message }} - @enderror -
-
- - -
- -
- - - @error('laluLintasDepanLoaksi') - {{ $message }} - @enderror -
-
- - -
- -
- - - @error('golHidupSekitar') - {{ $message }} - @enderror -
-
- - -
- -
- - - @error('tingkatKeramaian') - {{ $message }} - @enderror -
-
- - -
- -
- - - @error('tataLetakArea') - {{ $message }} - @enderror -
-
- - -
- -
-
- - -
- - @error('telahAdaBagunan') - {{ $message }} - @enderror -
-
- - -
- -
-
- - -
- - @error('bentuk_tanah') - {{ $message }} - @enderror -
-
- - -
- -
-
- - -
- - @error('bentuk_tanah') - {{ $message }} - @enderror -
-
- - -
- -
- - - @error('merupakanDaerah') - {{ $message }} - @enderror -
-
- - - -
- -
- - - @error('fasilitasUmumDekat') - {{ $message }} - @enderror -
-
-
-
- - -
-
-

Analisis Fakta

-
-
-
- -
- - @error('faktorPositif') - {{ $message }} - @enderror -
-
- -
- -
- - @error('faktorNegatif') - {{ $message }} - @enderror -
-
- -
- -
- - @error('ruteMenuju') - {{ $message }} - @enderror -
-
- -
- -
-
-
- -
-
- -
-
- - @error('kondisiFisikTanah') - {{ $message }} - @enderror -
-
- - -
- -
- - @error('kondisiLainTerkaitLingkungan') - {{ $message }} - @enderror -
-
- - -
- -
- - @error('kondisiLainTerkaitBangunan') - {{ $message }} - @enderror -
-
- -
- -
- - @error('informasiTerkaitDokumen') - {{ $message }} - @enderror -
-
- -
-
- - -
- -
-

Informasi Dinas Tata Ruang

-
- - -
- -
- -
- - @error('peruntukan') - {{ $message }} - @enderror -
-
- -
- -
- - @error('kdb') - {{ $message }} - @enderror -
-
- - -
- -
- - @error('kdh') - {{ $message }} - @enderror -
-
- -
- -
- - @error('gsb') - {{ $message }} - @enderror -
-
- -
- -
- - @error('maxLantai') - {{ $message }} - @enderror -
-
- -
- -
- - @error('klb') - {{ $message }} - @enderror -
-
- -
- -
- - @error('gss') - {{ $message }} - @enderror -
-
- -
- -
- - @error('pelebaranJalan') - {{ $message }} - @enderror -
-
- -
- -
- - @error('petugasTK') - {{ $message }} - @enderror -
-
-
- - -
-
- -
-
- - - -
-
- -
- -
- - -
-
-

Catatan yang Perlu Diperhatikan

- -
-
-
- -
- - -
- -
- - -@push('scripts') - - - - - -@endpush diff --git a/resources/views/surveyor/components/foto.blade.php b/resources/views/surveyor/components/foto.blade.php index 9d39cd3..4ca2845 100644 --- a/resources/views/surveyor/components/foto.blade.php +++ b/resources/views/surveyor/components/foto.blade.php @@ -1,89 +1,557 @@ -
- @if (isset($debitur->id)) - - @method('PUT') - @endif - @csrf +@extends('layouts.main') -
-
-

Rute Menuju Lokasi

- - - -
-
- - -
-
+{{-- @section('breadcrumbs') + {{ Breadcrumbs::render(request()->route()->getName()) }} +@endsection --}} - -
-
-

Objeck Jaminan

- - - -
-
-
- - - -
- -
-
- - -
-
-

Linkungan

- - - -
-
- - -
-
- -
- - -@push('script') - - - @endpush diff --git a/resources/views/surveyor/components/inspeksi.blade.php b/resources/views/surveyor/components/inspeksi.blade.php new file mode 100644 index 0000000..4e0e978 --- /dev/null +++ b/resources/views/surveyor/components/inspeksi.blade.php @@ -0,0 +1,761 @@ +@extends('layouts.main') + +{{-- @section('breadcrumbs') + {{ Breadcrumbs::render(request()->route()->getName()) }} +@endsection --}} + +@section('content') +
+
+
+
+

+ Data Jaminan +

+ +
+ @php + $jenisJaminanData = null; + + @endphp + +
+ @foreach ($permohonan->debiture->documents as $dokumen) + @php + $jenisJaminanData = $dokumen->jenisJaminan->name ?? ''; + @endphp + +
+ + +
+ @endforeach +
+
+
+ + + +
+
+
+ @if (isset($analisa->id)) + + @method('PUT') + @endif + @csrf + + + + + @php + $analisaType = 'unknown'; + $data = [ + 'tanah' => 'Tanah', + 'unit_rumah' => 'Rumah Tinggal / Ruko (Unit) / Apartemen (Unit) / Gudang', + 'tanah_bangunan' => 'Kawasan Industrial / Komersil / Residensial - Perumahan', + 'unit_gedung' => 'Gedung Apartement / Kantor / Condotel (Strata Title)', + 'tanah_bangunan' => 'Mall', + ]; + + + if (isset($analisa->id)) { + $analisaType = $analisa->type; + } else { + foreach ($data as $key => $value) { + if (isset($jenisJaminanData) && + trim(strtolower($jenisJaminanData)) === trim(strtolower($value))) { + $analisaType = $key; + break; + } + } + } + if ($analisaType === 'tanah') { + $analisaType = 'tanah_bangunan'; + } + + if ($analisaType === 'unit_rumah' || $analisaType === 'unit_gedung') { + $analisaType = 'unit'; + } + @endphp + + + + + @if ($analisaType == 'tanah_bangunan') + @include('lpj::surveyor.components.tanah-bangunan') + @else + @include('lpj::surveyor.components.apartemen-kantor') + @endif + + +
+
+

Analisis Lingkungan

+
+
+ +
+
+
+ + +
+
+ + +
+
+ + +
+
+
+ + +
+ +
+ +
+ +
+ + + @error('perkerasan_jalan') + {{ $message }} + @enderror +
+
+ + +
+ +
+ + + @error('lalu_lintas') + {{ $message }} + @enderror +
+
+ + +
+ +
+ + + @error('gol_mas_sekitar') + {{ $message }} + @enderror +
+
+ + +
+ +
+ + + @error('tingkat_keramaian') + {{ $message }} + @enderror +
+
+ + +
+ +
+ + + @error('terletak_diarea') + {{ $message }} + @enderror +
+
+ + +
+ +
+
+ + +
+ + @error('disekitar_lokasi') + {{ $message }} + @enderror +
+
+ + +
+ +
+
+ + +
+ + @error('dekatMakam') + {{ $message }} + @enderror +
+
+ + +
+ +
+
+ + +
+ + @error('dekatTps') + {{ $message }} + @enderror +
+
+ + +
+ +
+ + + @error('merupakan_daerah') + {{ $message }} + @enderror +
+
+ + + +
+ +
+ + + @error('fasilitas_dekat_object') + {{ $message }} + @enderror +
+
+
+
+ +
+
+

Analisis Fakta

+
+
+
+ +
+ + @error('fakta_positif') + {{ $message }} + @enderror +
+
+ +
+ +
+ + @error('fakta_negatif') + {{ $message }} + @enderror +
+
+ +
+ +
+ + @error('rute_menuju') + {{ $message }} + @enderror +
+
+ +
+ +
+
+
+ +
+
+ +
+
+ + @error('batas_batas') + {{ $message }} + @enderror +
+
+ + +
+ +
+ + @error('kondisi_linkungan') + {{ $message }} + @enderror +
+
+ + +
+ +
+ + @error('kondisi_lain_bangunan') + {{ $message }} + @enderror +
+
+ +
+ +
+ + @error('informasi_dokument') + {{ $message }} + @enderror +
+
+ +
+
+ + +
+ +
+

Informasi Dinas Tata Ruang

+
+ + +
+ +
+ +
+ + @error('peruntukan') + {{ $message }} + @enderror +
+
+ +
+ +
+ + @error('kdb') + {{ $message }} + @enderror +
+
+ + +
+ +
+ + @error('kdh') + {{ $message }} + @enderror +
+
+ +
+ +
+ + @error('gsb') + {{ $message }} + @enderror +
+
+ +
+ +
+ + @error('maxLantai') + {{ $message }} + @enderror +
+
+ +
+ +
+ + @error('klb') + {{ $message }} + @enderror +
+
+ +
+ +
+ + @error('gss') + {{ $message }} + @enderror +
+
+ +
+ +
+ + @error('pelebaran_jalan') + {{ $message }} + @enderror +
+
+ +
+ +
+ + @error('nama_petugas') + {{ $message }} + @enderror +
+
+
+ + +
+ + +
+ +
+
+ + + +
+
+ +
+ @if (old('foto_tempat', isset($analisa->analisaFakta) ? $analisa->analisaFakta->foto_tempat : '')) + Gambar Tempat + @endif +
+ + + + + @error('foto_tempat') + {{ $message }} + @enderror + + + +
+ +
+ + +
+
+

Catatan yang Perlu Diperhatikan +

+ +
+
+
+ +
+ +
+
+
+
+
+ +@endsection +@push('scripts') + +@endpush diff --git a/resources/views/surveyor/components/tanah-bangunan.blade.php b/resources/views/surveyor/components/tanah-bangunan.blade.php index 3ccb72f..11a8652 100644 --- a/resources/views/surveyor/components/tanah-bangunan.blade.php +++ b/resources/views/surveyor/components/tanah-bangunan.blade.php @@ -10,11 +10,13 @@
@@ -29,18 +31,19 @@
- @if (isset($arahMataAngin)) @foreach ($arahMataAngin as $item) - + @endforeach @endif - @error('bentuk_tanah') + @error('hadapMataAngin') {{ $message }} @enderror
@@ -50,13 +53,24 @@
- @@ -67,21 +81,25 @@
+ +
- @if (isset($konturTanah)) @foreach ($konturTanah as $item) - + @endforeach @endif - @error('konturTanah') + @error('kontur_tanah') {{ $message }} @enderror
@@ -93,17 +111,19 @@
- @error('ketinggianTanah') + @error('ketinggian_jalan') {{ $message }} @enderror
@@ -111,22 +131,23 @@ -
- @error('bentuk_tanah') + @error('kontur_jalan') {{ $message }} @enderror
@@ -136,18 +157,18 @@
- @if (isset($posisiKavling)) @foreach ($posisiKavling as $item) - + @endforeach @endif - - @error('posisiKavling') + @error('posisi_kavling') {{ $message }} @enderror
@@ -160,16 +181,18 @@
- @error('bentuk_tanah') + @error('tusuk_sate') {{ $message }} @enderror
@@ -181,16 +204,17 @@
- - @error('bentuk_tanah') + @error('lockland') {{ $message }} @enderror
@@ -202,17 +226,19 @@
- @error('kondisiFisikTanah') + @error('kondisi_fisik_tanah') {{ $message }} @enderror
@@ -220,28 +246,30 @@
+ +@if ($analisaType == 'tanah_bangunan')

Analisa Bangunan

- -
- @error('bentuk_tanah') + @error('luas_tanah_bagunan') {{ $message }} @enderror
@@ -253,17 +281,19 @@
- @error('jenisBangunan') + @error('jenis_bangunan') {{ $message }} @enderror
@@ -274,17 +304,19 @@
- @error('kondisiBangunan') + @error('kondisi_bangunan') {{ $message }} @enderror
@@ -295,65 +327,72 @@
- @error('sifatBangunan') + @error('sifat_bangunan') {{ $message }} @enderror
-
- -
- -
- @if (@isset($spekKategoriBagunan)) - @foreach ($spekKategoriBagunan as $item) -
- -
- - - @error('kondisiFisikTanah') - {{ $message }} - @enderror - -
-
- @endforeach - - @endif - - +
+
+ +
+
+ +
+ @if (@isset($spekKategoriBagunan)) + @foreach ($spekKategoriBagunan as $item) +
+ +
+ + @error('name') + {{ $message }} + @enderror +
+
+ @endforeach + @endif +
+ +
+
- - +
+
@@ -364,21 +403,78 @@
- @error('saranaPelengkap') + @error('sarana_pelengkap') {{ $message }} @enderror
-
+@endif + +@push('scripts') + +@endpush diff --git a/resources/views/surveyor/detail.blade.php b/resources/views/surveyor/detail.blade.php index 6e9754f..ff3bd3e 100644 --- a/resources/views/surveyor/detail.blade.php +++ b/resources/views/surveyor/detail.blade.php @@ -5,6 +5,18 @@ @endsection @section('content') + @push('style') + + @endpush +
@@ -43,156 +55,170 @@ {{ $permohonan->penilaian->keterangan }}
-
-
-
-

- Data Jaminan -

-
-
- @foreach ($permohonan->debiture->documents as $dokumen) -
- -