mirror of
https://github.com/getnamingo/registry.git
synced 2025-07-30 22:36:18 +02:00
81 lines
No EOL
3.6 KiB
Twig
81 lines
No EOL
3.6 KiB
Twig
<script src="/assets/js/tabulator.min.js" defer></script>
|
|
<script src="/assets/js/tabler.min.js" defer></script>
|
|
<script src="/assets/js/xlsx.full.min.js" defer></script>
|
|
<script src="/assets/js/jspdf.umd.min.js" defer></script>
|
|
<script src="/assets/js/jspdf.plugin.autotable.min.js" defer></script>
|
|
<script>
|
|
var table;
|
|
|
|
document.addEventListener("DOMContentLoaded", function(){
|
|
table = new Tabulator("#reportTable", {
|
|
ajaxURL:"/api/records/statistics", // Set the URL for your JSON data
|
|
ajaxConfig:"GET",
|
|
pagination:"local",
|
|
paginationSize: 10,
|
|
paginationSizeSelector:[10, 25, 50, 100],
|
|
clipboard:true,
|
|
clipboardPasteAction:"replace",
|
|
ajaxResponse:function(url, params, response){
|
|
return response.records;
|
|
},
|
|
layout:"fitColumns",
|
|
responsiveLayout: "collapse",
|
|
responsiveLayoutCollapseStartOpen:false,
|
|
resizableColumns:false,
|
|
initialSort:[
|
|
{column:"date", dir:"desc"},
|
|
],
|
|
placeholder: "{{ __('No Data') }}",
|
|
columns:[
|
|
{formatter:"responsiveCollapse", width:30, minWidth:30, hozAlign:"center", resizable:false, headerSort:false, responsive:0},
|
|
{title:"{{ __('Date') }}", field:"date", minWidth:150, resizable:false, headerSort:true, responsive:0},
|
|
{title:"{{ __('Total Domains') }}", minWidth:150, field:"total_domains", resizable:false, headerSort:true, responsive:0},
|
|
{title:"{{ __('Created Domains') }}", field:"created_domains", resizable:false, headerSort:true, responsive:2},
|
|
{title:"{{ __('Renewed Domains') }}", field:"renewed_domains", resizable:false, headerSort:true, responsive:2},
|
|
{title:"{{ __('Transferred Domains') }}", field:"transfered_domains", resizable:false, headerSort:true, responsive:2},
|
|
{title:"{{ __('Deleted Domains') }}", field:"deleted_domains", resizable:false, headerSort:true, responsive:2},
|
|
{title:"{{ __('Restored Domains') }}", field:"restored_domains", resizable:false, headerSort:true, responsive:2, download:false}
|
|
]
|
|
});
|
|
var searchInput = document.getElementById("search-input");
|
|
searchInput.addEventListener("input", function () {
|
|
var term = searchInput.value.toLowerCase();
|
|
|
|
if (term) { // Only apply the filter when there's a term to search for
|
|
table.setFilter(function (data) {
|
|
// Check if any of the fields contain the search term
|
|
return (
|
|
String(data.date).toLowerCase().includes(term) ||
|
|
data.total_domains.toString().includes(term) ||
|
|
data.created_domains.toString().includes(term) ||
|
|
data.renewed_domains.toString().includes(term) ||
|
|
data.transfered_domains.toString().includes(term) ||
|
|
data.deleted_domains.toString().includes(term) ||
|
|
data.restored_domains.toString().includes(term)
|
|
);
|
|
});
|
|
} else {
|
|
table.clearFilter(); // Clear the filter when the search box is emptied
|
|
}
|
|
});
|
|
});
|
|
|
|
function downloadCSV() {
|
|
table.download("csv", "reports.csv");
|
|
}
|
|
|
|
function downloadJSON() {
|
|
table.download("json", "reports.json");
|
|
}
|
|
|
|
function downloadXLSX() {
|
|
table.download("xlsx", "reports.xlsx", {sheetName:"My Reports"});
|
|
}
|
|
|
|
function downloadPDF() {
|
|
table.download("pdf", "reports.pdf", {
|
|
orientation:"portrait",
|
|
title:"My Reports"
|
|
});
|
|
}
|
|
</script> |