|
|
|
@ -15,10 +15,6 @@
|
|
|
|
|
</head>
|
|
|
|
|
<body>
|
|
|
|
|
<div class="header">
|
|
|
|
|
<div>
|
|
|
|
|
<button class="pdfButton" onclick="generatePDF()">Generar PDF de esta pagina</button>
|
|
|
|
|
<button class="pdfButton" onclick="generatePDF_All()">Generar PDF de todas entradas</button>
|
|
|
|
|
</div>
|
|
|
|
|
<h1>
|
|
|
|
|
<i class="fas fa-arrow-left" onclick="goBack()" style="cursor:pointer;"></i>
|
|
|
|
|
Listado de Familias
|
|
|
|
@ -27,8 +23,12 @@
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<input type="text" id="myInput" placeholder="Buscar por...."> <i class="fas fa-plus hide-icon" id="create-icon" th:if="${isAdmin}"></i>
|
|
|
|
|
|
|
|
|
|
<input type="text" id="myInput" placeholder="Buscar por....">
|
|
|
|
|
<i class="fas fa-plus hide-icon" id="create-icon" th:if="${isAdmin}"></i>
|
|
|
|
|
<div class="button-group">
|
|
|
|
|
<button class="pdfButton" onclick="generatePDF()">Generar PDF de esta pagina</button>
|
|
|
|
|
<button class="pdfButton" onclick="generatePDF_All()">Generar PDF de todas entradas</button>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="table-container">
|
|
|
|
|
<table class="table" id="table">
|
|
|
|
|
<thead class="thread-light">
|
|
|
|
@ -113,28 +113,29 @@
|
|
|
|
|
var isSearchBarUsed = false;
|
|
|
|
|
|
|
|
|
|
$table.on('click', '.edit-icon', function(event) {
|
|
|
|
|
console.log("Edit icon clicked");
|
|
|
|
|
//console.log("Edit icon clicked");
|
|
|
|
|
handleEdit(event);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$table.on('click', '.delete-icon', function(event) {
|
|
|
|
|
console.log("Delete icon clicked");
|
|
|
|
|
// console.log("Delete icon clicked");
|
|
|
|
|
handleDelete(event);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
function handleEdit(event) {
|
|
|
|
|
console.log("handleEdit function called");
|
|
|
|
|
//console.log("handleEdit function called");
|
|
|
|
|
const row = event.target.closest('tr');
|
|
|
|
|
const rowId = row.dataset.id;
|
|
|
|
|
console.log("Row ID: " + rowId);
|
|
|
|
|
//console.log("Row ID: " + rowId);
|
|
|
|
|
window.location = "/admin/familia/update/" + rowId;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var modal = document.getElementById("modalDelete");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function handleDelete(event) {
|
|
|
|
|
console.log("handleDelete function called");
|
|
|
|
|
console.log("Delete icon clicked");
|
|
|
|
|
//console.log("handleDelete function called");
|
|
|
|
|
//console.log("Delete icon clicked");
|
|
|
|
|
var modal = document.getElementById("modalDelete");
|
|
|
|
|
const row = event.target.closest('tr');
|
|
|
|
|
const rowId = row.dataset.id;
|
|
|
|
|
modal.style.display = "block";
|
|
|
|
@ -148,25 +149,21 @@
|
|
|
|
|
modal.style.display = "none";
|
|
|
|
|
document.body.style.pointerEvents = 'auto';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setTimeout(function() {
|
|
|
|
|
deleteSpan.onclick = function() {
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: '/familia/delete/' + rowId,
|
|
|
|
|
type: 'GET',
|
|
|
|
|
success: function(response) {
|
|
|
|
|
if (response === "La familia ha sido eliminada") {
|
|
|
|
|
alert("Familia borrada con exito");
|
|
|
|
|
modal.style.display = "none"; // Hide the modal
|
|
|
|
|
document.body.style.pointerEvents = 'auto'; // Enable pointer events
|
|
|
|
|
window.location.reload(); // Reload the page
|
|
|
|
|
} else {
|
|
|
|
|
alert("Error al borrar familia");
|
|
|
|
|
}
|
|
|
|
|
deleteSpan.onclick = function() {
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: '/familia/delete/' + rowId,
|
|
|
|
|
type: 'GET',
|
|
|
|
|
success: function(response) {
|
|
|
|
|
if (response === "La familia ha sido eliminado") {
|
|
|
|
|
alert("Familia borrada con exito");
|
|
|
|
|
modal.style.display = "none"; // Hide the modal
|
|
|
|
|
window.location.reload(); // Reload the page
|
|
|
|
|
} else {
|
|
|
|
|
alert("Error al borrar familia");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}, 500); // Delay of 500 milliseconds
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$myInput.on('input', function() {
|
|
|
|
|