diff --git a/db/models.py b/db/models.py index 2e877a4..4ae414a 100644 --- a/db/models.py +++ b/db/models.py @@ -246,7 +246,6 @@ def set_postpaid_user_money(user_id: int, money: float): int: The number of rows affected by the update operation. """ - print(f"set_postpaid_user_money: {user_id}, {money}") _log_transaction(user_id, user_is_postpaid=True, new_money_cent=money, description="Set money manually via Admin UI") t = text("UPDATE users_postpaid SET money = :money WHERE id = :id") with engine.connect() as connection: @@ -466,7 +465,6 @@ def get_last_drink(user_id: int, user_is_postpaid: bool, max_since_seconds: int last_drink_time = last_drink_time.replace(tzinfo=datetime.timezone.utc) if (now - last_drink_time).total_seconds() > max_since_seconds: return None - print(f"get_last_drink: user_id={user_id}, user_is_postpaid={user_is_postpaid}, drink_id={drink_id}, timestamp={timestamp}, drink_type={drink_type}") return {"id": drink_id, "timestamp": timestamp, "drink_type": drink_type} def revert_last_drink(user_id: int, user_is_postpaid: bool, drink_id: int, drink_cost: int = DRINK_COST): @@ -481,7 +479,6 @@ def revert_last_drink(user_id: int, user_is_postpaid: bool, drink_id: int, drink with engine.connect() as connection: # Check if the drink exists - print(f"revert_last_drink: user_id={user_id}, user_is_postpaid={user_is_postpaid}, drink_id={drink_id}, drink_cost={drink_cost}") drink_exists = connection.execute(del_t, {"user_id": user_id, "drink_id": drink_id}).rowcount > 0 if not drink_exists: raise HTTPException(status_code=404, detail="Drink not found") diff --git a/main.py b/main.py index 0322347..7c3b04c 100644 --- a/main.py +++ b/main.py @@ -182,11 +182,7 @@ async def drink(request: Request): if not user_db_id: raise HTTPException(status_code=404, detail="User not found") - form = await request.form() - getraenk = str(form.get("getraenk")) - print(f"User {user_authentik['preferred_username']} requested drink: {getraenk}") - - drink_postpaid_user(user_db_id, getraenk) + drink_postpaid_user(user_db_id) return RedirectResponse(url="/", status_code=303) @app.post("/payup") @@ -329,11 +325,6 @@ def delete_prepaid_user(request: Request, username: str = Form(...)): return RedirectResponse(url="/", status_code=303) -@app.get("/popup_getraenke") -async def popup_getraenke(): - alle_getraenke = ["Wasser", "Cola", "Bier", "Mate", "Saft", "Tee", "Kaffee", "Limo"] - return JSONResponse(content={"getraenke": random.sample(alle_getraenke, 4)}) - @app.post("/del_last_drink") def del_last_drink(request: Request): user_db_id = request.session.get("user_db_id") diff --git a/static/style.css b/static/style.css index 58539ff..d7d5db3 100644 --- a/static/style.css +++ b/static/style.css @@ -38,9 +38,71 @@ header { background: #23272a; color: #e0e0e0; } - input, select, button { + input, + select, + button { background: #23272a; color: #e0e0e0; border-color: #444; } } + +/* Responsive Design */ +@media (max-width: 600px) { + body { + max-width: 100vw; + padding: 0.5em; + } + header, + main { + padding: 0.5em; + margin-bottom: 0.5em; + } + h1 { + font-size: 1.3em; + text-align: center; + } + table { + font-size: 0.95em; + width: 100%; + display: block; + overflow-x: auto; + } + th, + td { + padding: 0.3em 0.5em !important; + word-break: break-word; + } + form { + flex-direction: column !important; + gap: 0.5em !important; + max-width: 100% !important; + } + input, + select, + button, + label { + width: 100% !important; + font-size: 1em !important; + box-sizing: border-box; + } + .github-icon-link { + top: 8px; + right: 8px; + width: 24px; + height: 24px; + } + img[alt="Logo"] { + height: 36px !important; + } + #popup { + max-width: 98vw !important; + left: 50% !important; + transform: translate(-50%, -25%) !important; + padding: 0.5em !important; + } + #popup-getraenke button { + font-size: 1em !important; + padding: 0.5em 0.7em !important; + } +} diff --git a/templates/base.html b/templates/base.html index 78b0ab3..f6b1107 100644 --- a/templates/base.html +++ b/templates/base.html @@ -56,25 +56,17 @@
| ID | Username | Key | -Postpaid_User ID | Money (€) | -Activated | -last drink |
|---|---|---|---|---|---|---|
| {{ prepaid_user_i.id }} | {{ prepaid_user_i.username }} | {{ prepaid_user_i.user_key }} | -{{ prepaid_user_i.postpaid_user_id }} | {{ prepaid_user_i.money / 100 }} | -{{ prepaid_user_i.activated }} | -{{ prepaid_user_i.last_drink }} |