elektronisk-kadaver-tidtaki.../config_editor.html

68 lines
2.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="disabled"><a href="/db_editor.html">👥 Endre løperbase</a></li>
<li class="selected"><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>Sett dato og tid startskuddet gikk:</h2>
<div hx-get="/api/config.php" hx-swap="outerHTML" hx-trigger="load"></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");
xmlHttpReq.open("GET", "/api/config.php", false);
xmlHttpReq.send();
document.getElementById('start_time').value = xmlHttpReq.response.split('+')[0]
console.log(xmlHttpReq.response)
</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>