redesign for mulituser
change validation concept (client and server) using entities
This commit is contained in:
@@ -1,26 +1,66 @@
|
||||
function syncScheduled(){
|
||||
$('#mySnycModal').modal('show');
|
||||
$('#mySnycModal').find('.modal-title').html("Synchronisierte Einträge!");
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "/syncScheduled/",
|
||||
data: {}, // serializes the form's elements.
|
||||
success: function(data){
|
||||
const myModale = document.querySelector('#mySnycModal');
|
||||
var modalText = myModale.querySelector('.modal-body');
|
||||
var modalFenster = myModale.querySelector('.modal-dialog');
|
||||
modalText.innerHTML = data;
|
||||
$('#todos').DataTable().ajax.reload();
|
||||
},
|
||||
error: function(data){
|
||||
const myModale = document.querySelector('#mySnycModal');
|
||||
var modalText = myModale.querySelector('.modal-body');
|
||||
var modalFenster = myModale.querySelector('.modal-dialog');
|
||||
modalFenster.classList.add("alert");
|
||||
modalFenster.classList.add("alert-danger");
|
||||
modalText.textContent = 'Fehler bei der Ausführung!';
|
||||
$('#todos').DataTable().ajax.reload();
|
||||
function syncScheduled(ele){
|
||||
var myModal = document.getElementById('mySnycModal');
|
||||
var modalTitle = myModal.querySelector('.modal-title');
|
||||
let modalBody = myModal.querySelector('.modal-body');
|
||||
modalTitle.textContent = 'Synchronisierte Einträge!';
|
||||
modalBody.textContent = 'Please Wait!';
|
||||
fetch("/syncScheduled", { method: "GET",headers: {"X-Requested-With": "XMLHttpRequest"},})
|
||||
.then(response => response.text())
|
||||
.then(data => {
|
||||
const myModale = document.querySelector('#mySnycModal');
|
||||
var modalBody = myModale.querySelector('.modal-body');
|
||||
if (data === "") {
|
||||
modalBody.innerHTML = "Nix Neues Synchronisiert!";
|
||||
}
|
||||
});
|
||||
// location.href = '/syncScheduled/';
|
||||
else
|
||||
modalBody.innerHTML = data;
|
||||
if (typeof loadToDosData === "function")
|
||||
loadToDosData();
|
||||
})
|
||||
.catch(
|
||||
error => {
|
||||
const myModale = document.querySelector('#mySnycModal');
|
||||
var modalBody = myModale.querySelector('.modal-body');
|
||||
modalBody.innerHTML = "Fehler bei der Ausführung! " + error;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function deleteEntry(event) {
|
||||
let myModalDelete = document.getElementById('mymodalDelete');
|
||||
let id = myModalDelete.getAttribute('data-bs-id');
|
||||
let table = myModalDelete.getAttribute('data-bs-table');
|
||||
let formData = new FormData();
|
||||
formData.set('id',id);
|
||||
|
||||
if (table == "scheduled")
|
||||
cmnd = "/deleteScheduled";
|
||||
else
|
||||
cmnd = "/deleteBill";
|
||||
fetch(cmnd, { method: "POST",headers: {"X-Requested-With": "XMLHttpRequest"}, body: formData})
|
||||
.then(response => {
|
||||
let myModal = document.getElementById('mymodal');
|
||||
let body = myModal.querySelector('.modal-body');
|
||||
if (!response.ok){
|
||||
body.innerHTML = response.statusText;
|
||||
}
|
||||
else{
|
||||
myModal.addEventListener('hidden.bs.modal', event => {
|
||||
let url = event.target.getAttribute('data-bs-url');
|
||||
window.location.href= url;
|
||||
})
|
||||
//document.getElementById('modal_ok').addEventListener('click', loadPage );
|
||||
response.json().then(json => {
|
||||
console.log(json);
|
||||
myModal.setAttribute('data-bs-url',json.url);
|
||||
body.innerHTML = "Erfolgreich gelöscht " + json.ID;
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch(
|
||||
error => {
|
||||
let body = myModal.querySelector('.modal-body');
|
||||
body.innerHTML = "Fehler bei der Ausführung! " + error;
|
||||
}
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user