Merge pull request 'feature/senior-officer' (#139) from feature/senior-officer into staging
Reviewed-on: #139
This commit is contained in:
@@ -16,7 +16,7 @@
|
|||||||
$total_luas_unit = 0;
|
$total_luas_unit = 0;
|
||||||
$jenis_legalitas_jaminan_id = 0;
|
$jenis_legalitas_jaminan_id = 0;
|
||||||
if (isset($item->detail)) {
|
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
|
@endphp
|
||||||
<input type="hidden" id="jenis_legalistas_jaminan_unit_id" name="jenis_legalistas_jaminan_unit_id"
|
<input type="hidden" id="jenis_legalistas_jaminan_unit_id" name="jenis_legalistas_jaminan_unit_id"
|
||||||
|
|||||||
@@ -286,6 +286,8 @@
|
|||||||
// Track files that are already on the server
|
// Track files that are already on the server
|
||||||
const existingFiles = new Set();
|
const existingFiles = new Set();
|
||||||
|
|
||||||
|
addCameraOption(dropzoneElement, paramName);
|
||||||
|
|
||||||
myDropzone = new Dropzone(selector, {
|
myDropzone = new Dropzone(selector, {
|
||||||
url: "{{ route('surveyor.storeFoto') }}",
|
url: "{{ route('surveyor.storeFoto') }}",
|
||||||
paramName: paramName,
|
paramName: paramName,
|
||||||
@@ -392,6 +394,133 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function addCameraOption(dropzoneElement, paramName) {
|
||||||
|
if (dropzoneElement.querySelector('.upload-options')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create the upload options container
|
||||||
|
const uploadOptionsContainer = document.createElement('div');
|
||||||
|
uploadOptionsContainer.className = 'upload-options';
|
||||||
|
uploadOptionsContainer.style.cssText = `
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
margin-top: 10px;
|
||||||
|
gap: 20px;
|
||||||
|
`;
|
||||||
|
|
||||||
|
// Create camera button
|
||||||
|
const cameraButton = document.createElement('button');
|
||||||
|
cameraButton.type = 'button';
|
||||||
|
cameraButton.className = 'camera-button';
|
||||||
|
cameraButton.innerHTML = '<i class="ki-duotone ki-camera fs-2"></i> Kamera';
|
||||||
|
cameraButton.style.cssText = `
|
||||||
|
padding: 8px 16px;
|
||||||
|
background-color: #f5f8fa;
|
||||||
|
border: 1px solid #e4e6ef;
|
||||||
|
border-radius: 6px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
cursor: pointer;
|
||||||
|
`;
|
||||||
|
|
||||||
|
// Create file button
|
||||||
|
const fileButton = document.createElement('button');
|
||||||
|
fileButton.type = 'button';
|
||||||
|
fileButton.className = 'file-button';
|
||||||
|
fileButton.innerHTML = '<i class="ki-duotone ki-folder fs-2"></i> File';
|
||||||
|
fileButton.style.cssText = `
|
||||||
|
padding: 8px 16px;
|
||||||
|
background-color: #f5f8fa;
|
||||||
|
border: 1px solid #e4e6ef;
|
||||||
|
border-radius: 6px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
cursor: pointer;
|
||||||
|
`;
|
||||||
|
|
||||||
|
/
|
||||||
|
const cameraInput = document.createElement('input');
|
||||||
|
cameraInput.type = 'file';
|
||||||
|
cameraInput.id = 'camera-input-' + paramName;
|
||||||
|
cameraInput.accept = 'image/*';
|
||||||
|
cameraInput.capture = 'environment';
|
||||||
|
cameraInput.style.display = 'none';
|
||||||
|
|
||||||
|
|
||||||
|
const fileInput = document.createElement('input');
|
||||||
|
fileInput.type = 'file';
|
||||||
|
fileInput.id = 'file-input-' + paramName;
|
||||||
|
fileInput.accept = 'image/*';
|
||||||
|
fileInput.style.display = 'none';
|
||||||
|
|
||||||
|
// Add event listeners - use only one instance per button
|
||||||
|
cameraButton.addEventListener('click', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
cameraInput.click();
|
||||||
|
}, false);
|
||||||
|
|
||||||
|
fileButton.addEventListener('click', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
fileInput.click();
|
||||||
|
}, false);
|
||||||
|
|
||||||
|
// Handle file selection for camera - clear input after use
|
||||||
|
cameraInput.addEventListener('change', function() {
|
||||||
|
if (this.files && this.files.length > 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) {
|
function loadExistingPhotos(dropzone, paramName, existingFilesSet) {
|
||||||
showLoadingOverlay();
|
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
|
// Inisialisasi Dropzone untuk elemen awal dengan pengecekan
|
||||||
function safeInitDropzone(selector, paramName) {
|
function safeInitDropzone(selector, paramName) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|||||||
@@ -128,9 +128,9 @@
|
|||||||
onchange="uploadFile(this, 'upload-gs-preview', 'upload_gs')">
|
onchange="uploadFile(this, 'upload-gs-preview', 'upload_gs')">
|
||||||
|
|
||||||
<img id="upload-gs-preview"
|
<img id="upload-gs-preview"
|
||||||
src="{{ asset('storage/' . (isset($forminspeksi['upload_gs']) ? $forminspeksi['upload_gs'] : '')) }}"
|
src="{{ isset($forminspeksi['upload_gs']) && is_string($forminspeksi['upload_gs']) && !empty($forminspeksi['upload_gs']) ? asset('storage/' . $forminspeksi['upload_gs']) : '' }}"
|
||||||
alt="Foto Gs" class="mt-2 max-w-full h-auto"
|
alt="Foto Gs" class="mt-2 max-w-full h-auto"
|
||||||
style="{{ isset($forminspeksi['upload_gs']) ? '' : 'display: none;' }} max-width: 30rem;" />
|
style="{{ isset($forminspeksi['upload_gs']) && is_string($forminspeksi['upload_gs']) && !empty($forminspeksi['upload_gs']) ? '' : 'display: none;' }} max-width: 30rem;" />
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -150,9 +150,9 @@
|
|||||||
>
|
>
|
||||||
|
|
||||||
<img id="sentuh_tanahku-preview"
|
<img id="sentuh_tanahku-preview"
|
||||||
src="{{ asset('storage/' . (isset($forminspeksi['foto_sentuh_tanahku']) ? $forminspeksi['foto_sentuh_tanahku'] : '')) }}"
|
src="{{ isset($forminspeksi['foto_sentuh_tanahku']) && is_string($forminspeksi['foto_sentuh_tanahku']) && !empty($forminspeksi['foto_sentuh_tanahku']) ? asset('storage/' . $forminspeksi['foto_sentuh_tanahku']) : '' }}"
|
||||||
alt="Foto Bhumi" class="mt-2 max-w-full h-auto"
|
alt="Foto Bhumi" class="mt-2 max-w-full h-auto"
|
||||||
style="{{ isset($forminspeksi['foto_sentuh_tanahku']) ? '' : 'display: none;' }} max-width: 30rem;" />
|
style="{{ isset($forminspeksi['foto_sentuh_tanahku']) && is_string($forminspeksi['foto_sentuh_tanahku']) && !empty($forminspeksi['foto_sentuh_tanahku']) ? '' : 'display: none;' }} max-width: 30rem;"/>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -173,9 +173,9 @@
|
|||||||
onchange="uploadFile(this, 'gistaru-preview', 'foto_gistaru')">
|
onchange="uploadFile(this, 'gistaru-preview', 'foto_gistaru')">
|
||||||
|
|
||||||
<img id="gistaru-preview"
|
<img id="gistaru-preview"
|
||||||
src="{{ asset('storage/' . (isset($forminspeksi['foto_gistaru']) ? $forminspeksi['foto_gistaru'] : '')) }}"
|
src="{{ isset($forminspeksi['foto_gistaru']) && is_string($forminspeksi['foto_gistaru']) && !empty($forminspeksi['foto_gistaru']) ? asset('storage/' . $forminspeksi['foto_gistaru']) : '' }}"
|
||||||
alt="Foto Bhumi" class="mt-2 max-w-full h-auto"
|
alt="Foto Bhumi" class="mt-2 max-w-full h-auto"
|
||||||
style="{{ isset($forminspeksi['foto_gistaru']) ? '' : 'display: none;' }} max-width: 30rem;" />
|
style="{{ isset($forminspeksi['foto_gistaru']) && is_string($forminspeksi['foto_gistaru']) && !empty($forminspeksi['foto_gistaru']) ? '' : 'display: none;' }} max-width: 30rem;" />
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -199,10 +199,15 @@
|
|||||||
class="file-input file-input-bordered w-full "
|
class="file-input file-input-bordered w-full "
|
||||||
accept=".jpg,.jpeg,.png,.gif,.bmp,.tiff,.tif,.webp,.svg"
|
accept=".jpg,.jpeg,.png,.gif,.bmp,.tiff,.tif,.webp,.svg"
|
||||||
onchange="uploadFile(this, 'bhumi-preview', 'foto_bhumi')">
|
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
|
||||||
<img id="bhumi-preview"
|
<img id="bhumi-preview"
|
||||||
src="{{ asset('storage/' . (isset($forminspeksi['foto_bhumi']) ? $forminspeksi['foto_bhumi'] : '')) }}"
|
src="{{ $bhumiPath }}"
|
||||||
alt="Foto Bhumi" class="mt-2 max-w-full h-auto"
|
alt="Foto Bhumi" class="mt-2 max-w-full h-auto"
|
||||||
style="{{ isset($forminspeksi['foto_bhumi']) ? ' ' : 'display: none;' }} max-width: 30rem;" />
|
style="{{ $bhumiPath ? '' : 'display: none;' }} max-width: 30rem;" />
|
||||||
</div>
|
</div>
|
||||||
<a href="https://bhumi.atrbpn.go.id/peta" type="button" class="btn btn-light" target="_blank">
|
<a href="https://bhumi.atrbpn.go.id/peta" type="button" class="btn btn-light" target="_blank">
|
||||||
<i class="ki-filled ki-map"></i> Bhumi
|
<i class="ki-filled ki-map"></i> Bhumi
|
||||||
@@ -222,10 +227,16 @@
|
|||||||
class="file-input file-input-bordered w-full"
|
class="file-input file-input-bordered w-full"
|
||||||
accept=".jpg,.jpeg,.png,.gif,.bmp,.tiff,.tif,.webp,.svg"
|
accept=".jpg,.jpeg,.png,.gif,.bmp,.tiff,.tif,.webp,.svg"
|
||||||
onchange="uploadFile(this, 'argis-region-preview', 'foto_argis_region')">
|
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
|
||||||
|
|
||||||
<img id="argis-region-preview"
|
<img id="argis-region-preview"
|
||||||
src="{{ asset('storage/' . (isset($forminspeksi['foto_argis_region']) ? $forminspeksi['foto_argis_region'] : '')) }}"
|
src="{{ $argisRegionPath }}"
|
||||||
alt="Foto Argis Region" class="mt-2 max-w-full h-auto"
|
alt="Foto Argis Region" class="mt-2 max-w-full h-auto"
|
||||||
style="{{ isset($forminspeksi['foto_argis_region']) ? '' : 'display: none;' }} max-width: 30rem;">
|
style="{{ $argisRegionPath ? '' : 'display: none;' }} max-width: 30rem;">
|
||||||
</div>
|
</div>
|
||||||
< </div>
|
< </div>
|
||||||
</div>
|
</div>
|
||||||
@@ -247,19 +258,14 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@php
|
@php
|
||||||
$fotoTempat = $forminspeksi['foto_tempat'] ?? null;
|
$fotoTempat = isset($forminspeksi['foto_tempat']) && is_string($forminspeksi['foto_tempat']) && !empty($forminspeksi['foto_tempat'])
|
||||||
$fotoSrc = '';
|
? asset('storage/' . $forminspeksi['foto_tempat'])
|
||||||
|
: '';
|
||||||
if (is_array($fotoTempat)) {
|
|
||||||
$fotoSrc = asset('storage/' . $fotoTempat[0]);
|
|
||||||
} elseif (!empty($fotoTempat)) {
|
|
||||||
$fotoSrc = asset('storage/' . $fotoTempat);
|
|
||||||
}
|
|
||||||
@endphp
|
@endphp
|
||||||
|
|
||||||
<img id="foto_tempat-preview" src="{{ $fotoSrc ?: '' }}" alt="Foto Tempat"
|
<img id="foto_tempat-preview" src="{{ $fotoTempat ?: '' }}" alt="Foto Tempat"
|
||||||
class="mt-2 max-w-full h-auto"
|
class="mt-2 max-w-full h-auto"
|
||||||
style="max-width: 30rem; {{ $fotoSrc ? '' : 'display: none;' }}">
|
style="max-width: 30rem; {{ $fotoTempat ? '' : 'display: none;' }}">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -67,19 +67,21 @@
|
|||||||
}
|
}
|
||||||
// Filter fotoTypes untuk memastikan hanya yang memiliki imagePath valid
|
// Filter fotoTypes untuk memastikan hanya yang memiliki imagePath valid
|
||||||
$validPhotoTypes = array_filter($fotoTypes, function ($type) use ($forminspeksi) {
|
$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
|
@endphp
|
||||||
@foreach ($validPhotoTypes as $type)
|
@foreach ($validPhotoTypes as $type)
|
||||||
@php
|
@php
|
||||||
$imagePath = $forminspeksi[$type] ?? null;
|
$imagePath = $forminspeksi[$type] ?? null;
|
||||||
|
$imageUrl = is_string($imagePath) ? asset('storage/' . $imagePath) : null;
|
||||||
|
|
||||||
@endphp
|
@endphp
|
||||||
@if ($imagePath && file_exists(storage_path('app/public/' . $imagePath)))
|
@if ($imagePath && file_exists(storage_path('app/public/' . $imagePath)))
|
||||||
<tr>
|
<tr>
|
||||||
<td style="20%"> {{ $customLabels[$type] ?? '' }}</td>
|
<td style="20%"> {{ $customLabels[$type] ?? '' }}</td>
|
||||||
<td width="1%" style="vertical-align: top;"></td>
|
<td width="1%" style="vertical-align: top;"></td>
|
||||||
<td style="width: 79%">
|
<td style="width: 79%">
|
||||||
<img src="{{ storage_path('app/public/' . $imagePath) }}" alt="{{ $imagePath }}"
|
<img src="{{ storage_path('app/public/' . $imagePath) }}" alt="{{ $imageUrl }}"
|
||||||
style="max-height: 400px; height: auto; max-width: 100%;">
|
style="max-height: 400px; height: auto; max-width: 100%;">
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
Reference in New Issue
Block a user