forked from bton/matekasse
added html for remove tag
This commit is contained in:
parent
7ba11cbbf5
commit
c047351723
2 changed files with 28 additions and 2 deletions
4
main.py
4
main.py
|
@ -124,7 +124,7 @@ def request_addtag(data):
|
||||||
socketio.emit("error", "error")
|
socketio.emit("error", "error")
|
||||||
|
|
||||||
@app.route("/removetag", methods=['GET'])
|
@app.route("/removetag", methods=['GET'])
|
||||||
def get_addtag_request():
|
def get_removetag_request():
|
||||||
global users
|
global users
|
||||||
try:
|
try:
|
||||||
user_id = int(request.args.get("id"))
|
user_id = int(request.args.get("id"))
|
||||||
|
@ -136,7 +136,7 @@ def get_addtag_request():
|
||||||
return render_template("removetag.html", user=user_id)
|
return render_template("removetag.html", user=user_id)
|
||||||
|
|
||||||
@socketio.on('removetag')
|
@socketio.on('removetag')
|
||||||
def request_addtag(data):
|
def request_removetag(data):
|
||||||
global finished
|
global finished
|
||||||
if len(users.queue) > 0:
|
if len(users.queue) > 0:
|
||||||
user = users.queue[len(users.queue) - 1]
|
user = users.queue[len(users.queue) - 1]
|
||||||
|
|
26
templates/removetag.html
Normal file
26
templates/removetag.html
Normal 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>
|
Loading…
Reference in a new issue