81 lines
3.3 KiB
JavaScript
81 lines
3.3 KiB
JavaScript
var datatable;
|
|
var todos;
|
|
|
|
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();
|
|
}
|
|
});
|
|
// location.href = '/syncScheduled/';
|
|
}
|
|
|
|
$(document).ready(function(){
|
|
datatable = $('#bookings').DataTable({
|
|
paging: false,
|
|
searching:true,
|
|
scrollX:false,
|
|
info:false,
|
|
order: [[ 1, 'desc' ]],
|
|
ajax: { url: '/Ajax/getOverviewData', dataSrc:''},
|
|
layout: {
|
|
topStart: {
|
|
buttons: [
|
|
{text:'Neue Rechnung',className:'btn-sm',action: function ( e, dt, node, config ) {
|
|
location.href = '/newBill/';
|
|
}},
|
|
]
|
|
},
|
|
topEnd: 'search'
|
|
},
|
|
// dom: '<"toolbar">frt',
|
|
columns: columns,
|
|
});
|
|
// $("div.toolbar").html('<a class="btn-sm btn-secondary" href="/newBill" role="button">Neuer Eintrag</a>');
|
|
// Add event listener for opening and closing details
|
|
$('#bookings tbody').on('click', 'td.dt-receiver', function () {collapseDetails($(this), datatable);} );
|
|
$('#bookings tbody').on('click', 'td.dt-datum', function () {location.href = '/editBill/'+getId($(this),datatable);});
|
|
$('#bookings tbody').on('click', 'table.tabdet', function () {location.href = '/editBill/'+$(this).attr('data-bs-id');});
|
|
|
|
todos = $('#todos').DataTable({
|
|
paging: true,
|
|
searching:true,
|
|
scrollX:false,
|
|
info:true,
|
|
order: [[ 1, 'desc' ]],
|
|
ajax: { url: '/Ajax/getToDosData', dataSrc:''},
|
|
layout: {
|
|
topStart: {
|
|
buttons: [
|
|
{text:'Sync',className:'btn-sm',action: syncScheduled},
|
|
]
|
|
},
|
|
topEnd: 'search'
|
|
},
|
|
// dom: '<"top"i<"syncbutton">>frt<"bottom"lp><"clear">',
|
|
columns: columns,
|
|
});
|
|
// $("div.syncbutton").html('<a class="btn-sm btn-secondary" href="/syncScheduled" role="button">Sync</a>');
|
|
// Add event listener for opening and closing details
|
|
$('#todos tbody').on('click', 'td.dt-receiver', function () {collapseDetails($(this), todos);} );
|
|
$('#todos tbody').on('click', 'td.dt-datum', function () {location.href = '/editBill/'+getId($(this),todos);});
|
|
$('#todos tbody').on('click', 'table.tabdet', function () {location.href = '/editBill/'+$(this).attr('data-bs-id');});
|
|
}); |