From 348c8e2f7f2b93dabbfbaf5217cb707ec9dc1c66 Mon Sep 17 00:00:00 2001 From: Alexander Malzkuhn Date: Tue, 22 Apr 2025 13:17:25 +0200 Subject: [PATCH] =?UTF-8?q?Monatsumstellungen=20Admin=20=C3=9Cbersucht?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Erste Funktionen zur Monatsauswahl --- users/testuser1/2024-11.txt | 28 ++++++++++++++++++ users/testuser1/2024-12.txt | 28 ++++++++++++++++++ users/testuser1/2025-2.txt | 28 ++++++++++++++++++ users/testuser1/2025-3.txt | 28 ++++++++++++++++++ web_ui.py | 57 +++++++++++++++++++++++++------------ 5 files changed, 151 insertions(+), 18 deletions(-) create mode 100644 users/testuser1/2024-11.txt create mode 100644 users/testuser1/2024-12.txt create mode 100644 users/testuser1/2025-2.txt create mode 100644 users/testuser1/2025-3.txt diff --git a/users/testuser1/2024-11.txt b/users/testuser1/2024-11.txt new file mode 100644 index 0000000..f25130e --- /dev/null +++ b/users/testuser1/2024-11.txt @@ -0,0 +1,28 @@ +1743965819 +1743965909 +1743966022 +1743966045 +1743966047 +1743966049 +1743967346 +1744889948 +1744889966 +1744989797 +1744989827 +1744989830 +1744989883 +1744989909 +1744989914 +1744989916 +1744991169 +1744991171 +1744991288 +1744991291 +1744991473 +1744991477 +1744991770 +1744991777 +1745181046 +1745181050 +1745240760 +1745240762 diff --git a/users/testuser1/2024-12.txt b/users/testuser1/2024-12.txt new file mode 100644 index 0000000..f25130e --- /dev/null +++ b/users/testuser1/2024-12.txt @@ -0,0 +1,28 @@ +1743965819 +1743965909 +1743966022 +1743966045 +1743966047 +1743966049 +1743967346 +1744889948 +1744889966 +1744989797 +1744989827 +1744989830 +1744989883 +1744989909 +1744989914 +1744989916 +1744991169 +1744991171 +1744991288 +1744991291 +1744991473 +1744991477 +1744991770 +1744991777 +1745181046 +1745181050 +1745240760 +1745240762 diff --git a/users/testuser1/2025-2.txt b/users/testuser1/2025-2.txt new file mode 100644 index 0000000..f25130e --- /dev/null +++ b/users/testuser1/2025-2.txt @@ -0,0 +1,28 @@ +1743965819 +1743965909 +1743966022 +1743966045 +1743966047 +1743966049 +1743967346 +1744889948 +1744889966 +1744989797 +1744989827 +1744989830 +1744989883 +1744989909 +1744989914 +1744989916 +1744991169 +1744991171 +1744991288 +1744991291 +1744991473 +1744991477 +1744991770 +1744991777 +1745181046 +1745181050 +1745240760 +1745240762 diff --git a/users/testuser1/2025-3.txt b/users/testuser1/2025-3.txt new file mode 100644 index 0000000..f25130e --- /dev/null +++ b/users/testuser1/2025-3.txt @@ -0,0 +1,28 @@ +1743965819 +1743965909 +1743966022 +1743966045 +1743966047 +1743966049 +1743967346 +1744889948 +1744889966 +1744989797 +1744989827 +1744989830 +1744989883 +1744989909 +1744989914 +1744989916 +1744991169 +1744991171 +1744991288 +1744991291 +1744991473 +1744991477 +1744991770 +1744991777 +1745181046 +1745181050 +1745240760 +1745240762 diff --git a/web_ui.py b/web_ui.py index fbc0bf6..91aeca2 100644 --- a/web_ui.py +++ b/web_ui.py @@ -110,6 +110,41 @@ def page_admin(): with ui.card(): with ui.row(): + def update_month_and_year(): + try: + calendar_card.clear() + except: + pass + with ui.card() as calendar_card: + with ui.grid(columns=6): + ui.markdown("Datum") + ui.markdown("Buchungen") + ui.markdown("Soll") + ui.markdown("Ist") + ui.markdown("+/-") + ui.space() + for day in range(1, monthrange(int(select_year.value), int(select_month.value))[1] + 1): + ui.markdown(f"{day}. {calendar.month_name[int(select_month.value)]}") + + # ---> Hier die Schleife für die Buchungen + ui.markdown('BUCHUNGEN') + ui.markdown("Soll") + ui.markdown("Ist") + ui.markdown("+/-") + ui.button("Bearbeiten") + + def update_months(): + + current_user = user(time_user.value) + available_months = current_user.get_months(select_year.value) + + available_months_dict = {} + for element in available_months: + available_months_dict[element] = calendar.month_name[int(element)] + select_month.clear() + select_month.set_options(available_months_dict) + select_month.value = list(available_months)[0] + current_year = datetime.datetime.now().year current_month = datetime.datetime.now().month @@ -122,38 +157,24 @@ def page_admin(): available_months_dict[element] = calendar.month_name[int(element)] select_month = ui.select(options=available_months_dict) + try: select_month.value = str(current_month) except: pass - select_year = ui.select(options=available_years) + select_year = ui.select(options=available_years, on_change=update_months) try: select_year.value = str(current_year) except: pass + ui.button("Aktualisieren", on_click=update_month_and_year) ui.markdown(f"###Buchungen für {calendar.month_name[current_month]} {current_year}") # Tabelle aufbauen - with ui.card() as calendar_card: - with ui.grid(columns=6): - ui.markdown("Datum") - ui.markdown("Buchungen") - ui.markdown("Soll") - ui.markdown("Ist") - ui.markdown("+/-") - ui.space() - for day in range(1, monthrange(int(select_year.value), int(select_month.value))[1] + 1): - ui.markdown(f"{day}. {calendar.month_name[int(select_month.value)]}") - - # ---> Hier die Schleife für die Buchungen - ui.markdown('BUCHUNGEN') - ui.markdown("Soll") - ui.markdown("Ist") - ui.markdown("+/-") - ui.button("Bearbeiten") + update_month_and_year()