Files
Inventarsystem/Web/templates/library_item_invoices.html
Aiirondev_dev e71567db11
Release Inventarsystem / release-docker (push) Successful in 2m26s
changes toi the darkmode style to have iot be a better edesign
2026-09-14 10:54:19 +02:00

309 lines
8.5 KiB
HTML

{% extends "base.html" %}
{% block title %}Rechnungs- & Schadenshistorie - {{ APP_VERSION }}{% endblock %}
{% block content %}
<style>
.invoice-history-shell {
max-width: 1180px;
margin: 0 auto;
padding: 20px;
}
.invoice-history-head {
background: linear-gradient(135deg, #ffffff 0%, #f7f9fc 100%);
border: 1px solid #dbe4ee;
border-radius: 16px;
padding: 18px 20px;
margin-bottom: 16px;
box-shadow: 0 10px 26px rgba(15, 23, 42, 0.07);
}
.invoice-history-head h1 {
margin: 0 0 6px 0;
font-size: 1.55rem;
}
.head-meta {
display: flex;
flex-wrap: wrap;
gap: 16px;
color: #4b5563;
font-size: 0.95rem;
margin-bottom: 12px;
}
.head-actions {
display: flex;
gap: 10px;
flex-wrap: wrap;
}
.section-header {
font-size: 1.25rem;
font-weight: 700;
color: #1e293b;
margin: 36px 0 16px 0;
padding-left: 4px;
}
.invoice-card {
background: var(--ui-surface);
border: 1px solid #e2e8f0;
border-radius: 16px;
padding: 18px;
box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}
.invoice-table {
width: 100%;
border-collapse: collapse;
}
.invoice-table th,
.invoice-table td {
padding: 12px 10px;
border-bottom: 1px solid #edf2f7;
vertical-align: top;
text-align: left;
}
.invoice-table th {
font-size: 0.83rem;
text-transform: uppercase;
letter-spacing: 0.04em;
color: #64748b;
background: var(--ui-surface-soft);
}
.invoice-table tr:hover td {
background: #fbfdff;
}
.badge-pill {
display: inline-flex;
align-items: center;
padding: 4px 10px;
border-radius: 999px;
font-size: 0.78rem;
font-weight: 700;
line-height: 1;
}
.badge-open { background: #fee2e2; color: #991b1b; }
.badge-paid { background: #dcfce7; color: #166534; }
.badge-active { background: #dbeafe; color: #1d4ed8; }
.badge-completed { background: #dcfce7; color: #166534; }
.badge-planned { background: #fef3c7; color: #b45309; }
.mono {
font-family: monospace;
font-size: 0.92rem;
}
.muted {
color: #6b7280;
font-size: 0.9rem;
}
.empty-state {
text-align: center;
color: #6b7280;
padding: 36px 20px;
}
:root[data-theme="dark"] .invoice-history-head {
background: linear-gradient(135deg, #172554 0%, #1e293b 100%);
border-color: var(--ui-border);
box-shadow: var(--ui-shadow-md);
}
:root[data-theme="dark"] .head-meta,
:root[data-theme="dark"] .muted,
:root[data-theme="dark"] .empty-state {
color: var(--ui-text-muted) !important;
}
:root[data-theme="dark"] .section-header {
color: var(--ui-title) !important;
}
:root[data-theme="dark"] .invoice-card {
background: var(--ui-surface) !important;
color: var(--ui-text) !important;
border-color: var(--ui-border) !important;
box-shadow: var(--ui-shadow-sm);
}
:root[data-theme="dark"] .invoice-table,
:root[data-theme="dark"] .invoice-table td {
background: var(--ui-surface) !important;
color: var(--ui-text) !important;
border-color: var(--ui-border) !important;
}
:root[data-theme="dark"] .invoice-table th {
background: var(--ui-surface-soft) !important;
color: var(--ui-text-muted) !important;
border-color: var(--ui-border) !important;
}
:root[data-theme="dark"] .invoice-table tr:hover td {
background: var(--ui-bg-accent) !important;
}
:root[data-theme="dark"] .badge-open {
background: #451a1a;
color: #fecaca;
}
:root[data-theme="dark"] .badge-paid,
:root[data-theme="dark"] .badge-completed {
background: #123524;
color: #b7f7ce;
}
:root[data-theme="dark"] .badge-active {
background: #172554;
color: #bfdbfe;
}
:root[data-theme="dark"] .badge-planned {
background: #422006;
color: #fde68a;
}
@media (max-width: 900px) {
.invoice-history-shell {
padding-left: 10px;
padding-right: 10px;
}
.invoice-table {
display: block;
overflow-x: auto;
white-space: nowrap;
}
}
</style>
<div class="invoice-history-shell">
<div class="invoice-history-head">
<h1>Rechnungs- & Schadenshistorie pro Element</h1>
<div class="head-meta">
<span><strong>Element:</strong> {{ item.name or '—' }}</span>
<span><strong>Code:</strong> {{ item.code or '—' }}</span>
<span><strong>Autor:</strong> {{ item.author or '—' }}</span>
<span><strong>ISBN:</strong> {{ item.isbn or '—' }}</span>
</div>
<div class="head-actions">
<a class="btn btn-outline-secondary" href="{{ url_for('library_loans_admin') }}">Zur Bibliotheks-Ausleihenverwaltung</a>
<a class="btn btn-secondary" href="{{ url_for('library_view') }}">Bibliothek öffnen</a>
</div>
</div>
<!-- BEREICH: RECHNUNGEN -->
<h2 class="section-header">Ausgestellte Rechnungen</h2>
<div class="invoice-card">
{% if invoices %}
<table class="invoice-table">
<thead>
<tr>
<th>Rechnung</th>
<th>Betrag</th>
<th>Ausleihe</th>
<th>Status</th>
<th>Schaden / Grund</th>
<th>Aktion</th>
</tr>
</thead>
<tbody>
{% for row in invoices %}
<tr>
<td>
<div class="mono">{{ row.invoice_number or '—' }}</div>
<div class="muted">erstellt {{ row.invoice_created_at or '—' }}</div>
{% if row.invoice_created_by %}<div class="muted">von {{ row.invoice_created_by }}</div>{% endif %}
</td>
<td>{{ row.invoice_amount }}</td>
<td>
<div>{{ row.borrow_user or '—' }}</div>
<div class="muted">{{ row.borrow_start or '' }}{% if row.borrow_end %} bis {{ row.borrow_end }}{% endif %}</div>
{% if row.borrow_status == 'active' %}
<span class="badge-pill badge-active">Aktiv</span>
{% elif row.borrow_status == 'planned' %}
<span class="badge-pill badge-planned">Geplant</span>
{% else %}
<span class="badge-pill badge-completed">Abgeschlossen</span>
{% endif %}
</td>
<td>
{% if row.invoice_paid %}
<span class="badge-pill badge-paid">Bezahlt</span>
{% if row.invoice_paid_at %}<div class="muted">am {{ row.invoice_paid_at }}</div>{% endif %}
{% if row.invoice_paid_by %}<div class="muted">durch {{ row.invoice_paid_by }}</div>{% endif %}
{% else %}
<span class="badge-pill badge-open">Offen</span>
{% endif %}
</td>
<td>
<div class="muted">{{ row.invoice_reason or 'Keine Beschreibung' }}</div>
</td>
<td>
<a class="btn btn-outline-primary btn-sm" href="{{ url_for('admin_view_invoice_pdf', borrow_id=row.borrow_id) }}" target="_blank" rel="noopener">PDF öffnen</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<div class="empty-state">Für dieses Element wurden noch keine Rechnungen gespeichert.</div>
{% endif %}
</div>
<!-- BEREICH: SCHÄDEN -->
<h2 class="section-header">Gemeldete Schäden</h2>
<div class="invoice-card">
{% if damages %}
<table class="invoice-table">
<thead>
<tr>
<th>Datum</th>
<th>Quelle</th>
<th>Nutzer / Verursacher</th>
<th>Beschreibung</th>
<th>Status</th>
</tr>
</thead>
<tbody>
{% for row in damages %}
<tr>
<td>
<div class="muted">{{ row.date }}</div>
</td>
<td>
<div class="mono">{{ row.source }}</div>
{% if row.borrow_id %}
<div class="muted" style="font-size: 0.8rem;">ID: <span title="{{ row.borrow_id }}">{{ row.borrow_id[:6] }}...</span></div>
{% endif %}
</td>
<td>{{ row.user }}</td>
<td>{{ row.description }}</td>
<td>
<!-- Einfache Logik, um bei reparierten Objekten einen grünen Badge zu zeigen -->
{% if row.status|lower in ['repariert', 'erledigt', 'geschlossen', 'bezahlt'] %}
<span class="badge-pill badge-completed">{{ row.status }}</span>
{% else %}
<span class="badge-pill badge-open">{{ row.status }}</span>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<div class="empty-state">Für dieses Element wurden bislang keine Schäden erfasst.</div>
{% endif %}
</div>
</div>
{% endblock %}