First commit
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.venv
|
70
app.py
Normal file
70
app.py
Normal file
@@ -0,0 +1,70 @@
|
||||
from flask import Flask, render_template, request, session
|
||||
from flask_bootstrap import Bootstrap
|
||||
|
||||
app = Flask(__name__)
|
||||
app.config['SECRET_KEY'] = 'j69ol5mcHLsEtLg4Y/+myd9wWD4pp56E'
|
||||
Bootstrap(app)
|
||||
|
||||
gesamtwert = 0
|
||||
item1 = 0
|
||||
item2 = 0
|
||||
item3 = 0
|
||||
item4 = 0
|
||||
item5 = 0
|
||||
item6 = 0
|
||||
|
||||
|
||||
@app.route("/", methods=["GET", "POST"])
|
||||
def index():
|
||||
global gesamtwert, item1, item2, item3, item4, item5, item6, sum
|
||||
|
||||
if request.method == "POST":
|
||||
wert = float(request.form["wert"])
|
||||
|
||||
if wert == 0:
|
||||
global gesamtwert
|
||||
gesamtwert = 0
|
||||
sum = "0"
|
||||
item1 = 0
|
||||
item2 = 0
|
||||
item3 = 0
|
||||
item4 = 0
|
||||
item5 = 0
|
||||
item6 = 0
|
||||
else:
|
||||
gesamtwert += wert
|
||||
gesamtwert = round(gesamtwert, 2)
|
||||
if gesamtwert > 0:
|
||||
sum = str(gesamtwert) + "0"
|
||||
# gesamtwert = '€{:,.2f}'.format(gesamtwert)
|
||||
if wert == 5.8:
|
||||
item1 += 1
|
||||
if wert == 4.8:
|
||||
item2 += 1
|
||||
if wert == 3.3:
|
||||
item3 += 1
|
||||
if wert == 8.8:
|
||||
item4 += 1
|
||||
if wert == 5.5:
|
||||
item5 += 1
|
||||
if wert == .2:
|
||||
item6 += 1
|
||||
|
||||
session['item1'] = item1
|
||||
session['item2'] = item2
|
||||
session['item3'] = item3
|
||||
session['item4'] = item4
|
||||
session['item5'] = item5
|
||||
session['item6'] = item6
|
||||
|
||||
return render_template("index.html", gesamtwert=sum,
|
||||
item1=session.get('item1', 0),
|
||||
item2=session.get('item2', 0),
|
||||
item3=session.get('item3', 0),
|
||||
item4=session.get('item4', 0),
|
||||
item5=session.get('item5', 0),
|
||||
item6=session.get('item6', 0),
|
||||
)
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run(debug=True, host="192.168.177.24")
|
84
templates/index.html
Normal file
84
templates/index.html
Normal file
@@ -0,0 +1,84 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>🍓 Erdbeerhannah 🍓</title>
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
|
||||
<style>
|
||||
body, html {
|
||||
height: 100%;
|
||||
}
|
||||
.table-container {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.table {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
table-layout: fixed;
|
||||
}
|
||||
.table td {
|
||||
height: calc(100vh / 5); /* Höhe der Zeilen dynamisch anpassen */
|
||||
vertical-align: middle;
|
||||
text-align: center;
|
||||
}
|
||||
.btn {
|
||||
width: 100%; /* Button füllt die Zelle */
|
||||
height: 100%; /* Button füllt die Zelle */
|
||||
}
|
||||
.bold-row {
|
||||
font-weight: bold;
|
||||
font-size: 400%;
|
||||
}
|
||||
.large-font {
|
||||
font-size: 300%;
|
||||
}
|
||||
.custom-btn-size {
|
||||
font-size: 200%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container-fluid table-container">
|
||||
<table class="table table-bordered">
|
||||
<!-- <thead>
|
||||
<tr>
|
||||
<th>Spalte 1</th>
|
||||
<th>Spalte 2</th>
|
||||
<th>Spalte 3</th>
|
||||
</tr>
|
||||
</thead> -->
|
||||
<form method="post">
|
||||
<tbody>
|
||||
<tr class="large-font">
|
||||
<td colspan="3">🍓 Erdbeerhannah 🍓</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><button type="submit" name="wert" value="5.8" class="btn btn-xl btn-primary custom-btn-size">🍓 5,80€ ({{ item1 }})</button></td>
|
||||
<td><button type="submit" name="wert" value="4.8" class="btn btn-xl btn-danger custom-btn-size">🫙🫙 4,80€ ({{ item2 }})</button></td>
|
||||
<td><button type="submit" name="wert" value="3.3" class="btn btn-xl btn-danger custom-btn-size">🫙 3,30€ ({{ item3 }})</button></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><button type="submit" name="wert" value="8.8" class="btn btn-xl btn-warning custom-btn-size">🧃🧃 8,80€ ({{ item4 }})</button></td>
|
||||
<td><button type="submit" name="wert" value="5.5" class="btn btn-xl btn-warning custom-btn-size">🧃 5,50€ ({{ item5 }})</button></td>
|
||||
<td><button type="submit" name="wert" value="0.2" class="btn btn-xl btn-success custom-btn-size">🛍️ 0,20€ ({{ item6 }})</button></td>
|
||||
</tr>
|
||||
<tr class="bold-row">
|
||||
<td colspan="3">🫰 {{ gesamtwert }}€</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3"><button type="submit" name="wert" value="0" id="reset" class="btn btn-xl btn-dark custom-btn-size">Reset 🐳</button></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</form>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user