This commit is contained in:
+195
-226
@@ -1,256 +1,225 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}Mahnungen & Überfällige Ausleihen{% endblock %}
|
||||
{% block title %}Mahnungsübersicht - {{ APP_VERSION }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<style>
|
||||
.mahnungen-shell {
|
||||
max-width: 1180px;
|
||||
margin: 0 auto;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
<!-- ==========================================
|
||||
CSS STYLES
|
||||
========================================== -->
|
||||
<style>
|
||||
:root {
|
||||
--bg-color: #f4f7f6;
|
||||
--text-color: #333;
|
||||
--primary: #4a90e2;
|
||||
--danger: #dc3545;
|
||||
--warning: #ffc107;
|
||||
--info: #0dcaf0;
|
||||
--success: #198754;
|
||||
--border-color: #dee2e6;
|
||||
}
|
||||
.mahnungen-head {
|
||||
background: linear-gradient(135deg, #ffffff 0%, #f7f9fc 100%);
|
||||
border: 1px solid #dbe4ee;
|
||||
border-radius: 16px;
|
||||
padding: 18px 20px;
|
||||
margin-bottom: 20px;
|
||||
box-shadow: 0 10px 26px rgba(15, 23, 42, 0.07);
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
|
||||
background-color: var(--bg-color);
|
||||
color: var(--text-color);
|
||||
margin: 0;
|
||||
padding: 20px;
|
||||
}
|
||||
.mahnungen-head h1 {
|
||||
margin: 0;
|
||||
font-size: 1.55rem;
|
||||
color: #1e293b;
|
||||
}
|
||||
|
||||
.container {
|
||||
width: 100%;
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.head-actions {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.header-bar {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.search-box-wrapper {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.header-bar h2 {
|
||||
margin: 0;
|
||||
color: #2c3e50;
|
||||
}
|
||||
.search-box {
|
||||
width: 100%;
|
||||
max-width: 360px;
|
||||
padding: 10px 14px;
|
||||
border: 1px solid #cbd5e1;
|
||||
border-radius: 8px;
|
||||
font-size: 0.95rem;
|
||||
outline: none;
|
||||
transition: border-color 0.2s, box-shadow 0.2s;
|
||||
}
|
||||
|
||||
/* Suchfeld Styling */
|
||||
.search-box {
|
||||
padding: 10px;
|
||||
width: 100%;
|
||||
max-width: 300px;
|
||||
border: 1px solid var(--border-color);
|
||||
border-radius: 4px;
|
||||
font-size: 1rem;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.search-box:focus {
|
||||
border-color: #3b82f6;
|
||||
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
|
||||
}
|
||||
|
||||
/* Card & Table Styling */
|
||||
.card {
|
||||
background-color: #fff;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 4px 6px rgba(0,0,0,0.05);
|
||||
padding: 20px;
|
||||
overflow-x: auto;
|
||||
}
|
||||
.mahnungen-card {
|
||||
background: var(--ui-surface, #ffffff);
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 16px;
|
||||
padding: 18px;
|
||||
box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
|
||||
}
|
||||
|
||||
.table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
text-align: left;
|
||||
}
|
||||
.mahnungen-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.table th, .table td {
|
||||
padding: 12px 15px;
|
||||
border-bottom: 1px solid var(--border-color);
|
||||
}
|
||||
.mahnungen-table th,
|
||||
.mahnungen-table td {
|
||||
padding: 12px 10px;
|
||||
border-bottom: 1px solid #edf2f7;
|
||||
vertical-align: middle;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.table th {
|
||||
background-color: #f8f9fa;
|
||||
font-weight: 600;
|
||||
color: #495057;
|
||||
}
|
||||
.mahnungen-table th {
|
||||
font-size: 0.83rem;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.04em;
|
||||
color: #64748b;
|
||||
background: var(--ui-surface-soft, #f8fafc);
|
||||
}
|
||||
|
||||
.table tbody tr:hover {
|
||||
background-color: #f8f9fa;
|
||||
}
|
||||
.mahnungen-table tr:hover td {
|
||||
background: #fbfdff;
|
||||
}
|
||||
|
||||
/* Badges */
|
||||
.badge {
|
||||
display: inline-block;
|
||||
padding: 5px 10px;
|
||||
font-size: 0.85em;
|
||||
font-weight: bold;
|
||||
border-radius: 20px;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
}
|
||||
.badge-pill {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 4px 10px;
|
||||
border-radius: 999px;
|
||||
font-size: 0.78rem;
|
||||
font-weight: 700;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.bg-danger { background-color: var(--danger); }
|
||||
.bg-warning { background-color: var(--warning); color: #000; }
|
||||
.bg-info { background-color: var(--info); color: #000; }
|
||||
.bg-success { background-color: var(--success); }
|
||||
.badge-open { background: #fee2e2; color: #991b1b; }
|
||||
.badge-warning { background: #fef3c7; color: #b45309; }
|
||||
.badge-info { background: #e0f2fe; color: #0369a1; }
|
||||
.badge-paid { background: #dcfce7; color: #166534; }
|
||||
|
||||
.text-danger {
|
||||
color: var(--danger);
|
||||
font-weight: bold;
|
||||
}
|
||||
.mono {
|
||||
font-family: monospace;
|
||||
font-size: 0.92rem;
|
||||
}
|
||||
|
||||
/* Buttons */
|
||||
.btn {
|
||||
padding: 10px 15px;
|
||||
border-radius: 4px;
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
color: #fff;
|
||||
background-color: #6c757d;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
transition: background 0.2s;
|
||||
}
|
||||
.text-danger {
|
||||
color: #dc2626;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.btn:hover { background-color: #5a6268; }
|
||||
.empty-state {
|
||||
text-align: center;
|
||||
color: #6b7280;
|
||||
padding: 36px 20px;
|
||||
}
|
||||
|
||||
/* Alert */
|
||||
.alert-success {
|
||||
background-color: #d1e7dd;
|
||||
color: #0f5132;
|
||||
padding: 15px;
|
||||
border-radius: 4px;
|
||||
text-align: center;
|
||||
border: 1px solid #badbcc;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
@media (max-width: 900px) {
|
||||
.mahnungen-table {
|
||||
display: block;
|
||||
overflow-x: auto;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- ==========================================
|
||||
HTML CONTENT (JINJA2)
|
||||
========================================== -->
|
||||
<div class="container">
|
||||
|
||||
<div class="header-bar">
|
||||
<h2>🚨 Mahnungsübersicht</h2>
|
||||
<a href="{{ url_for('library_loans_admin') }}" class="btn">Zurück zur Bibliothek</a>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
{% if overdue_list %}
|
||||
|
||||
<!-- Suchfeld für das JavaScript -->
|
||||
<input type="text" id="searchInput" class="search-box" placeholder="Suche nach Nutzer, Klasse oder Gegenstand..." onkeyup="filterTable()">
|
||||
|
||||
<table class="table" id="mahnungTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Nutzer</th>
|
||||
<th>Klasse</th>
|
||||
<th>Gegenstand</th>
|
||||
<th>Fällig am</th>
|
||||
<th>Tage drüber</th>
|
||||
<th>Mahnstufe</th>
|
||||
<th>Konto-Status</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for item in overdue_list %}
|
||||
<tr>
|
||||
<td><strong>{{ item.user }}</strong></td>
|
||||
<td>{{ item.klasse }}</td>
|
||||
<td>{{ item.item_name }}</td>
|
||||
<td>{{ item.due_date }}</td>
|
||||
<td class="text-danger">{{ item.days_overdue }} Tage</td>
|
||||
|
||||
<td>
|
||||
{% if item.mahnstufe == 2 %}
|
||||
<span class="badge bg-danger">Stufe 2 (Gesperrt)</span>
|
||||
{% elif item.mahnstufe == 1 %}
|
||||
<span class="badge bg-warning">Stufe 1 (Gewarnt)</span>
|
||||
{% else %}
|
||||
<span class="badge bg-info">Stufe 0 (Neu)</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
{% if item.is_blocked %}
|
||||
<span class="badge bg-danger">Gesperrt</span>
|
||||
{% else %}
|
||||
<span class="badge bg-success">Aktiv</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% else %}
|
||||
<div class="alert-success">
|
||||
<strong>Hervorragend!</strong> Aktuell gibt es keine überfälligen Ausleihen im System.
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="mahnungen-shell">
|
||||
<div class="mahnungen-head">
|
||||
<h1>🚨 Mahnungsübersicht</h1>
|
||||
<div class="head-actions">
|
||||
<a class="btn btn-outline-secondary" href="{{ url_for('library_loans_admin') }}">Zur Ausleihenverwaltung</a>
|
||||
<a class="btn btn-secondary" href="{{ url_for('library_view') }}">Bibliothek öffnen</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ==========================================
|
||||
JAVASCRIPT
|
||||
========================================== -->
|
||||
<script>
|
||||
/**
|
||||
* Funktion: filterTable()
|
||||
* Liest die Eingabe aus dem Suchfeld und filtert die Tabellenzeilen live.
|
||||
* Durchsucht Nutzer, Klassen und Gegenstände.
|
||||
*/
|
||||
function filterTable() {
|
||||
// Hole den Wert aus dem Eingabefeld und wandle ihn in Kleinbuchstaben um
|
||||
let input = document.getElementById("searchInput");
|
||||
let filter = input.value.toLowerCase();
|
||||
<div class="mahnungen-card">
|
||||
{% if overdue_list %}
|
||||
<div class="search-box-wrapper">
|
||||
<input type="text" id="searchInput" class="search-box" placeholder="🔍 Suche nach Nutzer, Klasse oder Gegenstand..." onkeyup="filterTable()">
|
||||
</div>
|
||||
|
||||
// Hole die Tabelle und alle Zeilen (tr) aus dem tbody
|
||||
let table = document.getElementById("mahnungTable");
|
||||
let tr = table.getElementsByTagName("tbody")[0].getElementsByTagName("tr");
|
||||
<table class="mahnungen-table" id="mahnungTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Nutzer</th>
|
||||
<th>Klasse</th>
|
||||
<th>Gegenstand</th>
|
||||
<th>Fällig am</th>
|
||||
<th>Tage drüber</th>
|
||||
<th>Mahnstufe</th>
|
||||
<th>Konto-Status</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for item in overdue_list %}
|
||||
<tr>
|
||||
<td><strong>{{ item.user or '—' }}</strong></td>
|
||||
<td>{{ item.klasse or '—' }}</td>
|
||||
<td>{{ item.item_name or '—' }}</td>
|
||||
<td><span class="mono">{{ item.due_date or '—' }}</span></td>
|
||||
<td class="text-danger">{{ item.days_overdue }} Tage</td>
|
||||
<td>
|
||||
{% if item.mahnstufe == 2 %}
|
||||
<span class="badge-pill badge-open">Stufe 2 (Gesperrt)</span>
|
||||
{% elif item.mahnstufe == 1 %}
|
||||
<span class="badge-pill badge-warning">Stufe 1 (Gewarnt)</span>
|
||||
{% else %}
|
||||
<span class="badge-pill badge-info">Stufe 0 (Neu)</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{% if item.is_blocked %}
|
||||
<span class="badge-pill badge-open">Gesperrt</span>
|
||||
{% else %}
|
||||
<span class="badge-pill badge-paid">Aktiv</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% else %}
|
||||
<div class="empty-state">
|
||||
<strong>Hervorragend!</strong> Aktuell gibt es keine überfälligen Ausleihen im System.
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
// Durchlaufe alle Zeilen
|
||||
for (let i = 0; i < tr.length; i++) {
|
||||
// Hole die Zellen für Nutzer (0), Klasse (1) und Gegenstand (2)
|
||||
let tdUser = tr[i].getElementsByTagName("td")[0];
|
||||
let tdClass = tr[i].getElementsByTagName("td")[1];
|
||||
let tdItem = tr[i].getElementsByTagName("td")[2];
|
||||
<script>
|
||||
function filterTable() {
|
||||
const input = document.getElementById("searchInput");
|
||||
const filter = input.value.toLowerCase();
|
||||
const table = document.getElementById("mahnungTable");
|
||||
const tr = table.getElementsByTagName("tbody")[0].getElementsByTagName("tr");
|
||||
|
||||
if (tdUser || tdClass || tdItem) {
|
||||
// Extrahiere den Text
|
||||
let textUser = tdUser.textContent || tdUser.innerText;
|
||||
let textClass = tdClass.textContent || tdClass.innerText;
|
||||
let textItem = tdItem.textContent || tdItem.innerText;
|
||||
for (let i = 0; i < tr.length; i++) {
|
||||
const tdUser = tr[i].getElementsByTagName("td")[0];
|
||||
const tdClass = tr[i].getElementsByTagName("td")[1];
|
||||
const tdItem = tr[i].getElementsByTagName("td")[2];
|
||||
|
||||
// Prüfe, ob der Suchbegriff in einer der drei Spalten vorkommt
|
||||
if (
|
||||
textUser.toLowerCase().indexOf(filter) > -1 ||
|
||||
textClass.toLowerCase().indexOf(filter) > -1 ||
|
||||
textItem.toLowerCase().indexOf(filter) > -1
|
||||
) {
|
||||
tr[i].style.display = ""; // Zeile anzeigen
|
||||
} else {
|
||||
tr[i].style.display = "none"; // Zeile ausblenden
|
||||
}
|
||||
}
|
||||
}
|
||||
if (tdUser || tdClass || tdItem) {
|
||||
const textUser = tdUser.textContent || tdUser.innerText;
|
||||
const textClass = tdClass.textContent || tdClass.innerText;
|
||||
const textItem = tdItem.textContent || tdItem.innerText;
|
||||
|
||||
if (
|
||||
textUser.toLowerCase().indexOf(filter) > -1 ||
|
||||
textClass.toLowerCase().indexOf(filter) > -1 ||
|
||||
textItem.toLowerCase().indexOf(filter) > -1
|
||||
) {
|
||||
tr[i].style.display = "";
|
||||
} else {
|
||||
tr[i].style.display = "none";
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user