diff --git a/resources/views/penilai/components/analisa/apartement-kantor.blade.php b/resources/views/penilai/components/analisa/apartemen-kantor.blade.php similarity index 100% rename from resources/views/penilai/components/analisa/apartement-kantor.blade.php rename to resources/views/penilai/components/analisa/apartemen-kantor.blade.php diff --git a/resources/views/surveyor/components/apartemen-kantor.blade.php b/resources/views/surveyor/components/apartemen-kantor.blade.php index 1034935..da7e5fe 100644 --- a/resources/views/surveyor/components/apartemen-kantor.blade.php +++ b/resources/views/surveyor/components/apartemen-kantor.blade.php @@ -16,7 +16,7 @@ $total_luas_unit = 0; $jenis_legalitas_jaminan_id = 0; if (isset($item->detail)) { - $total_luas_unit = calculateTotalLuas($item->detail, 'luas_tanah', 1, 27, 3); + $total_luas_unit = calculateTotalLuas($item->detail, 'luas_bangunan', 1, 27, 3); } @endphp 0) { + handleFileSelection(this.files, myDropzone); + + this.value = ''; + } + }, false); + + // Handle file selection for gallery - clear input after use + fileInput.addEventListener('change', function() { + if (this.files && this.files.length > 0) { + handleFileSelection(this.files, myDropzone); + + this.value = ''; + } + }, false); + + // Append elements + uploadOptionsContainer.appendChild(cameraButton); + uploadOptionsContainer.appendChild(fileButton); + document.body.appendChild(cameraInput); + document.body.appendChild(fileInput); + + // Find the message element in dropzone and insert the options after it + const dzMessage = dropzoneElement.querySelector('.dz-message'); + if (dzMessage) { + dzMessage.appendChild(uploadOptionsContainer); + } else { + dropzoneElement.appendChild(uploadOptionsContainer); + } + + + if (dzMessage) { + dzMessage.style.cssText += ` + display: flex; + flex-direction: column; + align-items: center; + `; + } + } + + + function handleFileSelection(files, dropzone) { + if (!dropzone) return; + + Array.from(files).forEach(file => { + dropzone.addFile(file); + }); + } + function loadExistingPhotos(dropzone, paramName, existingFilesSet) { showLoadingOverlay(); @@ -529,6 +658,12 @@ }); } + + // Check if device is mobile + function isMobileDevice() { + return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent); + } + // Inisialisasi Dropzone untuk elemen awal dengan pengecekan function safeInitDropzone(selector, paramName) { setTimeout(() => { diff --git a/resources/views/surveyor/components/informasi.blade.php b/resources/views/surveyor/components/informasi.blade.php index 5a7c563..b3a7104 100644 --- a/resources/views/surveyor/components/informasi.blade.php +++ b/resources/views/surveyor/components/informasi.blade.php @@ -128,9 +128,9 @@ onchange="uploadFile(this, 'upload-gs-preview', 'upload_gs')"> + style="{{ isset($forminspeksi['upload_gs']) && is_string($forminspeksi['upload_gs']) && !empty($forminspeksi['upload_gs']) ? '' : 'display: none;' }} max-width: 30rem;" /> @@ -150,9 +150,9 @@ > + style="{{ isset($forminspeksi['foto_sentuh_tanahku']) && is_string($forminspeksi['foto_sentuh_tanahku']) && !empty($forminspeksi['foto_sentuh_tanahku']) ? '' : 'display: none;' }} max-width: 30rem;"/> @@ -173,9 +173,9 @@ onchange="uploadFile(this, 'gistaru-preview', 'foto_gistaru')"> + style="{{ isset($forminspeksi['foto_gistaru']) && is_string($forminspeksi['foto_gistaru']) && !empty($forminspeksi['foto_gistaru']) ? '' : 'display: none;' }} max-width: 30rem;" /> @@ -199,10 +199,15 @@ class="file-input file-input-bordered w-full " accept=".jpg,.jpeg,.png,.gif,.bmp,.tiff,.tif,.webp,.svg" onchange="uploadFile(this, 'bhumi-preview', 'foto_bhumi')"> + @php + $bhumiPath = isset($forminspeksi['foto_bhumi']) && is_string($forminspeksi['foto_bhumi']) && !empty($forminspeksi['foto_bhumi']) + ? asset('storage/' . $forminspeksi['foto_bhumi']) + : ''; + @endphp + style="{{ $bhumiPath ? '' : 'display: none;' }} max-width: 30rem;" /> Bhumi @@ -222,10 +227,16 @@ class="file-input file-input-bordered w-full" accept=".jpg,.jpeg,.png,.gif,.bmp,.tiff,.tif,.webp,.svg" onchange="uploadFile(this, 'argis-region-preview', 'foto_argis_region')"> + @php + $argisRegionPath = isset($forminspeksi['foto_argis_region']) && is_string($forminspeksi['foto_argis_region']) && !empty($forminspeksi['foto_argis_region']) + ? asset('storage/' . $forminspeksi['foto_argis_region']) + : ''; + @endphp + + style="{{ $argisRegionPath ? '' : 'display: none;' }} max-width: 30rem;"> < @@ -247,19 +258,14 @@ @php - $fotoTempat = $forminspeksi['foto_tempat'] ?? null; - $fotoSrc = ''; - - if (is_array($fotoTempat)) { - $fotoSrc = asset('storage/' . $fotoTempat[0]); - } elseif (!empty($fotoTempat)) { - $fotoSrc = asset('storage/' . $fotoTempat); - } + $fotoTempat = isset($forminspeksi['foto_tempat']) && is_string($forminspeksi['foto_tempat']) && !empty($forminspeksi['foto_tempat']) + ? asset('storage/' . $forminspeksi['foto_tempat']) + : ''; @endphp - + style="max-width: 30rem; {{ $fotoTempat ? '' : 'display: none;' }}"> diff --git a/resources/views/surveyor/components/print-out/informasi.blade.php b/resources/views/surveyor/components/print-out/informasi.blade.php index f1b2a27..7e529ba 100644 --- a/resources/views/surveyor/components/print-out/informasi.blade.php +++ b/resources/views/surveyor/components/print-out/informasi.blade.php @@ -67,19 +67,21 @@ } // Filter fotoTypes untuk memastikan hanya yang memiliki imagePath valid $validPhotoTypes = array_filter($fotoTypes, function ($type) use ($forminspeksi) { - return isset($forminspeksi[$type]) && file_exists(storage_path('app/public/' . $forminspeksi[$type])); + return isset($forminspeksi[$type]) && !empty($forminspeksi[$type]) && is_string($forminspeksi[$type]); }); @endphp @foreach ($validPhotoTypes as $type) @php $imagePath = $forminspeksi[$type] ?? null; + $imageUrl = is_string($imagePath) ? asset('storage/' . $imagePath) : null; + @endphp @if ($imagePath && file_exists(storage_path('app/public/' . $imagePath))) {{ $customLabels[$type] ?? '' }} -