fix view foto jaminan

This commit is contained in:
majid
2025-02-06 14:48:45 +07:00
parent 8f2555c0a0
commit ac326c0a49
5 changed files with 276 additions and 446 deletions

View File

@@ -1,5 +1,5 @@
{
"rute_menuju_lokasi": [
"upload_foto": [
{
"name": "Tampak Depan Objek",
"description": "terdapat jalan depan rumah",
@@ -22,6 +22,5 @@
"updated_by": "Administrator",
"updated_at": "2025-02-05 04:38:53"
}
],
"foto_lantai_unit": []
]
}

View File

@@ -322,25 +322,7 @@
showConfirmButton: false,
timer: 1500
});
var mockFile = {
name: file.name,
size: file.size || 12345,
originalPath: file.path
};
myDropzone.emit("addedfile", mockFile);
myDropzone.emit("thumbnail", mockFile, response.file.path);
myDropzone.emit("complete", mockFile);
addEditAndDeleteButtons(mockFile, {
path: response.file.path,
name: response.file.name,
description: response.file.description || '',
category: response.file.category || 'lainnya',
sub: response.file.sub || '',
param_name: paramName
});
updatePhotoGallery();
}
},
@@ -448,25 +430,25 @@
if (response.fotos && response.fotos.length) {
response.fotos.forEach(function(foto) {
// Cek jika foto sudah ada di Dropzone
if (!isFileInDropzone(foto.name)) {
var mockFile = {
name: foto.name,
size: foto.size || 12345,
originalPath: foto.path
};
myDropzone.emit("addedfile", mockFile);
myDropzone.emit("thumbnail", mockFile, foto.path);
myDropzone.emit("complete", mockFile);
addEditAndDeleteButtons(mockFile, {
path: foto.path,
name: foto.name,
description: foto.description || '',
category: foto.category || 'lainnya',
sub: foto.sub || '',
param_name: 'upload_foto'
});
}
var mockFile = {
name: foto.name,
size: foto.size || 12345,
originalPath: foto.path
};
myDropzone.emit("addedfile", mockFile);
myDropzone.emit("thumbnail", mockFile, foto.path);
myDropzone.emit("complete", mockFile);
addEditAndDeleteButtons(mockFile, {
path: foto.path,
name: foto.name,
description: foto.description || '',
category: foto.category || 'lainnya',
sub: foto.sub || '',
param_name: 'upload_foto'
});
});
} else {
console.log('Tidak ada foto yang ditemukan');
@@ -479,10 +461,7 @@
}
function isFileInDropzone(fileName) {
let files = myDropzone.files;
return files.some(file => file.name === fileName);
}
// Inisialisasi Dropzone untuk elemen awal dengan pengecekan
function safeInitDropzone(selector, paramName) {