Compare commits

...

4 Commits

Author SHA1 Message Date
3757658539 letzte korrekturen und aufräumen 2025-02-19 21:39:15 +01:00
e097facef7 dashboard fix 2025-02-19 21:22:11 +01:00
d5a92d187f wallpaper fix 2025-02-19 21:14:02 +01:00
209a23509b styles geändert 2025-02-19 21:01:55 +01:00
5 changed files with 355 additions and 182 deletions

View File

@@ -32,7 +32,6 @@ def close_connection(exception):
def init_db():
with app.app_context():
db = get_db()
# Users
db.execute("""
CREATE TABLE IF NOT EXISTS users (
id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -42,7 +41,6 @@ def init_db():
is_admin INTEGER DEFAULT 0
);
""")
# Bookmarks
db.execute("""
CREATE TABLE IF NOT EXISTS bookmarks (
id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -53,11 +51,10 @@ def init_db():
FOREIGN KEY(user_id) REFERENCES users(id) ON DELETE CASCADE
);
""")
# Notifications
db.execute("""
CREATE TABLE IF NOT EXISTS notifications (
id INTEGER PRIMARY KEY AUTOINCREMENT,
user_id INTEGER, -- NULL = für alle
user_id INTEGER,
message TEXT NOT NULL,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
is_read INTEGER DEFAULT 0
@@ -71,7 +68,6 @@ def init_db():
FOREIGN KEY(user_id) REFERENCES users(id) ON DELETE CASCADE
);
""")
# Time Tracking
db.execute("""
CREATE TABLE IF NOT EXISTS time_entries (
id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -82,7 +78,6 @@ def init_db():
FOREIGN KEY(user_id) REFERENCES users(id) ON DELETE CASCADE
);
""")
# Settings (OPTIONAL, falls du globale User-Einstellungen abspeichern willst)
db.execute("""
CREATE TABLE IF NOT EXISTS user_settings (
id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -94,19 +89,8 @@ def init_db():
FOREIGN KEY(user_id) REFERENCES users(id) ON DELETE CASCADE
);
""")
db.execute("""
CREATE TABLE IF NOT EXISTS settings (
id INTEGER PRIMARY KEY AUTOINCREMENT,
user_id INTEGER NOT NULL,
wallpaper TEXT DEFAULT '19.png',
city TEXT DEFAULT 'Berlin',
show_forecast INTEGER DEFAULT 1,
bookmarks TEXT DEFAULT '[]',
FOREIGN KEY(user_id) REFERENCES users(id) ON DELETE CASCADE
);
""")
db.commit()
# ------------------------------------------------------------
# HILFSFUNKTIONEN
# ------------------------------------------------------------
@@ -204,7 +188,7 @@ def login():
flash("Benutzername oder Passwort falsch!", "red")
return render_template('login.html')
@app.route('/logout', methods=['POST'])
@app.route('/logout', methods=['GET', 'POST'])
def logout():
session.clear()
flash("Erfolgreich abgemeldet!", "green")
@@ -460,40 +444,54 @@ def dashboard():
user_id = session['user_id']
db = get_db()
# User abfragen
# User und Settings ermitteln
user = db.execute("SELECT * FROM users WHERE id = ?", (user_id,)).fetchone()
if not user:
flash("Benutzer nicht gefunden.", "red")
return redirect(url_for('logout'))
# Settings aus user_settings
settings = db.execute("SELECT * FROM user_settings WHERE user_id = ?", (user_id,)).fetchone()
# Standardwerte
# Standardwerte aus settings
if not settings:
wallpaper = '19.png'
city = 'Berlin'
show_forecast = True
bookmarks = []
# (Dieses 'bookmarks' ist optional, kannst du weglassen,
# wenn du ausschließlich die DB-Tabelle 'bookmarks' nutzt)
bookmarks_setting = []
else:
wallpaper = settings['wallpaper']
city = settings['city']
show_forecast = bool(settings['show_forecast'])
if settings['bookmarks']:
bookmarks = settings['bookmarks'].split(",")
bookmarks_setting = settings['bookmarks'].split(",") # Nur als Fallback
else:
bookmarks = []
bookmarks_setting = []
# Wetter holen (wenn gewünscht)
current_temp, weather_icon, forecast = get_weather(city)
if current_temp is None:
current_temp = "N/A"
weather_icon = "fa-question"
forecast = []
# DB-Bookmarks für den eingeloggten User
user_bookmarks = db.execute("""
SELECT id, title, url, icon_class
FROM bookmarks
WHERE user_id=?
ORDER BY id DESC
""", (user_id,)).fetchall()
# Domain, Logo usw.
domain = "example.com"
logo_path = url_for('static', filename='clickcandit.png')
# Notifications für diesen User (user_id) oder globale (user_id IS NULL)
notifications = db.execute("""
SELECT id, user_id, message, created_at
FROM notifications
WHERE user_id=? OR user_id IS NULL
ORDER BY created_at DESC
""", (user_id,)).fetchall()
# Ggf. Time-Entries (falls du sie zeigen willst)
time_entries = db.execute("""
SELECT *
FROM time_entries
WHERE user_id=?
ORDER BY start_time DESC
""", (user_id,)).fetchall()
# Beispiel-Apps
user_app_chunks = [
@@ -515,25 +513,83 @@ def dashboard():
]
]
# Wetter (Dummy oder API)
current_temp, weather_icon, forecast = get_weather(city)
if current_temp is None:
current_temp = "N/A"
weather_icon = "fa-question"
forecast = []
domain = "clickcandit.com/login"
logo_path = url_for('static', filename='clickcandit.png')
return render_template(
'dashboard.html',
user=user['username'],
wallpaper=wallpaper,
city=city,
show_forecast=show_forecast,
bookmarks=bookmarks,
bookmarks=bookmarks_setting, # falls noch gebraucht, sonst weglassen
current_temp=current_temp,
weather_icon=weather_icon,
forecast=forecast,
domain=domain,
logo_path=logo_path,
user_app_chunks=user_app_chunks
user_app_chunks=user_app_chunks,
# Hier die neuen Variablen:
user_bookmarks=user_bookmarks,
notifications=notifications,
time_entries=time_entries
)
# ------------------------------------------------------------
# SUPPORT & SETTINGS ROUTEN (Aus V1)
# ------------------------------------------------------------
@app.route('/delete_notification/<int:notif_id>', methods=['POST'])
def delete_notification(notif_id):
if 'user_id' not in session:
flash("Bitte melde dich an!", "red")
return redirect(url_for('login'))
user_id = session['user_id']
db = get_db()
# Prüfen, ob die Notification existiert
row = db.execute("""
SELECT user_id
FROM notifications
WHERE id=?
""", (notif_id,)).fetchone()
if not row:
flash("Benachrichtigung existiert nicht.", "red")
return redirect(url_for('dashboard'))
# Wenn user_id = NULL => globale Notification
# Du kannst selbst definieren, ob jeder sie löschen darf oder nur Admin
# Hier: Jeder kann globale Notification löschen, wenn er sie sieht.
# Oder du sagst: Nur Admin kann globale Notis löschen -> if row['user_id'] is None and not is_admin(): ...
if row['user_id'] is None:
# Optional: Nur Admin löschen
if not is_admin():
flash('Nicht erlaubt', 'red')
return redirect(url_for('dashboard'))
pass
else:
# Wenn es eine user-spezifische Notification ist: user_id muss übereinstimmen
if row['user_id'] != user_id:
flash("Keine Berechtigung, diese Benachrichtigung zu löschen.", "red")
return redirect(url_for('dashboard'))
# Benachrichtigung löschen
db.execute("DELETE FROM notifications WHERE id=?", (notif_id,))
db.commit()
flash("Benachrichtigung gelöscht!", "green")
return redirect(url_for('dashboard'))
@app.route('/send_support_message', methods=['POST'])
def send_support_message():
"""
@@ -580,12 +636,93 @@ def get_settings():
else:
# Falls noch kein Datensatz existiert
return jsonify({
"wallpaper": "1.png",
"wallpaper": "24.png",
"city": "",
"show_forecast": False,
"bookmarks": []
})
@app.context_processor
def inject_wallpaper():
"""
Dieser Context Processor wird bei jedem Template-Aufruf ausgeführt.
Ermittelt das Wallpaper des eingeloggten Benutzers (falls eingeloggt)
und stellt es allen Templates als Variable 'WALLPAPER_URL' bereit.
"""
if 'user_id' in session:
db = get_db()
row = db.execute("SELECT wallpaper FROM user_settings WHERE user_id=?", (session['user_id'],)).fetchone()
if row and row['wallpaper']:
# Bsp: row['wallpaper'] könnte '19.png' o. ä. sein
return {
"WALLPAPER_URL": url_for('static', filename=row['wallpaper'])
}
# Fallback: Wenn User nicht eingeloggt oder kein Wallpaper gesetzt
return {
"WALLPAPER_URL": url_for('static', filename='24.png')
}
@app.route('/admin/notifications/multi', methods=['POST'])
def add_notification_multi():
if not is_admin():
flash("Zugriff verweigert!", "red")
return redirect(url_for('dashboard'))
message = request.form.get('message')
target_list = request.form.getlist('target_users') # ['all'] oder ['1','2'] etc.
if not message:
flash("Bitte eine Nachricht eingeben.", "red")
return redirect(url_for('admin_panel'))
db = get_db()
# Wenn 'all' in der Liste, Notification für alle
if 'all' in target_list:
db.execute("INSERT INTO notifications (user_id, message) VALUES (NULL, ?)", (message,))
else:
# Sonst für jede ausgewählte ID
for uid in target_list:
db.execute("INSERT INTO notifications (user_id, message) VALUES (?, ?)", (uid, message))
db.commit()
flash("Benachrichtigungen erstellt!", "green")
return redirect(url_for('admin_panel'))
@app.route('/admin/bookmarks/multi', methods=['POST'])
def add_bookmarks_multi():
if not is_admin():
flash("Zugriff verweigert!", "red")
return redirect(url_for('dashboard'))
# Checkboxen im Template: name='target_users'
target_list = request.form.getlist('target_users') # Liste der IDs (Strings)
title = request.form.get('title')
url_ = request.form.get('url')
icon = request.form.get('icon_class', 'fas fa-bookmark')
# Ggf. Validierung
if not title or not url_:
flash("Bitte Titel und URL angeben!", "red")
return redirect(url_for('admin_panel'))
if not target_list:
flash("Bitte mindestens einen Benutzer auswählen!", "red")
return redirect(url_for('admin_panel'))
icon = request.form.get('icon_class')
db = get_db()
for uid in target_list:
db.execute(
"INSERT INTO bookmarks (user_id, title, url, icon_class) VALUES (?, ?, ?, ?)",
(uid, title, url_, icon)
)
db.commit()
flash("Neues Lesezeichen für mehrere Benutzer hinzugefügt!", "green")
return redirect(url_for('admin_panel'))
@app.route('/save_settings', methods=['POST'])
def save_settings():
"""
@@ -596,7 +733,7 @@ def save_settings():
return jsonify({"success": False, "error": "not logged in"}), 403
data = request.get_json()
wallpaper = data.get('wallpaper', '1.png')
wallpaper = data.get('wallpaper', '24.png')
city = data.get('city', '')
show_forecast = data.get('show_forecast', False)
bookmarks_list = data.get('bookmarks', [])

Binary file not shown.

View File

@@ -1,149 +1,176 @@
<!-- templates/admin.html -->
{% extends "base.html" %}
{% block title %}Admin-Bereich{% endblock %}
{% block title %}
Admin-Bereich
{% endblock title %}
{% block content %}
<div class="container mx-auto p-4 sm:p-6 lg:p-8">
<h1 class="text-3xl font-bold mb-6">Admin-Bereich</h1>
<div class="container mx-auto px-4 sm:px-6 lg:px-8 py-10">
<h1 class="text-3xl font-bold text-center mb-8">Admin-Bereich</h1>
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
{% for category, message in messages %}
<div class="bg-{{category}}-500 text-white p-2 rounded mb-2">
{{ message }}
</div>
{% endfor %}
{% endif %}
{% endwith %}
<!-- Flash-Messages -->
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
{% for category, message in messages %}
<div class="bg-{{ category }}-500 text-white p-3 rounded mb-4">
{{ message }}
</div>
{% endfor %}
{% endif %}
{% endwith %}
<!-- Benutzer anlegen -->
<div class="glassmorphism p-4 rounded shadow-lg mb-8">
<h2 class="text-xl font-semibold mb-2">Neuen Benutzer anlegen</h2>
<!-- Grid Layout für Boxen -->
<div class="grid gap-8 sm:grid-cols-1 md:grid-cols-2 xl:grid-cols-4">
<!-- NEUEN BENUTZER ANLEGEN -->
<div class="glassmorphism p-6 rounded shadow flex flex-col">
<h2 class="text-xl font-semibold mb-4">Neuen Benutzer anlegen</h2>
<form method="POST" action="{{ url_for('admin_panel') }}" class="space-y-4">
<div>
<label class="block mb-1">Benutzername</label>
<input type="text" name="new_username" class="p-2 border rounded w-full" required>
</div>
<div>
<label class="block mb-1">Passwort</label>
<input type="password" name="new_password" class="p-2 border rounded w-full" required>
</div>
<div>
<label class="inline-flex items-center">
<input type="checkbox" name="new_is_admin" class="form-checkbox h-5 w-5 text-blue-600" />
<span class="ml-2">Als Admin markieren</span>
</label>
</div>
<button type="submit" class="bg-green-500 text-white py-2 px-4 rounded hover:bg-green-600">
Erstellen
</button>
<div>
<label class="block mb-1 font-medium">Benutzername:</label>
<input type="text" name="new_username" required class="w-full p-3 rounded border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-400" />
</div>
<div>
<label class="block mb-1 font-medium">Passwort:</label>
<input type="password" name="new_password" required class="w-full p-3 rounded border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-400" />
</div>
<div class="flex items-center space-x-2">
<input type="checkbox" name="new_is_admin" class="h-5 w-5 rounded border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-400" />
<span class="font-medium">Als Admin markieren</span>
</div>
<button type="submit" class="bg-green-600 hover:bg-green-700 text-white py-3 px-6 rounded shadow transition duration-200">
Erstellen
</button>
</form>
</div>
<!-- Benutzerübersicht -->
<div class="glassmorphism p-4 rounded shadow-lg mb-8">
<h2 class="text-xl font-semibold mb-2">Benutzerverwaltung</h2>
<table class="w-full table-auto">
<thead>
<tr class="border-b">
<th class="px-2 py-1">ID</th>
<th class="px-2 py-1">Username</th>
<th class="px-2 py-1">Admin?</th>
<th class="px-2 py-1"></th>
</tr>
</thead>
<tbody>
{% for u in users %}
<tr class="border-b">
<td class="px-2 py-1">{{ u.id }}</td>
<td class="px-2 py-1">{{ u.username }}</td>
<td class="px-2 py-1">{{ 'Ja' if u.is_admin else 'Nein' }}</td>
<td class="px-2 py-1 text-right">
{% if u.id != session.user_id %}
<form method="POST" action="{{ url_for('delete_user', user_id=u.id) }}" onsubmit="return confirm('Benutzer wirklich löschen?')">
<button class="bg-red-500 text-white px-2 py-1 rounded hover:bg-red-600 text-sm">
Löschen
<!-- BENUTZERVERWALTUNG -->
<div style="background-color: transparent !important;" class="glassmorphism p-6 rounded shadow flex flex-col">
<h2 class="text-xl font-semibold mb-4">Benutzerverwaltung</h2>
<div class="overflow-x-auto">
<table class="w-full table-auto">
<thead>
<tr class="border-b">
<th class="p-3 text-left">ID</th>
<th class="p-3 text-left">Username</th>
<th class="p-3 text-left">Admin?</th>
<th class="p-3 text-left">Aktion</th>
</tr>
</thead>
<tbody>
{% for u in users %}
<tr class="border-b">
<td class="p-3">{{ u.id }}</td>
<td class="p-3">{{ u.username }}</td>
<td class="p-3">{{ 'Ja' if u.is_admin else 'Nein' }}</td>
<td class="p-3 space-x-2">
<a href="{{ url_for('manage_bookmarks', user_id=u.id) }}"
style="margin: 10px !important;" class="bg-blue-500 hover:bg-blue-600 text-white px-4 py-2 rounded text-sm transition duration-200">
Lesezeichen
</a>
<form method="POST" action="{{ url_for('delete_user', user_id=u.id) }}" class="inline"
onsubmit="return confirm('Benutzer wirklich löschen?')">
<button style="margin: 10px !important;" class="bg-red-500 text-white px-4 py-2 rounded text-sm transition duration-200">
Löschen
</button>
</form>
{% else %}
<span class="text-xs text-gray-400">[Eigener Account]</span>
{% endif %}
<a href="{{ url_for('manage_bookmarks', user_id=u.id) }}" class="ml-3 bg-blue-500 text-white px-2 py-1 rounded hover:bg-blue-600 text-sm">
Lesezeichen
</a>
</td>
</tr>
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<!-- BENACHRICHTIGUNG ERSTELLEN (MULTI-USER) -->
<div class="glassmorphism p-6 rounded shadow flex flex-col">
<h2 class="text-xl font-semibold mb-4">Benachrichtigung erstellen</h2>
<form method="POST" action="{{ url_for('add_notification_multi') }}" class="space-y-4">
<div>
<label class="block mb-1 font-medium">Nachricht:</label>
<textarea name="message" rows="3" required class="w-full p-3 rounded border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-400"></textarea>
</div>
<div>
<p class="mb-2 font-medium">Für welche Benutzer?</p>
<div class="flex flex-wrap gap-2">
<label class="inline-flex items-center gap-1 bg-gray-200 dark:bg-gray-800 p-2 rounded cursor-pointer"
for="notify_all">
<input type="checkbox" id="notify_all" name="target_users" value="all" class="h-5 w-5 rounded border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-400" />
Alle
</label>
{% for u in users %}
<label class="inline-flex items-center gap-1 bg-gray-200 dark:bg-gray-800 p-2 rounded cursor-pointer">
<input type="checkbox" name="target_users" value="{{ u.id }}" class="h-5 w-5 rounded border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-400" />
{{ u.username }}
</label>
{% endfor %}
</div>
</div>
<button type="submit" class="bg-purple-500 hover:bg-purple-600 text-white px-6 py-3 rounded shadow transition duration-200">
Senden
</button>
</form>
</div>
<!-- LESEZEICHEN-VERWALTUNG (MULTI-USER) -->
<div class="glassmorphism p-6 rounded shadow flex flex-col">
<h2 class="text-xl font-semibold mb-4">Lesezeichen-Verwaltung</h2>
<form method="POST" action="{{ url_for('add_bookmarks_multi') }}" class="space-y-4">
<p class="font-medium">Für welche Benutzer soll das Lesezeichen gelten?</p>
<div class="flex flex-wrap gap-2">
{% for u in users %}
<label class="inline-flex items-center gap-1 bg-gray-200 dark:bg-gray-800 p-2 rounded cursor-pointer">
<input type="checkbox" name="target_users" value="{{ u.id }}" class="h-5 w-5 rounded border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-400" />
{{ u.username }}
</label>
{% endfor %}
</tbody>
</table>
</div>
<!-- Benachrichtigung erstellen -->
<div class="glassmorphism p-4 rounded shadow-lg mb-8">
<h2 class="text-xl font-semibold mb-2">Benachrichtigung erstellen</h2>
<form method="POST" action="{{ url_for('add_notification') }}" class="space-y-4">
<div>
<label class="block mb-1">Nachricht</label>
<textarea name="message" class="p-2 border rounded w-full" rows="2" required></textarea>
</div>
<div>
<label class="block mb-1">Für Benutzer</label>
<select name="user_id" class="p-2 border rounded w-full">
<option value="all">Alle</option>
{% for u in users %}
<option value="{{ u.id }}">{{ u.username }}</option>
{% endfor %}
</select>
</div>
<button type="submit" class="bg-purple-500 text-white py-2 px-4 rounded hover:bg-purple-600">
Senden
</button>
</form>
</div>
<!-- Falls man Lesezeichen für EINEN User verwaltet -->
{% if single_user is defined and single_user %}
<div class="glassmorphism p-4 rounded shadow-lg mb-8">
<h2 class="text-xl font-semibold mb-2">
Lesezeichen für {{ single_user.username }}
</h2>
<form method="POST" class="space-y-4">
<div>
<label class="block mb-1">Titel</label>
<input type="text" name="title" class="p-2 border rounded w-full" required>
</div>
<div>
<label class="block mb-1">URL</label>
<input type="text" name="url" class="p-2 border rounded w-full" required>
</div>
<div>
<label class="block mb-1">Icon (FontAwesome CSS-Klasse)</label>
<input type="text" name="icon_class" class="p-2 border rounded w-full" placeholder="z.B. fas fa-user">
</div>
<button type="submit" class="bg-green-500 text-white py-2 px-4 rounded hover:bg-green-600">
Hinzufügen
</button>
</div>
<div>
<label class="block mb-1 font-medium">Titel:</label>
<input type="text" name="title" required class="w-full p-3 rounded border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-400" />
</div>
<div>
<label class="block mb-1 font-medium">URL:</label>
<input type="text" name="url" required class="w-full p-3 rounded border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-400" />
</div>
<div>
<label class="block mb-1 font-medium">Icon (FontAwesome CSS-Klasse):</label>
<input type="text" name="icon_class" placeholder="z.B. fas fa-user" class="w-full p-3 rounded border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-400" />
</div>
<button type="submit" class="bg-green-600 hover:bg-green-700 text-white px-6 py-3 rounded shadow transition duration-200">
Hinzufügen
</button>
</form>
<!-- Tabelle der vorhandenen Bookmarks -->
<ul class="mt-4 space-y-2">
{% if single_user and bookmarks %}
<p class="mt-6 mb-4 font-semibold">Lesezeichen für {{ single_user.username }}:</p>
<ul class="space-y-3">
{% for bm in bookmarks %}
<li class="bg-gray-100 dark:bg-gray-700 p-2 rounded flex justify-between items-center">
<li class="bg-gray-200 dark:bg-gray-800 p-3 rounded flex justify-between items-center">
<div>
<i class="{{ bm.icon_class }} mr-2"></i>
<a href="{{ bm.url }}" target="_blank" class="text-blue-600 hover:underline">{{ bm.title }}</a>
<a href="{{ bm.url }}" target="_blank" class="text-blue-500 hover:underline">
{{ bm.title }}
</a>
</div>
<form method="POST" action="{{ url_for('delete_bookmark', bookmark_id=bm.id, user_id=single_user.id) }}" onsubmit="return confirm('Lesezeichen wirklich löschen?')">
<button class="text-red-500 hover:text-red-700"><i class="fas fa-trash-alt"></i></button>
<form method="POST"
action="{{ url_for('delete_bookmark', bookmark_id=bm.id, user_id=single_user.id) }}"
onsubmit="return confirm('Lesezeichen wirklich löschen?')">
<button class="text-red-500 hover:text-red-700 transition duration-200">
<i class="fas fa-trash-alt"></i>
</button>
</form>
</li>
{% endfor %}
</ul>
{% else %}
<p class="text-sm text-gray-400 mt-6">Wähle oben in der Benutzerverwaltung „Lesezeichen“ für einen Nutzer aus, um konkrete Einträge zu sehen.</p>
{% endif %}
</div>
{% endif %}
</div> <!-- Grid Ende -->
<a href="{{ url_for('dashboard') }}" class="inline-block bg-blue-500 text-white px-4 py-2 rounded hover:bg-blue-600">
Zurück zum Dashboard
</a>
<a href="{{ url_for('dashboard') }}"
class="inline-block bg-blue-500 hover:bg-blue-600 text-white px-6 py-3 rounded shadow transition duration-200 mt-8">
Zurück zum Dashboard
</a>
</div>
{% endblock content %}

View File

@@ -5,12 +5,12 @@
<meta charset="UTF-8">
<title>{% block title %}Meine App{% endblock %}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Tailwind + FontAwesome + GSAP -->
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.9.1/gsap.min.js"></script>
<!-- Dark-Mode-Einstellung -->
<script>
tailwind.config = {
@@ -37,7 +37,7 @@
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.2);
border-radius: 10px;
border-radius: 15px !important;
}
.dark .glassmorphism {
background: rgba(0, 0, 0, 0.2);
@@ -66,9 +66,9 @@
</style>
</head>
<body class="min-h-screen bg-gray-100 dark:bg-gray-900 text-gray-800 dark:text-gray-100 transition-colors duration-300"
style="background-image: url('{{ url_for('static', filename='1.png') }}');">
style="background-image: url('{{ WALLPAPER_URL }}');">
{% block content %}{% endblock %}
{% block content %}{% endblock content %}
<script>
// Dark Mode init
@@ -79,4 +79,4 @@
</script>
</body>
</html>
</html>

View File

@@ -24,15 +24,15 @@
<!-- Websuche: ohne Input-BG/Border -->
<div class="glassmorphism p-4 shadow-lg mb-6 w-full max-w-lg">
<form id="searchForm" style="background-color: transparent !important;" class="flex flex-col sm:flex-row items-center justify-center">
<input type="text" style="background-color: transparent !important;" id="searchInput" placeholder="Suche..."
<form id="searchForm" style="background-color: transparent !important; padding-bottom: 2px;" class="flex flex-col sm:flex-row items-center justify-center">
<input type="text" style="background-color: transparent !important; padding-bottom: 2px !important;" id="searchInput" placeholder="Suche..."
class="flex-grow bg-transparent border-0 outline-none placeholder-gray-500 text-gray-800
dark:placeholder-gray-300" />
<select id="searchEngine" style="background-color: transparent !important;" class="bg-transparent border-0 outline-none text-gray-800 dark:text-white ml-2">
<select id="searchEngine" style="background-color: transparent !important; padding-bottom: 2px !important;" class="bg-transparent border-0 outline-none text-gray-800 dark:text-white ml-2">
<option value="qwant">Qwant</option>
<option value="google">Google</option>
</select>
<button type="submit" class="bg-green-500 text-white px-4 py-2 rounded hover:bg-green-600 ml-2">
<button type="submit" class="bg-green-500 text-white px-2 py-2 rounded hover:bg-green-600 ml-2">
Los
</button>
</form>
@@ -41,9 +41,9 @@
<!-- Flash-Messages -->
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
<div class="mb-4 w-full max-w-lg">
<div class="mb-4 w-full max-w-lg ">
{% for category, message in messages %}
<div class="alert flex items-center bg-{{ category }}-500 text-white text-sm font-bold px-4 py-3 mb-2"
<div style="border-radius: 15px !important;" class="alert flex items-center bg-{{ category }}-500 text-white text-sm font-bold px-4 py-3 mb-2"
role="alert">
<p>{{ message }}</p>
<svg class="fill-current h-6 w-6 text-white ml-auto close-flash" role="button"
@@ -68,12 +68,21 @@
<h2 class="text-lg font-semibold mb-2">Benachrichtigungen</h2>
{% if notifications %}
<ul class="space-y-2 max-h-56 overflow-auto">
{% for note in notifications %}
<li class="bg-gray-100 dark:bg-gray-700 p-2 rounded">
{{ note.message }}<br>
<span class="text-xs text-gray-500">{{ note.created_at }}</span>
</li>
{% endfor %}
{% for note in notifications %}
<li class="bg-gray-100 dark:bg-gray-700 p-2 rounded flex justify-between items-center">
<div>
{{ note.message }}<br>
<span class="text-xs text-gray-500">{{ note.created_at }}</span>
</div>
<form method="POST" action="{{ url_for('delete_notification', notif_id=note.id) }}"
onsubmit="return confirm('Benachrichtigung wirklich löschen?')"
class="inline">
<button class="text-red-500 hover:text-red-700 text-sm ml-2" title="Benachrichtigung löschen">
<i class="fas fa-times"></i>
</button>
</form>
</li>
{% endfor %}
</ul>
{% else %}
<p class="text-sm">Keine neuen Benachrichtigungen</p>
@@ -85,7 +94,7 @@
<h2 class="text-lg font-semibold mb-2">Zeiterfassung</h2>
<form action="{{ url_for('time_tracking') }}" method="POST"
class="mb-4 flex flex-col sm:flex-row items-center">
<input type="text" name="activity" placeholder="Aktivität"
<input type="text" name="activity" style="border-bottom: solid rgb(240, 222, 222) !important; border-top: none !important; border-left: none !important; border-right: none !important; background-color: transparent !important;" placeholder="Aktivität"
class="p-2 border rounded mb-2 sm:mb-0 sm:mr-2 flex-1 text-gray-800" />
<button type="submit" name="action" value="start"
class="bg-green-500 text-white px-4 py-2 rounded hover:bg-green-600 mr-2">