update new Datatable

This commit is contained in:
Markus 2024-07-12 23:21:35 +02:00
parent 5cb2bb142b
commit eb028d1783
7 changed files with 133 additions and 21 deletions

View File

@ -31,7 +31,7 @@
</div>
</div>
</form>
<table class="table table-sm" id="bookings" cellspacing="0"></table>
<table class="table table-sm table-striped" id="bookings" cellspacing="0"></table>
</div>
<div class="col-xxl-4 col-12 d-none d-xxl-block">
<div class="text-white-50"><h2>Aktuelle Kontostände</h2></div>

View File

@ -19,7 +19,20 @@ $(document).ready(function(){
d.source = $('#source').val();
},
dataSrc:''},
dom: '<"toolbar">frt',
layout: {
topStart: {
buttons: [
{text:'Neu Rechnung',className:'btn-sm',action: function ( e, dt, node, config ) {
location.href = '/newBill/';
}},
{text:'Neuer Transfer',className:'btn-sm mx-2',action: function ( e, dt, node, config ) {
location.href = '/newTransfer/';
}},
]
},
topEnd: 'search'
},
// dom: '<"toolbar">frt',
"createdRow": function ( row, data, index ) {
if(data.validate == "t"){
$(row).addClass('text-bg-warning');
@ -28,7 +41,7 @@ $(document).ready(function(){
columns: colomnspez,
});
$("div.toolbar").html('<a class="btn-sm btn-secondary mx-2" href="/newBill" role="button">Neue Rechnung</a><a class="btn-sm btn-secondary" href="/newTransfer" role="button">Neuer Transfer</a>');
// $("div.toolbar").html('<a class="btn-sm btn-secondary mx-2" href="/newBill" role="button">Neue Rechnung</a><a class="btn-sm btn-secondary" href="/newTransfer" role="button">Neuer Transfer</a>');
$('#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');});

78
public/js/stopuhr.js Normal file
View File

@ -0,0 +1,78 @@
let startBtn = document.getElementById('start');
let stopBtn = document.getElementById('stop');
let resetBtn = document.getElementById('reset');
let hour = 0;
let minute = 0;
let second = 0;
let count = 0;
startBtn.addEventListener('click', function () {
timer = true;
stopWatch();
});
stopBtn.addEventListener('click', function () {
timer = false;
});
resetBtn.addEventListener('click', function () {
timer = false;
hour = 0;
minute = 0;
second = 0;
count = 0;
document.getElementById('hr').innerHTML = "00";
document.getElementById('min').innerHTML = "00";
document.getElementById('sec').innerHTML = "00";
document.getElementById('count').innerHTML = "00";
});
function stopWatch() {
if (timer) {
count++;
if (count == 100) {
second++;
count = 0;
}
if (second == 60) {
minute++;
second = 0;
}
if (minute == 60) {
hour++;
minute = 0;
second = 0;
}
let hrString = hour;
let minString = minute;
let secString = second;
let countString = count;
if (hour < 10) {
hrString = "0" + hrString;
}
if (minute < 10) {
minString = "0" + minString;
}
if (second < 10) {
secString = "0" + secString;
}
if (count < 10) {
countString = "0" + countString;
}
document.getElementById('hr').innerHTML = hrString;
document.getElementById('min').innerHTML = minString;
document.getElementById('sec').innerHTML = secString;
document.getElementById('count').innerHTML = countString;
setTimeout(stopWatch, 10);
}
}

View File

@ -2,11 +2,12 @@ var accounts;
$(document).ready(function(){
accounts = $('#accounts').DataTable({
paging: false,
searching:false,
searching:true,
scrollX:false,
info:false,
ajax: { url: '/Ajax/getAccountsBalance', dataSrc:''},
dom: '<"toolbar">frtip',
layout: { topEnd: 'search' },
// dom: '<"toolbar">frtip',
columns: [
{ title: "Konto",orderable:false, data: "description",className:"dt-receiver" },
colBetrag

View File

@ -9,10 +9,20 @@ $(document).ready(function(){
info:false,
order: [[ 1, 'desc' ]],
ajax: { url: '/Ajax/getOverviewData', dataSrc:''},
dom: '<"toolbar">frt',
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>');
// $("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);});
@ -25,10 +35,20 @@ $(document).ready(function(){
info:true,
order: [[ 1, 'desc' ]],
ajax: { url: '/Ajax/getToDosData', dataSrc:''},
dom: '<"top"i<"syncbutton">>frt<"bottom"lp><"clear">',
layout: {
topStart: {
buttons: [
{text:'Sync',className:'btn-sm',action: function ( e, dt, node, config ) {
location.href = '/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>');
// $("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);});