Weitere Markdowns nach Label umgestellt
This commit is contained in:
parent
46a0182377
commit
8083e00392
@ -404,16 +404,18 @@ def page_admin():
|
||||
hours_to_work = int(current_user.get_day_workhours(select_year.value, select_month.value, day))
|
||||
if hours_to_work < 0:
|
||||
ui.space()
|
||||
day_type.content="Kein Arbeitsverhältnis"
|
||||
day_type.text="Kein Arbeitsverhältnis"
|
||||
day_type.set_visibility(True)
|
||||
else:
|
||||
ui.label(f"{convert_seconds_to_hours(int(hours_to_work) * 3600)}").classes('text-right')
|
||||
if int(hours_to_work) == 0:
|
||||
day_type.content = "**Kein Arbeitstag**"
|
||||
day_type.text = "Kein Arbeitstag"
|
||||
day_type.classes('text-bold')
|
||||
day_type.set_visibility(True)
|
||||
|
||||
if day_in_list.strftime("%Y-%m-%d") in data["holidays"]:
|
||||
day_type.content = f'**{data["holidays"][day_in_list.strftime("%Y-%m-%d")]}**'
|
||||
day_type.text = f'{data["holidays"][day_in_list.strftime("%Y-%m-%d")]}'
|
||||
day_type.classes('text-bold')
|
||||
|
||||
# Saldo für den Tag berechnen
|
||||
|
||||
|
38
lib/api.py
38
lib/api.py
@ -38,10 +38,10 @@ def page_overview_month(username: str, year: int, month: int):
|
||||
else:
|
||||
with ui.column().classes('w-full items-end gap-0'):
|
||||
ui.label(f"Bericht erstellt am {datetime.now().strftime('%d.%m.%Y %H:%M:%S')}")
|
||||
ui.markdown(f'#Bericht für {current_user.fullname} für {calendar.month_name[month]} {year}')
|
||||
ui.label(f'Bericht für {current_user.fullname} für {calendar.month_name[month]} {year}').classes(h1)
|
||||
|
||||
pad_x = 4
|
||||
pad_y = 1
|
||||
pad_y = 2
|
||||
|
||||
color_weekend = "gray-100"
|
||||
color_holiday = "gray-100"
|
||||
@ -89,18 +89,21 @@ def page_overview_month(username: str, year: int, month: int):
|
||||
|
||||
current_day_date = f"{datetime(year, month, day).strftime('%a')}, {day}.{month}.{year}"
|
||||
with ui.link_target(day).classes(f'border px-{pad_x} py-{pad_y} bg-{color_day}'):
|
||||
ui.markdown(current_day_date)
|
||||
ui.label(current_day_date)
|
||||
|
||||
# Abwesenheitseinträge
|
||||
booking_color = "inherit"
|
||||
booking_text_color = "inherit"
|
||||
bold = ''
|
||||
|
||||
try:
|
||||
# Abwesenheitszeiten behandeln
|
||||
for i in list(user_absent):
|
||||
if int(i) == day:
|
||||
booking_text += absence_entries[user_absent[i]]["name"] + "<br>"
|
||||
booking_text += absence_entries[user_absent[i]]["name"] + "\n"
|
||||
booking_color = absence_entries[user_absent[i]]["color"]
|
||||
booking_text_color = absence_entries[user_absent[i]]["text-color"]
|
||||
bold = 'text-bold'
|
||||
except:
|
||||
pass
|
||||
|
||||
@ -108,29 +111,30 @@ def page_overview_month(username: str, year: int, month: int):
|
||||
for i in range(0, len(timestamps_dict[day]), 2):
|
||||
try:
|
||||
temp_pair = [timestamps_dict[day][i], timestamps_dict[day][i + 1]]
|
||||
booking_text = booking_text + str(datetime.fromtimestamp(temp_pair[0]).strftime('%H:%M')) + " - " + str(datetime.fromtimestamp(temp_pair[1]).strftime('%H:%M')) + "<br>"
|
||||
booking_text = booking_text + str(datetime.fromtimestamp(temp_pair[0]).strftime('%H:%M')) + " - " + str(datetime.fromtimestamp(temp_pair[1]).strftime('%H:%M')) + "\n"
|
||||
|
||||
except:
|
||||
if len(timestamps_dict[day]) % 2 != 0:
|
||||
booking_text += datetime.fromtimestamp(int(timestamps_dict[day][i])).strftime('%H:%M') + " - ***Buchung fehlt!***"
|
||||
booking_text += datetime.fromtimestamp(int(timestamps_dict[day][i])).strftime('%H:%M') + " - Buchung fehlt!"
|
||||
|
||||
day_notes = current_user.get_day_notes(year, month, day)
|
||||
just_once = True
|
||||
|
||||
with ui.column().classes(f'border px-{pad_x} py-{pad_y} bg-{booking_color} text-{booking_text_color}'):
|
||||
booking_text_element = ui.markdown(booking_text)
|
||||
booking_text_element = ui.label(booking_text).style('white-space: pre-wrap').classes(bold)
|
||||
if len(day_notes) > 0:
|
||||
if len(timestamps_dict[day]) > 0 or day in list(map(int, list(user_absent))):
|
||||
ui.separator()
|
||||
for user_key, notes in day_notes.items():
|
||||
if user_key == "admin":
|
||||
ui.markdown(f"Administrator:<br>{notes}")
|
||||
ui.label(f"Administrator:\n{notes}").style('white-space: pre-wrap')
|
||||
else:
|
||||
with ui.element():
|
||||
ui.markdown(f"{current_user.fullname}:<br>{notes}")
|
||||
ui.label(f"{current_user.fullname}:\n{notes}").style('white-space: pre-wrap')
|
||||
if len(day_notes) > 1 and just_once:
|
||||
ui.separator()
|
||||
just_once = False
|
||||
|
||||
# Ist-Zeiten berechnen
|
||||
timestamps_of_this_day = []
|
||||
|
||||
@ -163,11 +167,10 @@ def page_overview_month(username: str, year: int, month: int):
|
||||
else:
|
||||
is_time = "Kein"
|
||||
|
||||
ui.markdown(is_time).classes(f'border px-{pad_x} py-{pad_y} text-center')
|
||||
ui.label(is_time).classes(f'border px-{pad_x} py-{pad_y} text-center')
|
||||
# Sollzeit bestimmen
|
||||
|
||||
hours_to_work = int(current_user.get_day_workhours(year, month, day))
|
||||
|
||||
if hours_to_work < 0:
|
||||
target_time = ""
|
||||
else:
|
||||
@ -176,10 +179,11 @@ def page_overview_month(username: str, year: int, month: int):
|
||||
booking_text = "Kein Arbeitstag"
|
||||
date_dt = datetime(year, month, day)
|
||||
if date_dt.strftime("%Y-%m-%d") in data["holidays"]:
|
||||
booking_text = f'**{data["holidays"][date_dt.strftime("%Y-%m-%d")]}**'
|
||||
booking_text_element.set_content(booking_text)
|
||||
booking_text = f'{data["holidays"][date_dt.strftime("%Y-%m-%d")]}'
|
||||
booking_text_element.classes('text-bold')
|
||||
booking_text_element.text = booking_text
|
||||
|
||||
ui.markdown(target_time).classes(f'border px-{pad_x} py-{pad_y} text-center')
|
||||
ui.label(target_time).classes(f'border px-{pad_x} py-{pad_y} text-center')
|
||||
|
||||
# Saldo für den Tag berechnen
|
||||
day_in_list = datetime(year, month, day)
|
||||
@ -190,7 +194,7 @@ def page_overview_month(username: str, year: int, month: int):
|
||||
saldo = 0
|
||||
total = ""
|
||||
booking_text = "Kein Arbeitsverhältnis"
|
||||
booking_text_element.set_content(booking_text)
|
||||
booking_text_element.value = booking_text
|
||||
else:
|
||||
saldo = int(time_sum) - int(time_duty)
|
||||
# Nach Abwesenheitseinträgen suchen
|
||||
@ -210,7 +214,7 @@ def page_overview_month(username: str, year: int, month: int):
|
||||
total_class = 'text-center'
|
||||
else:
|
||||
total_class = 'text-right'
|
||||
ui.markdown(total).classes(total_class).classes(f'border px-{pad_x} py-{pad_y}')
|
||||
ui.label(total).classes(total_class).classes(f'border px-{pad_x} py-{pad_y}')
|
||||
|
||||
# Überstundenzusammenfassung
|
||||
ui.label("Überstunden aus Vormonat:").classes(f'col-span-4 text-right border px-{pad_x} py-{pad_y}')
|
||||
@ -274,7 +278,7 @@ def page_overview_month(username: str, year: int, month: int):
|
||||
|
||||
with ui.dialog() as dialog, ui.card():
|
||||
with ui.grid(columns='1fr 1fr'):
|
||||
ui.markdown("Hiermit bestätigen Sie, dass die Zeitbuchungen im Montagsjournal korrekt sind.<br>Sollte dies nicht der Fall sein, wenden Sie sich für eine Korrektur an den Administrator.").classes('col-span-2')
|
||||
ui.label("Hiermit bestätigen Sie, dass die Zeitbuchungen im Montagsjournal korrekt sind.\nSollte dies nicht der Fall sein, wenden Sie sich für eine Korrektur an den Administrator.").classes('col-span-2').style('white-space: pre-wrap')
|
||||
ui.button("Archivieren", on_click=do_archiving)
|
||||
ui.button("Abbrechen", on_click=dialog.close)
|
||||
|
||||
|
@ -47,12 +47,12 @@ def page_touchscreen():
|
||||
for name in userlist:
|
||||
current_user = user(name)
|
||||
current_button = ui.button(on_click=lambda name=name: button_click(name)).classes(f'w-md h-full min-h-[{admin_settings["button_height"]}px]')
|
||||
|
||||
with current_button:
|
||||
if admin_settings["photos_on_touchscreen"]:
|
||||
try:
|
||||
with open(current_user.photofile, 'r') as file:
|
||||
pass
|
||||
file.close()
|
||||
ui.image(current_user.photofile).classes(f'max-h-[{admin_settings["picture_height"]}px]').props('fit=scale-down')
|
||||
except:
|
||||
pass
|
||||
|
@ -225,6 +225,8 @@ class user:
|
||||
with open(os.path.join(self.userfolder, f"{year}-{month}.json"), 'r') as json_file:
|
||||
data = json.load(json_file)
|
||||
return data["archived"]
|
||||
except FileNotFoundError:
|
||||
return False
|
||||
except:
|
||||
return -1
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user