This commit is contained in:
2025-02-25 14:08:48 +01:00
parent 80ece398c4
commit a08f3f5e8c
6 changed files with 31 additions and 24 deletions
+7 -12
View File
@@ -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;
}
});