Files
dev-manufaktur/Dashboard_V2/templates/admin.html
2025-02-19 21:01:55 +01:00

149 lines
5.0 KiB
HTML

<!-- templates/admin.html -->
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Admin-Bereich</title>
<style>
body {
background-color: black !important;
color: white !important;
font-family: Arial, sans-serif !important;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}
.container {
max-width: 800px;
width: 100%;
padding: 20px;
background-color: #222 !important;
border-radius: 10px !important;
}
.title {
text-align: center;
font-size: 24px !important;
}
.form-group {
margin-bottom: 15px;
}
input, select, button {
width: 100% !important;
padding: 8px !important;
border-radius: 5px !important;
margin-top: 5px !important;
}
button {
background-color: green !important;
color: white !important;
border: none !important;
cursor: pointer;
}
button:hover {
background-color: darkgreen !important;
}
table {
width: 100% !important;
border-collapse: collapse !important;
margin-top: 10px !important;
}
th, td {
padding: 10px !important;
border-bottom: 1px solid gray !important;
text-align: left !important;
}
th {
background-color: #333 !important;
}
.danger-button {
background-color: red !important;
}
.danger-button:hover {
background-color: darkred !important;
}
.link-button {
display: block !important;
background-color: blue !important;
color: white !important;
text-align: center !important;
padding: 10px !important;
border-radius: 5px !important;
margin-top: 20px !important;
text-decoration: none !important;
}
</style>
</head>
<body>
<div class="container">
<h1 class="title">Admin-Bereich</h1>
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
{% for category, message in messages %}
<div style="background-color: {{category}} !important; color: white !important; padding: 10px !important; border-radius: 5px !important; margin-bottom: 10px !important;">
{{ message }}
</div>
{% endfor %}
{% endif %}
{% endwith %}
<div>
<h2>Neuen Benutzer anlegen</h2>
<form method="POST" action="{{ url_for('admin_panel') }}">
<div class="form-group">
<label>Benutzername:</label>
<input type="text" name="new_username" required>
</div>
<div class="form-group">
<label>Passwort:</label>
<input type="password" name="new_password" required>
</div>
<div class="form-group">
<label>
<input type="checkbox" name="new_is_admin"> Als Admin markieren
</label>
</div>
<button type="submit">Erstellen</button>
</form>
</div>
<div>
<h2>Benutzerverwaltung</h2>
<table>
<thead>
<tr>
<th>ID</th>
<th>Username</th>
<th>Admin?</th>
<th>Aktion</th>
</tr>
</thead>
<tbody>
{% for u in users %}
<tr>
<td>{{ u.id }}</td>
<td>{{ u.username }}</td>
<td>{{ 'Ja' if u.is_admin else 'Nein' }}</td>
<td>
{% 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="danger-button">Löschen</button>
</form>
{% else %}
<span style="color: gray !important;">[Eigener Account]</span>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<a href="{{ url_for('dashboard') }}" class="link-button">Zurück zum Dashboard</a>
</div>
</body>
</html>