perbikan alamat di form inspeksi
This commit is contained in:
@@ -1,5 +1,3 @@
|
|||||||
@include('lpj::surveyor.components.header')
|
|
||||||
|
|
||||||
<div class="card w-full bg-white rounded-lg shadow-md overflow-hidden">
|
<div class="card w-full bg-white rounded-lg shadow-md overflow-hidden">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<h3 class="card-title uppercase">
|
<h3 class="card-title uppercase">
|
||||||
|
|||||||
@@ -178,13 +178,13 @@
|
|||||||
<div class="flex-wrap items-stretch">
|
<div class="flex-wrap items-stretch">
|
||||||
<div class="grid grid-cols-3 md:grid-cols-3 gap-4 mt-2">
|
<div class="grid grid-cols-3 md:grid-cols-3 gap-4 mt-2">
|
||||||
<label class="form-label flex items-center gap-3 text-nowrap">
|
<label class="form-label flex items-center gap-3 text-nowrap">
|
||||||
<input onclick="updateAlamatFields('sesuai')" type="radio" class="radio"
|
<input onclick="createAlamat('sesuai')" type="radio" class="radio"
|
||||||
name="alamat_sesuai" value="sesuai"
|
name="alamat_sesuai" value="sesuai"
|
||||||
{{ old('jenis_asset', isset($forminspeksi['asset']['alamat']['sesuai'])) ? 'checked' : '' }}>
|
{{ old('jenis_asset', isset($forminspeksi['asset']['alamat']['sesuai'])) ? 'checked' : '' }}>
|
||||||
<span class="ml-2">Ya</span>
|
<span class="ml-2">Ya</span>
|
||||||
</label>
|
</label>
|
||||||
<label class="form-label flex items-center gap-3 text-nowrap">
|
<label class="form-label flex items-center gap-3 text-nowrap">
|
||||||
<input onclick="updateAlamatFields('tidak sesuai')" type="radio" class="radio"
|
<input onclick="createAlamat('tidak sesuai')" type="radio" class="radio"
|
||||||
name="alamat_sesuai" value="tidak sesuai"
|
name="alamat_sesuai" value="tidak sesuai"
|
||||||
{{ old('jenis_asset', isset($forminspeksi['asset']['alamat']['tidak sesuai'])) ? 'checked' : '' }}>
|
{{ old('jenis_asset', isset($forminspeksi['asset']['alamat']['tidak sesuai'])) ? 'checked' : '' }}>
|
||||||
<span class="ml-2">Tidak</span>
|
<span class="ml-2">Tidak</span>
|
||||||
@@ -199,105 +199,8 @@
|
|||||||
|
|
||||||
@endphp
|
@endphp
|
||||||
|
|
||||||
<div id="alamat_form" class="grid gap-2 mt-5"
|
<div id="alamat_form" class="grid gap-2 mt-5" style="display: none;">
|
||||||
style="{{ isset($address) ? '' : 'display: none;' }}">
|
|
||||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
|
||||||
<label for="address" class="form-label max-w-56">Jl.</label>
|
|
||||||
<div class="flex flex-wrap items-baseline w-full">
|
|
||||||
<input type="text" id="address" name="address" class="input w-full"
|
|
||||||
placeholder="Masukkan Jl."
|
|
||||||
value="{{ isset($forminspeksi['asset']['alamat']['tidak sesuai']['address'])
|
|
||||||
? $forminspeksi['asset']['alamat']['tidak sesuai']['address']
|
|
||||||
: (isset($forminspeksi['asset']['alamat']['sesuai']['address'])
|
|
||||||
? $forminspeksi['asset']['alamat']['sesuai']['address']
|
|
||||||
: old('address')) }}">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
|
||||||
<label for="province_code" class="form-label max-w-56">Provinsi</label>
|
|
||||||
<div class="flex flex-wrap items-baseline w-full">
|
|
||||||
<select id="province_code" name="province_code" class="input w-full">
|
|
||||||
<option value="">Select Province</option>
|
|
||||||
@foreach ($provinces as $province)
|
|
||||||
<option value="{{ $province->code }}"
|
|
||||||
@if (
|
|
||||||
(isset($cekAlamat['province_code']) && $cekAlamat['province_code'] == $province->code) ||
|
|
||||||
(!isset($cekAlamat['province_code']) &&
|
|
||||||
isset($debitur->province_code) &&
|
|
||||||
$debitur->province_code == $province->code)) selected @endif>
|
|
||||||
{{ $province->name }}
|
|
||||||
</option>
|
|
||||||
@endforeach
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
|
||||||
<label for="city_code" class="form-label max-w-56">Kota/Kabupaten</label>
|
|
||||||
<div class="flex flex-wrap items-baseline w-full">
|
|
||||||
<select id="city_code" name="city_code" class="select w-full">
|
|
||||||
<option value="">Pilih Kota/Kabupaten</option>
|
|
||||||
@if (isset($cities))
|
|
||||||
@foreach ($cities as $city)
|
|
||||||
<option value="{{ $city->code }}"
|
|
||||||
@if (
|
|
||||||
(isset($cekAlamat['city_code']) && $cekAlamat['city_code'] == $city->code) ||
|
|
||||||
(!isset($cekAlamat['city_code']) && isset($debitur->city_code) && $debitur->city_code == $city->code)) selected @endif>
|
|
||||||
{{ $city->name }}
|
|
||||||
</option>
|
|
||||||
@endforeach
|
|
||||||
@endif
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
|
||||||
<label for="district_code" class="form-label max-w-56">Kecamatan</label>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="flex flex-wrap items-baseline w-full">
|
|
||||||
<select id="district_code" name="district_code" class="select w-full">
|
|
||||||
<option value="">Pilih Kecamatan</option>
|
|
||||||
@if (isset($districts))
|
|
||||||
@foreach ($districts as $district)
|
|
||||||
<option value="{{ $district->code }}"
|
|
||||||
@if (
|
|
||||||
(isset($cekAlamat['district_code']) && $cekAlamat['district_code'] == $district->code) ||
|
|
||||||
(!isset($cekAlamat['district_code']) &&
|
|
||||||
isset($debitur->district_code) &&
|
|
||||||
$debitur->district_code == $district->code)) selected @endif>
|
|
||||||
{{ $district->name }}
|
|
||||||
</option>
|
|
||||||
@endforeach
|
|
||||||
|
|
||||||
@endif
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
|
||||||
<label for="village_code" class="form-label max-w-56">Kelurahan</label>
|
|
||||||
<div class="flex flex-wrap items-baseline w-full">
|
|
||||||
<select id="village_code" name="village_code" class="select w-full">
|
|
||||||
<option value="">Pilih Kelurahan</option>
|
|
||||||
@if (isset($villages))
|
|
||||||
@foreach ($villages as $village)
|
|
||||||
<option value="{{ $village->code }}"
|
|
||||||
@if (
|
|
||||||
(isset($cekAlamat['village_code']) && $cekAlamat['village_code'] == $village->code) ||
|
|
||||||
(!isset($cekAlamat['village_code']) &&
|
|
||||||
isset($debitur->village_code) &&
|
|
||||||
$debitur->village_code == $village->code)) selected @endif>
|
|
||||||
{{ $village->name }}
|
|
||||||
</option>
|
|
||||||
@endforeach
|
|
||||||
|
|
||||||
@endif
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -552,3 +455,129 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<script>
|
||||||
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
// Cek radio button saat halaman dimuat
|
||||||
|
const sesuaiRadio = document.querySelector('input[name="alamat_sesuai"][value="sesuai"]');
|
||||||
|
const tidakSesuaiRadio = document.querySelector('input[name="alamat_sesuai"][value="tidak sesuai"]');
|
||||||
|
|
||||||
|
// Jika "Ya" sudah tercentang saat load halaman
|
||||||
|
if (sesuaiRadio.checked) {
|
||||||
|
createAlamat('sesuai');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Jika "Tidak" sudah tercentang saat load halaman
|
||||||
|
if (tidakSesuaiRadio.checked) {
|
||||||
|
createAlamat('tidak sesuai');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
function createAlamat(data) {
|
||||||
|
const createElementAlamat = document.getElementById('alamat_form');
|
||||||
|
createElementAlamat.style.display = 'block';
|
||||||
|
|
||||||
|
if (data == 'sesuai') {
|
||||||
|
createElementAlamat.innerHTML = `
|
||||||
|
<div class="grid gap-2.5 w-full">
|
||||||
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
||||||
|
<label for="address" class="form-label max-w-56">Jl.</label>
|
||||||
|
<div class="flex flex-wrap items-baseline w-full">
|
||||||
|
<input type="text" id="address" name="address" class="input w-full "
|
||||||
|
value="{{ isset($permohonan->debiture->address) ? $permohonan->debiture->address : old('address') }}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<input type="hidden" name="province_code"
|
||||||
|
value="{{ isset($permohonan->debiture->province) ? $permohonan->debiture->province->code : '' }}">
|
||||||
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
||||||
|
<label for="province" class="form-label max-w-56">Provinsi</label>
|
||||||
|
<div class="flex flex-wrap items-baseline w-full">
|
||||||
|
<input type="text" id="province" class="input w-full cursor-not-allowed" readonly
|
||||||
|
value="{{ isset($permohonan->debiture->province) ? $permohonan->debiture->province->name : '' }}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<input type="hidden" name="city_code"
|
||||||
|
value="{{ isset($permohonan->debiture->city) ? $permohonan->debiture->city->code : '' }}">
|
||||||
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
||||||
|
<label for="city" class="form-label max-w-56">Kabupaten/Kota</label>
|
||||||
|
<div class="flex flex-wrap items-baseline w-full">
|
||||||
|
<input type="text" id="city" class="input w-full cursor-not-allowed" readonly
|
||||||
|
value="{{ isset($permohonan->debiture->city) ? $permohonan->debiture->city->name : '' }}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<input type="hidden" name="district_code"
|
||||||
|
value="{{ isset($permohonan->debiture->district) ? $permohonan->debiture->district->code : '' }}">
|
||||||
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
||||||
|
<label for="district" class="form-label max-w-56">Kecamatan</label>
|
||||||
|
<div class="flex flex-wrap items-baseline w-full">
|
||||||
|
<input type="text" id="district" class="input w-full cursor-not-allowed" readonly
|
||||||
|
value="{{ isset($permohonan->debiture->district) ? $permohonan->debiture->district->name : '' }}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<input type="hidden" name="village_code"
|
||||||
|
value="{{ isset($permohonan->debiture->village) ? $permohonan->debiture->village->code : '' }}">
|
||||||
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
||||||
|
<label for="village" class="form-label max-w-56">Desa/Kelurahan</label>
|
||||||
|
<div class="flex flex-wrap items-baseline w-full">
|
||||||
|
<input type="text" id="village" class="input w-full cursor-not-allowed" readonly
|
||||||
|
value="{{ isset($permohonan->debiture->village) ? $permohonan->debiture->village->name : '' }}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data == 'tidak sesuai') {
|
||||||
|
createElementAlamat.innerHTML = `
|
||||||
|
<div class="grid gap-2.5 w-full">
|
||||||
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
||||||
|
<label for="address" class="form-label max-w-56">Jl.</label>
|
||||||
|
<div class="flex flex-wrap items-baseline w-full">
|
||||||
|
<input type="text" id="address" name="address" class="input w-full"
|
||||||
|
placeholder="Masukkan Jl."
|
||||||
|
value="{{ old('address') }}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
||||||
|
<label for="province_code" class="form-label max-w-56">Provinsi</label>
|
||||||
|
<div class="flex flex-wrap items-baseline w-full">
|
||||||
|
<select id="province_code" name="province_code" class="input w-full" >
|
||||||
|
<option value="">Select Province</option>
|
||||||
|
@foreach ($provinces as $province)
|
||||||
|
<option value="{{ $province->code }}">{{ $province->name }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
||||||
|
<label for="city_code" class="form-label max-w-56">Kota/Kabupaten</label>
|
||||||
|
<div class="flex flex-wrap items-baseline w-full">
|
||||||
|
<select id="city_code" name="city_code" class="select w-full" >
|
||||||
|
<option value="">Pilih Kota/Kabupaten</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
||||||
|
<label for="district_code" class="form-label max-w-56">Kecamatan</label>
|
||||||
|
<div class="flex flex-wrap items-baseline w-full">
|
||||||
|
<select id="district_code" name="district_code" class="select w-full" >
|
||||||
|
<option value="">Pilih Kecamatan</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
||||||
|
<label for="village_code" class="form-label max-w-56">Kelurahan</label>
|
||||||
|
<div class="flex flex-wrap items-baseline w-full">
|
||||||
|
<select id="village_code" name="village_code" class="select w-full">
|
||||||
|
<option value="">Pilih Kelurahan</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|||||||
@@ -17,21 +17,27 @@
|
|||||||
$formKategori = json_decode($dokumen->jenisJaminan->form_kategori, true);
|
$formKategori = json_decode($dokumen->jenisJaminan->form_kategori, true);
|
||||||
@endphp
|
@endphp
|
||||||
@if (isset($formKategori) && $formKategori)
|
@if (isset($formKategori) && $formKategori)
|
||||||
<input type="hidden" name="action"
|
@php
|
||||||
value="{{ is_array($formKategori) ? implode(',', $formKategori) : $formKategori }}">
|
$kategoriArray = is_array($formKategori) ? $formKategori : [$formKategori];
|
||||||
<input type="hidden" name="type"
|
$kategoriUnik = array_unique($kategoriArray);
|
||||||
value="{{ is_array($formKategori) ? implode(',', $formKategori) : $formKategori }}">
|
@endphp
|
||||||
@if (is_array($formKategori))
|
<input type="hidden" name="action" value="{{ implode(',', $kategoriUnik) }}">
|
||||||
@foreach ($formKategori as $kategori)
|
<input type="hidden" name="type" value="{{ implode(',', $kategoriUnik) }}">
|
||||||
@include('lpj::surveyor.components.' . str_replace('-', '-', $kategori), [
|
@if (array_intersect($kategoriUnik, ['tanah', 'bangunan', 'apartemen-kantor']))
|
||||||
'dokumen' => $dokumen,
|
@include('lpj::surveyor.components.header')
|
||||||
])
|
|
||||||
@endforeach
|
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
@foreach ($kategoriUnik as $kategori)
|
||||||
|
{{-- Tampilkan komponen sesuai kategori --}}
|
||||||
|
@include('lpj::surveyor.components.' . str_replace('-', '-', $kategori), [
|
||||||
|
'dokumen' => $dokumen,
|
||||||
|
])
|
||||||
|
@endforeach
|
||||||
@endif
|
@endif
|
||||||
@endif
|
@endif
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|
||||||
|
|
||||||
<div class="flex justify-end gap-2" style="margin-right: 20px; margin-top: 20px">
|
<div class="flex justify-end gap-2" style="margin-right: 20px; margin-top: 20px">
|
||||||
<button type="button" class="btn btn-success" id="saveButton" onclick="submitData()">
|
<button type="button" class="btn btn-success" id="saveButton" onclick="submitData()">
|
||||||
<span id="saveButtonText">Save</span>
|
<span id="saveButtonText">Save</span>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
@include('lpj::surveyor.components.header')
|
|
||||||
|
|
||||||
<div class="card w-full bg-white rounded-lg shadow-md overflow-hidden">
|
<div class="card w-full bg-white rounded-lg shadow-md overflow-hidden">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
|
|||||||
Reference in New Issue
Block a user