added html for remove tag

This commit is contained in:
2000-Trek 2023-06-09 21:26:17 +02:00
parent 7ba11cbbf5
commit c047351723
2 changed files with 28 additions and 2 deletions

View file

@ -124,7 +124,7 @@ def request_addtag(data):
socketio.emit("error", "error")
@app.route("/removetag", methods=['GET'])
def get_addtag_request():
def get_removetag_request():
global users
try:
user_id = int(request.args.get("id"))
@ -136,7 +136,7 @@ def get_addtag_request():
return render_template("removetag.html", user=user_id)
@socketio.on('removetag')
def request_addtag(data):
def request_removetag(data):
global finished
if len(users.queue) > 0:
user = users.queue[len(users.queue) - 1]

26
templates/removetag.html Normal file
View file

@ -0,0 +1,26 @@
<!DOCTYPE html>
<html lang="en">
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.0.1/socket.io.js" integrity="sha512-q/dWJ3kcmjBLU4Qc47E4A9kTB4m3wuTY7vkFJDTZKjTs8jhyGQnaUrxa0Ytd0ssMZhbNua9hE+E7Qv1j+DyZwA==" crossorigin="anonymous"></script>
<script type="text/javascript" charset="utf-8">
var socket = io();
var user = {{ user }}
socket.on('connect', function() {
socket.emit('removetag', {data: user});
});
socket.on("busy", function(){
document.write('<p>the nfc reader is busy at the moment. Pleas Wait ...</p>')
socket.emit('addtag', {data: user})
});
socket.on("wait", function(){
document.write('<p>Pleas hold your tag on to the nfc reader</p>')
});
socket.on("error", function(data) {
alert(data)
window.location="http://matekasse.server.c3h/"
});
socket.on("finished", function(data){
alert(data)
window.location="http://matekasse.server.c3h/"
});
</script>
</html>