UI update for all tables

This commit is contained in:
Pinga 2025-02-17 11:32:54 +02:00
parent c7b4e3c631
commit 9be8b799cc
21 changed files with 217 additions and 168 deletions

View file

@ -18,6 +18,11 @@
pagination: true,
paginationMode: "remote",
paginationSize: 10,
paginationSizeSelector:[10, 25, 50, 100],
paginationCounter:"rows",
paginationCounterElement:"#page-count",
clipboard:true,
clipboardPasteAction:"replace",
sortMode: "remote",
ajaxURL: "/dapi/statements",
ajaxURLGenerator: function(url, config, params) {
@ -58,28 +63,29 @@
var lastPage = Math.ceil(response.results / this.options.paginationSize);
return {
last_page: lastPage, // Calculated total number of pages
last_row: response.results, // Total number of rows
data: response.records, // Data for the current page
};
} else {
console.error('Unexpected response format', response);
return { last_page: 1, data: [] };
return { last_page: 1, last_row: 0, data: [] };
}
},
layout:"fitDataFill",
layout:"fitColumns",
responsiveLayout: "collapse",
responsiveLayoutCollapseStartOpen:false,
resizableColumns:false,
placeholder: "{{ __('No Data') }}",
columns:[
{formatter:"responsiveCollapse", width:30, minWidth:30, hozAlign:"center", resizable:false, headerSort:false, responsive:0},
{title:"{{ __('Registrar') }}", field:"registrar_name", resizable:false, headerSort:true, responsive:0},
{title:"{{ __('Registrar') }}", field:"registrar_name", minWidth:150, resizable:false, headerSort:true, responsive:0},
{title:"{{ __('Date') }}", field:"date", resizable:false, headerSort:true, responsive:2},
{title:"{{ __('Command') }}", field:"command", resizable:false, headerSort:true, responsive:2},
{title:"{{ __('Domain') }}", field:"domain_name", resizable:false, headerSort:true, download:false, responsive:0},
{title:"{{ __('Domain') }}", field:"domain_name", resizable:false, headerSort:true, download:false, responsive:2},
{title:"{{ __('Length') }}", field:"length_in_months", resizable:false, download:false, headerSort:true, responsive:2},
{title:"{{ __('From') }}", field:"fromS", resizable:false, headerSort:true, download:false, responsive:2},
{title:"{{ __('To') }}", field:"toS", resizable:false, headerSort:true, download:false, responsive:2},
{title:"{{ __('Amount') }}", field:"amount", resizable:false, headerSort:true, responsive:0, formatter:"money", formatterParams:function(cell){
{title:"{{ __('Amount') }}", field:"amount", resizable:false, minWidth:150, headerSort:true, responsive:0, formatter:"money", formatterParams:function(cell){
return {
decimal: ".",
thousand: " ",
@ -101,22 +107,21 @@
});
function downloadCSV() {
table.download("csv", "data.csv");
table.download("csv", "transactions.csv");
}
function downloadJSON() {
table.download("json", "data.json");
table.download("json", "transactions.json");
}
function downloadXLSX() {
table.download("xlsx", "data.xlsx", {sheetName:"My Transactions"});
table.download("xlsx", "transactions.xlsx", {sheetName:"My Transactions"});
}
function downloadPDF() {
table.download("pdf", "data.pdf", {
table.download("pdf", "transactions.pdf", {
orientation:"portrait",
title:"My Transactions",
jsPDF:{unit:"mm", format:"a4", orientation:"p"}
title:"My Transactions"
});
}
</script>