update form foto
This commit is contained in:
@@ -360,6 +360,14 @@ class SurveyorController extends Controller
|
|||||||
'lantai.*' => 'nullable|image|mimes:jpeg,png,jpg,gif,svg|max:2048',
|
'lantai.*' => 'nullable|image|mimes:jpeg,png,jpg,gif,svg|max:2048',
|
||||||
'name_lantai_unit.*' => 'nullable|string|max:255',
|
'name_lantai_unit.*' => 'nullable|string|max:255',
|
||||||
'foto_lantai_unit.*' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:2048',
|
'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();
|
// DB::beginTransaction();
|
||||||
@@ -369,6 +377,9 @@ class SurveyorController extends Controller
|
|||||||
$rute_menuju_lokasi = [];
|
$rute_menuju_lokasi = [];
|
||||||
$object_jaminan = [];
|
$object_jaminan = [];
|
||||||
$lingkungan = [];
|
$lingkungan = [];
|
||||||
|
$foto_lantai_unit = [];
|
||||||
|
$foto_lantai_lainnya = [];
|
||||||
|
$foto_rute_lainnya = [];
|
||||||
|
|
||||||
|
|
||||||
foreach ($request->file('foto_rute', []) as $key => $value) {
|
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 = [
|
$formatFotojson = [
|
||||||
'rute_menuju_lokasi' => $rute_menuju_lokasi,
|
'rute_menuju_lokasi' => $rute_menuju_lokasi,
|
||||||
'object_jaminan' => $object_jaminan,
|
'object_jaminan' => $object_jaminan,
|
||||||
'lingkungan' => $lingkungan
|
'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();
|
// DB::commit();
|
||||||
|
|||||||
@@ -175,10 +175,7 @@
|
|||||||
</div>
|
</div>
|
||||||
@endforeach
|
@endforeach
|
||||||
@else
|
@else
|
||||||
{{-- <img id="foto_rute-preview"
|
|
||||||
src="{{ asset('storage/' . (isset($forminspeksi['foto_rute[]']) ? $forminspeksi['foto_rute[]'] : '')) }}"
|
|
||||||
alt="Foto Argis Region" class="mt-2 max-w-full h-auto"
|
|
||||||
style="{{ isset($forminspeksi['foto_rute']) ? '' : 'display: none;' }}"> --}}
|
|
||||||
|
|
||||||
<div id="inputContainerRute" style="margin-top: 10px">
|
<div id="inputContainerRute" style="margin-top: 10px">
|
||||||
<div class="flex w-full items-center justify-center gap-4 mb-4">
|
<div class="flex w-full items-center justify-center gap-4 mb-4">
|
||||||
@@ -188,8 +185,8 @@
|
|||||||
|
|
||||||
<div class="input-group w-full flex gap-2">
|
<div class="input-group w-full flex gap-2">
|
||||||
<input class="name_rute" type="hidden" name="name_rute[]" value="rute">
|
<input class="name_rute" type="hidden" name="name_rute[]" value="rute">
|
||||||
<img id="foto_rute-preview" src="" alt="Foto Argis Region"
|
{{-- <img id="foto_rute-preview" src="" alt="Foto Argis Region"
|
||||||
class="mt-2 max-w-full h-auto" style="display: none;">
|
class="mt-2 max-w-full h-auto" style="display: none;"> --}}
|
||||||
<input id="inputRute" type="file" name="foto_rute[]"
|
<input id="inputRute" type="file" name="foto_rute[]"
|
||||||
class="file-input file-input-bordered w-full" accept="image/*" capture="camera"
|
class="file-input file-input-bordered w-full" accept="image/*" capture="camera"
|
||||||
onchange="previewImage(this, 'foto_rute-preview')">
|
onchange="previewImage(this, 'foto_rute-preview')">
|
||||||
@@ -220,9 +217,9 @@
|
|||||||
</label>
|
</label>
|
||||||
|
|
||||||
<div class="input-group w-full flex gap-2">
|
<div class="input-group w-full flex gap-2">
|
||||||
<input class="name_gerbang" type="hidden" name="foto_gerbang" value="rute">
|
<input class="name_gerbang" type="hidden" name="name_gerbang" value="rute">
|
||||||
<img id="foto_gerbang-preview" src="" alt="Foto Gerbong"
|
{{-- <img id="foto_gerbang-preview" src="" alt="Foto Gerbong"
|
||||||
class="mt-2 max-w-full h-auto" style="display: none;">
|
class="mt-2 max-w-full h-auto" style="display: none;"> --}}
|
||||||
<input id="inputRute" type="file" name="foto_gerbang"
|
<input id="inputRute" type="file" name="foto_gerbang"
|
||||||
class="file-input file-input-bordered w-full" accept="image/*" capture="camera"
|
class="file-input file-input-bordered w-full" accept="image/*" capture="camera"
|
||||||
onchange="previewImage(this, 'foto_gerbang-preview')">
|
onchange="previewImage(this, 'foto_gerbang-preview')">
|
||||||
@@ -394,8 +391,8 @@
|
|||||||
<span class="form-label">Basement</span>
|
<span class="form-label">Basement</span>
|
||||||
</label>
|
</label>
|
||||||
<div class="input-group w-full flex gap-2">
|
<div class="input-group w-full flex gap-2">
|
||||||
<input type="hidden" name="name_lantai_unit[]" value="lantai">
|
<input type="hidden" name="name_basement" value="basement">
|
||||||
<input id="inputLantai" type="file" name="foto_lantai_unit[]"
|
<input id="inputLantai" type="file" name="foto_basement"
|
||||||
class="file-input file-input-bordered w-full" accept="image/*" capture="camera">
|
class="file-input file-input-bordered w-full" accept="image/*" capture="camera">
|
||||||
<button type="button" id="btnCamera" class="btn btn-light"
|
<button type="button" id="btnCamera" class="btn btn-light"
|
||||||
data-modal-toggle="#cameraModal">
|
data-modal-toggle="#cameraModal">
|
||||||
@@ -759,7 +756,7 @@
|
|||||||
<div class="flex flex-wrap items-baseline w-full">
|
<div class="flex flex-wrap items-baseline w-full">
|
||||||
<div class="flex flex-col lg:flex-row gap-2 w-full">
|
<div class="flex flex-col lg:flex-row gap-2 w-full">
|
||||||
<div class="flex flex-wrap items-baseline px-2">
|
<div class="flex flex-wrap items-baseline px-2">
|
||||||
<input class="input" type="text" name="${inputName}[]">
|
<input class="input" type="text" name="name_${inputName}[]">
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-wrap items-baseline w-full">
|
<div class="flex flex-wrap items-baseline w-full">
|
||||||
<div class="input-group w-full flex gap-2">
|
<div class="input-group w-full flex gap-2">
|
||||||
|
|||||||
Reference in New Issue
Block a user