Dritte Hälfte Admin Panel
This commit is contained in:
parent
7a4fe740a5
commit
29dea32561
Binary file not shown.
24
database.py
24
database.py
|
|
@ -60,7 +60,6 @@ def get_ats_names():
|
|||
cursor.execute("SELECT name FROM ats ORDER BY name ASC")
|
||||
names = cursor.fetchall()
|
||||
connection.close()
|
||||
|
||||
return [row[0] for row in names]
|
||||
|
||||
def get_einsaetze():
|
||||
|
|
@ -71,10 +70,29 @@ def get_einsaetze():
|
|||
cursor = connection.cursor()
|
||||
cursor.execute("SELECT * FROM einsaetze ORDER BY id DESC")
|
||||
data = cursor.fetchall()
|
||||
|
||||
connection.close()
|
||||
|
||||
return [dict(row) for row in data]
|
||||
|
||||
|
||||
# ATS Träger aus DB Löschen ODER einfügen.abs
|
||||
def delete_ats_traeger(id):
|
||||
connection = sqlite3.connect(DB_NAME)
|
||||
|
||||
cursor = connection.cursor()
|
||||
|
||||
def get_ats_with_id():
|
||||
#Verbindung Aufbauen
|
||||
connection = sqlite3.connect(DB_NAME)
|
||||
connection.row_factory = sqlite3.Row
|
||||
|
||||
#Cursor in die DB Schicken und Daten holen.
|
||||
cursor = connection.cursor()
|
||||
cursor.execute("SELECT id, name FROM ats ORDER BY name ASC")
|
||||
|
||||
#
|
||||
data = cursor.fetchall()
|
||||
return [dict(row) for row in data]
|
||||
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
|
|
@ -83,22 +83,17 @@ def build_ui():
|
|||
admin_container = ui.column().classes("w-full")
|
||||
|
||||
with ui.card().classes("w-full"):
|
||||
admin_login = ui.input(placeholder="Admin Passwort", password=True).props("clearable")
|
||||
admin_loginbutton = ui.button(text="Login")
|
||||
def check_login():
|
||||
print("geändert")
|
||||
admin_container.clear()
|
||||
print ("CHEEEECK!")
|
||||
# 1. Das Passwort-Feld
|
||||
pw_input = ui.input("Passwort", password=True)
|
||||
|
||||
# Das Admin-Panel wird nur angezeigt, wenn der Wert vom Input '1234' ist.
|
||||
# lambda v: v == '1234' ist die Prüf-Logik (True/False).
|
||||
|
||||
if admin_login.value == "1234":
|
||||
with admin_container:
|
||||
ui.separator()
|
||||
admin_loginbutton.on_click(check_login)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
with ui.card().bind_visibility_from(pw_input, 'value', backward=lambda v: v == '1234').classes("w-full"):
|
||||
ui.label("Admin Panel")
|
||||
with ui.row().classes('w-full'):
|
||||
ui.input(label="Neuer ATS Träger").classes('flex-1')
|
||||
ui.button(text="Hinzufügen")
|
||||
|
||||
# --- Rechte Karte: Tabelle ---
|
||||
# 'flex-1': Diese Karte nimmt die restliche Breite der Reihe ein.
|
||||
|
|
@ -127,6 +122,6 @@ def build_ui():
|
|||
|
||||
with ui.row().classes("p-2 pb-6 items-center"):
|
||||
dark = ui.dark_mode(True)
|
||||
# Der Switch ist nun schön in einer Leiste unten
|
||||
#Light/Dark Switch in der Leiste unten.
|
||||
ui.switch('Dark mode').bind_value(dark)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user