Add way for admins to forcibly sign users out at a specific time by clicking implausible entries
This commit is contained in:
parent
01089aaf12
commit
215e848efd
11
web/main.js
11
web/main.js
|
@ -6,10 +6,17 @@ if (qp.action) {
|
|||
mform.style.display = 'block'
|
||||
}
|
||||
|
||||
// Prefill the name field if it was successfully entered before
|
||||
// Get the name field if it was successfully entered before
|
||||
var savedName = localStorage.getItem('name')
|
||||
if (savedName && qp)
|
||||
if (qp && qp.name) {
|
||||
// Forced Admin checkout - prefill qp name and auto-agree
|
||||
document.getElementById('name').value = qp.name.replace(/-/g, ' ').toUpperCase();
|
||||
document.getElementById('agree').checked = true
|
||||
document.getElementById('agree').parentElement.style.display = 'none'
|
||||
} else if (savedName && qp) {
|
||||
// Prefill the client's locally saved name
|
||||
document.getElementById('name').value = savedName
|
||||
}
|
||||
|
||||
// 2nd script, server API communication
|
||||
var name, datetime, agreed, tested
|
||||
|
|
13
web/view.js
13
web/view.js
|
@ -88,6 +88,14 @@ function exportCSV() {
|
|||
|
||||
}
|
||||
|
||||
function offerUserCheckout(event) {
|
||||
|
||||
var name = event.target.getAttribute('data-name')
|
||||
var room = event.target.textContent
|
||||
window.open(`/?departure=${room}&edittime=1&name=${name}`, '_blank').focus();
|
||||
|
||||
}
|
||||
|
||||
function renderData() {
|
||||
|
||||
if (data == null) {
|
||||
|
@ -165,8 +173,11 @@ function renderData() {
|
|||
if (entry.tested)
|
||||
block.classList.add('tested') // = 3G
|
||||
|
||||
if (dur > 60 * 24)
|
||||
if (dur > 60 * 24) {
|
||||
block.classList.add('implausible')
|
||||
block.setAttribute('data-name', name)
|
||||
block.addEventListener('click', offerUserCheckout);
|
||||
}
|
||||
|
||||
row.appendChild(block)
|
||||
|
||||
|
|
Loading…
Reference in New Issue