diff --git a/app/Http/Controllers/SurveyorController.php b/app/Http/Controllers/SurveyorController.php index 537b3fb..3d68811 100644 --- a/app/Http/Controllers/SurveyorController.php +++ b/app/Http/Controllers/SurveyorController.php @@ -360,6 +360,14 @@ class SurveyorController extends Controller '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', + 'name_rute_lainnya.*' => 'nullable|string', + 'foto_rute_lainnya.*' => 'nullable|image|mimes:jpeg,png,jpg,gif,svg|max:2048', + 'foto_lantai_lainnya.*' => 'nullable|image|mimes:jpeg,png,jpg,gif,svg|max:2048', + 'name_lantai_lainnya.*' => 'nullable|string|max:255', + 'foto_basement.*' => 'nullable|image|mimes:jpeg,png,jpg,gif,svg|max:2048', + 'name_basement.*' => 'nullable|string|max:255', + 'foto_gerbang' => 'nullable|image|mimes:jpeg,png,jpg,gif,svg|max:2048', + 'name_gerbang' => 'nullable|string|max:255', ]); // DB::beginTransaction(); @@ -369,6 +377,9 @@ class SurveyorController extends Controller $rute_menuju_lokasi = []; $object_jaminan = []; $lingkungan = []; + $foto_lantai_unit = []; + $foto_lantai_lainnya = []; + $foto_rute_lainnya = []; foreach ($request->file('foto_rute', []) as $key => $value) { @@ -398,15 +409,61 @@ class SurveyorController extends Controller ]; } + foreach ($request->file('foto_lantai_unit', []) as $key => $value) { + $foto_lantai_unit_Path = $this->uploadFile($request->file('foto_lantai_unit.' . $key), 'foto_lantai_unit.' . $key); + $foto_lantai_unit[] = [ + 'name_lantai_unit' => $request->input('name_lantai_unit.' . $key), + 'foto_lantai_unit' => $foto_lantai_unit_Path, + + ]; + } + + foreach ($request->file('foto_rute_lainnya', []) as $key => $value) { + $foto_rute_lainnya_path = $this->uploadFile($request->file('foto_rute_lainnya.' . $key), 'foto_rute_lainnya.' . $key); + $foto_rute_lainnya[] = [ + 'name_rute_lainnya' => $request->input('name_rute_lainnya.' . $key), + 'foto_rute_lainnya' => $foto_rute_lainnya_path, + + ]; + } + + + foreach ($request->file('foto_lantai_lainnya', []) as $key => $value) { + $foto_lantai_lainnya_path = $this->uploadFile($request->file('foto_lantai_lainnya.' . $key), 'foto_lantai_lainnya.' . $key); + $foto_lantai_lainnya[] = [ + 'name_lantai_lainnya' => $request->input('name_lantai_lainnya.' . $key), + 'foto_lantai_lainnya' => $foto_lantai_lainnya_path, + + ]; + } + + + $basement = $this->uploadFile($request->file('foto_basement'), 'foto_basement'); + $gerbang = $this->uploadFile($request->file('foto_gerbang'), 'foto_gerbang'); $formatFotojson = [ 'rute_menuju_lokasi' => $rute_menuju_lokasi, 'object_jaminan' => $object_jaminan, 'lingkungan' => $lingkungan + ,'foto_lantai_unit' => $foto_lantai_unit, + 'foto_lantai_lainnya' => $foto_lantai_lainnya, + 'foto_rute_lainnya' => $foto_rute_lainnya, + 'basement' => $basement, + 'gerbang' => $gerbang ]; + $inspeksi = Inspeksi::where('permohonan_id', $request->input('permohonan_id'))->first(); + if($request->input('permohonan_id') == $inspeksi->permohonan_id){ + $inspeksi->update([ + 'foto_form' => json_encode($formatFotojson) + ]); + }else { - + Inspeksi::create([ + 'permohonan_id' => $request->input('permohonan_id'), + 'foto_form' => json_encode($formatFotojson) + ]); + } // DB::commit(); diff --git a/resources/views/surveyor/components/foto.blade.php b/resources/views/surveyor/components/foto.blade.php index 1f502c4..d51f5ea 100644 --- a/resources/views/surveyor/components/foto.blade.php +++ b/resources/views/surveyor/components/foto.blade.php @@ -175,10 +175,7 @@ @endforeach @else - {{-- --}} +