From 623df67966225e018e751705453381db29e35ba4 Mon Sep 17 00:00:00 2001 From: SimolZimol <70102430+SimolZimol@users.noreply.github.com> Date: Thu, 24 Oct 2024 15:57:30 +0200 Subject: [PATCH] modified: app.py modified: templates/global_admin_dashboard.html modified: templates/server_admin_dashboard.html --- app.py | 10 +++++-- templates/global_admin_dashboard.html | 38 ++++++++++++--------------- templates/server_admin_dashboard.html | 32 ++++++++++++---------- 3 files changed, 43 insertions(+), 37 deletions(-) diff --git a/app.py b/app.py index aa5d031..c53512b 100644 --- a/app.py +++ b/app.py @@ -249,15 +249,19 @@ def server_admin_dashboard(guild_id): cursor.execute("SELECT permission FROM user_data WHERE user_id = %s AND guild_id = %s", (user_id, guild_id)) user_data = cursor.fetchone() + cursor.execute("SELECT name FROM guilds WHERE guild_id = %s", (guild_id,)) # Nehme an, du speicherst Guild-Infos + guild_name = cursor.fetchone()["name"] + cursor.close() connection.close() if user_data and user_data['permission'] >= 8: # Benutzer ist Admin auf diesem Server - return render_template("server_admin_dashboard.html", guild_id=guild_id) + return render_template("server_admin_dashboard.html", guild_id=guild_id, guild_name=guild_name) return redirect(url_for("user_landing_page")) + @app.route("/user_dashboard/") def user_dashboard(guild_id): """Serverbasiertes User-Dashboard""" @@ -325,7 +329,9 @@ def user_landing_page(): def global_admin_dashboard(): """Globales Admin-Dashboard nur für globale Admins""" if session.get("is_admin"): - return render_template("global_admin_dashboard.html") + user_info = session['discord_user'] + bot_running = bot_status() # Funktion, die den Status des Bots prüft + return render_template("global_admin_dashboard.html", user_info=user_info, bot_running=bot_running) return redirect(url_for("user_landing_page")) @app.route("/logout") diff --git a/templates/global_admin_dashboard.html b/templates/global_admin_dashboard.html index eb00167..b39b291 100644 --- a/templates/global_admin_dashboard.html +++ b/templates/global_admin_dashboard.html @@ -9,11 +9,23 @@ - {% include 'navigation.html' %} - + +
-

Global Admin Dashboard - {{ user_info.username }}

-

Manage the global bot settings and users.

+

Welcome, {{ user_info.username }} (Global Admin)

+

Manage global bot settings and controls.

@@ -27,26 +39,10 @@ class="btn btn-primary btn-block {{ 'disabled' if bot_running else '' }}">Start Bot Stop Bot - Settings + Global Settings View Logs
- -
-
-
Giveaway Management
-

Manage and view all active giveaways globally.

- View Giveaways -
-
- -
-
-
User Management
-

Manage all registered users globally.

- View Users -
-
diff --git a/templates/server_admin_dashboard.html b/templates/server_admin_dashboard.html index ea08cad..28bdf57 100644 --- a/templates/server_admin_dashboard.html +++ b/templates/server_admin_dashboard.html @@ -9,35 +9,39 @@ - {% include 'navigation.html' %} +
-

Admin Dashboard for Server {{ guild_id }}

-

Manage server-specific settings and users.

+

Server Admin Dashboard for {{ guild_name }}

+

Manage server-specific settings and controls.

-
Server Status
-

Here you can manage server-specific functionalities like giveaways and points.

+
Giveaway Management
+

Manage and view all active giveaways for this server.

View Giveaways
-
Manage Server Points
+
Manage Points

Manage user points for this server.

Manage Points
- -
-
-
User Management
-

Manage all users for this server.

- View Users -
-