Lizenzübersichtsseite
Dieser Commit ist enthalten in:
@@ -100,5 +100,31 @@ def dashboard():
|
||||
|
||||
return render_template("index.html", username=session.get('username'))
|
||||
|
||||
@app.route("/licenses")
|
||||
@login_required
|
||||
def licenses():
|
||||
conn = get_connection()
|
||||
cur = conn.cursor()
|
||||
|
||||
# Alle Lizenzen mit Kundeninformationen abrufen
|
||||
cur.execute("""
|
||||
SELECT l.id, l.license_key, c.name, c.email, l.license_type,
|
||||
l.valid_from, l.valid_until, l.is_active,
|
||||
CASE
|
||||
WHEN l.valid_until < CURRENT_DATE THEN 'abgelaufen'
|
||||
WHEN l.valid_until < CURRENT_DATE + INTERVAL '30 days' THEN 'läuft bald ab'
|
||||
ELSE 'aktiv'
|
||||
END as status
|
||||
FROM licenses l
|
||||
JOIN customers c ON l.customer_id = c.id
|
||||
ORDER BY l.valid_until DESC
|
||||
""")
|
||||
|
||||
licenses = cur.fetchall()
|
||||
cur.close()
|
||||
conn.close()
|
||||
|
||||
return render_template("licenses.html", licenses=licenses, username=session.get('username'))
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run(host="0.0.0.0", port=443, ssl_context='adhoc')
|
||||
|
||||
@@ -17,7 +17,10 @@
|
||||
</nav>
|
||||
|
||||
<div class="container py-5">
|
||||
<h2 class="mb-4">Neue Lizenz erstellen</h2>
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h2>Neue Lizenz erstellen</h2>
|
||||
<a href="/licenses" class="btn btn-secondary">📋 Lizenzübersicht</a>
|
||||
</div>
|
||||
|
||||
<form method="post" action="/" accept-charset="UTF-8">
|
||||
<div class="row g-3">
|
||||
|
||||
95
v2_adminpanel/templates/licenses.html
Normale Datei
95
v2_adminpanel/templates/licenses.html
Normale Datei
@@ -0,0 +1,95 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Lizenzübersicht - Admin Panel</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<style>
|
||||
.status-aktiv { color: #28a745; }
|
||||
.status-ablaufend { color: #ffc107; }
|
||||
.status-abgelaufen { color: #dc3545; }
|
||||
</style>
|
||||
</head>
|
||||
<body class="bg-light">
|
||||
<nav class="navbar navbar-dark bg-dark">
|
||||
<div class="container">
|
||||
<span class="navbar-brand">🎛️ Lizenzverwaltung</span>
|
||||
<div class="d-flex align-items-center">
|
||||
<span class="text-white me-3">Angemeldet als: {{ username }}</span>
|
||||
<a href="/logout" class="btn btn-outline-light btn-sm">Abmelden</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="container py-5">
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h2>Lizenzübersicht</h2>
|
||||
<a href="/" class="btn btn-primary">➕ Neue Lizenz erstellen</a>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Lizenzschlüssel</th>
|
||||
<th>Kunde</th>
|
||||
<th>E-Mail</th>
|
||||
<th>Typ</th>
|
||||
<th>Gültig von</th>
|
||||
<th>Gültig bis</th>
|
||||
<th>Status</th>
|
||||
<th>Aktiv</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for license in licenses %}
|
||||
<tr>
|
||||
<td>{{ license[0] }}</td>
|
||||
<td><code>{{ license[1] }}</code></td>
|
||||
<td>{{ license[2] }}</td>
|
||||
<td>{{ license[3] or '-' }}</td>
|
||||
<td>
|
||||
{% if license[4] == 'full' %}
|
||||
<span class="badge bg-success">Vollversion</span>
|
||||
{% else %}
|
||||
<span class="badge bg-warning">Testversion</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>{{ license[5].strftime('%d.%m.%Y') }}</td>
|
||||
<td>{{ license[6].strftime('%d.%m.%Y') }}</td>
|
||||
<td>
|
||||
{% if license[8] == 'abgelaufen' %}
|
||||
<span class="status-abgelaufen">⚠️ Abgelaufen</span>
|
||||
{% elif license[8] == 'läuft bald ab' %}
|
||||
<span class="status-ablaufend">⏰ Läuft bald ab</span>
|
||||
{% else %}
|
||||
<span class="status-aktiv">✅ Aktiv</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{% if license[7] %}
|
||||
<span class="text-success">✓</span>
|
||||
{% else %}
|
||||
<span class="text-danger">✗</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{% if not licenses %}
|
||||
<div class="text-center py-5">
|
||||
<p class="text-muted">Noch keine Lizenzen vorhanden.</p>
|
||||
<a href="/" class="btn btn-primary">Erste Lizenz erstellen</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
In neuem Issue referenzieren
Einen Benutzer sperren