pannenkoekenwachtrij/templates/home.html

66 lines
2.1 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html lang="en">
2019-12-17 06:03:47 +01:00
<head>
<meta charset="UTF-8">
<title>Pannenkoekenwachtrij</title>
</head>
2019-12-17 06:03:47 +01:00
<body>
2019-12-17 06:03:47 +01:00
<header>
<h1>Welkom bij de pannenkoekenwachtrij</h1>
<form id="addPersonForm">
<p>Naam van de volgende <input type="text" name="name"></p>
<p>Specifieke opmerkingen <input type="text" name="remark"></p>
<p><input type="submit" value="Persoon toevoegen" id="addPersonButton"></p>
</form>
<h2>Zie hieronder de lijst van personen die een pannenkoek willen</h2>
<table>
{% for order in orders %}
<tr>
2019-12-17 06:03:47 +01:00
<td><button onclick="start_bakken({{order.id}})">Aan het bakken</button></td>
<td><button onclick="klaar({{order.id}})">Klaar</button></td>
<td><button onclick="dissmiss({{order.id}})">Dismiss</button></td>
<th>{{ order.name + order.remark + ": " }}</th>
<td>{{ "Huidige status: " + order.status }}</td>
</tr>
2019-12-17 06:03:47 +01:00
{% endfor %}
</table>
</header>
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script>
$(document).ready(function() {
$("#addPersonButton").click(function(event) {
event.preventDefault();
var form = $("#addPersonForm").serializeArray();
var name = form[0]["value"];
var remark = form[1]["value"];
$.ajax({
type: "POST",
url: '/execute',
contentType: "application/json",
data: JSON.stringify({
"lecode": `insert into orders (name, remark) values ("${name}", "${remark}")`
}),
success: function(data) {
console.log("SUCCESS : ", data);
},
error: function(e) {
console.log("ERROR : ", e);
}
});
});
})
</script>
</body>
2019-12-17 06:03:47 +01:00
</html>