2025-10-31 01:45:41 +01:00

102 lines
3.6 KiB
HTML

<!DOCTYPE html>
<html lang="no">
<head>
<meta charset="UTF-8" />
<title>EKT admin</title>
<meta name="viewport" content="width=device-width,initial-scale=1" />
<meta name="description" content="Elektronisk Kadaver Tidtakningssystem" />
<link rel="icon" type="image/png" href="/img/favicon-96x96.png" sizes="96x96" />
<link rel="shortcut icon" href="/img/favicon.ico" />
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png" />
<meta name="apple-mobile-web-app-title" content="Kadaver'n" />
<link rel="manifest" href="/img/site.webmanifest" />
<link rel="stylesheet" href="css/matcha.css">
</head>
<body>
<nav>
<menu>
<li class="disabled"><a href="/admin.php">📊 Dashbord</a></li>
<li class="disabled"><a href="/registrering.php">⏱️ Registrer passering på matpost/mål</a></li>
<li class="selected"><a href="/db_editor.html">👥 Endre løperbase</a></li>
<li class="disabled"><a href="/config_editor.html">⚙️ Konfigurasjon</a></li>
<li class="disabled">⏳️ Nedtelling matpost
<menu>
<li><a href="/matpost_nedtelling.php?matpost=0">1. mat</a></li>
<li><a href="/matpost_nedtelling.php?matpost=1">2. mat</a></li>
</menu>
</li>
</menu>
</nav>
<h2>Legg til løper</h2>
<form action="/api/runner.php" method="POST" hx-boost="true" hx-target="#updated" hx-swap="show:none">
<input style="display: none;" type="text" id="password" name="password" required>
<label for="id">Startnummer:
<input type="text" id="id" name="id" required>
</label>
<label for="navn">Navn:
<input type="text" id="name" name="name">
</label>
<label for="club">Klubb:
<input type="text" id="club" name="club">
</label>
<fieldset>
<legend>Klasse</legend>
<label>
<input type="radio" name="course" value="Kadaverløpet" checked="checked">
Kadaverløpet
</label>
<label>
<input type="radio" name="course" value="Minikadaver'n">
Minikadaver'n
</label>
</fieldset>
<button type="submit">Legg til løper</button>
</form>
<div id="updated"></div>
<h2>Endre løper</h2>
<form action="/api/runner.php" method="GET" hx-boost="true" hx-target="#runner" hx-swap="show:none">
<input type="hidden" id="edit" name="edit" value="true">
<label>
Søk etter navn, startnummer eller klubb
<input type="text" name="search" id="search">
</label>
<button type="submit">Søk</button>
</form>
<div id="runner"></div>
</div>
<div id="updated"></div>
<script>
function log_out(){
localStorage.removeItem("navn");
localStorage.removeItem("passord");
window.location.href = "/login.html";
}
// Sjekk om brukeren er logga inn. hvis ikke hiv de ut til innloggingskjermen
let xmlHttpReq = new XMLHttpRequest();
xmlHttpReq.open("POST", "/api/is_authorized.php", false);
xmlHttpReq.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8")
xmlHttpReq.send("username=" + localStorage.getItem("navn")+"&"+"password=" + localStorage.getItem("passord"));
if (xmlHttpReq.status != 200){
window.location.href = "/login.html";
}
document.getElementById('password').value = localStorage.getItem("passord");
</script>
<script src="/lib/htmx.min.js"></script>
<script>
document.body.addEventListener('htmx:beforeSwap', function(evt) {
// Allow 422 and 400 responses to swap
// We treat these as form validation errors
if (evt.detail.xhr.status === 422 || evt.detail.xhr.status === 400) {
evt.detail.shouldSwap = true;
evt.detail.isError = false;
}
});
</script>
</body>
</html>