Einsatz Liste wird angezeigt. Einträge können eingegeben werden.
This commit is contained in:
parent
06b7287e20
commit
b649652d25
Binary file not shown.
BIN
ats_doku.db
BIN
ats_doku.db
Binary file not shown.
|
|
@ -40,7 +40,7 @@ def add_data_to_einsaetze(name, location, date, time):
|
||||||
connection = sqlite3.connect(DB_NAME)
|
connection = sqlite3.connect(DB_NAME)
|
||||||
cursor = connection.cursor()
|
cursor = connection.cursor()
|
||||||
|
|
||||||
sql_query = "INSERT INTO einsaetze (name, ort, datum, zeit) VALUES (?, ?, ?, ?)"
|
sql_query = "INSERT INTO einsaetze (name, location, date, time) VALUES (?, ?, ?, ?)"
|
||||||
data = (name, location, date, time)
|
data = (name, location, date, time)
|
||||||
|
|
||||||
cursor.execute(sql_query, data)
|
cursor.execute(sql_query, data)
|
||||||
|
|
@ -62,14 +62,13 @@ def get_ats_names():
|
||||||
|
|
||||||
def get_einsaetze():
|
def get_einsaetze():
|
||||||
connection = sqlite3.connect(DB_NAME)
|
connection = sqlite3.connect(DB_NAME)
|
||||||
cursor = connection.cursor()
|
|
||||||
|
|
||||||
#Get Data an Row Names
|
#Get Data an Row Names
|
||||||
connection.row_factory = sqlite3.Row
|
connection.row_factory = sqlite3.Row
|
||||||
|
cursor = connection.cursor()
|
||||||
cursor.execute("SELECT * FROM einsaetze ORDER BY id DESC")
|
cursor.execute("SELECT * FROM einsaetze ORDER BY id DESC")
|
||||||
data = cursor.fetchall()
|
data = cursor.fetchall()
|
||||||
|
|
||||||
connection.commit()
|
|
||||||
connection.close()
|
connection.close()
|
||||||
|
|
||||||
return [dict(row) for row in data]
|
return [dict(row) for row in data]
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -42,6 +42,10 @@ def build_ui():
|
||||||
time = input_time.value
|
time = input_time.value
|
||||||
database.add_data_to_einsaetze(name, location, date, time)
|
database.add_data_to_einsaetze(name, location, date, time)
|
||||||
print (name, location, date, time)
|
print (name, location, date, time)
|
||||||
|
|
||||||
|
einsaetze_table.rows = database.get_einsaetze()
|
||||||
|
einsaetze_table.update()
|
||||||
|
|
||||||
ui.notify("Eintrag in Datenbank erstellt.")
|
ui.notify("Eintrag in Datenbank erstellt.")
|
||||||
|
|
||||||
def ClearForm():
|
def ClearForm():
|
||||||
|
|
@ -59,7 +63,17 @@ def build_ui():
|
||||||
|
|
||||||
|
|
||||||
with ui.card().classes('flex-1 h-[85vh] p-0'):
|
with ui.card().classes('flex-1 h-[85vh] p-0'):
|
||||||
ui.label("PLACEHOLDER ##### Datenbankeinträge aus Alten Einsätzen.")
|
collums = [
|
||||||
|
{'name': 'date', 'label': 'Datum', 'field': 'date', 'sortable': True, 'align': 'left'},
|
||||||
|
{'name': 'name', 'label': 'Name', 'field': 'name', 'sortable': True, 'align': 'left'},
|
||||||
|
{'name': 'location', 'label': 'Ort', 'field': 'location', 'align': 'left'},
|
||||||
|
{'name': 'time', 'label': 'Dauer', 'field': 'time'},
|
||||||
|
]
|
||||||
|
einsaetze_table = ui.table(
|
||||||
|
columns = collums,
|
||||||
|
rows = database.get_einsaetze(),
|
||||||
|
row_key = "id"
|
||||||
|
).classes("w-full h-full")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user