commit 22/01/2026
This commit is contained in:
@@ -1,15 +1,35 @@
|
||||
$(document).ready(function() {
|
||||
// Your code here
|
||||
console.log("log.js is loaded and ready.");
|
||||
let $logchooser = $('#logchooser');
|
||||
// if logchooser value is null, set to today's date in format mm/dd/yyyy
|
||||
if ($logchooser.val() === null) {
|
||||
$logchooser.val(new Date().toISOString().split('T')[0]);
|
||||
}
|
||||
|
||||
$('#logoutbtn').on('click', function() {
|
||||
// Clear session storage on logout
|
||||
fetch('/logout').then(() => {
|
||||
window.location.href = '/login.html';
|
||||
});
|
||||
});
|
||||
$logchooser.on('change', function() {
|
||||
const selectedLog = $(this).val();
|
||||
GetLog(selectedLog);
|
||||
});
|
||||
});
|
||||
|
||||
$(window).on('beforeunload', function() {
|
||||
console.log("User is leaving log.html");
|
||||
// Your cleanup code here
|
||||
});
|
||||
});
|
||||
|
||||
// function GetLog with date parameter in string, with default value today's date in format dd/mm/yyyy
|
||||
function GetLog(date = new Date().toISOString().split('T')[0]) {
|
||||
console.log("Fetching logs for date: " + date);
|
||||
Get('getLogs?'+new URLSearchParams({date: date}).toString(), function(data){
|
||||
console.log(data);
|
||||
}, function(error){
|
||||
alert(error);
|
||||
})
|
||||
}
|
||||
@@ -23,7 +23,7 @@
|
||||
</nav>
|
||||
<div class="row mb-2">
|
||||
<div class="col-2"><label class="col-form-label w-100 h-100 ms-1">Log Chooser</label></div>
|
||||
<div class="col"><input class="form-control-lg" type="date"></div>
|
||||
<div class="col"><input class="form-control-lg" id="logchooser" type="date"></div>
|
||||
</div>
|
||||
<div class="row mb-2">
|
||||
<div class="table-responsive">
|
||||
|
||||
Reference in New Issue
Block a user