mirror of
https://github.com/getnamingo/registry.git
synced 2025-08-05 17:18:04 +02:00
Added log pages in cp
This commit is contained in:
parent
07b69a4e2b
commit
3d639c7268
8 changed files with 303 additions and 15 deletions
77
cp/resources/views/partials/js-poll.twig
Normal file
77
cp/resources/views/partials/js-poll.twig
Normal file
|
@ -0,0 +1,77 @@
|
|||
<script src="/assets/js/tabulator.min.js" defer></script>
|
||||
<script src="/assets/js/tabler.min.js" defer></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.18.5/xlsx.full.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf-autotable/3.6.0/jspdf.plugin.autotable.min.js"></script>
|
||||
<script>
|
||||
var table;
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function(){
|
||||
table = new Tabulator("#pollTable", {
|
||||
ajaxURL:"/api/records/poll?join=registrar", // Set the URL for your JSON data
|
||||
ajaxConfig:"GET",
|
||||
pagination:"local",
|
||||
paginationSize:10,
|
||||
ajaxResponse:function(url, params, response){
|
||||
return response.records;
|
||||
},
|
||||
layout:"fitDataFill",
|
||||
responsiveLayout: "collapse",
|
||||
responsiveLayoutCollapseStartOpen:false,
|
||||
resizableColumns:false,
|
||||
initialSort:[
|
||||
{column:"qdate", dir:"desc"}, // sorting by the "cldate" field in descending order
|
||||
],
|
||||
columns:[
|
||||
{formatter:"responsiveCollapse", width:30, minWidth:30, hozAlign:"center", resizable:false, headerSort:false, responsive:0},
|
||||
{title:"Registrar", field:"registrar_id.name", headerSort:true, responsive:2},
|
||||
{title:"Date", field:"qdate", headerSort:true, responsive:0},
|
||||
{title:"Message", field:"msg", headerSort:true, responsive:0},
|
||||
{title:"Message Type", field:"msg_type", headerSort:true, responsive:0},
|
||||
{title:"Object", field:"obj_name_or_id", headerSort:true, responsive:2},
|
||||
],
|
||||
placeholder:function(){
|
||||
return this.getHeaderFilters().length ? "No Matching Data" : "No Data"; //set placeholder based on if there are currently any header filters
|
||||
}
|
||||
});
|
||||
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.registrar_id.name).toLowerCase().includes(term) ||
|
||||
String(data.qdate).toLowerCase().includes(term) ||
|
||||
String(data.msg).toLowerCase().includes(term) ||
|
||||
String(data.msg_type).toLowerCase().includes(term) ||
|
||||
String(data.obj_name_or_id).toLowerCase().includes(term)
|
||||
);
|
||||
});
|
||||
} else {
|
||||
table.clearFilter(); // Clear the filter when the search box is emptied
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function downloadCSV() {
|
||||
table.download("csv", "data.csv");
|
||||
}
|
||||
|
||||
function downloadJSON() {
|
||||
table.download("json", "data.json");
|
||||
}
|
||||
|
||||
function downloadXLSX() {
|
||||
table.download("xlsx", "data.xlsx", {sheetName:"My Contacts"});
|
||||
}
|
||||
|
||||
function downloadPDF() {
|
||||
table.download("pdf", "data.pdf", {
|
||||
orientation:"portrait",
|
||||
title:"My Contacts",
|
||||
jsPDF:{unit:"mm", format:"a4", orientation:"p"}
|
||||
});
|
||||
}
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue