Schreibschutz kann von Admin aufgehoben werden
This commit is contained in:
parent
ac3c16633c
commit
4b1a222132
16
admin.py
16
admin.py
@ -11,6 +11,8 @@ from calendar import monthrange
|
||||
from web_ui import *
|
||||
|
||||
import os.path
|
||||
import os
|
||||
from stat import S_IREAD, S_IRWXU
|
||||
import hashlib
|
||||
import calendar
|
||||
import locale
|
||||
@ -140,7 +142,11 @@ def page_admin():
|
||||
|
||||
def revoke_archive_status():
|
||||
def revoke_status():
|
||||
filename = f"{current_user.userfolder}/{int(select_year.value)}-{int(select_month.value)}.json"
|
||||
filestring = f"{current_user.userfolder}/{int(select_year.value)}-{int(select_month.value)}"
|
||||
filename = f"{filestring}.txt"
|
||||
os.chmod(filename, S_IRWXU)
|
||||
filename = f"{filestring}.json"
|
||||
os.chmod(filename, S_IRWXU)
|
||||
with open(filename, 'r') as json_file:
|
||||
data = json.load(json_file)
|
||||
data["archived"] = 0
|
||||
@ -160,7 +166,7 @@ def page_admin():
|
||||
dialog.open()
|
||||
|
||||
if archive_status == True:
|
||||
with ui.row().classes('text-right col-span-6 justify-center'):
|
||||
with ui.row().classes('text-right col-span-7 justify-center'):
|
||||
ui.button("Archiviert", on_click=revoke_archive_status).classes('bg-transparent text-black')
|
||||
ui.separator()
|
||||
calendar_card.classes('bg-yellow')
|
||||
@ -539,13 +545,15 @@ Dies kann nicht rückgängig gemacht werden!''')
|
||||
dialog.open()
|
||||
dialog.move(calendar_card)
|
||||
|
||||
with ui.button(icon='menu'):
|
||||
with ui.button(icon='menu') as menu_button:
|
||||
with ui.menu() as menu:
|
||||
menu_item = ui.menu_item("Zeiteintrag hinzufügen", lambda day=day: add_entry(day))
|
||||
if archive_status:
|
||||
menu_item.disable()
|
||||
ui.separator()
|
||||
menu_item = ui.menu_item("Notizen bearbeiten", lambda day=day: edit_notes(day))
|
||||
if archive_status:
|
||||
menu_item.disable()
|
||||
ui.separator()
|
||||
for i in list(absence_entries):
|
||||
menu_item = ui.menu_item(f"{absence_entries[i]['name']} eintragen", lambda absence_type=i, day=day: add_absence(absence_type, day))
|
||||
@ -553,6 +561,8 @@ Dies kann nicht rückgängig gemacht werden!''')
|
||||
menu_item.disable()
|
||||
if str(day) in list(user_absent):
|
||||
menu_item.disable()
|
||||
if archive_status:
|
||||
menu_button.disable()
|
||||
|
||||
#ui.button("Eintrag hinzufügen", on_click=lambda day=day: add_entry(day))
|
||||
|
||||
|
13
playgound.py
13
playgound.py
@ -1,6 +1,17 @@
|
||||
from nicegui import ui
|
||||
import json
|
||||
import urllib.request
|
||||
|
||||
from nicegui import ui, app
|
||||
|
||||
|
||||
import segno
|
||||
|
||||
@app.get("/data")
|
||||
async def deliver_data():
|
||||
with open("settings.json") as json_file:
|
||||
data = json.load(json_file)
|
||||
return data
|
||||
|
||||
string = ""
|
||||
for i in range(1000):
|
||||
string += str(i)
|
||||
|
2
users/testuser1/2025-4.json
Normal file → Executable file
2
users/testuser1/2025-4.json
Normal file → Executable file
@ -1 +1 @@
|
||||
{"archived": 1, "overtime": -860821, "absence": {"7": "U", "8": "K", "9": "KK", "10": "UU", "11": "F", "14": "EZ"}}
|
||||
{"archived": 0, "overtime": -860821, "absence": {"7": "U", "8": "K", "9": "KK", "10": "UU", "11": "F", "14": "EZ"}}
|
0
users/testuser1/2025-4.txt
Normal file → Executable file
0
users/testuser1/2025-4.txt
Normal file → Executable file
Loading…
x
Reference in New Issue
Block a user