This commit is contained in:
@@ -20,7 +20,7 @@ class NewMedicineState(rx.State):
|
|||||||
last_scan_time: str = ""
|
last_scan_time: str = ""
|
||||||
updated_uuid: bool = False
|
updated_uuid: bool = False
|
||||||
scanning: bool = False
|
scanning: bool = False
|
||||||
rate: float = 2
|
rate: float = 1
|
||||||
lastupdatetime: int = 0
|
lastupdatetime: int = 0
|
||||||
|
|
||||||
def start_scan(self):
|
def start_scan(self):
|
||||||
@@ -55,9 +55,7 @@ class NewMedicineState(rx.State):
|
|||||||
results = session.exec(statement)
|
results = session.exec(statement)
|
||||||
medicine = results.first()
|
medicine = results.first()
|
||||||
if medicine is not None:
|
if medicine is not None:
|
||||||
medicine_name = (
|
medicine_name = f"{medicine.name} - {medicine.owner.name}"
|
||||||
f"{medicine.name} - {medicine.owner.name}"
|
|
||||||
)
|
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@@ -208,9 +206,11 @@ def taken_form():
|
|||||||
rx.divider(),
|
rx.divider(),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def just_show(x):
|
def just_show(x):
|
||||||
return rx.text(x)
|
return rx.text(x)
|
||||||
|
|
||||||
|
|
||||||
@template(route="/medicine", title="Medikamente")
|
@template(route="/medicine", title="Medikamente")
|
||||||
def medicine() -> rx.Component:
|
def medicine() -> rx.Component:
|
||||||
"""The dashboard page.
|
"""The dashboard page.
|
||||||
@@ -242,10 +242,7 @@ def medicine() -> rx.Component:
|
|||||||
border_bottom=styles.border,
|
border_bottom=styles.border,
|
||||||
padding="1em",
|
padding="1em",
|
||||||
),
|
),
|
||||||
rx.cond(
|
rx.cond(NewMedicineState.show_med_add_form, new_medicine_form()),
|
||||||
NewMedicineState.show_med_add_form,
|
|
||||||
new_medicine_form()
|
|
||||||
),
|
|
||||||
rx.cond(
|
rx.cond(
|
||||||
NewMedicineState.updated_uuid,
|
NewMedicineState.updated_uuid,
|
||||||
taken_form(),
|
taken_form(),
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
"""The meds page."""
|
|
||||||
from reflex_ipad.templates import template
|
|
||||||
|
|
||||||
import reflex as rx
|
|
||||||
|
|
||||||
|
|
||||||
@template(route="/medicine", title="Medikamente")
|
|
||||||
def dashboard() -> rx.Component:
|
|
||||||
"""The dashboard page.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
The UI for the dashboard page.
|
|
||||||
"""
|
|
||||||
return rx.vstack(
|
|
||||||
rx.heading("Medikamente", font_size="3em"),
|
|
||||||
rx.text("Heute schon genommen?"),
|
|
||||||
rx.text(
|
|
||||||
"Scan the Med",
|
|
||||||
),
|
|
||||||
)
|
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
from reflex_ipad import styles
|
from reflex_ipad import styles
|
||||||
|
|
||||||
# Import all the pages.
|
# Import all the pages.
|
||||||
from reflex_ipad.pages import *
|
from reflex_ipad.pages import index, dashboard, settings
|
||||||
from reflex_ipad import api
|
from reflex_ipad import api
|
||||||
from reflex_ipad.models import *
|
from reflex_ipad.models import *
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user