56 lines
2.2 KiB
Python
56 lines
2.2 KiB
Python
|
|
from nicegui import app,ui
|
||
|
|
import data
|
||
|
|
|
||
|
|
data = data.CON
|
||
|
|
cur = data.cursor()
|
||
|
|
|
||
|
|
def content() -> None:
|
||
|
|
with ui.grid(columns=1).classes('translate-x-5 p-2 m-2'):
|
||
|
|
toggle = ui.toggle(["Hannah", "Fiona", "Liam"], clearable=True, on_change=lambda: show_person(toggle)).props('vertical')
|
||
|
|
tog = ui.button('Hannah', on_click=lambda: show_person(tog)).props('vertical')
|
||
|
|
tog2 = ui.button('Fiona', on_click=lambda: show_person(tog2)).props('vertical')
|
||
|
|
tog3 = ui.button('Liam', on_click=lambda: show_person(tog3)).props('vertical')
|
||
|
|
with ui.row().classes('absolute bottom-0 left-0 p-2 m-2'):
|
||
|
|
with ui.element('q-fab').props('icon=navigation color=green'):
|
||
|
|
ui.element('q-fab-action').props('icon=add color=blue-5').on('click', lambda: add_verse(toggle))
|
||
|
|
ui.element('q-fab-action').props('icon=remove color=red-3').on('click', lambda: remove_verse(toggle))
|
||
|
|
with ui.row() as addverse:
|
||
|
|
ui.row()
|
||
|
|
|
||
|
|
def add_verse(toggle):
|
||
|
|
if toggle.value is None:
|
||
|
|
ui.notify("Oops! You haven't selected a person")
|
||
|
|
else:
|
||
|
|
with addverse:
|
||
|
|
with toggle:
|
||
|
|
ui.input(label="Add Verse Here")
|
||
|
|
result = ui.label()
|
||
|
|
ui.button().props('icon=book color=grey-5').on('click', lambda: submit_verse(result))
|
||
|
|
|
||
|
|
def submit_verse(result):
|
||
|
|
pass
|
||
|
|
|
||
|
|
def remove_verse(toggle):
|
||
|
|
with ui.dialog() as dialog, ui.card():
|
||
|
|
ui.label('What verse would you like to add?')
|
||
|
|
|
||
|
|
def show_person(person):
|
||
|
|
ui.add_body_html("<div class=mainmain></div>")
|
||
|
|
if person.text is not None:
|
||
|
|
res = cur.execute(f"select verse,verse_passage,status from tasks where person='{person.text.lower()}'")
|
||
|
|
dbinfo = res.fetchall()
|
||
|
|
person.clear()
|
||
|
|
with ui.element('div').classes('flex-start'):
|
||
|
|
with person:
|
||
|
|
for item in dbinfo:
|
||
|
|
with ui.grid(columns=2):
|
||
|
|
ui.chip(item[0], icon='ads_click', on_click=lambda: ui.notify(item[1]))
|
||
|
|
ui.chip(item[2], selectable=True, icon="checkmark", color="green")
|
||
|
|
else:
|
||
|
|
person.clear()
|
||
|
|
|
||
|
|
# with addcard():
|
||
|
|
# verse = ui.input(label="Verse", placeholder="Verse")
|
||
|
|
# ui.button("Add")
|
||
|
|
# ui.button("Delete")
|