# Zeiterfassung

from web_ui import *
from admin import *
from login import *
from users import *
from touchscreen import *
from definitions import *
from api import *
from homepage import *

import json

def main():

    # Einstellungen einlesen
    data = load_adminsettings()
    port = int(data["port"])
    secret = data["secret"]

    list_users()

    homepage()

    def startup_message():

        message_string = f"{app_title} {app_version}"
        underline = ""
        for i in range(len(message_string)):
            underline += "-"
        print(message_string)
        print(underline)

        url_string = ""
        for i in list(app.urls):
            url_string += f"{i}, "
        url_string = url_string[0:-2]
        print("Weboberfläche erreichbar unter: " + url_string)

    app.on_startup(startup_message)
    ui.run(favicon="favicon.svg", port=port, storage_secret=secret, language='de-DE', show_welcome_message=False)

if __name__ in ("__main__", "__mp_main__"):
    main()
