Compare commits
No commits in common. "master" and "master" have entirely different histories.
5 changed files with 1 additions and 82 deletions
|
@ -57,10 +57,6 @@ def create_app(test_config=None):
|
||||||
def socketiojs():
|
def socketiojs():
|
||||||
return send_file('../static/socket.io.js')
|
return send_file('../static/socket.io.js')
|
||||||
|
|
||||||
@app.route('/ka-ching.wav')
|
|
||||||
def kaching():
|
|
||||||
return send_file('../static/ka-ching.wav')
|
|
||||||
|
|
||||||
@app.route('/new.css')
|
@app.route('/new.css')
|
||||||
def newcss():
|
def newcss():
|
||||||
return send_file('../static/new.min.css')
|
return send_file('../static/new.min.css')
|
||||||
|
@ -287,31 +283,6 @@ def create_app(test_config=None):
|
||||||
socketio.emit("error", "418", to=session[id])
|
socketio.emit("error", "418", to=session[id])
|
||||||
leave_room(session[id])
|
leave_room(session[id])
|
||||||
|
|
||||||
@app.route("/transfare")
|
|
||||||
def transfare():
|
|
||||||
db = get_db()
|
|
||||||
c = db.cursor()
|
|
||||||
c.execute("SELECT * FROM users")
|
|
||||||
user_list = c.fetchall()
|
|
||||||
return render_template("transfare.html", user_list=user_list)
|
|
||||||
|
|
||||||
@app.route("/api/transfare", methods=['POST'])
|
|
||||||
def api_transfare():
|
|
||||||
db = get_db()
|
|
||||||
c = db.cursor()
|
|
||||||
transfare_from = request.form["transfarefrom"]
|
|
||||||
transfare_to = request.form["transfareto"]
|
|
||||||
change = int(float(request.form["change"]) * float(100))
|
|
||||||
c.execute("SELECT * FROM users WHERE id=?", [transfare_from])
|
|
||||||
if c.fetchall() == []:
|
|
||||||
return render_template("error.html", error_code="043")
|
|
||||||
c.execute("SELECT * FROM users WHERE id=?", [transfare_to])
|
|
||||||
if c.fetchall() == []:
|
|
||||||
return render_template("error.html", error_code="043")
|
|
||||||
db_handler.change_balance(transfare_from, -change)
|
|
||||||
db_handler.change_balance(transfare_to, change)
|
|
||||||
return render_template("redirect.html")
|
|
||||||
|
|
||||||
@app.route("/api/balance", methods=['POST', 'GET'])
|
@app.route("/api/balance", methods=['POST', 'GET'])
|
||||||
def api_change():
|
def api_change():
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
></script>
|
></script>
|
||||||
<link rel="stylesheet" href="/new.css">
|
<link rel="stylesheet" href="/new.css">
|
||||||
|
|
||||||
<link rel="prefetch" href="/ka-ching.wav" />
|
|
||||||
<link rel="shortcut icon" type="Logo/png" href="/ccc_logo.png"/>
|
<link rel="shortcut icon" type="Logo/png" href="/ccc_logo.png"/>
|
||||||
{% block customscript %}{% endblock %}
|
{% block customscript %}{% endblock %}
|
||||||
</head>
|
</head>
|
||||||
|
@ -18,7 +17,6 @@
|
||||||
| <a href="/list">user and tag list</a>
|
| <a href="/list">user and tag list</a>
|
||||||
| <a href="/documentation">Documentation</a>
|
| <a href="/documentation">Documentation</a>
|
||||||
| <a href="/transactionlist">transactionlist</a>
|
| <a href="/transactionlist">transactionlist</a>
|
||||||
| <a href="/transfare">transfare<font face="emoji">🎺⚧</font></a>
|
|
||||||
</p>
|
</p>
|
||||||
</nav>
|
</nav>
|
||||||
<hr>
|
<hr>
|
||||||
|
|
|
@ -4,21 +4,6 @@ Strichliste
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block customscript %}
|
{% block customscript %}
|
||||||
<script type="text/javascript" charset="utf-8">
|
<script type="text/javascript" charset="utf-8">
|
||||||
function play() {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
var audio = new Audio('/ka-ching.wav');
|
|
||||||
audio.play();
|
|
||||||
|
|
||||||
audio.addEventListener("ended", function(){
|
|
||||||
resolve()
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async function ka_ching(element) {
|
|
||||||
await play();
|
|
||||||
element.parentElement.submit();
|
|
||||||
}
|
|
||||||
var socket = io();
|
var socket = io();
|
||||||
socket.on("update", function () {
|
socket.on("update", function () {
|
||||||
window.location = "http://matekasse.server.c3h/list"
|
window.location = "http://matekasse.server.c3h/list"
|
||||||
|
@ -43,8 +28,7 @@ Strichliste
|
||||||
</form>
|
</form>
|
||||||
<form action="/change" method="post" style="display: inline">
|
<form action="/change" method="post" style="display: inline">
|
||||||
<input name="id" type="hidden" value="{{user[0]}}">
|
<input name="id" type="hidden" value="{{user[0]}}">
|
||||||
<input name="change" value={{preis}} type="hidden">
|
<button type="submit" name="change" value={{preis}}>{{preis}}€</button>
|
||||||
<button onclick="ka_ching(this)" type="button">{{preis}}€</button>
|
|
||||||
</form>
|
</form>
|
||||||
<br style="line-height: 50%;"></br>
|
<br style="line-height: 50%;"></br>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
|
@ -1,34 +0,0 @@
|
||||||
{% extends "base.html" %}
|
|
||||||
|
|
||||||
{% block title %}
|
|
||||||
transfare
|
|
||||||
{% endblock %}
|
|
||||||
{% block content %}
|
|
||||||
<form action="/api/transfare" method="post">
|
|
||||||
<p>
|
|
||||||
<select name="transfarefrom">
|
|
||||||
<option value="">Select the user to transfare from</option>
|
|
||||||
{% for user in user_list %}
|
|
||||||
<option value={{user[0]}}>{{user[1]}}</option>
|
|
||||||
{% endfor %}
|
|
||||||
</select>
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<select name="transfareto">
|
|
||||||
<option value="">Select the user to transfare to</option>
|
|
||||||
{% for user in user_list %}
|
|
||||||
<option value={{user[0]}}>{{user[1]}}</option>
|
|
||||||
{% endfor %}
|
|
||||||
</select>
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<input name="change" type="number" lang="nb" step="0.01" max=1000 min=-1000 placeholder="money to transfare">
|
|
||||||
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<button type="submit">transfare money</button>
|
|
||||||
|
|
||||||
</p>
|
|
||||||
</form>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
Binary file not shown.
Loading…
Reference in a new issue