Merge pull request #589 from phl0/showIncrement

WIP: Show increment
This commit is contained in:
Florian (DF2ET)
2024-07-17 17:10:41 +02:00
committed by GitHub
2 changed files with 15 additions and 7 deletions

View File

@@ -8,6 +8,7 @@
var lang_general_word_yearly = '<?= __("Yearly"); ?>';
var lang_general_word_month = '<?= __("Month"); ?>';
var lang_general_word_monthly = '<?= __("Monthly"); ?>';
var lang_general_word_diff = '<?= __("Difference"); ?>';
</script>
<div class="container">
<h2><?php echo $page_title; ?></h1>

View File

@@ -65,13 +65,16 @@ function accumulatePlot(form) {
$("#accumulateTable").append(
'<table style="width:100%" class="accutable table table-sm table-bordered table-hover table-striped table-condensed text-center"><thead>' +
"<tr>" +
"<td>#</td>" +
"<td>" +
"<th>#</th>" +
"<th>" +
periodtext +
"</td>" +
"<td>" +
"</th>" +
"<th>" +
awardtext +
"</td>" +
"</th>" +
"<th>" +
lang_general_word_diff +
"</th>" +
"</tr>" +
"</thead>" +
"<tbody></tbody></table>"
@@ -81,6 +84,7 @@ function accumulatePlot(form) {
var $myTable = $(".accutable");
var i = 1;
var last_total = 0;
// building the rows in the table
var rowElements = data.map(function (row) {
@@ -89,8 +93,11 @@ function accumulatePlot(form) {
var $iterator = $("<td></td>").html(i++);
var $type = $("<td></td>").html(row.year);
var $content = $("<td></td>").html(row.total);
diff = row.total - last_total;
var $diff = $("<td></td>").html((last_total == 0 || diff == 0) ? '' : "+"+diff);
last_total = row.total;
$row.append($iterator, $type, $content);
$row.append($iterator, $type, $content, $diff);
return $row;
});
@@ -156,11 +163,11 @@ function accumulatePlot(form) {
$(".ld-ext-right").prop("disabled", false);
$(".accutable").DataTable({
responsive: false,
ordering: false,
scrollY: "400px",
scrollCollapse: true,
paging: false,
scrollX: true,
sortable: true,
language: {
url: getDataTablesLanguageUrl(),
},