update preview foto dan alamat surveyor
This commit is contained in:
@@ -52,27 +52,60 @@
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script type="text/javascript">
|
||||
function updateAlamatFields(type) {
|
||||
if (type === 'sesuai') {
|
||||
// Update nilai form dengan data sesuai
|
||||
document.getElementById('nama_jalan').value = "{{ $dokumen->address ?? '' }}";
|
||||
document.getElementById('provinsi').value = "{{ $dokumen->province->code ?? '' }}";
|
||||
document.getElementById('kota_kabupaten').value = "{{ $dokumen->city->code ?? '' }}";
|
||||
document.getElementById('kecamatan').value = "{{ $dokumen->district->code ?? '' }}";
|
||||
document.getElementById('desa_kelurahan').value = "{{ $dokumen->village->code ?? '' }}";
|
||||
} else if (type === 'tidak sesuai') {
|
||||
// Reset nilai form untuk input manual
|
||||
document.getElementById('nama_jalan').value = '';
|
||||
document.getElementById('provinsi').value = '';
|
||||
document.getElementById('kota_kabupaten').value = '';
|
||||
document.getElementById('kecamatan').value = '';
|
||||
document.getElementById('desa_kelurahan').value = '';
|
||||
function updateAlamatFields(status) {
|
||||
// Ambil elemen formulir
|
||||
const addressForm = document.getElementById('alamat_form');
|
||||
const inputs = addressForm.querySelectorAll('input, select');
|
||||
const addressInput = document.getElementById('address');
|
||||
|
||||
if (status === 'sesuai') {
|
||||
addressInput.value = "{{ $dokumen->address ?? '' }}";
|
||||
inputs.forEach(element => {
|
||||
if (element.tagName === 'INPUT') {
|
||||
element.setAttribute('readonly', true);
|
||||
} else if (element.tagName === 'SELECT') {
|
||||
element.setAttribute('disabled', true);
|
||||
element.classList.add('disabled-input')
|
||||
}
|
||||
});
|
||||
|
||||
addressForm.style.display = 'grid';
|
||||
addressForm.disabled = true;
|
||||
addressForm.classList.add('disabled-input')
|
||||
|
||||
|
||||
} else if (status === 'tidak sesuai') {
|
||||
addressForm.style.display = 'grid';
|
||||
|
||||
addressForm.removeAttribute('disabled');
|
||||
addressForm.classList.remove('disabled-input')
|
||||
const formInspeksi = @json($forminspeksi);
|
||||
const addressInput = document.getElementById('address');
|
||||
|
||||
if (formInspeksi && formInspeksi.asset && formInspeksi.asset.alamat) {
|
||||
if (formInspeksi.asset.alamat['tidak sesuai'] && formInspeksi.asset.alamat['tidak sesuai'].address) {
|
||||
addressInput.value = formInspeksi.asset.alamat['tidak sesuai'].address;
|
||||
} else if (formInspeksi.asset.alamat['sesuai'] && formInspeksi.asset.alamat['sesuai'].address) {
|
||||
addressInput.value = formInspeksi.asset.alamat['sesuai'].address;
|
||||
} else {
|
||||
addressInput.value = "";
|
||||
}
|
||||
}
|
||||
|
||||
inputs.forEach(element => {
|
||||
if (element.tagName === 'INPUT') {
|
||||
element.removeAttribute('readonly');
|
||||
} else if (element.tagName === 'SELECT') {
|
||||
element.removeAttribute('disabled');
|
||||
element.classList.remove('disabled-input')
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function toggleFieldVisibility(fieldName, inputId, visibleValues = []) {
|
||||
const selectedValue = $(`[name="${fieldName}"]:checked`).val();
|
||||
const inputField = $(`#${inputId}`);
|
||||
@@ -319,12 +352,21 @@
|
||||
}
|
||||
}
|
||||
|
||||
.scrollable-x-auto {
|
||||
overflow-x: auto;
|
||||
max-width: 100%;
|
||||
div[disabled] {
|
||||
background-color: #f5f5f5;
|
||||
color: #a0a0a0;
|
||||
border: 1px solid #d1d1d1;
|
||||
cursor: not-allowed;
|
||||
|
||||
pointer-events: none;
|
||||
|
||||
}
|
||||
div[disabled]:hover {
|
||||
background-color: #e8e8e8;
|
||||
}
|
||||
|
||||
.table {
|
||||
min-width: 100%;
|
||||
div.disabled-input {
|
||||
opacity: 0.6;
|
||||
transition: opacity 0.3s ease;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user