2024-02-16 11:14:45 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="no">
|
|
|
|
<head>
|
2024-10-08 19:41:41 +00:00
|
|
|
<meta charset="UTF-8" />
|
|
|
|
<title>EKT</title>
|
|
|
|
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
|
|
|
<meta name="description" content="Elektronisk Kadaver Tidtakningssystem" />
|
2024-10-11 16:04:23 +00:00
|
|
|
<link rel="stylesheet" href="matcha.css">
|
2024-02-16 11:14:45 +00:00
|
|
|
<style>
|
2024-10-27 17:15:45 +00:00
|
|
|
body {
|
|
|
|
padding: 0;
|
|
|
|
}
|
|
|
|
.settings {
|
|
|
|
padding: 0 1.5rem;
|
|
|
|
}
|
|
|
|
fieldset {
|
|
|
|
display: flex;
|
|
|
|
flex-wrap: wrap;
|
|
|
|
justify-content: space-evenly;
|
|
|
|
}
|
|
|
|
.bg-success {
|
|
|
|
background: var(--bg-success) !important;
|
|
|
|
}
|
|
|
|
.bg-active {
|
|
|
|
background: var(--bg-active) !important;
|
|
|
|
}
|
2024-02-16 11:14:45 +00:00
|
|
|
</style>
|
|
|
|
</head>
|
|
|
|
<body>
|
2024-10-27 17:15:45 +00:00
|
|
|
<div class="settings">
|
|
|
|
<legend>Passord</legend>
|
|
|
|
<input type="password" name="passord" id="password">
|
2024-10-08 19:41:41 +00:00
|
|
|
<fieldset>
|
|
|
|
<legend>Velg post</legend>
|
|
|
|
<label>
|
2024-10-11 15:41:20 +00:00
|
|
|
<input type="radio" name="post" value="1" onclick="update()">
|
2024-10-08 19:41:41 +00:00
|
|
|
1. Matpost
|
|
|
|
</label>
|
|
|
|
<label>
|
2024-10-11 15:41:20 +00:00
|
|
|
<input type="radio" name="post" value="2" onclick="update()">
|
2024-10-08 19:41:41 +00:00
|
|
|
2. Matpost
|
|
|
|
</label>
|
|
|
|
<label>
|
2024-10-11 15:41:20 +00:00
|
|
|
<input type="radio" name="post" value="3" onclick="update()">
|
2024-10-08 19:41:41 +00:00
|
|
|
Mål
|
|
|
|
</label>
|
|
|
|
</fieldset>
|
|
|
|
|
2024-10-27 17:15:45 +00:00
|
|
|
<button onmousedown="update()">Oppdater tabell</button>
|
2024-10-08 19:41:41 +00:00
|
|
|
<input id="search" type="number" class="form-control" onkeyup="filterTable()" placeholder="Søk">
|
2024-10-08 10:55:26 +00:00
|
|
|
<br>
|
2024-10-27 17:15:45 +00:00
|
|
|
</div>
|
|
|
|
<table id="runners"></table>
|
2024-02-16 11:14:45 +00:00
|
|
|
<script>
|
|
|
|
// Hvilken matpost vi er på:
|
2024-10-08 19:41:41 +00:00
|
|
|
var control = location.search[1];
|
2024-02-16 11:14:45 +00:00
|
|
|
|
2024-10-11 15:41:20 +00:00
|
|
|
function get_control() {
|
|
|
|
try {
|
|
|
|
return document.querySelector('input[name="post"]:checked').value;
|
|
|
|
}
|
|
|
|
catch (error) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-02-16 11:14:45 +00:00
|
|
|
function register_runner(id) {
|
2024-10-11 15:41:20 +00:00
|
|
|
control = get_control();
|
|
|
|
if (control == 0) {
|
|
|
|
console.error(error);
|
|
|
|
alert("Velg en post!");
|
|
|
|
return 0;
|
|
|
|
}
|
2024-02-16 11:14:45 +00:00
|
|
|
let formData = new FormData();
|
2024-10-27 17:15:45 +00:00
|
|
|
formData.append(name= 'password', value=document.getElementById('password').value)
|
2024-02-16 11:14:45 +00:00
|
|
|
formData.append(name= 'control', value=control);
|
|
|
|
formData.append(name= 'id', value=id);
|
2024-02-16 20:26:46 +00:00
|
|
|
time = new Date(Date.now()).toISOString().split('.')[0]+"Z"
|
2024-02-16 11:14:45 +00:00
|
|
|
formData.append('time', time);
|
2024-10-27 17:34:42 +00:00
|
|
|
response = fetch("passing.php", {
|
2024-02-16 11:14:45 +00:00
|
|
|
method: "POST",
|
|
|
|
body: formData,
|
2024-10-27 17:15:45 +00:00
|
|
|
})
|
|
|
|
.then(response => {
|
|
|
|
if (response.status == 401) {
|
|
|
|
alert("Feil passord!")
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2024-10-11 15:41:20 +00:00
|
|
|
update()
|
2024-11-01 10:54:27 +00:00
|
|
|
document.getElementById("search").focus()
|
2024-02-16 11:14:45 +00:00
|
|
|
};
|
2024-10-08 10:55:26 +00:00
|
|
|
function filterTable() {
|
|
|
|
var input, filter, table, tr, td, i, txtValue;
|
|
|
|
input = document.getElementById("search");
|
2024-10-27 17:15:45 +00:00
|
|
|
filter = input.value;
|
|
|
|
table = document.getElementById("runners").getElementsByTagName("tbody")[0];
|
2024-11-01 10:54:27 +00:00
|
|
|
if (!table) {
|
|
|
|
setTimeout(filterTable, 100);
|
|
|
|
}
|
2024-10-08 10:55:26 +00:00
|
|
|
tr = table.getElementsByTagName("tr");
|
2024-02-16 11:14:45 +00:00
|
|
|
|
2024-10-27 17:15:45 +00:00
|
|
|
if (filter == "") {
|
|
|
|
for (i = 0; i < tr.length; i++) {
|
|
|
|
tr[i].style.display = "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2024-10-08 10:55:26 +00:00
|
|
|
for (i = 0; i < tr.length; i++) {
|
|
|
|
td = tr[i].getElementsByTagName("td");
|
2024-10-27 17:15:45 +00:00
|
|
|
txtValue = td[0].textContent;
|
|
|
|
if (txtValue == filter) {
|
|
|
|
tr[i].style.display = "";
|
|
|
|
} else {
|
|
|
|
tr[i].style.display = "none";
|
2024-10-08 10:55:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-10-27 17:15:45 +00:00
|
|
|
}
|
2024-10-11 15:41:20 +00:00
|
|
|
|
|
|
|
function update() {
|
|
|
|
const table = document.getElementById("runners");
|
|
|
|
control = get_control();
|
2024-11-01 10:54:27 +00:00
|
|
|
let request = new Request(`table.php?registrering,`+control);
|
|
|
|
fetch(request)
|
2024-10-11 15:41:20 +00:00
|
|
|
.then((response) => response.text())
|
2024-11-01 10:54:27 +00:00
|
|
|
.then((text) => {table.innerHTML = text;})
|
|
|
|
filterTable()
|
2024-10-11 15:41:20 +00:00
|
|
|
}
|
2024-02-16 11:14:45 +00:00
|
|
|
</script>
|
2024-10-27 17:15:45 +00:00
|
|
|
</body>
|
|
|
|
</html>
|