fixing
This commit is contained in:
parent
80ece398c4
commit
a08f3f5e8c
@ -484,7 +484,7 @@ $result = $stmt->get_result();
|
||||
|
||||
<div class="card-body text-center">
|
||||
<h5 class="card-title"><?php echo htmlspecialchars($row['name']); ?></h5>
|
||||
<p class="card-text"><?php echo htmlspecialchars($row['address']); ?></p>
|
||||
<p class="card-text"><?php echo htmlspecialchars($row['address']); ?> - <?php echo htmlspecialchars($row['city']); ?></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -591,7 +591,11 @@ $result = $stmt->get_result();
|
||||
<script>
|
||||
// Gestisci l'eliminazione con SweetAlert
|
||||
$('.delete-home-btn').on('click', function() {
|
||||
var idhome = $(this).data('id'); // Ottieni l'id della casa
|
||||
console.log("Bottone eliminazione cliccato!"); // Debugging
|
||||
|
||||
var idhome = $(this).data('id');
|
||||
console.log("ID Casa:", idhome); // Debugging
|
||||
|
||||
Swal.fire({
|
||||
title: 'Sei sicuro?',
|
||||
text: "Questa azione eliminerà la casa e non può essere annullata.",
|
||||
@ -603,16 +607,7 @@ $result = $stmt->get_result();
|
||||
cancelButtonText: 'Annulla'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
// Chiude il dropdown prima di eseguire l'azione
|
||||
let dropdownMenu = $(this).closest('.dropdown-menu');
|
||||
let dropdownButton = dropdownMenu.prev('.dropdown-toggle');
|
||||
let dropdownInstance = bootstrap.Dropdown.getInstance(dropdownButton[0]);
|
||||
|
||||
if (dropdownInstance) {
|
||||
dropdownInstance.hide();
|
||||
}
|
||||
|
||||
// Reindirizza al file di eliminazione
|
||||
console.log("Utente ha confermato l'eliminazione."); // Debugging
|
||||
window.location.href = "delete-home.php?idhome=" + idhome;
|
||||
}
|
||||
});
|
||||
|
||||
BIN
public/userportal/mainphoto/2-15101febb-1740487600.png
Normal file
BIN
public/userportal/mainphoto/2-15101febb-1740487600.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.4 MiB |
BIN
public/userportal/mainphoto/2-202306porticicasa05-1740488813.jpg
Normal file
BIN
public/userportal/mainphoto/2-202306porticicasa05-1740488813.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 297 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 100 KiB |
BIN
public/userportal/mainphoto/2-ufficioorganizzato-1740488820.jpg
Normal file
BIN
public/userportal/mainphoto/2-ufficioorganizzato-1740488820.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 110 KiB |
@ -213,7 +213,7 @@ $cadastral_notesdb = $homeData['cadastral_notes'];
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary mt-3 w-100 save-btn d-none"><i class="fas fa-save"></i> Salva</button>
|
||||
<!-- <button type="submit" class="btn btn-primary mt-3 w-100 save-btn d-none"><i class="fas fa-save"></i> Salva</button> -->
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@ -238,7 +238,7 @@ $cadastral_notesdb = $homeData['cadastral_notes'];
|
||||
// Se è un nuovo record, entra automaticamente in modalità modifica
|
||||
if (isNewRecord) {
|
||||
// Modifica il testo del pulsante
|
||||
editToggleBtn.innerHTML = '<i class="fas fa-eye"></i> Visualizza';
|
||||
editToggleBtn.innerHTML = '<i class="fas fa-save"></i> Salva';
|
||||
editToggleBtn.classList.remove('btn-light');
|
||||
editToggleBtn.classList.add('btn-info');
|
||||
|
||||
@ -262,9 +262,9 @@ $cadastral_notesdb = $homeData['cadastral_notes'];
|
||||
|
||||
if (editMode) {
|
||||
// Attiva modalità modifica
|
||||
editToggleBtn.innerHTML = '<i class="fas fa-eye"></i> Visualizza';
|
||||
editToggleBtn.innerHTML = '<i class="fas fa-save"></i> Salva';
|
||||
editToggleBtn.classList.remove('btn-light');
|
||||
editToggleBtn.classList.add('btn-info');
|
||||
editToggleBtn.classList.add('btn-success');
|
||||
|
||||
// Abilita tutti i campi
|
||||
formFields.forEach(field => {
|
||||
@ -334,15 +334,27 @@ $cadastral_notesdb = $homeData['cadastral_notes'];
|
||||
});
|
||||
|
||||
// Anteprima immagine selezionata
|
||||
document.getElementById("photo").addEventListener("change", function(event) {
|
||||
document.getElementById('photo').addEventListener('change', function(event) {
|
||||
let file = event.target.files[0];
|
||||
if (file) {
|
||||
let reader = new FileReader();
|
||||
reader.onload = function(e) {
|
||||
document.getElementById("photo-preview").src = e.target.result;
|
||||
};
|
||||
reader.readAsDataURL(file);
|
||||
}
|
||||
if (!file) return;
|
||||
|
||||
let formData = new FormData();
|
||||
formData.append("photo", file);
|
||||
formData.append("idhome", <?php echo $idhome; ?>);
|
||||
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", "save-home.php", true);
|
||||
xhr.onreadystatechange = function() {
|
||||
if (xhr.readyState === XMLHttpRequest.DONE) {
|
||||
let response = JSON.parse(xhr.responseText);
|
||||
if (response.success) {
|
||||
document.getElementById('photo-preview').src = "mainphoto/" + response.filename;
|
||||
} else {
|
||||
alert("Errore nel caricamento: " + response.message);
|
||||
}
|
||||
}
|
||||
};
|
||||
xhr.send(formData);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user