-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreport.auth-log.php
69 lines (61 loc) · 2.19 KB
/
report.auth-log.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<a href="#" class="back-to-top"><i class="fa-solid fa-circle-arrow-up fa-2x"></i></a>
<div class="container-fluid mt-2" id="master">
<h1>Authentication Log</h1>
<div class="row">
<div class="col-auto">
<div class="form-group">
<label for="from_date" class="mb-0">From Date</label>
<input type="date" id="from_date" class="form-control" value="<?=date('Y-m-d')?>">
</div>
</div>
<div class="col-auto">
<div class="form-group">
<label for="to_date" class="mb-0">To Date</label>
<input type="date" id="to_date" class="form-control" value="<?=date('Y-m-d')?>">
</div>
</div>
<div class="col-auto">
<button class="btn btn-primary px-4 mt-4" onclick="$(document).trigger('report:auth-log')">Report</button>
</div>
</div>
<div class="mt-4" id="output"></div>
</div>
<div class="container" id="auth-log-detail"></div>
<script>
if (!documentEventExists('report:auth-log')) {
$(document).on('report:auth-log', ƒ => {
$('#auth-log-detail').html(`<img src="/images/ellipsis.svg" height="40" alt="...">`).load(`report-data.auth-log.php` + net.queryParams({
from_date: $('#from_date').val(),
to_date: $('#to_date').val()
}));
});
}
$(async ƒ => {
// To facilitate scroll-to-top (recommended on all reports)
$(window).on('scroll', ƒ => {
if ($(window).scrollTop() > offset) {
$('.back-to-top').fadeIn(duration);
} else {
$('.back-to-top').fadeOut(duration);
}
});
$('.back-to-top').on('click', ƒ => {
ƒ.preventDefault();
$('html, body').animate({scrollTop: 0}, duration);
return false;
})
$('#btn-report').off('click').on('click', ƒ => {
console.log('report button clicked.')
const from_date = $('#from_date').val();
const to_date = $('#to_date').val();
if (from_date.length === 0) return ui.toastr.error(`From Date is required`, 'ATTENTION');
if (to_date.length === 0) return ui.toastr.error(`To Date is required`, 'ATTENTION');
$('#report').prop('disabled', true);
$('#output').html(report_loader).load(`report-data.auth-log.php` + net.queryParams({
from_date, to_date
}), ƒ => {
$('#report').prop('disabled', false);
});
});
});
</script>