update form inspeksi dan so bisa ambil alih
This commit is contained in:
@@ -27,10 +27,10 @@
|
||||
|
||||
<div id="luas_unit_tidak_sesuai" class="flex items-baseline gap-2"
|
||||
style="{{ old('luas_unit', $forminspeksi['luas_unit'] ?? '') == 'tidak sesuai' ? '' : 'display: none;' }}">
|
||||
<input type="text" name="luas_unit_tidak_sesuai" class="input w-full"
|
||||
<input id="analisa_luas_unit_tidak_sesuai" type="text" name="luas_unit_tidak_sesuai" class="input w-full"
|
||||
placeholder="Masukan Luas Tanah"
|
||||
value="{{ old('luas_unit_tidak_sesuai', $forminspeksi['luas_unit_tidak_sesuai'] ?? '') }}">
|
||||
<button type="button" class="btn btn-md btn-primary">Save</button>
|
||||
<button type="button" class="btn btn-md btn-primary" onclick="updateAnalisa('analisa_unit')">Save</button>
|
||||
</div>
|
||||
</div>
|
||||
<em id="error-luas_unit" class="alert text-danger text-sm"></em>
|
||||
@@ -80,9 +80,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56">Lantai</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
|
||||
@@ -5,7 +5,20 @@
|
||||
</div>
|
||||
<div class="grid gap-5">
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56">Luas Tanah</label>
|
||||
<label class="form-label max-w-56">Luas Bagunan</label>
|
||||
<div class="mt-2">
|
||||
|
||||
@if (isset($permohonan->debiture->documents))
|
||||
@foreach ($permohonan->debiture->documents as $item)
|
||||
@php
|
||||
$luas = $item->detail;
|
||||
$details = json_decode($luas[0]->details, true);
|
||||
$luas_bangunan = isset($details['luas_bangunan']) ? $details['luas_bangunan'] : 'N/A';
|
||||
@endphp
|
||||
<p class="text-2sm text-gray-700">{{ $luas_bangunan }} m<sup>2</sup></p>
|
||||
@endforeach
|
||||
|
||||
@endif
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<div class="grid grid-cols-2 md:grid-cols-3 gap-4 mt-2">
|
||||
<label class="form-label flex items-center gap-3 text-nowrap">
|
||||
@@ -25,15 +38,16 @@
|
||||
|
||||
<div id="luas_tanah_bagunan_tidak_sesuai" class="flex items-baseline gap-2"
|
||||
style="{{ old('luas_tanah_bagunan_bagunan', $forminspeksi['bangunan']['luas_tanah_bagunan_bagunan'] ?? '') == 'tidak sesuai' ? '' : 'display: none;' }}">
|
||||
<input type="text" name="luas_tanah_bagunan_tidak_sesuai" class="input w-full"
|
||||
<input type="text"id="analisa_bangunan_tidak_sesuai" name="luas_tanah_bagunan_tidak_sesuai" class="input w-full"
|
||||
placeholder="Masukan Luas Bangunan Tidak Sesuai..."
|
||||
value="{{ old('luas_tanah_bagunan_tidak_sesuai', $forminspeksi['bangunan']['luas_tanah_bagunan_tidak_sesuai'] ?? '') }}">
|
||||
<button type="button" class="btn btn-md btn-primary">Save</button>
|
||||
<button type="button" class="btn btn-md btn-primary" onclick="updateAnalisa('analisa_bangunan')">Save</button>
|
||||
</div>
|
||||
</div>
|
||||
<em id="error-luas_tanah_bagunan" class="alert text-danger text-sm"></em>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Jenis Bangunan -->
|
||||
@@ -139,7 +153,7 @@
|
||||
@if (@isset($spekKategoriBagunan))
|
||||
@foreach ($spekKategoriBagunan as $item)
|
||||
<div>
|
||||
<input type="hidden" name="spek_kategori_bangunan[]"
|
||||
<input type="hidden" name="spek_kategori_bangunan.[]"
|
||||
value="{{ $item->name }}">
|
||||
<label
|
||||
class="form-label flex items-center gap-3 text-nowrap">{{ $item->name }}</label>
|
||||
@@ -149,7 +163,7 @@
|
||||
@if ($spek->spek_kategori_bangunan_id == $item->id)
|
||||
<label class="form-label flex items-center gap-2.5">
|
||||
<input class="checkbox"
|
||||
name="spek_bangunan_{{ $item->name }}[]"
|
||||
name="spek_bangunan[{{ $item->name }}][]"
|
||||
type="checkbox" value="{{ $spek->name }}" />
|
||||
{{ $spek->name }}
|
||||
</label>
|
||||
@@ -235,33 +249,39 @@
|
||||
|
||||
document.getElementById('addBagunan').addEventListener('click', function() {
|
||||
const newDiv = spekBangunanContainer.querySelector('.spek-bangunan').cloneNode(true);
|
||||
console.log('Building label');
|
||||
// Clear the selected values and input fields of the cloned input fields
|
||||
newDiv.querySelectorAll('select, input').forEach(input => {
|
||||
|
||||
// Update input fields
|
||||
newDiv.querySelectorAll('select, input').forEach((input, index) => {
|
||||
if (input.type === 'checkbox' || input.type === 'radio') {
|
||||
input.checked = false;
|
||||
} else {
|
||||
input.value = '';
|
||||
}
|
||||
|
||||
// Update name attribute
|
||||
if (input.name) {
|
||||
const baseName = input.name.split('[')[0]; // Get the base name
|
||||
const count = spekBangunanContainer.querySelectorAll('.spek-bangunan').length + 1;
|
||||
input.name = `${baseName}[${count}]`;
|
||||
}
|
||||
});
|
||||
|
||||
// Append the cloned div to the container
|
||||
// Append the cloned div
|
||||
spekBangunanContainer.appendChild(newDiv);
|
||||
|
||||
// Add event listener to the delete button in the cloned div
|
||||
newDiv.querySelector('.delete-button').addEventListener('click', function() {
|
||||
spekBangunanContainer.removeChild(newDiv);
|
||||
updateDeleteButtonsVisibility();
|
||||
updateBuildingLabels(); // Update the labels after removing
|
||||
console.log('Building label');
|
||||
updateBuildingLabels();
|
||||
});
|
||||
|
||||
// Update delete buttons visibility and labels
|
||||
// Update UI
|
||||
updateDeleteButtonsVisibility();
|
||||
updateBuildingLabels();
|
||||
console.log('Building label');
|
||||
});
|
||||
|
||||
|
||||
// Initial setup: Ensure "Bangunan 1" is labeled
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
updateDeleteButtonsVisibility();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,6 +5,7 @@
|
||||
@endsection --}}
|
||||
|
||||
@section('content')
|
||||
@include('lpj::assetsku.includenya')
|
||||
<div class="w-full grid gap-5 lg:gap-7.5 mx-auto">
|
||||
<div class="card min-w-full">
|
||||
<div class="card min-w-full">
|
||||
@@ -234,6 +235,7 @@
|
||||
if (response.success) {
|
||||
window.location.href =
|
||||
'{{ route('surveyor.show', ['id' => $permohonan->id]) }}?form=denah';
|
||||
toastrSuccessBuild(response.message);
|
||||
}
|
||||
console.log(response);
|
||||
},
|
||||
@@ -249,6 +251,8 @@
|
||||
console.log('Status:', status);
|
||||
console.log('Response:', xhr.responseText);
|
||||
console.log(errors);
|
||||
toastrErrorBuild(error);
|
||||
|
||||
},
|
||||
complete: function() {
|
||||
// Re-enable the button and hide the spinner
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
@endsection --}}
|
||||
|
||||
@section('content')
|
||||
@include('lpj::assetsku.includenya')
|
||||
<div class="w-full grid gap-5 lg:gap-7.5 mx-auto">
|
||||
<div class="card min-w-full">
|
||||
<div class="card min-w-full">
|
||||
@@ -588,104 +589,14 @@
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Modal Kamera -->
|
||||
<div class="modal fade" data-modal="true" id="cameraModal" data-backdrop="" data-keyboard="false">
|
||||
<div class="modal-content">
|
||||
|
||||
<div class="modal-header">
|
||||
<h3 class="modal-title">Ambil Foto</h3>
|
||||
<button class="btn btn-xs btn-icon btn-light" data-modal-dismiss="true" id="closeModal">
|
||||
<i class="ki-outline ki-cross"></i>
|
||||
</button>
|
||||
</div>
|
||||
<!-- Camera Interface -->
|
||||
<div class="modal-body">
|
||||
<div class="camera-container relative">
|
||||
<video id="video" class="w-full h-auto" autoplay playsinline></video>
|
||||
<canvas id="canvas" class="hidden w-full h-auto"></canvas>
|
||||
<canvas id="drawingCanvas" class="hidden absolute top-0 left-0 w-full h-full"></canvas>
|
||||
<div id="textOverlay" class="position-absolute top-0 left-0 w-100 h-100 pointer-events-none">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer mt-2">
|
||||
<div id="cameraControls" class="flex justify-center gap-2 mt-4">
|
||||
<button id="startButton" class="btn btn-primary">
|
||||
<i class="ki-outline ki-camera"></i> Start Camera
|
||||
</button>
|
||||
<button id="takePhotoButton" class="btn btn-success" disabled>
|
||||
<i class="ki-outline ki-photograph"></i> Ambil Foto
|
||||
</button>
|
||||
<button id="switchButton" class="btn btn-info" disabled>
|
||||
<i class="ki-outline ki-arrows-circle"></i> Switch Camera
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Editor Controls -->
|
||||
<div id="editorControls" class=" flex flex-wrap gap-2 mt-4">
|
||||
<div class="drawing-tools flex gap-2">
|
||||
|
||||
<button class="tool-btn btn btn-sm" data-tool="brush">
|
||||
<i class="ki-filled ki-brush"></i>
|
||||
</button>
|
||||
<button class="tool-btn btn btn-sm" data-tool="rectangle">
|
||||
<i class="ki-filled ki-frame"></i>
|
||||
</button>
|
||||
<button class="btn btn-light btn-sm tool-btn" data-tool="arrow">
|
||||
<i class="ki-duotone ki-arrow-right fs-2"></i>
|
||||
</button>
|
||||
<button class="tool-btn btn btn-sm" data-tool="circle">
|
||||
<i class="ki-filled ki-mouse-circle"></i>
|
||||
</button>
|
||||
<button class="tool-btn btn btn-sm" data-tool="text">
|
||||
<i class="ki-filled ki-text"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="drawing-settings flex gap-2">
|
||||
<input type="color" id="colorPicker" class="w-8 h-8 rounded">
|
||||
<div class="flex items-center gap-2">
|
||||
<input type="range" id="brushSize" min="1" max="20" value="5"
|
||||
class="range range-sm">
|
||||
<span id="brushSizeValue" class="text-sm">5px</span>
|
||||
</div>
|
||||
<input type="text" id="textInput" class="input" placeholder="Enter text">
|
||||
<button type="button" class="btn btn-primary" id="confirmTextBtn">Add Text</button>
|
||||
</div>
|
||||
|
||||
<div class="history-controls flex gap-2">
|
||||
<button id="undoButton" class="btn btn-sm">
|
||||
<i class="ki-filled ki-arrows-loop"></i>
|
||||
</button>
|
||||
<button id="resetButton" class="btn btn-sm">
|
||||
<i class="ki-outline ki-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="final-controls flex gap-2">
|
||||
<button type="button" class="btn btn-light btn-sm" data-modal-dismiss="true">Cancel</button>
|
||||
<button id="backButton" class="btn btn-warning btn-sm">
|
||||
<i class="ki-outline ki-arrow-left"></i> Kembali
|
||||
</button>
|
||||
<button id="saveButton" class="btn btn-success btn-sm" data-modal-dismiss="true">
|
||||
<i class="ki-outline ki-check"></i> Simpan
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@include('lpj::surveyor.components.modal-kamera')
|
||||
@endsection
|
||||
|
||||
|
||||
|
||||
@push('scripts')
|
||||
<script>
|
||||
|
||||
|
||||
function submitFoto() {
|
||||
const formElement = $('#formFoto')[0];
|
||||
const formData = new FormData(formElement);
|
||||
@@ -712,6 +623,7 @@
|
||||
if (response.success) {
|
||||
window.location.href =
|
||||
'{{ route('surveyor.show', ['id' => $permohonan->id]) }}?form=foto';
|
||||
toastrSuccessBuild(response.message);
|
||||
}
|
||||
|
||||
},
|
||||
@@ -727,6 +639,7 @@
|
||||
console.log('Status:', status);
|
||||
console.log('Response:', xhr.responseText);
|
||||
console.log(errors);
|
||||
toastrErrorBuild(error);
|
||||
},
|
||||
complete: function() {
|
||||
// Re-enable the button and hide the spinner
|
||||
@@ -738,307 +651,6 @@
|
||||
}
|
||||
</script>
|
||||
@include('lpj::surveyor.js.camera-editor')
|
||||
|
||||
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
const ruteLainnyaDiv = document.getElementById("ruteLainnya");
|
||||
const lantaiLainnyaDiv = document.getElementById("lantaiLainnya");
|
||||
|
||||
// Function to add delete event listeners to existing buttons
|
||||
function addDeleteListeners(container) {
|
||||
container.querySelectorAll(".delete-button").forEach(button => {
|
||||
button.addEventListener("click", function() {
|
||||
this.closest(
|
||||
".flex.items-baseline.flex-wrap.lg\\:flex-nowrap.gap-2\\.5.mb-5"
|
||||
).remove();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Add delete listeners to existing buttons
|
||||
addDeleteListeners(ruteLainnyaDiv);
|
||||
addDeleteListeners(lantaiLainnyaDiv);
|
||||
|
||||
function createNewDiv(container, inputName) {
|
||||
const newDiv = document.createElement("div");
|
||||
newDiv.className = "flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 mb-5";
|
||||
newDiv.innerHTML = `
|
||||
<label class="flex flex-col form-label max-w-56">
|
||||
Masukkan nama ${inputName}
|
||||
</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_${inputName}[]">
|
||||
</div>
|
||||
<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"
|
||||
style="{{ isset($formFoto['gerbang']) ? '' : 'display: none;' }} width: 30rem;">
|
||||
|
||||
|
||||
<div class="input-group w-full flex gap-2">
|
||||
<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')"
|
||||
>
|
||||
<button type="button" id="btnCamera" class="btn btn-light"
|
||||
data-modal-toggle="#cameraModal">
|
||||
<i class="ki-outline ki-abstract-33"></i> Camera
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<button type="button" class="btn btn-danger btn-sm delete-button">
|
||||
<i class="ki-filled ki-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
container.appendChild(newDiv);
|
||||
addDeleteListeners(container);
|
||||
}
|
||||
|
||||
document.getElementById("btnAddMore").addEventListener("click", function() {
|
||||
createNewDiv(ruteLainnyaDiv, "rute_lainnya");
|
||||
});
|
||||
|
||||
document.getElementById("btnAddMoreObject").addEventListener("click", function() {
|
||||
createNewDiv(lantaiLainnyaDiv, "lantai_lainnya");
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
const style = document.createElement('style');
|
||||
style.textContent = `
|
||||
.draggable-text {
|
||||
z-index: 1000;
|
||||
}
|
||||
.draggable-text:hover {
|
||||
outline: 1px dashed #666;
|
||||
}
|
||||
`;
|
||||
document.head.appendChild(style);
|
||||
|
||||
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const editor = new UniversalCameraEditor();
|
||||
const cameraButtons = document.querySelectorAll('#btnCamera');
|
||||
const modal = document.getElementById('cameraModal');
|
||||
const closeModal = document.getElementById('closeModal');
|
||||
|
||||
// Current input field to update
|
||||
let currentInputField = null;
|
||||
|
||||
// Handle camera button click
|
||||
cameraButtons.forEach(button => {
|
||||
button.addEventListener('click', function(e) {
|
||||
e.preventDefault();
|
||||
const inputContainer = this.closest('.input-group');
|
||||
currentInputField = inputContainer.querySelector('input[type="file"]');
|
||||
modal.classList.remove('hidden');
|
||||
modal.classList.add('modal-open');
|
||||
editor.startCamera();
|
||||
});
|
||||
});
|
||||
|
||||
closeModal.addEventListener('click', function() {
|
||||
modal.classList.add('hidden');
|
||||
editor.closeCamera();
|
||||
});
|
||||
// Override save function
|
||||
editor.saveAndUpload = async function() {
|
||||
try {
|
||||
// Create final canvas
|
||||
const finalCanvas = document.createElement('canvas');
|
||||
finalCanvas.width = this.canvas.width;
|
||||
finalCanvas.height = this.canvas.height;
|
||||
const ctx = finalCanvas.getContext('2d');
|
||||
|
||||
// Draw original photo and edited result on final canvas
|
||||
ctx.drawImage(this.canvas, 0, 0);
|
||||
ctx.drawImage(this.drawingCanvas, 0, 0);
|
||||
|
||||
// Convert canvas to Blob and create file
|
||||
finalCanvas.toBlob(async (blob) => {
|
||||
const file = new File([blob], `camera_photo_${Date.now()}.jpg`, {
|
||||
type: "image/jpeg"
|
||||
});
|
||||
|
||||
// Create FileList and update input field
|
||||
const dataTransfer = new DataTransfer();
|
||||
dataTransfer.items.add(file);
|
||||
|
||||
if (currentInputField) {
|
||||
currentInputField.files = dataTransfer.files;
|
||||
|
||||
const event = new Event('change', {
|
||||
bubbles: true
|
||||
});
|
||||
currentInputField.dispatchEvent(event);
|
||||
const previewContainer = currentInputField.closest('.input-group')
|
||||
.querySelector('.preview-container');
|
||||
if (previewContainer) {
|
||||
const img = document.createElement('img');
|
||||
img.src = URL.createObjectURL(file);
|
||||
img.className = 'w-full h-32 object-cover rounded-lg';
|
||||
previewContainer.innerHTML = '';
|
||||
previewContainer.appendChild(img);
|
||||
}
|
||||
}
|
||||
|
||||
// Close modal
|
||||
|
||||
modal.classList.remove('show');
|
||||
modal.style.display = 'none';
|
||||
modal.setAttribute('aria-hidden', 'true');
|
||||
// document.body.classList.remove('modal-open');
|
||||
|
||||
|
||||
// Remove modal backdrop if exists
|
||||
const backdrop = document.querySelector('.modal-backdrop');
|
||||
if (backdrop) {
|
||||
backdrop.remove();
|
||||
}
|
||||
|
||||
// Stop camera stream
|
||||
if (editor.stream) {
|
||||
editor.stream.getTracks().forEach(track => track.stop());
|
||||
editor.stream = null;
|
||||
}
|
||||
|
||||
// Reset camera to initial state
|
||||
editor.closeCamera();
|
||||
|
||||
// Reset scroll if needed
|
||||
window.scrollTo(0, 0); // Adjust as necessary
|
||||
}, 'image/jpeg', 0.8);
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error saving photo:', error);
|
||||
alert('Error saving photo. Please try again.');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Handle escape key
|
||||
document.addEventListener('keydown', function(e) {
|
||||
if (e.key === 'Escape') {
|
||||
const modal = document.getElementById('cameraModal');
|
||||
if (modal.classList.contains('modal-open')) {
|
||||
modal.classList.remove('modal-open');
|
||||
modal.classList.add('hidden');
|
||||
if (editor.stream) {
|
||||
editor.stream.getTracks().forEach(track => track.stop());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
function setupInputHandlers(containerId, buttonId, labelText, inputDataClass, buttonDeleteClass) {
|
||||
const inputContainer = document.getElementById(containerId);
|
||||
const addButton = document.getElementById(buttonId);
|
||||
|
||||
function updateLabels() {
|
||||
const labels = inputContainer.querySelectorAll('.form-label span');
|
||||
labels.forEach((label, index) => {
|
||||
label.textContent = `${labelText} ${index + 1}`;
|
||||
});
|
||||
}
|
||||
|
||||
function handleDeleteButtons() {
|
||||
const deleteBtns = inputContainer.querySelectorAll(`.${buttonDeleteClass}`);
|
||||
deleteBtns.forEach(btn => {
|
||||
btn.style.display = inputContainer.children.length > 1 ? 'block' : 'none';
|
||||
});
|
||||
}
|
||||
|
||||
function createNewInput() {
|
||||
const newDiv = inputContainer.children[0].cloneNode(true);
|
||||
const inputFile = newDiv.querySelector(`.${inputDataClass}`);
|
||||
inputFile.id = `inputRute-${inputContainer.children.length}`;
|
||||
|
||||
// Reset input file value
|
||||
if (inputFile) {
|
||||
inputFile.value = '';
|
||||
}
|
||||
|
||||
// Update the camera button to set currentInputField
|
||||
const cameraButton = newDiv.querySelector('#btnCamera');
|
||||
if (cameraButton) {
|
||||
cameraButton.addEventListener('click', function(e) {
|
||||
e.preventDefault();
|
||||
currentInputField = inputFile; // Set current input field to the new input
|
||||
modal.classList.remove('hidden');
|
||||
modal.classList.add('modal-open');
|
||||
editor.startCamera();
|
||||
});
|
||||
}
|
||||
|
||||
// Add delete button functionality
|
||||
const deleteBtn = newDiv.querySelector(`.${buttonDeleteClass}`);
|
||||
if (deleteBtn) {
|
||||
deleteBtn.addEventListener('click', function() {
|
||||
inputContainer.removeChild(newDiv);
|
||||
handleDeleteButtons();
|
||||
updateLabels();
|
||||
});
|
||||
}
|
||||
|
||||
// Update preview container
|
||||
const previewContainer = document.createElement('div');
|
||||
previewContainer.className = 'preview-container';
|
||||
|
||||
const img = document.createElement('img');
|
||||
img.id = `foto_rute-preview-${inputFile.id}`;
|
||||
img.src = '';
|
||||
img.className = 'mt-2 h-auto';
|
||||
img.style.display = 'none';
|
||||
img.style.width = '30rem';
|
||||
previewContainer.appendChild(img);
|
||||
|
||||
// Append preview container to the new input group
|
||||
const inputGroup = newDiv.querySelector('.input-group');
|
||||
inputGroup.appendChild(previewContainer);
|
||||
|
||||
newDiv.style.marginTop = '10px';
|
||||
inputContainer.appendChild(newDiv);
|
||||
updateLabels();
|
||||
handleDeleteButtons();
|
||||
}
|
||||
|
||||
if (addButton) {
|
||||
addButton.addEventListener('click', createNewInput);
|
||||
}
|
||||
|
||||
const firstDeleteBtn = inputContainer.children[0].querySelector(`.${buttonDeleteClass}`);
|
||||
if (firstDeleteBtn) {
|
||||
firstDeleteBtn.addEventListener('click', function() {
|
||||
if (inputContainer.children.length > 1) {
|
||||
inputContainer.removeChild(this.closest('.flex'));
|
||||
handleDeleteButtons();
|
||||
updateLabels();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
updateLabels();
|
||||
}
|
||||
|
||||
setupInputHandlers('inputContainerRute', 'btnRute', 'Foto Rute Menuju Lokasi', 'file-input',
|
||||
'delete-btn');
|
||||
setupInputHandlers('inputContainerLantai', 'btnLantai', 'Foto Lantai', 'file-input', 'delete-btn');
|
||||
setupInputHandlers('inputContainerLingkungan', 'btnLingkungan', 'Lingkungan', 'file-input',
|
||||
'delete-btn');
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<div class=" card w-full bg-white rounded-lg shadow-md overflow-hidden">
|
||||
<div class=" card w-full bg-white rounded-lg shadow-md ">
|
||||
<div class="card-body">
|
||||
<div class="py-4">
|
||||
<h1 class="text-md font-medium text-gray-900">Order Penilaian</h1>
|
||||
@@ -79,7 +79,7 @@
|
||||
</div>
|
||||
|
||||
|
||||
<div class="card w-full bg-white rounded-lg shadow-md overflow-hidden">
|
||||
<div class="card w-full bg-white rounded-lg shadow-md ">
|
||||
<div class="card-body">
|
||||
<div class="py-4 ">
|
||||
<h1 class="text-md font-medium text-gray-900">Deskripsi Aset jaminan</h1>
|
||||
@@ -99,36 +99,36 @@
|
||||
<div class="flex-wrap items-stretch">
|
||||
<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">
|
||||
<input onclick="toggleFieldVisibility('jenis_asset', 'jenis_asset', ['tidak sesuai'])" type="radio" class="radio"
|
||||
name="jenis_asset" value="sesuai"
|
||||
<input onclick="toggleFieldVisibility('jenis_asset', 'jenis_asset', ['tidak sesuai'])"
|
||||
type="radio" class="radio" name="jenis_asset" value="sesuai"
|
||||
{{ old('jenis_asset', $forminspeksi['asset']['jenis_asset'] ?? '') == 'sesuai' ? 'checked' : '' }}>
|
||||
<span class="ml-2">Ya</span>
|
||||
</label>
|
||||
<label class="form-label flex items-center gap-2.5 text-nowrap">
|
||||
<input onclick="toggleFieldVisibility('jenis_asset', 'jenis_asset', ['tidak sesuai'])" type="radio" class="radio"
|
||||
name="jenis_asset" value="tidak sesuai"
|
||||
<input onclick="toggleFieldVisibility('jenis_asset', 'jenis_asset', ['tidak sesuai'])"
|
||||
type="radio" class="radio" name="jenis_asset" value="tidak sesuai"
|
||||
{{ old('jenis_asset', $forminspeksi['asset']['jenis_asset'] ?? '') == 'tidak sesuai' ? 'checked' : '' }}>
|
||||
<span class="ml-2">Tidak</span>
|
||||
</label>
|
||||
<!-- Select dropdown untuk "Tidak Sesuai" -->
|
||||
|
||||
<div id="jenis_asset" class="flex items-baseline gap-2" style="{{ old('jenis_asset', $forminspeksi['asset']['jenis_asset'] ?? '') == 'tidak sesuai' ? '' : 'display: none;' }}">
|
||||
<select
|
||||
class="input w-full"
|
||||
name="jenis_asset_tidak_sesuai"
|
||||
>
|
||||
<option value="">Select Jenis asset</option>
|
||||
@if (isset($jenisJaminan))
|
||||
@foreach ($jenisJaminan as $item)
|
||||
<option value="{{ $item->name }}"
|
||||
{{ old('jenis_asset_tidak_sesuai', $forminspeksi['asset']['jenis_asset_tidak_sesuai'] ?? '') == $item->name ? 'selected' : '' }}>
|
||||
{{ $item->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
@endif
|
||||
</select>
|
||||
<button type="button" class="btn btn-md btn-primary">Save</button>
|
||||
</div>
|
||||
<div id="jenis_asset" class="flex items-baseline gap-2"
|
||||
style="{{ old('jenis_asset', $forminspeksi['asset']['jenis_asset'] ?? '') == 'tidak sesuai' ? '' : 'display: none;' }}">
|
||||
<select id="jenis_asset_tidak_sesuai" class="input w-full"
|
||||
name="jenis_asset_tidak_sesuai">
|
||||
<option value="">Select Jenis asset</option>
|
||||
@if (isset($jenisJaminan))
|
||||
@foreach ($jenisJaminan as $item)
|
||||
<option value="{{ $item->id }}"
|
||||
{{ old('jenis_asset_tidak_sesuai', $forminspeksi['asset']['jenis_asset_tidak_sesuai'] ?? '') == $item->name ? 'selected' : '' }}>
|
||||
{{ $item->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
@endif
|
||||
</select>
|
||||
<button type="button" class="btn btn-md btn-primary"
|
||||
onclick="updateAnalisa('jenis_asset')">Save</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<em id="error-jenis_asset" class="alert text-danger text-sm"></em>
|
||||
@@ -139,7 +139,6 @@
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56">Alamat</label>
|
||||
<div>
|
||||
|
||||
@foreach ($permohonan->debiture->documents as $dokumen)
|
||||
<span class="text-2sm text-gray-700">
|
||||
{{ formatAlamat($dokumen) }}
|
||||
@@ -148,207 +147,136 @@
|
||||
|
||||
<div class="flex-wrap items-stretch">
|
||||
<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">
|
||||
<input onclick="toggleTidakSesuai('alamat_sesuai','alamat_tidak_sesuai')" type="radio"
|
||||
class="radio" name="alamat_sesuai" value="sesuai"
|
||||
{{ old('alamat_sesuai', $forminspeksi['asset']['alamat_sesuai'] ?? '') == 'sesuai' ? 'checked' : '' }}>
|
||||
<span class="ml-2">Ya</span>
|
||||
</label>
|
||||
<label class="form-label flex items-center gap-2.5 text-nowrap">
|
||||
<input onclick="toggleTidakSesuai('alamat_sesuai','alamat_tidak_sesuai')" type="radio"
|
||||
class="radio" name="alamat_sesuai" value="tidak sesuai"
|
||||
{{ old('alamat_sesuai', $forminspeksi['asset']['alamat_sesuai'] ?? '') == 'tidak sesuai' ? 'checked' : '' }}>
|
||||
<span class="ml-2">Tidak</span>
|
||||
</label>
|
||||
<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">
|
||||
<input
|
||||
onclick="toggleAlamatVisibility('alamat_sesuai', 'alamat_tidak_sesuai', 'sesuai')"
|
||||
type="radio" class="radio" name="alamat_sesuai" value="sesuai"
|
||||
{{ old('jenis_asset', $forminspeksi['asset']['jenis_asset'] ?? '') == 'sesuai' ? 'checked' : '' }}>
|
||||
<span class="ml-2">Ya</span>
|
||||
</label>
|
||||
<label class="form-label flex items-center gap-3 text-nowrap">
|
||||
<input
|
||||
onclick="toggleAlamatVisibility('alamat_sesuai', 'alamat_tidak_sesuai', 'tidak sesuai')"
|
||||
type="radio" class="radio" name="alamat_sesuai" value="tidak sesuai"
|
||||
{{ old('jenis_asset', $forminspeksi['asset']['jenis_asset'] ?? '') == 'tidak sesuai' ? 'checked' : '' }}>
|
||||
<span class="ml-2">Tidak</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<em id="error-alamat" class="alert text-danger text-sm"></em>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="alamat_tidak_sesuai" class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5" style="display: none;">
|
||||
<label class="form-label max-w-56">
|
||||
Address
|
||||
</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 w-full">
|
||||
<select id="province_code" name="province_code" class="select w-full @error('province_code') border-danger bg-danger-light @enderror">
|
||||
<option value="">Select Province</option>
|
||||
@foreach($provinces as $province)
|
||||
@if(isset($debitur))
|
||||
<option value="{{ $province->code }}" {{ isset($debitur->province_code) && $debitur->province_code == $province->code?'selected' : '' }}>
|
||||
{{ $province->name }}
|
||||
</option>
|
||||
@else
|
||||
<option value="{{ $province->code }}">
|
||||
{{ $province->name }}
|
||||
</option>
|
||||
@endif
|
||||
@endforeach
|
||||
</select>
|
||||
@error('province_code')
|
||||
<em class="alert text-danger text-sm">{{ $message }}</em>
|
||||
@enderror
|
||||
</div>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<select id="city_code" name="city_code" class="select w-full @error('city_code') border-danger bg-danger-light @enderror">
|
||||
<option value="">Select City</option>
|
||||
@if(isset($cities))
|
||||
@foreach($cities as $city)
|
||||
@if(isset($debitur))
|
||||
<option value="{{ $city->code }}" {{ isset($debitur->city_code) && $debitur->city_code == $city->code?'selected' : '' }}>
|
||||
{{ $city->name }}
|
||||
</option>
|
||||
@else
|
||||
<option value="{{ $city->code }}">
|
||||
{{ $city->name }}
|
||||
</option>
|
||||
@endif
|
||||
@endforeach
|
||||
|
||||
@endif
|
||||
</select>
|
||||
@error('city_code')
|
||||
<em class="alert text-danger text-sm">{{ $message }}</em>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col lg:flex-row gap-2 w-full mt-2 lg:mt-5">
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<select id="district_code" name="district_code" class="select w-full @error('district_code') border-danger bg-danger-light @enderror">
|
||||
<option value="">Select District</option>
|
||||
@if(isset($districts))
|
||||
@foreach($districts as $district)
|
||||
@if(isset($debitur))
|
||||
<option value="{{ $district->code }}" {{ isset($debitur->district_code) && $debitur->district_code == $district->code?'selected' : '' }}>
|
||||
{{ $district->name }}
|
||||
</option>
|
||||
@else
|
||||
<option value="{{ $district->code }}">
|
||||
{{ $district->name }}
|
||||
</option>
|
||||
@endif
|
||||
@endforeach
|
||||
|
||||
@endif
|
||||
</select>
|
||||
@error('district_code')
|
||||
<em class="alert text-danger text-sm">{{ $message }}</em>
|
||||
@enderror
|
||||
</div>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<select id="village_code" name="village_code" class="select w-full @error('district_code') border-danger bg-danger-light @enderror">
|
||||
<option value="">Select Village</option>
|
||||
@if(isset($villages))
|
||||
@foreach($villages as $village)
|
||||
@if(isset($debitur))
|
||||
<option value="{{ $village->code }}" {{ isset($debitur->village_code) && $debitur->village_code == $village->code?'selected' : '' }}>
|
||||
{{ $village->name }}
|
||||
</option>
|
||||
@else
|
||||
<option value="{{ $village->code }}">
|
||||
{{ $village->name }}
|
||||
</option>
|
||||
@endif
|
||||
@endforeach
|
||||
|
||||
@endif
|
||||
</select>
|
||||
@error('district_code')
|
||||
<em class="alert text-danger text-sm">{{ $message }}</em>
|
||||
@enderror
|
||||
</div>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<input class="input @error('postal_code') border-danger bg-danger-light @enderror" type="number" id="postal_code" name="postal_code" value="{{ $debitur->postal_code ?? '' }}" placeholder="Postal Code">
|
||||
@error('postal_code')
|
||||
<em class="alert text-danger text-sm">{{ $message }}</em>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-row w-full mt-2 lg:mt-5">
|
||||
<textarea class="textarea @error('address') border-danger bg-danger-light @enderror" rows="3" type="number" id="address" name="address">{{ $debitur->address ?? '' }}</textarea>
|
||||
@error('address')
|
||||
<em class="alert text-danger text-sm">{{ $message }}</em>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="alamat_tidak_sesuai" class="grid gap-2 mt-5" style="display: none;">
|
||||
@php
|
||||
|
||||
$inputDataLoaksi = [];
|
||||
$inputDataLoaksi = [
|
||||
[
|
||||
'label' => 'Jl.',
|
||||
'index' => 0,
|
||||
'name' => 'nama_jalan',
|
||||
'value' => old(
|
||||
'nama_jalan',
|
||||
isset($forminspeksi['asset']['nama_jalan']) ? $forminspeksi['asset']['nama_jalan'] : '',
|
||||
),
|
||||
],
|
||||
|
||||
[
|
||||
'label' => 'Desa/Kelurahan',
|
||||
'index' => 3,
|
||||
'name' => 'desa_kelurahan',
|
||||
'value' => old(
|
||||
'desa_kelurahan',
|
||||
isset($forminspeksi['asset']['desa_kelurahan']) ? $forminspeksi['asset']['desa_kelurahan'] : '',
|
||||
),
|
||||
],
|
||||
[
|
||||
'label' => 'Kecamatan',
|
||||
'index' => 4,
|
||||
'name' => 'kecamatan',
|
||||
'value' => old(
|
||||
'kecamatan',
|
||||
isset($forminspeksi['asset']['kecamatan']) ? $forminspeksi['asset']['kecamatan'] : '',
|
||||
),
|
||||
],
|
||||
[
|
||||
'label' => 'Kota/Kabupaten',
|
||||
'index' => 5,
|
||||
'name' => 'kota_kabupaten',
|
||||
'value' => old(
|
||||
'kota_kabupaten',
|
||||
isset($forminspeksi['asset']['kota_kabupaten']) ? $forminspeksi['asset']['kota_kabupaten'] : '',
|
||||
),
|
||||
],
|
||||
[
|
||||
'label' => 'Provinsi',
|
||||
'index' => 6,
|
||||
'name' => 'provinsi',
|
||||
'value' => old(
|
||||
'provinsi',
|
||||
isset($forminspeksi['asset']['provinsi']) ? $forminspeksi['asset']['provinsi'] : '',
|
||||
),
|
||||
],
|
||||
];
|
||||
|
||||
@endphp
|
||||
|
||||
@if (count($inputDataLoaksi) > 0)
|
||||
@foreach ($inputDataLoaksi as $item)
|
||||
<!-- Nomor Lambung -->
|
||||
{{-- Alamat Sesuai --}}
|
||||
<div id="alamat_sesuai" class="grid gap-2 mt-5" style="display: none;">
|
||||
@foreach ($permohonan->debiture->documents as $dokumen)
|
||||
@php
|
||||
$fields = [
|
||||
[
|
||||
'label' => 'Jl.',
|
||||
'value' => $dokumen->address ?? '',
|
||||
'name' => 'nama_jalan',
|
||||
'readonly' => false,
|
||||
],
|
||||
[
|
||||
'label' => 'Provinsi',
|
||||
'value' => $dokumen->province->name ?? '',
|
||||
'name' => 'provinsi',
|
||||
'readonly' => true,
|
||||
],
|
||||
[
|
||||
'label' => 'Kota/Kabupaten',
|
||||
'value' => $dokumen->city->name ?? '',
|
||||
'name' => 'kota_kabupaten',
|
||||
'readonly' => true,
|
||||
],
|
||||
[
|
||||
'label' => 'Kecamatan',
|
||||
'value' => $dokumen->district->name ?? '',
|
||||
'name' => 'kecamatan',
|
||||
'readonly' => true,
|
||||
],
|
||||
[
|
||||
'label' => 'Kelurahan',
|
||||
'value' => $dokumen->village->name ?? '',
|
||||
'name' => 'desa_kelurahan',
|
||||
'readonly' => true,
|
||||
],
|
||||
];
|
||||
@endphp
|
||||
@foreach ($fields as $field)
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56">{{ $item['label'] }}</label>
|
||||
<label class="form-label max-w-56">{{ $field['label'] }}</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<input type="text" name="{{ $item['name'] }}" class="input"
|
||||
placeholder="Masukkan {{ $item['label'] }}"
|
||||
value="{{ $item['value'] }}">
|
||||
<em id="error-{{ $item['name'] }}" class="alert text-danger text-sm"></em>
|
||||
<input type="text" class="input" name="{{ $field['name'] }}"
|
||||
value="{{ $field['value'] }}" {{ $field['readonly'] ? 'readonly' : '' }}>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
@endif
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
{{-- Alamat Tidak Sesuai --}}
|
||||
<div id="alamat_tidak_sesuai" class="grid gap-2 mt-5" style="display: none;">
|
||||
@php
|
||||
$inputDataLokasi = [
|
||||
['label' => 'Jl.', 'id' => 'address', 'name' => 'address', 'type' => 'text'],
|
||||
[
|
||||
'label' => 'Provinsi',
|
||||
'id' => 'province_code',
|
||||
'name' => 'provinsi',
|
||||
'type' => 'select',
|
||||
'options' => $provinces,
|
||||
],
|
||||
[
|
||||
'label' => 'Kota/Kabupaten',
|
||||
'id' => 'city_code',
|
||||
'name' => 'kota_kabupaten',
|
||||
'type' => 'select',
|
||||
'options' => $provinces,
|
||||
],
|
||||
[
|
||||
'label' => 'Kecamatan',
|
||||
'id' => 'district_code',
|
||||
'name' => 'kecamatan',
|
||||
'type' => 'select',
|
||||
'options' => $provinces,
|
||||
],
|
||||
[
|
||||
'label' => 'Desa/Kelurahan',
|
||||
'id' => 'village_code',
|
||||
'name' => 'desa_kelurahan',
|
||||
'type' => 'select',
|
||||
'options' => $provinces,
|
||||
],
|
||||
];
|
||||
@endphp
|
||||
|
||||
|
||||
@foreach ($inputDataLokasi as $item)
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56">{{ $item['label'] }}</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
@if ($item['type'] === 'text')
|
||||
<input id="{{ $item['id'] }}" name="{{ $item['name'] }}" class="input">
|
||||
@else
|
||||
<select id="{{ $item['id'] }}" name="{{ $item['name'] }}"
|
||||
class="select w-full">
|
||||
<option value="">{{ $item['label'] }}</option>
|
||||
@if ($item['id'] === 'province_code')
|
||||
@foreach ($item['options'] as $option)
|
||||
<option value="{{ $option->code }}">{{ $option->name }}</option>
|
||||
@endforeach
|
||||
@endif
|
||||
</select>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -363,12 +291,15 @@
|
||||
<label class="form-label max-w-56">Kordinat</label>
|
||||
<div id="perwakilan" class="flex items-baseline w-full gap-5">
|
||||
<div class="grid grid-cols-2 gap-4 items-center w-full">
|
||||
<input class="input" type="text" placeholder="Masukan Koordinat Latitude" type="text" name="kordinat_lat" id="lat"
|
||||
<input class="input" type="text" placeholder="Masukan Koordinat Latitude" type="text"
|
||||
name="kordinat_lat" id="lat"
|
||||
value="{{ old('kordinat_lat', isset($forminspeksi['asset']['kordinat_lat']) ? $forminspeksi['asset']['kordinat_lat'] : '') }}">
|
||||
<input class="input" type="text" placeholder="Masukan Koordinat Longitude" name="kordinat_lng" id="lng"
|
||||
value="{{ old('kordinat_lng', isset($forminspeksi['asset']['kordinat_lng']) ? $forminspeksi['asset']['kordinat_lng'] : '') }}" >
|
||||
<input class="input" type="text" placeholder="Masukan Koordinat Longitude"
|
||||
name="kordinat_lng" id="lng"
|
||||
value="{{ old('kordinat_lng', isset($forminspeksi['asset']['kordinat_lng']) ? $forminspeksi['asset']['kordinat_lng'] : '') }}">
|
||||
</div>
|
||||
<a target="_blank" href="https://www.google.com/maps"type="button" class="btn btn-md btn-outline btn-primary" >
|
||||
<a target="_blank" href="https://www.google.com/maps"type="button"
|
||||
class="btn btn-md btn-outline btn-primary">
|
||||
<i class="ki-filled ki-map"></i>Ambil
|
||||
Kordinat</a>
|
||||
</div>
|
||||
@@ -477,21 +408,23 @@
|
||||
<div>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
@foreach ($permohonan->debiture->documents as $dokumen)
|
||||
{{ $dokumen->pemilik->hubungan_pemilik->name?? "" }}
|
||||
{{ $dokumen->pemilik->hubungan_pemilik->name ?? '' }}
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
<div class="flex-wrap items-stretch">
|
||||
<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">
|
||||
<input onclick="toggleFieldVisibility('hub_cadeb','hub_cadeb_tidak_sesuai', ['tidak sesuai'])" type="radio" class="radio"
|
||||
name="hub_cadeb" value="sesuai"
|
||||
<input
|
||||
onclick="toggleFieldVisibility('hub_cadeb','hub_cadeb_tidak_sesuai', ['tidak sesuai'])"
|
||||
type="radio" class="radio" name="hub_cadeb" value="sesuai"
|
||||
{{ old('hub_cadeb', $forminspeksi['asset']['hub_cadeb'] ?? '') == 'sesuai' ? 'checked' : '' }}>
|
||||
<span class="ml-2">Ya</span>
|
||||
</label>
|
||||
<label class="form-label flex items-center gap-2.5 text-nowrap">
|
||||
<input onclick="toggleFieldVisibility('hub_cadeb','hub_cadeb_tidak_sesuai', ['tidak sesuai'])" type="radio" class="radio"
|
||||
name="hub_cadeb" value="tidak sesuai"
|
||||
<input
|
||||
onclick="toggleFieldVisibility('hub_cadeb','hub_cadeb_tidak_sesuai', ['tidak sesuai'])"
|
||||
type="radio" class="radio" name="hub_cadeb" value="tidak sesuai"
|
||||
{{ old('hub_cadeb', $forminspeksi['asset']['hub_cadeb'] ?? '') == 'tidak sesuai' ? 'checked' : '' }}>
|
||||
<span class="ml-2">Tidak</span>
|
||||
</label>
|
||||
@@ -524,24 +457,26 @@
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56">Penghuni Jaminan</label>
|
||||
|
||||
<div>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<div class="mt-2">
|
||||
<div class="flex flex-wrap items-baseline w-full text-sm">
|
||||
@foreach ($permohonan->debiture->documents as $dokumen)
|
||||
{{ $dokumen->penghuni->hubungan_penghuni->name?? "" }}
|
||||
{{ $dokumen->penghuni->hubungan_penghuni->name ?? 'N/A' }}
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
<div class="flex-wrap items-stretch">
|
||||
<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">
|
||||
<input onclick="toggleFieldVisibility('hub_cadeb_penghuni','hub_cadeb_Penghuni_tidak_sesuai', ['tidak sesuai'])" type="radio" class="radio"
|
||||
name="hub_cadeb_penghuni" value="sesuai"
|
||||
<input
|
||||
onclick="toggleFieldVisibility('hub_cadeb_penghuni','hub_cadeb_Penghuni_tidak_sesuai', ['tidak sesuai'])"
|
||||
type="radio" class="radio" name="hub_cadeb_penghuni" value="sesuai"
|
||||
{{ old('hub_cadeb_penghuni', $forminspeksi['asset']['hub_cadeb_penghuni'] ?? '') == 'sesuai' ? 'checked' : '' }}>
|
||||
<span class="ml-2">Ya</span>
|
||||
</label>
|
||||
<label class="form-label flex items-center gap-2.5 text-nowrap">
|
||||
<input onclick="toggleFieldVisibility('hub_cadeb_penghuni', 'hub_cadeb_Penghuni_tidak_sesuai', ['tidak sesuai'])" type="radio" class="radio"
|
||||
name="hub_cadeb_penghuni" value="tidak sesuai"
|
||||
<input
|
||||
onclick="toggleFieldVisibility('hub_cadeb_penghuni', 'hub_cadeb_Penghuni_tidak_sesuai', ['tidak sesuai'])"
|
||||
type="radio" class="radio" name="hub_cadeb_penghuni" value="tidak sesuai"
|
||||
{{ old('hub_cadeb_penghuni', $forminspeksi['asset']['hub_cadeb_penghuni'] ?? '') == 'tidak sesuai' ? 'checked' : '' }}>
|
||||
<span class="ml-2">Tidak</span>
|
||||
</label>
|
||||
@@ -551,8 +486,8 @@
|
||||
name="hub_cadeb_Penghuni_tidak_sesuai"
|
||||
style="{{ old('hub_cadeb', $forminspeksi['asset']['hub_cadeb'] ?? '') == 'tidak sesuai' ? '' : 'display: none;' }}">
|
||||
<option value="">Select Hubungan Cadeb</option>
|
||||
@if (isset($hubCadeb))
|
||||
@foreach ($hubCadeb as $item)
|
||||
@if (isset($hubPenghuni))
|
||||
@foreach ($hubPenghuni as $item)
|
||||
<option value="{{ $item->name }}"
|
||||
{{ old('hub_cadeb_Penghuni_tidak_sesuai', $forminspeksi['asset']['hub_cadeb_Penghuni_tidak_sesuai'] ?? '') == $item->name ? 'selected' : '' }}>
|
||||
{{ $item->name }}
|
||||
@@ -570,5 +505,3 @@
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@@ -165,30 +165,44 @@
|
||||
@endif
|
||||
</div>
|
||||
<!-- Upload Photo Button -->
|
||||
<div class=" flex w-full mt-2" style="margin-top: 20px">
|
||||
<div class="flex flex-col input-group w-full">
|
||||
<label for="" class="block text-sm font-medium text-gray-700">Upload Photo</label>
|
||||
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5" style="margin-top: 20px">
|
||||
<label for="" class="form-label max-w-56 text-sm font-medium text-gray-700">Upload Photo</label>
|
||||
|
||||
<div class="w-full">
|
||||
<div class="w-full grid gap-5">
|
||||
<div class="input-group w-full flex gap-2">
|
||||
<input id="foto_tempat" type="file" name="foto_tempat"
|
||||
|
||||
class="file-input file-input-bordered w-full" accept="image/*"
|
||||
onchange="previewImage(this, 'foto_tempat-preview')">
|
||||
<button type="button" id="btnCamera" class="btn btn-light"
|
||||
data-modal-toggle="#cameraModal">
|
||||
<i class="ki-outline ki-abstract-33"></i> Camera
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<img id="foto_tempat-preview"
|
||||
<img id="foto_tempat-preview"
|
||||
src="{{ asset('storage/' . (isset($forminspeksi['foto_tempat']) ? $forminspeksi['foto_tempat'] : '')) }}"
|
||||
alt="Foto Argis Region" class="mt-2 max-w-full h-auto"
|
||||
style="{{ isset($forminspeksi['foto_tempat']) ? '' : 'display: none;' }}">
|
||||
</div>
|
||||
</div>
|
||||
</div>77r7777
|
||||
|
||||
<!-- Notes Section -->
|
||||
<div class="mt-2" >
|
||||
<div class="bg-white rounded-lg">
|
||||
<h4 class="block text-sm font-medium text-gray-700 mt-2">Catatan yang Perlu Diperhatikan
|
||||
</h4>
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5" style="margin-top: 20px">
|
||||
|
||||
<label class="form-label max-w-56">Catatan yang Perlu Diperhatikan
|
||||
</label>
|
||||
<div class="input-group w-full flex gap-2">
|
||||
<textarea name="keterangan" class="textarea mt-2" placeholder="Masukkan catatan penting" rows="3">{{ old('keterangan', $forminspeksi['fakta']['keterangan'] ?? '') }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@include('lpj::surveyor.components.modal-kamera')
|
||||
|
||||
@push('scripts')
|
||||
@include('lpj::surveyor.js.camera-editor')
|
||||
@endpush
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
@endsection --}}
|
||||
|
||||
@section('content')
|
||||
@include('lpj::assetsku.includenya')
|
||||
<div class="w-full grid gap-5 lg:gap-7.5 mx-auto">
|
||||
<div class="card min-w-full">
|
||||
<div class="card min-w-full">
|
||||
@@ -124,6 +125,22 @@
|
||||
}
|
||||
|
||||
|
||||
function toggleAlamatVisibility(idSesuai, idTidakSesuai, selectedValue) {
|
||||
// Ambil elemen berdasarkan ID
|
||||
const alamatSesuai = document.getElementById(idSesuai);
|
||||
const alamatTidakSesuai = document.getElementById(idTidakSesuai);
|
||||
|
||||
// Periksa nilai yang dipilih dan tampilkan elemen yang sesuai
|
||||
if (selectedValue === 'sesuai') {
|
||||
alamatSesuai.style.display = 'grid'; // Tampilkan "Alamat Sesuai"
|
||||
alamatTidakSesuai.style.display = 'none'; // Sembunyikan "Alamat Tidak Sesuai"
|
||||
} else if (selectedValue === 'tidak sesuai') {
|
||||
alamatSesuai.style.display = 'none'; // Sembunyikan "Alamat Sesuai"
|
||||
alamatTidakSesuai.style.display = 'grid'; // Tampilkan "Alamat Tidak Sesuai"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function submitData() {
|
||||
const formElement = $('#formInspeksi')[0];
|
||||
@@ -144,10 +161,12 @@
|
||||
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||
},
|
||||
success: function(response) {
|
||||
if (response.success) {
|
||||
window.location.href =
|
||||
'{{ route('surveyor.show', ['id' => $permohonan->id]) }}?form=inspeksi';
|
||||
}
|
||||
// if (response.success) {
|
||||
// toastrSuccessBuild(response.message)
|
||||
// window.location.href =
|
||||
// '{{ route('surveyor.show', ['id' => $permohonan->id]) }}?form=inspeksi';
|
||||
// }
|
||||
|
||||
console.log(response);
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
@@ -162,6 +181,7 @@
|
||||
console.log('Status:', status);
|
||||
console.log('Response:', xhr.responseText);
|
||||
console.log(errors);
|
||||
toastrErrorBuild(error);
|
||||
},
|
||||
complete: function() {
|
||||
// Re-enable the button and hide the spinner
|
||||
@@ -211,8 +231,53 @@
|
||||
|
||||
container.appendChild(newElement);
|
||||
}
|
||||
|
||||
|
||||
function updateAnalisa(params) {
|
||||
const inputMap = {
|
||||
jenis_asset: 'jenis_asset_tidak_sesuai',
|
||||
analisa_tanah: 'analisa_tanah_tidak_sesuai',
|
||||
analisa_unit: 'analisa_luas_unit_tidak_sesuai',
|
||||
analisa_bangunan: 'analisa_bangunan_tidak_sesuai',
|
||||
};
|
||||
|
||||
// Pastikan elemen ID ada di inputMap
|
||||
if (!inputMap[params]) {
|
||||
console.error('Parameter tidak valid:', params);
|
||||
return;
|
||||
}
|
||||
|
||||
// Ambil nilai berdasarkan parameter
|
||||
const inputValue = document.getElementById(inputMap[params]).value;
|
||||
const data = {
|
||||
[params === 'jenis_asset' ? 'jenis_asset' : params.replace('analisa_', 'luas_')]: inputValue,
|
||||
types: params
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
url: '{{ route('surveyor.update_analisa', ['id' => $permohonan->id]) }}',
|
||||
type: 'POST',
|
||||
data: data,
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||
},
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
if (response.success) {
|
||||
if (response.jenis_asset) {
|
||||
window.location.href =
|
||||
'{{ route('surveyor.show', ['id' => $permohonan->id]) }}?form=inspeksi';
|
||||
}
|
||||
toastrSuccessBuild(response.message);
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error('Terjadi error:', error);
|
||||
console.log('Status:', status);
|
||||
console.log('Response:', xhr.responseText);
|
||||
toastrErrorBuild(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
|
||||
|
||||
|
||||
88
resources/views/surveyor/components/modal-kamera.blade.php
Normal file
88
resources/views/surveyor/components/modal-kamera.blade.php
Normal file
@@ -0,0 +1,88 @@
|
||||
<div class="modal fade" data-modal="true" id="cameraModal" data-backdrop="" data-keyboard="false">
|
||||
<div class="modal-content">
|
||||
|
||||
<div class="modal-header">
|
||||
<h3 class="modal-title">Ambil Foto</h3>
|
||||
<button class="btn btn-xs btn-icon btn-light" data-modal-dismiss="true" id="closeModal">
|
||||
<i class="ki-outline ki-cross"></i>
|
||||
</button>
|
||||
</div>
|
||||
<!-- Camera Interface -->
|
||||
<div class="modal-body">
|
||||
<div class="camera-container relative">
|
||||
<video id="video" class="w-full h-auto" autoplay playsinline></video>
|
||||
<canvas id="canvas" class="hidden w-full h-auto"></canvas>
|
||||
<canvas id="drawingCanvas" class="hidden absolute top-0 left-0 w-full h-full"></canvas>
|
||||
<div id="textOverlay" class="position-absolute top-0 left-0 w-100 h-100 pointer-events-none">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer mt-2">
|
||||
<div id="cameraControls" class="flex justify-center gap-2 mt-4">
|
||||
<button type="button" id="startButton" class="btn btn-primary">
|
||||
<i class="ki-outline ki-camera"></i> Start Camera
|
||||
</button>
|
||||
<button type="button" id="takePhotoButton" class="btn btn-success" disabled>
|
||||
<i class="ki-outline ki-photograph"></i> Ambil Foto
|
||||
</button>
|
||||
<button type="button" id="switchButton" class="btn btn-info" disabled>
|
||||
<i class="ki-outline ki-arrows-circle"></i> Switch Camera
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Editor Controls -->
|
||||
<div id="editorControls" class=" flex flex-wrap gap-2 mt-4">
|
||||
<div class="drawing-tools flex gap-2">
|
||||
|
||||
<button type="button" class="tool-btn btn btn-sm" data-tool="brush">
|
||||
<i class="ki-filled ki-brush"></i>
|
||||
</button>
|
||||
<button type="button" class="tool-btn btn btn-sm" data-tool="rectangle">
|
||||
<i class="ki-filled ki-frame"></i>
|
||||
</button>
|
||||
<button type="button" class="btn btn-light btn-sm tool-btn" data-tool="arrow">
|
||||
<i class="ki-duotone ki-arrow-right fs-2"></i>
|
||||
</button>
|
||||
<button type="button" class="tool-btn btn btn-sm" data-tool="circle">
|
||||
<i class="ki-filled ki-mouse-circle"></i>
|
||||
</button>
|
||||
<button type="button" class="tool-btn btn btn-sm" data-tool="text">
|
||||
<i class="ki-filled ki-text"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="drawing-settings flex gap-2">
|
||||
<input type="color" id="colorPicker" class="w-8 h-8 rounded">
|
||||
<div class="flex items-center gap-2">
|
||||
<input type="range" id="brushSize" min="1" max="20" value="5"
|
||||
class="range range-sm">
|
||||
<span id="brushSizeValue" class="text-sm">5px</span>
|
||||
</div>
|
||||
<input type="text" id="textInput" class="input" placeholder="Enter text">
|
||||
<button type="button" class="btn btn-primary" id="confirmTextBtn">Add Text</button>
|
||||
</div>
|
||||
|
||||
<div class="history-controls flex gap-2">
|
||||
<button type="button" id="undoButton" class="btn btn-sm">
|
||||
<i class="ki-filled ki-arrows-loop"></i>
|
||||
</button>
|
||||
<button type="button" id="resetButton" class="btn btn-sm">
|
||||
<i class="ki-outline ki-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="final-controls flex gap-2">
|
||||
<button type="button" class="btn btn-light btn-sm" data-modal-dismiss="true">Cancel</button>
|
||||
<button id="backButton" class="btn btn-warning btn-sm">
|
||||
<i class="ki-outline ki-arrow-left"></i> Kembali
|
||||
</button>
|
||||
<button type="button" id="saveButton" class="btn btn-success btn-sm" data-modal-dismiss="true">
|
||||
<i class="ki-outline ki-check"></i> Simpan
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -13,13 +13,15 @@
|
||||
<label class="form-label max-w-56">Luas Tanah</label>
|
||||
<div class="mt-2">
|
||||
@if (isset($permohonan->debiture->documents))
|
||||
@foreach ($permohonan->debiture->documents as $item)
|
||||
@php
|
||||
$details = json_decode($item->detail);
|
||||
$luas_tanah = isset($details['luas_tanah']) ? $details['luas_tanah'] : 'N/A';
|
||||
@endphp
|
||||
<p class="text-2sm text-gray-700">{{ $luas_tanah }} m2</p>
|
||||
@endforeach
|
||||
@foreach ($permohonan->debiture->documents as $item)
|
||||
@php
|
||||
$luas = $item->detail;
|
||||
$details = json_decode($luas[0]->details, true);
|
||||
$luas_tanah = isset($details['luas_tanah']) ? $details['luas_tanah'] : 'N/A';
|
||||
@endphp
|
||||
<p class="text-2sm text-gray-700">{{ $luas_tanah }} m<sup>2</sup></p>
|
||||
@endforeach
|
||||
|
||||
@endif
|
||||
<div class="flex-wrap items-stretch">
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
@@ -38,10 +40,10 @@
|
||||
</label>
|
||||
<div id="luas_tanah_tidak_sesuai" class="flex items-baseline gap-2"
|
||||
style="{{ old('luas_tanah', $forminspeksi['tanah']['luas_tanah'] ?? '') == 'tidak sesuai' ? '' : 'display: none;' }}">
|
||||
<input type="text" name="luas_tanah_tidak_sesuai" class="input w-full"
|
||||
<input id="analisa_tanah_tidak_sesuai" type="text" name="luas_tanah_tidak_sesuai" class="input w-full"
|
||||
placeholder="Masukan Luas Tanah"
|
||||
value="{{ old('luas_tanah_tidak_sesuai', $forminspeksi['tanah']['luas_tanah_tidak_sesuai'] ?? '') }}">
|
||||
<button type="button" class="btn btn-md btn-primary">Save</button>
|
||||
<button type="button" class="btn btn-md btn-primary" onclick="updateAnalisa('analisa_tanah')">Save</button>
|
||||
</div>
|
||||
</div>
|
||||
<em id="error-luas_tanah" class="alert text-danger text-sm"></em>
|
||||
@@ -63,7 +65,7 @@
|
||||
</label>
|
||||
|
||||
<label class="form-label flex items-center gap-2.5 text-nowrap">
|
||||
<input type="radio" class="radio" name="hadap_mata_angin" value="tidak sesuai"
|
||||
<input type="radio" class="radio" name="hadap_mata_angin" value="tidak sesuai"
|
||||
onclick="toggleFieldVisibility('hadap_mata_angin', 'hadap_mata_angin_tidak_sesuai' ,['tidak sesuai'])"
|
||||
{{ old('hadap_mata_angin', $forminspeksi['tanah']['hadap_mata_angin'] ?? '') == 'tidak sesuai' ? 'checked' : '' }}>
|
||||
<span class="ml-2">Tidak Sesuai</span>
|
||||
@@ -74,7 +76,8 @@
|
||||
style="{{ old('hadap_mata_angin', $forminspeksi['tanah']['hadap_mata_angin'] ?? '') == 'tidak sesuai' ? '' : 'display: none;' }}">
|
||||
<select
|
||||
class="input w-full
|
||||
name="hadap_mata_angin_tidak_sesuai">
|
||||
id="hadap_matangin_tidak_sesuai"
|
||||
name="analisa_tanah_hadap_mata_angin_tidak_sesuai">
|
||||
<option value="">Select Hadap Mata Angin</option>
|
||||
@if (isset($arahMataAngin))
|
||||
@foreach ($arahMataAngin as $item)
|
||||
@@ -85,7 +88,7 @@
|
||||
@endforeach
|
||||
@endif
|
||||
</select>
|
||||
<button type="button" class="btn btn-md btn-primary">Save</button>
|
||||
{{-- <button type="button" class="btn btn-md btn-primary" onclick="updateAnalisa('hadap_mata_angin')">Save</button> --}}
|
||||
</div>
|
||||
</div>
|
||||
<em id="error-hadap_mata_angin" class="alert text-danger text-sm"></em>
|
||||
|
||||
Reference in New Issue
Block a user