update form inspeksi and basic data inspeksi
This commit is contained in:
@@ -79,16 +79,13 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<form id="formFoto" method="POST" class="grid gap-5" enctype="multipart/form-data">
|
||||
|
||||
|
||||
<input type="hidden" name="permohonan_id" value="{{ $permohonan->id }}">
|
||||
<input type="hidden" name="jenis_jaminan_id" value="{{ request('jenis_jaminan') }}">
|
||||
|
||||
<div class="card bg-white rounded-lg shadow-md">
|
||||
<div class="card-body">
|
||||
<div class=" text-white py-4 px-6 flex items-center justify-between">
|
||||
<div class=" text-white py-4 flex items-center justify-between">
|
||||
<h1 class="text-md font-medium text-gray-900">Rute Menuju Lokasi</h1>
|
||||
<button id="btnRute" type="button" class="btn btn-primary btn-sm">
|
||||
<i class="ki-filled ki-plus text-lg"></i>
|
||||
@@ -131,6 +128,7 @@
|
||||
<i class="ki-filled ki-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
@else
|
||||
<div id="inputContainerRute" style="margin-top: 10px">
|
||||
@@ -162,7 +160,6 @@
|
||||
</div>
|
||||
<span class="alert text-danger text-sm"></span>
|
||||
</div>
|
||||
|
||||
@endif
|
||||
<div id="inputContainerGerbang" style="margin-top: 10px">
|
||||
<div class="flex w-full items-center justify-center gap-4 mb-4">
|
||||
@@ -191,14 +188,16 @@
|
||||
<div id="ruteLainnya" style="margin-top: 10px">
|
||||
@if (isset($formFoto['foto_rute_lainnya']) && is_array($formFoto['foto_rute_lainnya']))
|
||||
@foreach ($formFoto['foto_rute_lainnya'] as $Index => $photo)
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 mb-5" id="photoContainer">
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 mb-5"
|
||||
id="photoContainer">
|
||||
<label class="form-label max-w-56">
|
||||
Masukkan nama rute lainnya
|
||||
</label>
|
||||
<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-wrap items-baseline px-2">
|
||||
<input class="input" type="text" name="name_rute_lainnya[]" value="{{$photo['name_rute_lainnya']}}">
|
||||
<input class="input" type="text" name="name_rute_lainnya[]"
|
||||
value="{{ $photo['name_rute_lainnya'] }}">
|
||||
</div>
|
||||
<div class="input-group w-full flex flex-col gap-2">
|
||||
<img id="foto_rute_lainnya-preview-"
|
||||
@@ -208,10 +207,10 @@
|
||||
<div class="input-group w-full flex gap-2">
|
||||
<input type="file" name="foto_rute_lainnya[]"
|
||||
class="file-input file-input-bordered w-full"
|
||||
value="{{ $photo['foto_rute_lainnya'] }}"
|
||||
accept="image/*" onchange="previewImage(this, 'foto_rute_lainnya-preview-{{ $index }}')">
|
||||
<button type="button" id="btnCamera-{{ $index }}" class="btn btn-light"
|
||||
data-modal-toggle="#cameraModal">
|
||||
value="{{ $photo['foto_rute_lainnya'] }}" accept="image/*"
|
||||
onchange="previewImage(this, 'foto_rute_lainnya-preview-{{ $index }}')">
|
||||
<button type="button" id="btnCamera-{{ $index }}"
|
||||
class="btn btn-light" data-modal-toggle="#cameraModal">
|
||||
<i class="ki-outline ki-abstract-33"></i> Camera
|
||||
</button>
|
||||
</div>
|
||||
@@ -229,19 +228,16 @@
|
||||
<button type="button" class="btn btn-primary btn-sm" id="btnAddMore" style="margin-top: 10px">
|
||||
<i class="ki-outline ki-plus text-2sm"></i> Lainnya
|
||||
</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card bg-white rounded-lg shadow-md">
|
||||
<div class="card-body">
|
||||
<div class=" text-white py-4 px-6 flex items-center justify-between">
|
||||
<div class="text-white py-4 flex items-center justify-between">
|
||||
<h1 class="text-md font-medium text-gray-900">Objek Jaminan</h1>
|
||||
</div>
|
||||
|
||||
@php
|
||||
// Array untuk menyimpan kategori yang sudah diproses
|
||||
$processedCategories = [];
|
||||
@endphp
|
||||
|
||||
@@ -334,22 +330,20 @@
|
||||
}
|
||||
@endphp
|
||||
|
||||
|
||||
@if (count($objekViews) > 0)
|
||||
@foreach ($objekViews as $view)
|
||||
<div class="flex flex-wrap gap-4 {{ !$loop->first ? 'mt-2' : '' }}">
|
||||
<div class="flex w-full gap-4">
|
||||
<label class="form-label max-w-56"><span
|
||||
class="form-label">{{ $view['label'] }}</span>
|
||||
</label>
|
||||
class="form-label">{{ $view['label'] }}</span></label>
|
||||
<input type="hidden" class="form-control"
|
||||
name="name_objek[]" value="{{ $view['label'] }}" />
|
||||
<div class="w-full grid gap-5">
|
||||
<img id="foto_object_jaminan_preview_{{ $view['index'] }}"
|
||||
src="{{ isset($formFoto['object_jaminan'][$view['index']]['foto_object']) ? asset('storage/' . $formFoto['object_jaminan'][$view['index']]['foto_object']) : '' }}"
|
||||
alt="{{ $view['label'] }}" class="mb-2 w-48 h-auto"
|
||||
onchange="previewImage(this, 'foto_object_jaminan_preview_{{ $view['index'] }}')"
|
||||
style="{{ isset($formFoto['foto_object']) ? '' : 'display: none;' }} width: 30rem;">
|
||||
|
||||
style="{{ isset($formFoto['object_jaminan'][$view['index']]['foto_object']) ? '' : 'display: none;' }} width: 30rem;">
|
||||
<div class="input-group w-full flex gap-2">
|
||||
<input type="file" name="foto_objek[]"
|
||||
class="file-input file-input-bordered w-full"
|
||||
@@ -357,11 +351,10 @@
|
||||
<button type="button" id="btnCamera"
|
||||
class="btn btn-light"
|
||||
data-modal-toggle="#cameraModal">
|
||||
<i class="ki-outline ki-abstract-33"></i> Camera
|
||||
<i class="ki-outline ki-abstract-33"></i> Camera
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<textarea name="deskripsi_objek[]" class="textarea" rows="3" placeholder="Deskripsi">{{ isset($formFoto) && isset($formFoto['object_jaminan'][$view['index']]) ? str_replace($view['label'] . ': ', '', $formFoto['object_jaminan'][$view['index']]['deskripsi_objek']) : '' }}</textarea>
|
||||
<textarea name="deskripsi_objek[]" class="textarea" rows="3" placeholder="Deskripsi">{{ isset($formFoto['object_jaminan'][$view['index']]) ? str_replace($view['label'] . ': ', '', $formFoto['object_jaminan'][$view['index']]['deskripsi_objek']) : '' }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<span class="alert text-danger text-sm"></span>
|
||||
@@ -370,7 +363,6 @@
|
||||
@endif
|
||||
|
||||
@php
|
||||
// Tandai kategori sebagai sudah diproses
|
||||
$processedCategories[] = $kategori;
|
||||
@endphp
|
||||
@endif
|
||||
@@ -381,8 +373,8 @@
|
||||
@endforeach
|
||||
|
||||
<div class="flex flex-wrap gap-4 w-full">
|
||||
<div class="w-full ">
|
||||
<div class=" text-white py-4 px-6 flex items-center justify-between w-full">
|
||||
<div class="w-full">
|
||||
<div class="text-white py-4 flex items-center justify-between w-full">
|
||||
<label class="form-label">
|
||||
<span class="form-label">Lantai</span>
|
||||
</label>
|
||||
@@ -399,7 +391,6 @@
|
||||
<span class="form-label">Foto Lantai 1</span>
|
||||
</label>
|
||||
<div class="w-full grid gap-5">
|
||||
|
||||
<img src="{{ asset('storage/' . old('foto_lantai_unit', $item['foto_lantai_unit'])) }}"
|
||||
alt="Gambar Pendamping" style="width: 30rem;">
|
||||
<input type="hidden" name="name_lantai_unit[]" value="lantai">
|
||||
@@ -411,17 +402,13 @@
|
||||
<i class="ki-filled ki-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<span id="inputLantaiError" class="alert text-danger text-sm"></span>
|
||||
|
||||
</div>
|
||||
@endforeach
|
||||
@else
|
||||
<div id="inputContainerLantai" class="w-full">
|
||||
<div class="flex w-full items-center justify-center gap-4">
|
||||
|
||||
<label class="form-label max-w-56">
|
||||
<span class="form-label">Foto Lantai 1</span>
|
||||
</label>
|
||||
@@ -432,7 +419,7 @@
|
||||
capture="camera">
|
||||
<button type="button" id="btnCamera" class="btn btn-light"
|
||||
data-modal-toggle="#cameraModal">
|
||||
<i class="ki-outline ki-abstract-33"></i> Camera
|
||||
<i class="ki-outline ki-abstract-33"></i> Camera
|
||||
</button>
|
||||
</div>
|
||||
<button type="button" class="btn btn-danger btn-sm delete-btn"
|
||||
@@ -448,41 +435,32 @@
|
||||
|
||||
<div id="inputContainerBasement" class="w-full" style="margin-top: 10px">
|
||||
<div class="flex w-full items-center justify-center gap-4">
|
||||
<label class="form-label max-w-56">
|
||||
<span class="form-label">Basement</span>
|
||||
</label>
|
||||
<div class="input-group w-full flex flex-col gap-2">
|
||||
<input type="hidden" name="name_basement" value="basement">
|
||||
|
||||
<img id="foto_basement"
|
||||
src="{{ isset($formFoto['foto_basement']) ? asset('storage/' . old('foto_basement', $formFoto['foto_basement'])) : '#' }}"
|
||||
alt="Gambar foto_basement" style="width: 30rem;"
|
||||
onerror="this.style.display='none';"
|
||||
onchange="previewImage(this, 'foto_basement')">
|
||||
<div class="input-group w-full flex gap-2">
|
||||
<input id="inputLantai" type="file" name="foto_basement"
|
||||
class="file-input file-input-bordered w-full" accept="image/*"
|
||||
capture="camera">
|
||||
<button type="button" id="btnCamera" class="btn btn-light"
|
||||
data-modal-toggle="#cameraModal">
|
||||
<i class="ki-outline ki-abstract-33"></i> Camera
|
||||
</button>
|
||||
</div>
|
||||
<label class="form-label max-w-56">
|
||||
<span class="form-label">Basement</span>
|
||||
</label>
|
||||
<div class="input-group w-full flex flex-col gap-2">
|
||||
<input type="hidden" name="name_basement" value="basement">
|
||||
<img id="foto_basement_preview"
|
||||
src="{{ isset($formFoto['foto_basement']) ? asset('storage/' . old('foto_basement', $formFoto['foto_basement'])) : '#' }}"
|
||||
alt="Gambar foto_basement" style="width: 30rem;"
|
||||
onerror="this.style.display='none';"
|
||||
onchange="previewImage(this, 'foto_basement_preview')">
|
||||
<div class="input-group w-full flex gap-2">
|
||||
<input id="inputBasement" type="file" name="foto_basement"
|
||||
class="file-input file-input-bordered w-full" accept="image/*" capture="camera">
|
||||
<button type="button" id="btnCamera" class="btn btn-light" data-modal-toggle="#cameraModal">
|
||||
<i class="ki-outline ki-abstract-33"></i> Camera
|
||||
</button>
|
||||
</div>
|
||||
<button type="button" class="btn btn-danger btn-sm delete-btn"
|
||||
style="display: none;" id="btnDelete">
|
||||
<i class="ki-filled ki-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
<button type="button" class="btn btn-danger btn-sm delete-btn" style="display: none;" id="btnDelete">
|
||||
<i class="ki-filled ki-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<span id="alertBasement" class="alert text-danger text-sm"></span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="lantaiLainnya" style="margin-top: 10px">
|
||||
|
||||
</div>
|
||||
<div id="lantaiLainnya" style="margin-top: 10px"></div>
|
||||
|
||||
<button type="button" class="btn btn-primary btn-sm" id="btnAddMoreObject"
|
||||
style="margin-top: 10px">
|
||||
@@ -494,81 +472,68 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="card bg-white rounded-lg shadow-md">
|
||||
<div class="card-body">
|
||||
<div class=" text-white py-4 px-6 flex items-center justify-between">
|
||||
<h1 class="text-md font-medium text-gray-900">Lingkungan</h1>
|
||||
<button id="btnLingkungan" type="button" class="btn btn-primary btn-sm">
|
||||
<i class="ki-filled ki-plus text-lg"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@if (isset($formFoto['lingkungan']) && !is_array($formFoto['lingkungan']) && !empty($formFoto['lingkungan']))
|
||||
@foreach ($formFoto['lingkungan'] as $item)
|
||||
<div id="inputContainerLingkungan" style="margin-top: 10px">
|
||||
<div class="flex w-full items-center justify-center gap-4 mb-4">
|
||||
<label class="form-label max-w-56">
|
||||
<span class="form-label">Lingkungan</span>
|
||||
</label>
|
||||
<div class="w-full grid gap-5">
|
||||
<img src="{{ asset('storage/' . old('foto_lingkungan', $item['foto_lingkungan'])) }}"
|
||||
alt="Gambar Pendamping" style="width: 30rem;">
|
||||
|
||||
<div class="input-group w-full flex gap-2">
|
||||
<input type="hidden" name="name_lingkungan[]" value="lingkungan">
|
||||
<input id="inputLingkungan" type="file" name="foto_lingkungan[]"
|
||||
class="file-input file-input-bordered w-full" accept="image/*"
|
||||
capture="camera">
|
||||
<button type="button" id="btnCamera" class="btn btn-light"
|
||||
data-modal-toggle="#cameraModal">
|
||||
<i class="ki-outline ki-abstract-33"></i> Camera
|
||||
</button>
|
||||
</div>
|
||||
<button type="button" class="btn btn-danger btn-sm delete-btn"
|
||||
style="display: none;" id="btnDelete">
|
||||
<i class="ki-filled ki-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<span class="alert text-danger text-sm"></span>
|
||||
<div class="text-white py-4 flex items-center justify-between">
|
||||
<h1 class="text-md font-medium text-gray-900">Lingkungan</h1>
|
||||
<button id="btnLingkungan" type="button" class="btn btn-primary btn-sm">
|
||||
<i class="ki-filled ki-plus text-lg"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@if (isset($formFoto['lingkungan']) && is_array($formFoto['lingkungan']) && count($formFoto['lingkungan']) > 0)
|
||||
@foreach ($formFoto['lingkungan'] as $key => $item)
|
||||
<div id="inputContainerLingkungan_{{ $key }}" style="margin-top: 10px">
|
||||
<div class="flex w-full items-center justify-center gap-4 mb-4">
|
||||
<label class="form-label max-w-56">
|
||||
<span class="form-label">Lingkungan</span>
|
||||
</label>
|
||||
<div class="w-full grid gap-5">
|
||||
<img id="foto_lingkungan_preview_{{ $key }}"
|
||||
src="{{ asset('storage/' . old('foto_lingkungan.' . $key, $item['foto_lingkungan'])) }}"
|
||||
alt="Gambar Lingkungan" style="width: 30rem;">
|
||||
<input type="hidden" name="name_lingkungan[]" value="lingkungan">
|
||||
<div class="input-group w-full flex gap-2">
|
||||
<input id="inputLingkungan_{{ $key }}" type="file" name="foto_lingkungan[]"
|
||||
class="file-input file-input-bordered w-full" accept="image/*" capture="camera">
|
||||
<button type="button" id="btnCamera" class="btn btn-light" data-modal-toggle="#cameraModal">
|
||||
<i class="ki-outline ki-abstract-33"></i> Camera
|
||||
</button>
|
||||
</div>
|
||||
@endforeach
|
||||
@else
|
||||
<div id="inputContainerLingkungan" style="margin-top: 10px">
|
||||
<div class="flex w-full items-center justify-center gap-4 mb-4">
|
||||
<label class="form-label max-w-56">
|
||||
<span class="form-label">Lingkungan</span>
|
||||
</label>
|
||||
<div class="input-group w-full flex gap-2">
|
||||
<input type="hidden" name="name_lingkungan[]" value="lingkungan">
|
||||
<input id="inputLingkungan" type="file" name="foto_lingkungan[]"
|
||||
class="file-input file-input-bordered w-full" accept="image/*" capture="camera">
|
||||
|
||||
<button type="button" id="btnCamera" class="btn btn-light"
|
||||
data-modal-toggle="#cameraModal">
|
||||
<i class="ki-outline ki-abstract-33"></i> Camera
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<button type="button" class="btn btn-danger btn-sm delete-btn" style="display: none;"
|
||||
id="btnDelete">
|
||||
<i class="ki-filled ki-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
<span class="alert text-danger text-sm"></span>
|
||||
<button type="button" class="btn btn-danger btn-sm delete-btn" style="display: none;" id="btnDelete">
|
||||
<i class="ki-filled ki-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
<span class="alert text-danger text-sm"></span>
|
||||
</div>
|
||||
@endforeach
|
||||
@else
|
||||
<div id="inputContainerLingkungan_0" style="margin-top: 10px">
|
||||
<div class="flex w-full items-center justify-center gap-4 mb-4">
|
||||
<label class="form-label max-w-56">
|
||||
<span class="form-label">Lingkungan</span>
|
||||
</label>
|
||||
<div class="input-group w-full flex gap-2">
|
||||
<input type="hidden" name="name_lingkungan[]" value="lingkungan">
|
||||
<input id="inputLingkungan_0" type="file" name="foto_lingkungan[]"
|
||||
class="file-input file-input-bordered w-full" accept="image/*" capture="camera">
|
||||
<button type="button" id="btnCamera" class="btn btn-light" data-modal-toggle="#cameraModal">
|
||||
<i class="ki-outline ki-abstract-33"></i> Camera
|
||||
</button>
|
||||
</div>
|
||||
<button type="button" class="btn btn-danger btn-sm delete-btn" style="display: none;" id="btnDelete">
|
||||
<i class="ki-filled ki-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
<span class="alert text-danger text-sm"></span>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="card bg-white rounded-lg shadow-md">
|
||||
<div class="card-body">
|
||||
|
||||
|
||||
<div class=" text-white py-4 px-6 flex items-center justify-between">
|
||||
<div class=" text-white py-4 flex items-center justify-between">
|
||||
<h1 class="text-md font-medium text-gray-900">Pendamping</h1>
|
||||
</div>
|
||||
<div style="margin-top: 5px">
|
||||
@@ -619,9 +584,8 @@
|
||||
</div>
|
||||
|
||||
</form>
|
||||
{{--
|
||||
</div>
|
||||
</div> --}}
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@@ -720,24 +684,14 @@
|
||||
|
||||
@push('scripts')
|
||||
<script>
|
||||
// function previewImage(input, previewId) {
|
||||
// if (input.files && input.files[0]) {
|
||||
// var reader = new FileReader();
|
||||
// reader.onload = function(e) {
|
||||
// $('#' + previewId).attr('src', e.target.result).show();
|
||||
// }
|
||||
// reader.readAsDataURL(input.files[0]);
|
||||
// } else {
|
||||
// $('#' + previewId).hide();
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
function submitFoto() {
|
||||
const formElement = $('#formFoto')[0];
|
||||
const formData = new FormData(formElement);
|
||||
for (const [key, value] of formData.entries()) {
|
||||
console.log(`Key: ${key}, Value: ${value}`);
|
||||
}
|
||||
// for (const [key, value] of formData.entries()) {
|
||||
// console.log(`Key: ${key}, Value: ${value}`);
|
||||
// }
|
||||
|
||||
// Disable the button and show the spinner
|
||||
$('#saveButtonFoto').prop('disabled', true);
|
||||
@@ -755,11 +709,11 @@
|
||||
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||
},
|
||||
success: function(response) {
|
||||
// if (response.success) {
|
||||
// window.location.href =
|
||||
// '{{ route('surveyor.show', ['id' => $permohonan->id]) }}?form=foto';
|
||||
// }
|
||||
console.log(response);
|
||||
if (response.success) {
|
||||
window.location.href =
|
||||
'{{ route('surveyor.show', ['id' => $permohonan->id]) }}?form=foto';
|
||||
}
|
||||
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
let errors = xhr.responseJSON?.errors;
|
||||
@@ -818,7 +772,7 @@
|
||||
<div class="flex flex-wrap items-baseline px-2">
|
||||
<input class="input" type="text" name="name_${inputName}[]">
|
||||
</div>
|
||||
<div class="input-group w-full flex flex-col gap-2">
|
||||
<div class=" w-full flex flex-col gap-2">
|
||||
<img id="foto_${inputName}-preview"
|
||||
src="{{ isset($formFoto['gerbang']) ? asset('storage/' . $formFoto['gerbang']) : '' }}"
|
||||
alt="Foto Gerbong" class="mt-2 max-w-full h-auto"
|
||||
@@ -826,7 +780,7 @@
|
||||
|
||||
|
||||
<div class="input-group w-full flex gap-2">
|
||||
<input id="inputPendamping" type="file" name="foto_${inputName}[]"
|
||||
<input id="inputLainnya" type="file" name="foto_${inputName}[]"
|
||||
class="file-input file-input-bordered w-full" accept="image/*" capture="camera"
|
||||
onchange="previewImage(this, 'foto_${inputName}-preview')"
|
||||
>
|
||||
@@ -1086,3 +1040,7 @@
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user