EVOLUTION-MANAGER
Edit File: crud-informativo.js
const datos = window.appData.datosnoticias; function delete_button(event, id) { event.preventDefault(); Swal.fire({ title: "Esta seguro de borrar este registro?", text: "Si lo hace no podra recuperarlo!", icon: "warning", showCancelButton: true, confirmButtonColor: "#3085d6", cancelButtonColor: "#d33", confirmButtonText: "Si, borralo!" }).then((result) => { if (result.isConfirmed) { const loadingModal = document.getElementById('loadingModal'); loadingModal.style.display = 'block'; $.ajaxSetup({ headers: { "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content') } }); $.ajax({ url: "/administrador/crud-boletin/eliminar-noticias/" + id, method: "DELETE", enctype: "multipart/form-data", processData: false, contentType: false, success: function (response) { if (response.success) { loadingModal.style.display = 'none'; for (var x = 0; x < datos.length; x++) { if (datos[x]["id_informativo"] == id) datos.splice(x, 1); } document.getElementById(id).remove(); document.getElementById("cantidad-actualizada").innerHTML = response.cantidad['cantidad']; mensaje_de_alerta("success", response.message); } else { loadingModal.style.display = 'none'; if (response.error) { mensaje_de_alerta("error", response.error); } } }, error: function (xhr) { loadingModal.style.display = 'none'; var message = JSON.parse(xhr.responseText); mensaje_de_alerta("error", message.message); } }); } }); } function mensaje_de_alerta(icon, title) { Swal.fire({ icon: icon, title: title, showConfirmButton: true, }); }