Mahnungswesen implementierung
Release Inventarsystem / release-docker (push) Successful in 2m14s

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