Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
fc9cd70776
|
|||
8b9654370c
|
|||
4471c140c1 |
@ -94,6 +94,7 @@ def calculate_nutrition(food, weight):
|
||||
# Index-Route
|
||||
@app.route('/')
|
||||
@oidc.require_login
|
||||
@oidc.require_keycloak_role('user')
|
||||
def index():
|
||||
return render_template('index.html')
|
||||
|
||||
@ -101,6 +102,7 @@ def index():
|
||||
|
||||
@app.route('/get_products')
|
||||
@oidc.require_login
|
||||
@oidc.require_keycloak_role('user')
|
||||
def get_products():
|
||||
conn = get_db_connection()
|
||||
cursor = conn.cursor()
|
||||
@ -117,6 +119,7 @@ def get_products():
|
||||
# Route zum Hinzufügen und Berechnen von Lebensmitteln
|
||||
@app.route('/add_lm', methods=['GET'])
|
||||
@oidc.require_login
|
||||
@oidc.require_keycloak_role('user')
|
||||
def add_lm():
|
||||
food = request.args.get('food')
|
||||
weight = float(request.args.get('weight'))
|
||||
@ -164,6 +167,7 @@ def add_nutrition():
|
||||
|
||||
@app.route('/nutrition')
|
||||
@oidc.require_login
|
||||
@oidc.require_keycloak_role('user')
|
||||
def nutrition():
|
||||
return render_template('nutrition.html')
|
||||
|
||||
|
@ -172,15 +172,6 @@ function updateTotalNutrition() {
|
||||
document.getElementById('total-ca').innerText = Math.round(totalCa);
|
||||
}
|
||||
|
||||
// Rufen Sie diese Funktion auf, wenn sich die Haupttabelle ändert
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Diese Funktion sollte aufgerufen werden, wenn ein Produkt hinzugefügt oder entfernt wird
|
||||
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
@ -196,7 +187,7 @@ function updateTotalNutrition() {
|
||||
<div class="content">
|
||||
<form onsubmit="event.preventDefault(); addProduct();" id="product-form">
|
||||
<label for="my_combobox">Wählen Sie ein Lebensmittel</label>
|
||||
<input list="products" name="my_combobox" id="my_combobox" oninput="updateButtonState()" autocomplete="off">
|
||||
<input list="products" name="my_combobox" id="my_combobox" placeholder="Lebensmittel" oninput="updateButtonState()" autocomplete="off">
|
||||
<datalist id="products">
|
||||
<!-- Produkte werden hier dynamisch eingefügt -->
|
||||
</datalist>
|
||||
|
Reference in New Issue
Block a user