This commit is contained in:
Tim Berchtold 2025-07-05 10:13:28 +02:00
parent eeda5062ae
commit a95e8a00b8
7 changed files with 46 additions and 39 deletions

View file

@ -7,7 +7,8 @@
<title>Document</title>
</head>
<body>
<form name="order" onsubmit="return validateForm()" action="{{ url_for('order_get') }}" method="POST" class="flex-container">
<form name="order" onsubmit="return validateForm()" action="{{ url_for('order_get') }}" method="POST" class="flex-container">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
<li class="box desk-nr">Tisch Nummer
<div>
<select name="desk" class="desk-select">

View file

@ -46,10 +46,7 @@
</ul>
</td>
<td>
<button
class="finish-btn"
onclick="markFinished({{ order[2] }})"
id="btn-{{ order[2] }}">
<button class="finish-btn" onclick="markFinished({{ order[2] }})" id="btn-{{ order[2] }}">
Finished
</button>
</td>
@ -59,15 +56,17 @@
<tr><td colspan="3">No open orders.</td></tr>
{% endfor %}
</table>
<script>
var csrfToken = "{{ csrf_token() }}";
// Track active timers for each order
window.activeTimers = {};
function markFinished(orderId) {
fetch('/orders', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
headers: { 'Content-Type': 'application/x-www-form-urlencoded',
'X-CSRFToken': csrfToken },
body: `order_id=${orderId}&action=finish`
})
.then(response => response.json())
@ -106,7 +105,8 @@
fetch('/orders', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
headers: { 'Content-Type': 'application/x-www-form-urlencoded' ,
'X-CSRFToken': csrfToken },
body: `order_id=${orderId}&action=undo`
})
.then(response => response.json())