Jelajahi Sumber

Implementierung einer neuen Forderungsliste mit verbessertem Layout und interaktiven Filtern

- Hinzufügen von JavaScript für eine schwebende Kopfzeile in der Tabelle
- Umstrukturierung der HTML-Vorlagen für die Forderungsliste und Filter
- Einführung von aktiven Filtern und einer Zusammenfassung der Ergebnisse
- Verbesserung der Benutzeroberfläche durch neue CSS-Klassen und Layout-Anpassungen
- Implementierung von Tests zur Sicherstellung der Funktionalität und Stabilität der neuen Liste
gc-server3 2 minggu lalu
induk
melakukan
6135485984

+ 12 - 0
README.md

@@ -131,3 +131,15 @@ verwendet, E-Mail bleibt leer. Nach dem Deaktivieren von `DEBUG_AUTH` werden die
 nicht mehr akzeptiert. Standardmäßig ist `DEBUG_AUTH=false`; außerhalb der Umgebungen
 nicht mehr akzeptiert. Standardmäßig ist `DEBUG_AUTH=false`; außerhalb der Umgebungen
 `development`, `debug` und `test` verweigert die Anwendung den Start mit aktivem Debug-Login.
 `development`, `debug` und `test` verweigert die Anwendung den Start mit aktivem Debug-Login.
 `COOKIE_SECURE=false` ist nur für lokale HTTP-Tests gedacht; bei HTTPS auf `true` setzen.
 `COOKIE_SECURE=false` ist nur für lokale HTTP-Tests gedacht; bei HTTPS auf `true` setzen.
+
+## Darstellung der Forderungsliste
+
+Die Filter bleiben vollständig sichtbar und sind in Organisation, Kunde und Beleg sowie
+Bearbeitung und Wiedervorlage gegliedert. Beim Scrollen der Seite dockt der Tabellenkopf
+unter der Navigation an; bei schmalen Fenstern lässt sich die Tabelle seitlich verschieben.
+Kommentare und Antragsinformationen werden je Beleg über „Anzeigen“ eingeblendet.
+
+Die Fußleiste zeigt Anzahl und offenen Gesamtbetrag aller gefilterten Treffer, unabhängig
+von den bereits nachgeladenen Zeilen. Aktive Filter lassen sich dort aufklappen.
+Auch ohne Treffer bleiben die Filter bedienbar. Die gemeinsamen Gestaltungsregeln liegen
+in `app.css`, die Ansichten ergänzen `list.css` beziehungsweise `details.css`.

+ 4 - 2
app/routes.py

@@ -219,8 +219,8 @@ def forderungen_liste(request: Request, db: Session = Depends(get_session), limi
         defaults[f.name] = unquote(request.query_params.get(f.name, f.default_value))
         defaults[f.name] = unquote(request.query_params.get(f.name, f.default_value))
         f.current_value = defaults[f.name]
         f.current_value = defaults[f.name]
 
 
-    if len(q_limit) == 0:
-        return None
+    if page > 0 and not q_limit:
+        return HTMLResponse("")
 
 
     template = "base/liste.html"
     template = "base/liste.html"
     if page > 0:
     if page > 0:
@@ -236,6 +236,8 @@ def forderungen_liste(request: Request, db: Session = Depends(get_session), limi
             "defaults": defaults,
             "defaults": defaults,
             "summary": summary,
             "summary": summary,
             "page": page,
             "page": page,
+            "limit": limit,
+            "has_more": (page + 1) * limit < len(q),
             "filter_config": forderung_filter_config,
             "filter_config": forderung_filter_config,
         },
         },
     )
     )

+ 62 - 0
static/assets/css/app.css

@@ -0,0 +1,62 @@
+/* Shared application theme and navigation. CoreUI remains the component base. */
+:root {
+  --gc-header-height: 64px;
+  --gc-context-height: 130px;
+  --gc-brand-header: #c3ccd4;
+  --gc-brand-section: #cdd4da;
+  --gc-brand-border: #b1bcc7;
+  --gc-brand-action: #72889b;
+  --gc-brand-ink: #182630;
+  --gc-brand-mark: #b30808;
+}
+body {
+  --cui-body-font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
+  --cui-heading-font-family: var(--cui-body-font-family);
+  font-family: var(--cui-body-font-family);
+}
+.gc-app-header { font-family: var(--cui-body-font-family); font-size: 1.125rem; }
+.gc-app-header.header {
+  position: sticky;
+  top: 0;
+  z-index: 1030;
+  padding: 0;
+  margin: 0;
+  background: var(--gc-brand-header);
+  border-bottom: 1px solid var(--gc-brand-border);
+  box-shadow: 0 2px 8px #1826300a;
+}
+.gc-app-header .gc-header-inner {
+  display: flex;
+  flex-wrap: wrap;
+  align-items: center;
+  gap: .4rem 1rem;
+  min-height: 64px;
+  padding: .65rem 1.25rem;
+}
+.gc-header-brand { flex: 0 1 180px; min-width: 0; }
+.gc-header-brand img { display: block; width: 100%; max-width: 180px; height: auto; }
+.gc-app-header .header-nav { flex-wrap: wrap; gap: .25rem; }
+.gc-app-header .nav-link { font-size: inherit; color: var(--gc-brand-ink); border-radius: 6px; }
+.gc-app-header .nav-link:hover { background: #ffffff70; }
+.gc-header-account { flex-wrap: wrap; min-width: 0; }
+.gc-header-account span { overflow-wrap: anywhere; }
+.gc-section-title { margin: 0; padding: .8rem 1rem; background: var(--gc-brand-section); border-radius: 9px 9px 0 0; font-size: 1.125rem; font-weight: 700; line-height: 1.5; display: flex; align-items: center; gap: .6rem; font-family: inherit; }
+.gc-section-description { padding: .75rem 1rem 0; margin: 0; font-size: 1.0625rem; color: #52616f; }
+.gc-document-badge { display: inline-flex; justify-content: center; width: 3.25rem; padding: .15rem .5rem; border: 1px solid transparent; border-radius: 5px; font-size: 0.9375rem; font-weight: 700; white-space: nowrap; color: #000; }
+.gc-document-badge--M1 { background: #ffe97e; border-color: #c8af45; }
+.gc-document-badge--M2 { background: #f7d8bf; border-color: #e98751; }
+.gc-document-badge--M3 { background: #f5dddd; border-color: #b30808; }
+.gc-section-title .icon { flex-shrink: 0; width: 1.25rem; height: 1.25rem; font-size: 1.25rem; vertical-align: -.1em; }
+
+html, body { min-height: 100%; background: #f4f6fb; color: #111827; }
+body { overflow-y: auto; }
+.gc-page { flex: 1; width: 100%; max-width: 1840px; margin: 0 auto; padding: 1.25rem; display: flex; flex-direction: column; gap: 1rem; min-height: calc(100vh - 72px); }
+.gc-card { background: #fff; border: 1px solid #dce2e7; border-radius: 10px; box-shadow: 0 2px 6px #18263004; }
+:is(.gc-detail-page, .gc-list-page, .gc-list-summary) :is(a, button, input, select, summary, [tabindex]):focus-visible,
+.gc-app-header :is(a, button):focus-visible { outline: 3px solid #354f63; outline-offset: 3px; }
+@media (max-width: 575.98px) {
+  .gc-app-header .gc-header-inner { padding: .5rem .75rem; gap: .25rem .65rem; }
+  .gc-header-brand { flex-basis: 140px; }
+  .gc-app-header .gc-header-tools { width: 100%; margin-left: 0 !important; }
+  .gc-header-account { flex: 1; justify-content: flex-end; font-size: 1rem; }
+}

+ 1 - 56
static/assets/css/details.css

@@ -1,45 +1,4 @@
-/* Shared navigation; all detail styles are scoped to the detail main element. */
-:root {
-  --gc-header-height: 64px;
-  --gc-context-height: 130px;
-  --gc-brand-header: #c3ccd4;
-  --gc-brand-section: #cdd4da;
-  --gc-brand-border: #b1bcc7;
-  --gc-brand-action: #72889b;
-  --gc-brand-ink: #182630;
-  --gc-brand-mark: #b30808;
-}
-body {
-  --cui-body-font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
-  --cui-heading-font-family: var(--cui-body-font-family);
-  font-family: var(--cui-body-font-family);
-}
-.gc-app-header { font-family: var(--cui-body-font-family); font-size: 1.125rem; }
-.gc-app-header.header {
-  position: sticky;
-  top: 0;
-  z-index: 1030;
-  padding: 0;
-  margin: 0;
-  background: var(--gc-brand-header);
-  border-bottom: 1px solid var(--gc-brand-border);
-  box-shadow: 0 2px 8px #1826300a;
-}
-.gc-app-header .gc-header-inner {
-  display: flex;
-  flex-wrap: wrap;
-  align-items: center;
-  gap: .4rem 1rem;
-  min-height: 64px;
-  padding: .65rem 1.25rem;
-}
-.gc-header-brand { flex: 0 1 180px; min-width: 0; }
-.gc-header-brand img { display: block; width: 100%; max-width: 180px; height: auto; }
-.gc-app-header .header-nav { flex-wrap: wrap; gap: .25rem; }
-.gc-app-header .nav-link { font-size: inherit; color: var(--gc-brand-ink); border-radius: 6px; }
-.gc-app-header .nav-link:hover { background: #ffffff70; }
-.gc-header-account { flex-wrap: wrap; min-width: 0; }
-.gc-header-account span { overflow-wrap: anywhere; }
+/* Invoice detail page. Shared theme rules live in app.css. */
 .gc-page.gc-detail-page {
 .gc-page.gc-detail-page {
   --primary: #526b7e;
   --primary: #526b7e;
   --primary-light: #72889b;
   --primary-light: #72889b;
@@ -83,7 +42,6 @@ body:has(.gc-detail-page) { max-width: 1840px; }
 .gc-case-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 5fr) minmax(0, 4fr); gap: 1.25rem; align-items: start; padding: 0 1.25rem; }
 .gc-case-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 5fr) minmax(0, 4fr); gap: 1.25rem; align-items: start; padding: 0 1.25rem; }
 .gc-case-data, .gc-case-conversation, .gc-case-actions { display: flex; flex-direction: column; gap: 1rem; }
 .gc-case-data, .gc-case-conversation, .gc-case-actions { display: flex; flex-direction: column; gap: 1rem; }
 .gc-detail-card, .gc-detail-page .chat-container { background: #fff; border: 1px solid #dce2e7; border-radius: 10px; box-shadow: 0 2px 6px #18263004; }
 .gc-detail-card, .gc-detail-page .chat-container { background: #fff; border: 1px solid #dce2e7; border-radius: 10px; box-shadow: 0 2px 6px #18263004; }
-.gc-section-title { margin: 0; padding: .8rem 1rem; background: var(--gc-brand-section); border-radius: 9px 9px 0 0; font-size: 1.125rem; font-weight: 700; line-height: 1.5; }
 .gc-data-fields { margin: 0; padding: .4rem 1rem; }
 .gc-data-fields { margin: 0; padding: .4rem 1rem; }
 .gc-data-field { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: .65rem; padding: .5rem 0; border-bottom: 1px solid #edf0f2; font-size: 1.0625rem; line-height: 1.5; }
 .gc-data-field { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: .65rem; padding: .5rem 0; border-bottom: 1px solid #edf0f2; font-size: 1.0625rem; line-height: 1.5; }
 .gc-data-field:last-child { border-bottom: 0; }
 .gc-data-field:last-child { border-bottom: 0; }
@@ -97,8 +55,6 @@ body:has(.gc-detail-page) { max-width: 1840px; }
 .gc-data-more { border-top: 1px solid #edf0f2; }
 .gc-data-more { border-top: 1px solid #edf0f2; }
 .gc-data-more summary { cursor: pointer; padding: .65rem 1rem; font-size: 1rem; font-weight: 600; color: #354f63; }
 .gc-data-more summary { cursor: pointer; padding: .65rem 1rem; font-size: 1rem; font-weight: 600; color: #354f63; }
 .gc-data-more[open] summary { background: #f4f6f8; }
 .gc-data-more[open] summary { background: #f4f6f8; }
-.gc-detail-page :is(a, button, input, select, summary, [tabindex]):focus-visible,
-.gc-app-header :is(a, button):focus-visible { outline: 3px solid #354f63; outline-offset: 3px; }
 .gc-detail-page .btn { white-space: normal !important; border-radius: 6px; font-size: 1.0625rem; padding: .5rem .75rem; }
 .gc-detail-page .btn { white-space: normal !important; border-radius: 6px; font-size: 1.0625rem; padding: .5rem .75rem; }
 /* Dark text on the exact corporate action color meets text contrast requirements. */
 /* Dark text on the exact corporate action color meets text contrast requirements. */
 .gc-detail-page .btn-primary { --cui-btn-bg: #72889b; --cui-btn-border-color: #72889b; --cui-btn-color: #101b24; --cui-btn-hover-bg: #c3ccd4; --cui-btn-hover-color: #101b24; --cui-btn-hover-border-color: #72889b; --cui-btn-active-bg: #b1bcc7; --cui-btn-active-color: #101b24; }
 .gc-detail-page .btn-primary { --cui-btn-bg: #72889b; --cui-btn-border-color: #72889b; --cui-btn-color: #101b24; --cui-btn-hover-bg: #c3ccd4; --cui-btn-hover-color: #101b24; --cui-btn-hover-border-color: #72889b; --cui-btn-active-bg: #b1bcc7; --cui-btn-active-color: #101b24; }
@@ -168,7 +124,6 @@ body:has(.gc-detail-page) { max-width: 1840px; }
 .gc-detail-page .table td { overflow-wrap: anywhere; }
 .gc-detail-page .table td { overflow-wrap: anywhere; }
 .gc-detail-page .table .text-end { white-space: nowrap; font-variant-numeric: tabular-nums; }
 .gc-detail-page .table .text-end { white-space: nowrap; font-variant-numeric: tabular-nums; }
 .gc-case-bookings { margin: 0 1.25rem; }
 .gc-case-bookings { margin: 0 1.25rem; }
-.gc-section-description { padding: .75rem 1rem 0; margin: 0; font-size: 1.0625rem; color: #52616f; }
 .gc-detail-page #bookings-history > p { margin: .75rem 1rem; }
 .gc-detail-page #bookings-history > p { margin: .75rem 1rem; }
 .gc-detail-page [role="status"] { color: #52616f; }
 .gc-detail-page [role="status"] { color: #52616f; }
 /* Keep booking text black, including reminders; only the type badge is colored. */
 /* Keep booking text black, including reminders; only the type badge is colored. */
@@ -176,23 +131,13 @@ body:has(.gc-detail-page) { max-width: 1840px; }
 .gc-detail-page #bookings-history .history-tabs { padding-left: 0; padding-right: 0; margin-bottom: .75rem; }
 .gc-detail-page #bookings-history .history-tabs { padding-left: 0; padding-right: 0; margin-bottom: .75rem; }
 .gc-detail-page #bookings-history .table { --cui-table-color: #000; --cui-table-striped-color: #000; }
 .gc-detail-page #bookings-history .table { --cui-table-color: #000; --cui-table-striped-color: #000; }
 .gc-detail-page #bookings-history .table td { color: #000; }
 .gc-detail-page #bookings-history .table td { color: #000; }
-.gc-document-badge { display: inline-flex; justify-content: center; width: 3.25rem; padding: .15rem .5rem; border: 1px solid transparent; border-radius: 5px; font-size: 0.9375rem; font-weight: 700; white-space: nowrap; color: #000; }
-.gc-document-badge--M1 { background: #ffe97e; border-color: #c8af45; }
-.gc-document-badge--M2 { background: #f7d8bf; border-color: #e98751; }
-.gc-document-badge--M3 { background: #f5dddd; border-color: #b30808; }
 .gc-detail-page .gc-files-table { --cui-table-bg: #fff; }
 .gc-detail-page .gc-files-table { --cui-table-bg: #fff; }
 .gc-detail-page .gc-files-table :is(th, td) { background: #fff; box-shadow: none; }
 .gc-detail-page .gc-files-table :is(th, td) { background: #fff; box-shadow: none; }
-.gc-section-title { display: flex; align-items: center; gap: .6rem; font-family: inherit; }
-.gc-section-title .icon { flex-shrink: 0; width: 1.25rem; height: 1.25rem; font-size: 1.25rem; vertical-align: -.1em; }
 @media (max-width: 1199.98px) {
 @media (max-width: 1199.98px) {
   .gc-case-grid { grid-template-columns: minmax(0, 1fr); }
   .gc-case-grid { grid-template-columns: minmax(0, 1fr); }
   .gc-detail-page .chat-container { height: 38rem; }
   .gc-detail-page .chat-container { height: 38rem; }
 }
 }
 @media (max-width: 575.98px) {
 @media (max-width: 575.98px) {
-  .gc-app-header .gc-header-inner { padding: .5rem .75rem; gap: .25rem .65rem; }
-  .gc-header-brand { flex-basis: 140px; }
-  .gc-app-header .gc-header-tools { width: 100%; margin-left: 0 !important; }
-  .gc-header-account { flex: 1; justify-content: flex-end; font-size: 1rem; }
   .gc-case-context { padding: .65rem .75rem; gap: .5rem; }
   .gc-case-context { padding: .65rem .75rem; gap: .5rem; }
   .gc-context-heading { flex-basis: 100%; }
   .gc-context-heading { flex-basis: 100%; }
   .gc-context-heading h1 { font-size: 1.25rem; }
   .gc-context-heading h1 { font-size: 1.25rem; }

+ 87 - 0
static/assets/css/list.css

@@ -0,0 +1,87 @@
+/* All list components are scoped; the document, not the table, scrolls vertically. */
+:root { --gc-summary-height: 0px; }
+body:has(.gc-list-page) { max-width: 1840px; }
+.gc-list-page { font-size: 1.0625rem; color: var(--gc-brand-ink); padding-bottom: calc(var(--gc-summary-height) + 1.5rem); gap: 1.25rem; }
+.gc-list-page * { min-width: 0; }
+.gc-list-page h1 { font-size: 1.75rem; font-weight: 700; margin: 0; }
+.gc-list-filter-content { padding: 1rem; }
+.gc-list-filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; }
+.gc-filter-group { margin: 0; padding: 0; border: 0; }
+.gc-filter-group + .gc-filter-group { padding-left: 1.25rem; border-left: 1px solid #dce2e7; }
+.gc-filter-group legend { float: none; width: auto; font-size: 1rem; font-weight: 600; margin: 0 0 .75rem; }
+.gc-filter-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
+.gc-filter-field label { display: block; font-size: 1rem; color: #52616f; margin-bottom: .3rem; }
+.gc-list-page :is(.form-control, .form-select) { font-size: 1.0625rem; min-height: 42px; border-color: #b1bcc7; border-radius: 6px; }
+.gc-list-page :is(.form-control, .form-select):focus { border-color: #526b7e; box-shadow: 0 0 0 3px #72889b33; }
+.gc-list-page input[type="date"]::-webkit-datetime-edit-year-field,
+.gc-list-page input[type="date"]::-webkit-datetime-edit-month-field,
+.gc-list-page input[type="date"]::-webkit-datetime-edit-day-field,
+.gc-list-page input[type="date"]::-webkit-datetime-edit-text { color: var(--gc-brand-ink); }
+.gc-list-table-region { position: relative; }
+.gc-list-table-scroll { position: relative; overflow-x: auto; max-width: 100%; border-radius: 0 0 9px 9px; }
+.gc-list-table { width: 100%; min-width: 1560px; border-collapse: separate; border-spacing: 0; font-size: 1.0625rem; margin: 0; table-layout: fixed; color: #111; }
+.gc-list-table :is(th, td) { padding: .8rem .75rem; vertical-align: top; overflow-wrap: anywhere; }
+.gc-list-table thead { position: static; }
+/* A visually hidden bottom caption extends the scroll height by one pixel. */
+.gc-list-table caption { caption-side: top; }
+.gc-list-table th { background: var(--gc-brand-action); color: #101b24; font-size: 1rem; font-weight: 700; border-bottom: 1px solid #526b7e; line-height: 1.45; hyphens: auto; }
+.gc-list-table tbody td { background: #fff; border-bottom: 1px solid #e5e9ed; line-height: 1.5; }
+.gc-list-table .gc-invoice-row:hover td { background: #f6f8fa; }
+.gc-list-table th:nth-child(1) { width: 8%; }
+.gc-list-table th:nth-child(2) { width: 9%; }
+.gc-list-table th:nth-child(3) { width: 10%; }
+.gc-list-table th:nth-child(4) { width: 10%; }
+.gc-list-table th:nth-child(5) { width: 15%; }
+.gc-list-table th:nth-child(6) { width: 11%; }
+.gc-list-table th:nth-child(7) { width: 8%; }
+.gc-list-table th:nth-child(8) { width: 7%; }
+.gc-list-table th:nth-child(9) { width: 9%; }
+.gc-list-table th:nth-child(10) { width: 9%; }
+.gc-list-table th:nth-child(11) { width: 4%; }
+.gc-list-page a { color: #354f63; text-underline-offset: .15em; }
+.gc-list-page .gc-title { font-weight: 600; }
+.gc-list-page .gc-subtitle { margin-top: .3rem; font-size: 1rem; color: #52616f; line-height: 1.5; }
+.gc-list-page .gc-money, .gc-list-summary strong { font-variant-numeric: tabular-nums; white-space: nowrap; }
+.gc-list-table td:nth-child(6) > .gc-money { font-weight: 700; }
+.gc-list-table td:nth-child(6) .gc-subtitle { font-variant-numeric: tabular-nums; }
+.gc-list-badge { display: inline-flex; align-items: center; justify-content: center; padding: .15rem .5rem; border: 1px solid #b1bcc7; border-radius: 5px; font-size: .9375rem; font-weight: 600; color: #182630; white-space: nowrap; }
+.gc-list-badge-info { background: #edf2f5; }
+.gc-list-badge-warning, .gc-list-badge-1 { background: #fff3bd; border-color: #c8af45; }
+.gc-list-badge-2 { background: #f5dddd; border-color: #b30808; }
+.gc-list-badge-0 { background: #e6eedc; border-color: #92aa78; }
+.gc-list-page .btn { font-size: 1rem; border-radius: 6px; }
+.gc-list-page .gc-comment-toggle { display: inline-flex; align-items: center; gap: .4rem; border: 1px solid #b1bcc7; background: #fff; color: #354f63; padding: .4rem .5rem; }
+.gc-comment-toggle[aria-expanded="true"] { background: #e6edf2; }
+.gc-list-page .gc-action-btn { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 8px; background: #fff; color: #354f63; border: 1px solid #72889b; }
+.gc-list-page .gc-action-btn:hover { background: #c7dee7; }
+.gc-list-page .gc-action-btn .icon { font-size: 18px; width: 18px; height: 18px; }
+.gc-list-page .gc-comment-row > td { background: #f6f8fa; padding: 1rem; }
+.gc-row-comments { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
+.gc-row-comments section { background: #fff; border: 1px solid #dce2e7; border-radius: 6px; padding: .85rem 1rem; }
+.gc-row-comments h3 { font-size: 1.125rem; margin: 0 0 .5rem; font-weight: 600; }
+.gc-row-comments p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
+.gc-list-empty { padding: 2rem !important; text-align: center; color: #52616f; }
+.gc-list-load td { padding: .5rem; text-align: center; color: #52616f; font-size: 1rem; }
+.gc-floating-table-head { position: fixed; z-index: 1020; overflow: hidden; pointer-events: none; box-shadow: 0 3px 7px #18263018; }
+.gc-floating-table-head .gc-list-table { min-width: 0; }
+.gc-list-summary { position: fixed; bottom: 0; left: 0; right: 0; z-index: 1025; background: #edf1f4; border-top: 1px solid #b1bcc7; color: #182630; font-size: 1rem; box-shadow: 0 -2px 8px #18263008; }
+.gc-summary-inner { width: calc(100% - 1.5rem); max-width: 1816px; margin: auto; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem 1.5rem; padding: .8rem 1.25rem; }
+.gc-summary-inner > div { display: flex; gap: .65rem; align-items: baseline; }
+.gc-summary-total strong { font-size: 1.125rem; }
+.gc-active-filters summary { cursor: pointer; font-weight: 600; }
+.gc-active-filter-panel { position: absolute; bottom: calc(100% + .5rem); left: max(1rem, calc((100% - 1800px) / 2)); width: min(32rem, calc(100% - 2rem)); max-height: min(40vh, 20rem); overflow-y: auto; padding: 1rem; background: #fff; border: 1px solid #b1bcc7; border-radius: 8px; box-shadow: 0 4px 18px #18263020; }
+.gc-active-filter-panel > div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); gap: .75rem; padding: .4rem 0; overflow-wrap: anywhere; }
+.gc-active-filter-panel a { color: #354f63; }
+@media (max-width: 1199.98px) {
+  .gc-list-filters { grid-template-columns: 1fr; }
+  .gc-filter-group + .gc-filter-group { padding: 1rem 0 0; border-left: 0; border-top: 1px solid #dce2e7; }
+  .gc-filter-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
+}
+@media (max-width: 575.98px) {
+  .gc-list-page { padding: 1rem .5rem calc(var(--gc-summary-height) + 1rem); }
+  .gc-list-filter-content { padding: .75rem; }
+  .gc-filter-fields { grid-template-columns: minmax(0, 1fr); }
+  .gc-summary-inner { padding: .6rem .75rem; gap: .5rem; font-size: .9375rem; }
+  .gc-summary-total { flex: 1 1 100%; justify-content: space-between; }
+  .gc-row-comments { grid-template-columns: minmax(0, 1fr); }
+}

+ 0 - 561
static/assets/css/redesign.css

@@ -1,561 +0,0 @@
-:root {
-    --gc-bg: #f4f6fb;
-    --gc-surface: #ffffff;
-    --gc-surface-soft: #f8fafc;
-    --gc-border: #e5e7eb;
-    --gc-text: #111827;
-    --gc-muted: #6b7280;
-    --gc-primary: #475569;
-    --gc-primary-dark: #334155;
-    --gc-primary-soft: #eef2f7;
-    --gc-danger: #dc2626;
-    --gc-warning: #d97706;
-    --gc-success: #16a34a;
-    --gc-radius-sm: 10px;
-    --gc-radius-md: 16px;
-    --gc-radius-lg: 22px;
-    --gc-shadow-sm: 0 4px 14px rgba(15, 23, 42, .06);
-    --gc-shadow-md: 0 18px 45px rgba(15, 23, 42, .10);
-    --gc-topbar-height: 72px;
-  }
-  
-  /* Basis */
-  
-  html,
-  body {
-    min-height: 100%;
-    background: var(--gc-bg);
-    color: var(--gc-text);
-  }
-  
-  body {
-    overflow-y: auto;
-    overflow-x: auto;
-    font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
-  }
-  
-  /* App Shell */
-  
-  .gc-shell {
-    height: 100vh;
-    display: flex;
-    flex-direction: column;
-    background:
-      radial-gradient(circle at top left, rgba(100, 116, 139, .10), transparent 34rem),
-      linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
-  }
-  
-  .gc-topbar {
-    height: var(--gc-topbar-height);
-    flex: 0 0 var(--gc-topbar-height);
-    display: flex;
-    align-items: center;
-    padding: 0 1.5rem;
-    background: rgba(255, 255, 255, .86);
-    backdrop-filter: blur(18px);
-    border-bottom: 1px solid rgba(226, 232, 240, .9);
-    z-index: 1000;
-  }
-  
-  .gc-logo {
-    height: 38px;
-    width: auto;
-    object-fit: contain;
-  }
-  
-  .gc-brand {
-    font-size: 1rem;
-    font-weight: 800;
-    letter-spacing: -.02em;
-    color: var(--gc-text);
-  }
-  
-  .gc-nav-link {
-    display: inline-flex;
-    align-items: center;
-    min-height: 38px;
-    padding: .45rem .8rem;
-    border-radius: 999px;
-    color: var(--gc-muted);
-    font-weight: 700;
-    text-decoration: none;
-    transition: all .18s ease;
-  }
-  
-  .gc-nav-link:hover {
-    color: #334155;
-    background: #eef2f7;
-    text-decoration: none;
-  }
-  
-  .gc-page {
-    flex: 1;
-    width: 100%;
-    max-width: 1840px;
-    margin: 0 auto;
-    padding: 1.25rem;
-    overflow: hidden;
-    display: flex;
-    flex-direction: column;
-    gap: 1rem;
-  }
-  
-  /* Cards */
-  
-  .gc-card {
-    background: rgba(255, 255, 255, .95);
-    border: 1px solid rgba(226, 232, 240, .95);
-    border-radius: var(--gc-radius-lg);
-    box-shadow: var(--gc-shadow-sm);
-  }
-  
-  /* Filter */
-  
-  .gc-filterbar {
-    padding: 1rem;
-  }
-  
-  .gc-filterbar .form-label {
-    font-size: .74rem;
-    font-weight: 800;
-    text-transform: uppercase;
-    color: var(--gc-muted);
-    letter-spacing: .04em;
-  }
-  
-  .gc-filterbar .form-control,
-  .gc-filterbar .form-select {
-    border-radius: 12px;
-    border-color: var(--gc-border);
-    font-weight: 600;
-  }
-  
-  .gc-filterbar .form-control:focus,
-  .gc-filterbar .form-select:focus {
-    border-color: #94a3b8;
-    box-shadow: 0 0 0 .2rem rgba(100, 116, 139, .12);
-  }
-  
-  /* Tabelle */
-  
-  .gc-table-wrap {
-    flex: 1;
-    overflow: auto;
-    border-radius: var(--gc-radius-lg);
-    padding-top: 0 !important;
-  }
-  
-  .gc-table {
-    width: 100%;
-    min-width: 1450px;
-    margin: 0 !important;
-    border-collapse: separate !important;
-    border-spacing: 0 !important;
-    table-layout: auto !important;
-    font-size: .88rem;
-  }
-  
-  .gc-table thead {
-    position: static !important;
-    z-index: auto !important;
-  }
-  
-  .gc-table thead th {
-    position: static !important;
-    top: auto !important;
-    z-index: auto !important;
-    background: #f3f4f6 !important;
-    color: #667085;
-    font-size: .7rem;
-    font-weight: 900;
-    text-transform: uppercase;
-    letter-spacing: .055em;
-    padding: .85rem .8rem !important;
-    border-top: 0 !important;
-    border-bottom: 1px solid #d7dde5 !important;
-    box-shadow: none !important;
-    white-space: nowrap;
-    vertical-align: bottom;
-  }
-  
-  .gc-table tbody td {
-    background: #ffffff;
-    padding: .85rem .8rem !important;
-    border-top: 1px solid #edf2f7;
-    vertical-align: top;
-  }
-  
-  .gc-table tbody tr {
-    transition: background .15s ease;
-  }
-  
-  .gc-table tbody tr:hover td {
-    background: #fafbfc;
-  }
-  
-  /* Spalten */
-  
-  .gc-table th:nth-child(2),
-  .gc-table td:nth-child(2) {
-    width: 120px;
-    white-space: normal !important;
-  }
-  
-  .gc-table th:nth-child(3),
-  .gc-table td:nth-child(3) {
-    padding-left: 14px !important;
-  }
-  
-  .gc-table th:nth-child(8),
-  .gc-table td:nth-child(8),
-  .gc-table td:nth-child(8) *,
-  .gc-table th:nth-child(9),
-  .gc-table td:nth-child(9),
-  .gc-table td:nth-child(9) * {
-    white-space: nowrap !important;
-  }
-  
-  /* Tabellenlinks neutral/grau */
-  
-  .gc-table a {
-    color: #008 !important;
-    text-decoration: none;
-    font-weight: 600;
-  }
-  
-  .gc-table a:hover {
-    color: #1f2937 !important;
-    text-decoration: underline;
-  }
-  
-  /* Typografie */
-  
-  .gc-title {
-    color: var(--gc-text);
-    font-weight: 750;
-    line-height: 1.25;
-  }
-  
-  .gc-subtitle {
-    margin-top: .15rem;
-    color: var(--gc-muted);
-    font-size: .78rem;
-    line-height: 1.35;
-  }
-  
-  .gc-main-cell {
-    min-width: 290px;
-  }
-  
-  .gc-money {
-    font-variant-numeric: tabular-nums;
-    font-weight: 400;
-    white-space: nowrap;
-  }
-  /* Offen / Kunde ges. weiterhin fett */
-.gc-table td:nth-child(8) .gc-money {
-    font-weight: 800 !important;
-  }
-  
-  /* Buttons */
-  
-  .gc-action-btn {
-    border-radius: 10px;
-    font-weight: 700;
-    background: #7b8ea3 !important;
-    border-color: #7b8ea3 !important;
-    color: #ffffff !important;
-    box-shadow: none !important;
-  }
-  
-  .gc-action-btn:hover {
-    background: #66788c !important;
-    border-color: #66788c !important;
-    color: #ffffff !important;
-  }
-  
-  /* Badges */
-  
-  .gc-badge {
-    display: inline-flex;
-    align-items: center;
-    justify-content: center;
-    gap: .3rem;
-    min-height: 24px;
-    padding: .22rem .55rem;
-    border-radius: 999px;
-    font-size: .7rem;
-    font-weight: 800;
-    border: 1px solid transparent;
-    white-space: nowrap;
-  }
-  
-  .gc-badge-info {
-    background: #edf2f7;
-    color: #475569;
-    border-color: #dbe3ee;
-  }
-  
-  .gc-badge-warning, .gc-badge-1 {
-    background: #f6ecd2;
-    color: #8a6a1f;
-    border-color: #ead9a7;
-  }
-  
-  .gc-badge-danger, .gc-badge-2 {
-    background: #fee2e2;
-    color: #991b1b;
-    border-color: #fecaca;
-  }
-  
-  .gc-badge-success, .gc-badge-0 {
-    background: #dcfce7;
-    color: #166534;
-    border-color: #bbf7d0;
-  }
-  
-  /* Mahnstufen */
-  
-  .gc-mahnstufe-1 {
-    background: #fee2e2 !important;
-    color: #991b1b !important;
-    border-color: #fecaca !important;
-  }
-  
-  .gc-mahnstufe-2 {
-    background: #fecaca !important;
-    color: #7f1d1d !important;
-    border-color: #fca5a5 !important;
-  }
-  
-  .gc-mahnstufe-3 {
-    background: #dc2626 !important;
-    color: #ffffff !important;
-    border-color: #991b1b !important;
-  }
-  
-  /* Wiedervorlage */
-  
-  .gc-wv-overdue {
-    background: #fee2e2 !important;
-    color: #991b1b !important;
-    border-color: #fecaca !important;
-  }
-  
-  .gc-wv-today {
-    background: #f6ecd2 !important;
-    color: #8a6a1f !important;
-    border-color: #ead9a7 !important;
-  }
-  
-  .gc-wv-future {
-    background: #dcfce7 !important;
-    color: #166534 !important;
-    border-color: #bbf7d0 !important;
-  }
-  
-  /* Infinite Scroll */
-  
-  .gc-load-sentinel,
-  .gc-load-sentinel td {
-    height: 1px !important;
-    padding: 0 !important;
-    border: 0 !important;
-    background: transparent !important;
-  }
-  
-  @media (max-width: 992px) {
-    body {
-      overflow: auto;
-    }
-  
-    .gc-shell {
-      min-height: 100vh;
-      height: auto;
-    }
-  
-    .gc-page {
-      overflow: visible;
-    }
-  
-    .gc-table-wrap {
-      overflow-x: auto;
-    }
-  }
-  /* =========================================================
-   HAUPTSEITE: SINNVOLLERE SPALTENBREITEN
-========================================================= */
-
-.gc-table {
-    min-width: 1380px;
-  }
-  
-  /* Aktion */
-  .gc-table th:nth-child(12),
-  .gc-table td:nth-child(12) {
-    width: 54px;
-  }
-  
-  /* Filiale / Bereich */
-  .gc-table th:nth-child(1),
-  .gc-table td:nth-child(1) {
-    width: 115px;
-    max-width: 115px;
-    white-space: normal !important;
-  }
-  
-  /* Verursacher */
-  .gc-table th:nth-child(2),
-  .gc-table td:nth-child(2) {
-    width: 145px;
-    min-width: 145px;
-    padding-left: 6px !important;
-  }
-  
-  /* RG-Nr. */
-  .gc-table th:nth-child(3),
-  .gc-table td:nth-child(3) {
-    width: 118px;
-  }
-  
-  /* RG-Datum / Fällig */
-  .gc-table th:nth-child(4),
-  .gc-table td:nth-child(4) {
-    width: 120px;
-  }
-  
-  /* Kunde */
-  .gc-table th:nth-child(5),
-  .gc-table td:nth-child(5) {
-    width: 230px;
-    min-width: 230px;
-    padding-left: 8px !important;
-  }  
-
-  /* offen / Kunde ges. */
-  .gc-table th:nth-child(6),
-  .gc-table td:nth-child(6) {
-    width: 155px;
-  }
-  
-  /* Mahnstufe / Staffel */
-  .gc-table th:nth-child(7),
-  .gc-table td:nth-child(7) {
-    width: 125px;
-  }
-  
-  /* Abw. */
-  .gc-table th:nth-child(8),
-  .gc-table td:nth-child(8) {
-    width: 80px;
-  }
-  
-  /* Kommentar Fibu */
-  .gc-table th:nth-child(9),
-  .gc-table td:nth-child(9) {
-    width: 165px;
-  }
-  
-  /* Kommentar Abteilung */
-  .gc-table th:nth-child(10),
-  .gc-table td:nth-child(10) {
-    width: 165px;
-  }
-  
-  /* Wiedervorlage */
-  .gc-table th:nth-child(11),
-  .gc-table td:nth-child(11) {
-    width: 120px;
-  }
-  
-  /* Abw. wieder im alten Gelb */
-  .gc-table td:nth-child(8) .gc-badge-warning {
-    background: #fef3c7 !important;
-    color: #92400e !important;
-    border-color: #fde68a !important;
-    text-align: left;
-  }
-  /* =========================================================
-   EDIT BUTTON LINKS HELLER
-========================================================= */
-
-.gc-table td:nth-child(12) button,
-.gc-table td:nth-child(12) .btn,
-.gc-table td:nth-child(12) a {
-  width: 34px;
-  height: 34px;
-  border-radius: 12px !important;
-  border: 1px solid #d6dee8 !important;
-
-  background: linear-gradient(
-    180deg,
-    #9db0c2 0%,
-    #879caf 100%
-  ) !important;
-
-  color: #ffffff !important;
-
-  box-shadow:
-    inset 0 1px 0 rgba(255,255,255,.28),
-    0 2px 6px rgba(15,23,42,.08);
-
-  transition: all .18s ease;
-}
-
-/* Hover */
-.gc-table td:nth-child(12) button:hover,
-.gc-table td:nth-child(12) .btn:hover,
-.gc-table td:nth-child(12) a:hover {
-  background: linear-gradient(
-    180deg,
-    #a8b9c9 0%,
-    #92a6b8 100%
-  ) !important;
-
-  transform: translateY(-1px);
-}
-
-/* Icon */
-.gc-table td:nth-child(12) i,
-.gc-table td:nth-child(12) svg {
-  color: #ffffff !important;
-  font-size: .9rem;
-}
-
-  /* =========================================================
-   BUTTONS: KEIN ZEILENUMBRUCH
-========================================================= */
-
-.gc-action-btn,
-.gc-action-btn span,
-.gc-action-btn button,
-.btn {
-  white-space: nowrap !important;
-}
-.btn-warning {
-  background-color: #e80;
-}
-
-/* =========================================================
-   DETAILSEITE: SEITE BEI AUFGEKLAPPTEN BOXEN SCROLLBAR
-========================================================= */
-
-body {
-    overflow-y: auto !important;
-    overflow-x: hidden !important;
-  }
-  
-  .gc-shell {
-    min-height: 100vh !important;
-    height: auto !important;
-  }
-  
-  .gc-page {
-    min-height: calc(100vh - var(--gc-topbar-height)) !important;
-    height: auto !important;
-    overflow: visible !important;
-  }
-  
-.gc-link {
-  color: #008;
-}

+ 101 - 0
static/assets/js/list.js

@@ -0,0 +1,101 @@
+/* A visual header mirror lets the document scroll vertically while the table
+   retains its own horizontal scrollbar. The original header stays semantic. */
+(() => {
+  let currentPage;
+  let dispose = () => {};
+  let refresh = () => {};
+
+  function initList() {
+    const page = document.querySelector('.gc-list-page');
+    if (page === currentPage) {
+      refresh();
+      return;
+    }
+    dispose();
+    currentPage = page;
+    document.documentElement.style.setProperty('--gc-summary-height', '0px');
+    if (!page) return;
+
+    document.querySelectorAll('.gc-floating-table-head').forEach(node => node.remove());
+    const table = page.querySelector('#invoice-list');
+    const scroller = page.querySelector('.gc-list-table-scroll');
+    const header = document.querySelector('.gc-app-header');
+    const footer = document.querySelector('.gc-list-summary');
+    if (!table || !scroller) return;
+
+    const events = new AbortController();
+    const floating = document.createElement('div');
+    floating.className = 'gc-floating-table-head';
+    floating.setAttribute('aria-hidden', 'true');
+    floating.inert = true;
+    floating.hidden = true;
+    const mirror = table.cloneNode(false);
+    mirror.removeAttribute('id');
+    const columns = document.createElement('colgroup');
+    const head = table.tHead.cloneNode(true);
+    head.querySelectorAll('[id]').forEach(node => node.removeAttribute('id'));
+    for (const cell of table.tHead.rows[0].cells) columns.append(document.createElement('col'));
+    mirror.append(columns, head);
+    floating.append(mirror);
+    document.body.append(floating);
+
+    let frame;
+    let needsMeasure = true;
+    const update = () => {
+      frame = undefined;
+      if (!page.isConnected) return;
+      const viewport = scroller.getBoundingClientRect();
+      const bounds = table.getBoundingClientRect();
+      const originalHead = table.tHead.getBoundingClientRect();
+      const top = header?.getBoundingClientRect().bottom || 0;
+      if (needsMeasure) {
+        mirror.style.width = `${bounds.width}px`;
+        [...table.tHead.rows[0].cells].forEach((cell, index) => {
+          columns.children[index].style.width = `${cell.getBoundingClientRect().width}px`;
+        });
+        document.documentElement.style.setProperty('--gc-summary-height', `${footer?.offsetHeight || 0}px`);
+        needsMeasure = false;
+      }
+      floating.style.top = `${top}px`;
+      floating.style.left = `${viewport.left}px`;
+      floating.style.width = `${scroller.clientWidth}px`;
+      mirror.style.transform = `translateX(${-scroller.scrollLeft}px)`;
+      floating.hidden = !(originalHead.top < top && bounds.bottom > top + originalHead.height);
+    };
+    const schedule = (measure = false) => {
+      needsMeasure ||= measure;
+      if (!frame) frame = requestAnimationFrame(update);
+    };
+    refresh = () => schedule(true);
+    const sizes = new ResizeObserver(refresh);
+    for (const node of [table, scroller, header, footer]) if (node) sizes.observe(node);
+    window.addEventListener('scroll', () => schedule(), { passive: true, signal: events.signal });
+    window.addEventListener('resize', refresh, { passive: true, signal: events.signal });
+    scroller.addEventListener('scroll', () => schedule(), { passive: true, signal: events.signal });
+    document.addEventListener('htmx:beforeHistorySave', () => floating.remove(), { signal: events.signal });
+    document.fonts?.ready.then(() => { if (page.isConnected) refresh(); });
+    dispose = () => {
+      events.abort();
+      sizes.disconnect();
+      if (frame) cancelAnimationFrame(frame);
+      floating.remove();
+      refresh = () => {};
+    };
+    refresh();
+  }
+
+  document.addEventListener('click', event => {
+    const button = event.target.closest('[data-gc-comments]');
+    if (!button) return;
+    const row = document.getElementById(button.getAttribute('aria-controls'));
+    if (!row) return;
+    row.hidden = !row.hidden;
+    button.setAttribute('aria-expanded', String(!row.hidden));
+    button.querySelector('span').textContent = row.hidden ? 'Anzeigen' : 'Ausblenden';
+    refresh();
+  });
+  document.addEventListener('DOMContentLoaded', initList);
+  document.addEventListener('htmx:load', initList);
+  document.addEventListener('htmx:historyRestore', () => { currentPage = undefined; initList(); });
+  window.addEventListener('pageshow', initList);
+})();

+ 4 - 23
templates/base/base.html

@@ -24,9 +24,11 @@
   <link href="https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap" rel="stylesheet">
   <link href="https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap" rel="stylesheet">
 
 
   <link href="/static/assets/css/main.css" rel="stylesheet">
   <link href="/static/assets/css/main.css" rel="stylesheet">
-  <link href="/static/assets/css/redesign.css" rel="stylesheet">
+  <link href="/static/assets/css/app.css" rel="stylesheet">
 
 
   <link href="/static/assets/css/details.css" rel="stylesheet">
   <link href="/static/assets/css/details.css" rel="stylesheet">
+  <link href="/static/assets/css/list.css" rel="stylesheet">
+  <script src="/static/assets/js/list.js" defer></script>
   <script src="/static/assets/js/layout.js" defer></script>
   <script src="/static/assets/js/layout.js" defer></script>
 
 
   <!-- Favicon icon -->
   <!-- Favicon icon -->
@@ -67,28 +69,7 @@
   </div>
   </div>
 
 
   {% if summary %}
   {% if summary %}
-  <footer class="footer footer-sticky">
-    <div class="container-fluid">
-      <div class="row mb-3">
-        <div class="col-sm-3">
-          Datensätze: {{ summary.Anzahl }}
-        </div>
-        <div class="col-sm-6">
-          Filter:
-          {% for f in filter_config %}
-
-          {% if f.filter_type != 'hidden' and f.current_value != f.default_value %}
-          {{ f.text }} = '{{ f.current_value }}' |
-          {% endif %}
-
-          {% endfor %}
-        </div>
-        <div class="col-sm-3 text-end">
-          Gesamt: <strong>{{ summary.Beleg_offen|number_format }}</strong>
-        </div>
-      </div>
-    </div>
-  </footer>
+  {% include 'forderungen/liste/summary.html' %}
   {% endif %}
   {% endif %}
 
 
 </body>
 </body>

+ 17 - 62
templates/base/liste.html

@@ -1,66 +1,21 @@
 {% extends "base/base.html" %}
 {% extends "base/base.html" %}
-
+{% block page_class %}gc-list-page{% endblock %}
 {% block content %}
 {% block content %}
-
-
-
-{# =========================================================
-FILTERBEREICH
----------------------------------------------------------
-Oberer Bereich mit:
-- Dropdowns
-- Suchfeldern
-- Datumsfiltern
-- Bereichsfiltern
-========================================================= #}
-<div class="gc-card gc-filterbar">
-
-  {% include 'base/liste_filter.html' %}
-
-</div>
-
-
-
-{# =========================================================
-TABELLEN-CONTAINER
----------------------------------------------------------
-Enthält die komplette Forderungsliste.
-
-Klassen:
-- gc-card → Kartenlayout
-- gc-table-wrap → Scroll-/Tabellencontainer
-========================================================= #}
-<div class="gc-card gc-table-wrap">
-
-  <table class="table gc-table table-hover align-middle">
-
-    {# =====================================================
-    TABELLENKOPF
-    -----------------------------------------------------
-    Enthält:
-    - Spaltenüberschriften
-    - Sticky Header
-    ====================================================== #}
-    <thead>
-
-      {% include 'forderungen/liste/liste_kopfzeile.html' %}
-
-    </thead>
-
-
-    {# =====================================================
-    TABELLENINHALT
-    -----------------------------------------------------
-    Enthält alle Datensätze / Tabellenzeilen
-    ====================================================== #}
-    <tbody>
-
-      {% include 'base/liste_tabelle.html' %}
-
-    </tbody>
-  </table>
-</div>
-
+<h1>Forderungen</h1>
+<section class="gc-card" aria-labelledby="list-filter-title">
+  <h2 class="gc-section-title" id="list-filter-title"><i class="icon cil-filter" aria-hidden="true"></i> Filter</h2>
+  <div class="gc-list-filter-content">{% include 'base/liste_filter.html' %}</div>
+</section>
+<section class="gc-card gc-list-table-region" aria-labelledby="list-table-title">
+  <h2 class="gc-section-title" id="list-table-title"><i class="icon cil-list" aria-hidden="true"></i> Forderungsliste</h2>
+  <div class="gc-list-table-scroll" tabindex="0" role="region" aria-label="Forderungstabelle – horizontal scrollbar">
+    <table class="table gc-list-table" id="invoice-list">
+      <caption class="visually-hidden">Gefilterte Forderungen mit Beleg-, Kunden- und Bearbeitungsinformationen</caption>
+      <thead>{% include 'forderungen/liste/liste_kopfzeile.html' %}</thead>
+      <tbody>{% include 'base/liste_tabelle.html' %}</tbody>
+    </table>
+  </div>
+</section>
 <!-- Modal -->
 <!-- Modal -->
 <div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
 <div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
   <div class="modal-dialog">
   <div class="modal-dialog">
@@ -83,4 +38,4 @@ Klassen:
   </div>
   </div>
 </div>
 </div>
 
 
-{% endblock %}
+{% endblock %}

+ 40 - 33
templates/base/liste_filter.html

@@ -1,37 +1,44 @@
-<form class="row g-3" id="liste-filter"
-      hx-get=""
-      hx-params="*"
-      hx-trigger="change"
-      hx-push-url="true" 
-      hx-swap="innerHTML" 
-      hx-target="body">
-
-  {% for f in filter_config  %}
-  
-  {% if f.filter_type != 'hidden' %}
-  <div class="col-md-{{ f.width }}">
-    <label for="{{ f.name }}" class="form-label">{{ f.text }}</label>
-    {% if f.filter_type == 'select' %}
-    <select id="{{ f.name }}" name="{{ f.name }}" class="form-select">
-        <option value="">-</option>
-      {% for key, value in f.options.items() %}
-        {% if key == f.current_value %}
-        <option value="{{ key }}" selected>{{ value }}</option>
-        {% else %}
-        <option value="{{ key }}">{{ value }}</option>
-        {% endif %}
-      {% endfor %}
-    </select>
-    {% elif f.filter_type == 'date' %}
-    <input type="date" class="form-control" id="{{ f.name }}" name="{{ f.name }}" value="{{ f.current_value|date_format2 }}">
-    {% else %}
-    <input type="text" class="form-control" id="{{ f.name }}" name="{{ f.name }}" value="{{ f.current_value }}">
+{% macro filter_field(f) %}
+<div class="gc-filter-field">
+  <label for="{{ f.name }}">{{ f.text }}</label>
+  {% if f.filter_type == 'select' %}
+  <select id="{{ f.name }}" name="{{ f.name }}" class="form-select">
+    <option value="">Alle</option>
+    {% set selected = namespace(found=false) %}
+    {% for key, value in f.options.items() %}
+      {% set matches = key|string == f.current_value|string %}
+      {% if matches %}{% set selected.found = true %}{% endif %}
+      <option value="{{ key }}"{% if matches %} selected{% endif %}>{{ value }}</option>
+    {% endfor %}
+    {% if f.current_value and not selected.found %}
+    <option value="{{ f.current_value }}" selected>{{ f.current_value }}</option>
     {% endif %}
     {% endif %}
-  </div>
+  </select>
+  {% elif f.filter_type == 'date' %}
+  <input type="date" class="form-control" id="{{ f.name }}" name="{{ f.name }}" value="{{ f.current_value|date_format2 }}">
+  {% else %}
+  <input type="text" class="form-control" id="{{ f.name }}" name="{{ f.name }}" value="{{ f.current_value or '' }}">
   {% endif %}
   {% endif %}
-
+</div>
+{% endmacro %}
+{% set organisation = ['Mandant', 'Filiale', 'Abteilung', 'Verursacher'] %}
+{% set beleg = ['RechnungGutschrift', 'Fahrzeug', 'Kunde', 'Rechnungsnummer', 'RechnungsdatumVon', 'RechnungsdatumBis'] %}
+<form class="gc-list-filters" id="liste-filter" hx-get="/app/forderungen/liste"
+      hx-params="*" hx-trigger="change" hx-push-url="true" hx-swap="innerHTML" hx-target="body">
+  {% for group in ['Organisation', 'Kunde und Beleg', 'Bearbeitung und Wiedervorlage'] %}
+  <fieldset class="gc-filter-group">
+    <legend>{{ group }}</legend>
+    <div class="gc-filter-fields">
+    {% for f in filter_config %}
+      {% if f.filter_type != 'hidden' %}
+        {% if (group == 'Organisation' and f.name in organisation) or
+              (group == 'Kunde und Beleg' and f.name in beleg) or
+              (group == 'Bearbeitung und Wiedervorlage' and f.name not in organisation and f.name not in beleg) %}
+          {{ filter_field(f) }}
+        {% endif %}
+      {% endif %}
+    {% endfor %}
+    </div>
+  </fieldset>
   {% endfor %}
   {% endfor %}
-
 </form>
 </form>
-
-<br>

+ 13 - 7
templates/base/liste_tabelle.html

@@ -1,7 +1,13 @@
-    {% for row in forderungen_liste %}
-      {%include 'forderungen/liste/liste_zeile.html' %}
-    {% endfor %}
-
-    <tr hx-trigger="revealed" hx-swap="outerHTML" hx-get="" hx-vals='{"page" : "{{ page+1 }}"}'>
-
-    </tr>
+{% for row in forderungen_liste %}
+  {% include 'forderungen/liste/liste_zeile.html' %}
+{% else %}
+  {% if page == 0 %}
+  <tr><td colspan="11" class="gc-list-empty" role="status">Keine Forderungen für die gewählten Filter gefunden.</td></tr>
+  {% endif %}
+{% endfor %}
+{% if has_more %}
+<tr class="gc-list-load" hx-trigger="revealed" hx-swap="outerHTML" hx-get="/app/forderungen/liste"
+    hx-include="#liste-filter" hx-vals='{"page": {{ page + 1 }}, "limit": {{ limit }}}' hx-push-url="false">
+  <td colspan="11">Weitere Forderungen werden geladen …</td>
+</tr>
+{% endif %}

+ 13 - 14
templates/forderungen/liste/liste_kopfzeile.html

@@ -1,14 +1,13 @@
-    <tr>
-        <th>Filiale / Abteilung</th>
-        <th>Verursacher</th>
-        <th>RG-Betrag<br>/ RG-Nr.</th>
-        <th>RG-Datum<br>/ Fällig</th>
-        <th>Kunde</th>
-        <th>offen /<br>Kunde ges.</th>
-        <th>Mahnstufe<br>/ Tage offen</th>
-        <th>Abw.</th>
-        <th>Kommentar<br>Fibu</th>
-        <th>Kommentar<br>Abteilung</th>
-        <th>Wieder-<br>vorlage</th>
-        <th></th>
-    </tr>
+<tr>
+  <th scope="col">Filiale / Abteilung</th>
+  <th scope="col">Verursacher</th>
+  <th scope="col">Rechnungs<wbr>betrag / Belegnummer</th>
+  <th scope="col">Rechnungs<wbr>datum / Fälligkeit</th>
+  <th scope="col">Kunde</th>
+  <th scope="col">Offen / Kunde gesamt</th>
+  <th scope="col">Tage offen / Mahnstufe</th>
+  <th scope="col">Abwarten</th>
+  <th scope="col">Kommentare</th>
+  <th scope="col">Wiedervorlage</th>
+  <th scope="col"><span class="visually-hidden">Details öffnen</span></th>
+</tr>

+ 39 - 22
templates/forderungen/liste/liste_zeile.html

@@ -1,4 +1,6 @@
-<tr>
+{% set comments_id = 'row-comments-' ~ (row.Client_DB|string|urlencode) ~ '-' ~ (row.Beleg_Nr|string|urlencode) %}
+{% set has_comments = row.Kommentar_Fibu or row.Kommentar_Abteilung or row.Antrag_Nr %}
+<tr class="gc-invoice-row">
   <td>
   <td>
     <div class="gc-title">{{ row.Standort_Name }}</div>
     <div class="gc-title">{{ row.Standort_Name }}</div>
     <div class="gc-subtitle">{{ row.Abteilung }}</div>
     <div class="gc-subtitle">{{ row.Abteilung }}</div>
@@ -10,14 +12,14 @@
       {{ row.Verursacher_Text }}
       {{ row.Verursacher_Text }}
     </a>
     </a>
     {% if row.Verursacher_Text == '--N.N.' %}
     {% if row.Verursacher_Text == '--N.N.' %}
-    <span class="gc-badge gc-badge-warning ms-1">offen</span>
+    <span class="gc-list-badge gc-list-badge-warning ms-1">offen</span>
     {% endif %}
     {% endif %}
   </td>
   </td>
 
 
   <td class="text-end align-top">
   <td class="text-end align-top">
     <div class="gc-money">{{ row.Beleg_Betrag|number_format }} €</div>
     <div class="gc-money">{{ row.Beleg_Betrag|number_format }} €</div>
-    <a href="#" data-coreui-toggle="modal" data-coreui-target="#exampleModal" onclick='javascript:document.getElementById("invoiceIframe").src="/app/forderungen/files/{{ row.Client_DB }}_{{ row.Beleg_Nr }}";'>
-      <span class="gc-badge gc-badge-info">{{ row.Beleg_Nr }}</span>
+    <a href="#" hx-boost="false" aria-label="Rechnung {{ row.Beleg_Nr }} als PDF öffnen" data-coreui-toggle="modal" data-coreui-target="#exampleModal" onclick='javascript:document.getElementById("invoiceIframe").src="/app/forderungen/files/{{ row.Client_DB }}_{{ row.Beleg_Nr }}";'>
+      <span class="gc-list-badge gc-list-badge-info">{{ row.Beleg_Nr }}</span>
     </a>
     </a>
   </td>
   </td>
 
 
@@ -44,44 +46,59 @@
   </td>
   </td>
 
 
   <td class="text-end">
   <td class="text-end">
+    <div>{{ row.Beleg_Tage_offen }} Tage</div>
     {% set mahnstufe = row.Mahnstufe or '0' %}
     {% set mahnstufe = row.Mahnstufe or '0' %}
 
 
     {% if mahnstufe and mahnstufe|string != '0' %}
     {% if mahnstufe and mahnstufe|string != '0' %}
-    <span class="gc-badge gc-badge-danger gc-mahnstufe-{{ mahnstufe }}">
-      M{{ mahnstufe }}
-    </span>
+    <div class="gc-subtitle">
+      <span class="gc-document-badge gc-document-badge--M{{ mahnstufe }}">M{{ mahnstufe }}</span>
+    </div>
     {% endif %}
     {% endif %}
-    <div class="gc-subtitle">{{ row.Beleg_Tage_offen }} Tage</div>
   </td>
   </td>
 
 
   <td class="text-end">
   <td class="text-end">
     {% if row.Abwarten %}
     {% if row.Abwarten %}
-    <span class="gc-badge gc-badge-warning">{{ row.Abwarten }}</span>
+    <span class="gc-list-badge gc-list-badge-warning">{{ row.Abwarten }}</span>
     {% endif %}
     {% endif %}
   </td>
   </td>
 
 
   <td>
   <td>
-    <div class="gc-subtitle">{{ row.Kommentar_Fibu or '' }}</div>
-  </td>
-
-  <td>
-    {% if row.Antrag_Nr %}
-    <div class="gc-subtitle">{{ row.Antrag_Art }} {{ row.Antrag_Nr }} vom {{ row.Antrag_Datum|date_format }}<br>{{ row.Antrag_Benutzer_ID }}, Status: {{ row.Antrag_Status }}</div>
-    {% else %}
-    <div class="gc-subtitle">{{ row.Kommentar_Abteilung or '' }}</div>
-    {% endif %}
+    {% if has_comments %}
+    <button type="button" class="btn gc-comment-toggle" data-gc-comments aria-expanded="false" aria-controls="{{ comments_id }}">
+      <i class="icon cil-chat-bubble" aria-hidden="true"></i> <span>Anzeigen</span><span class="visually-hidden"> – {{ row.Beleg_Nr }}</span>
+    </button>
+    {% else %}<span class="gc-subtitle">Keine</span>{% endif %}
   </td>
   </td>
 
 
   <td class="text-end">
   <td class="text-end">
     {% if row.Wiedervorlage %}
     {% if row.Wiedervorlage %}
-    <span class="gc-badge gc-badge-{{ row.Wiedervorlage_Stufe }}">{{ row.Wiedervorlage|date_format }}</span>
+    <span class="gc-list-badge gc-list-badge-{{ row.Wiedervorlage_Stufe }}">{{ row.Wiedervorlage|date_format }}</span>
     {% endif %}
     {% endif %}
   </td>
   </td>
 
 
   <td>
   <td>
     <a href="/app/forderungen/details/{{ row.Client_DB }}_{{ row.Beleg_Nr }}"
     <a href="/app/forderungen/details/{{ row.Client_DB }}_{{ row.Beleg_Nr }}"
-      class="btn btn-sm btn-primary gc-action-btn">
-      <i class="icon cil-pencil"></i>
+      class="btn gc-action-btn" aria-label="Details zu Beleg {{ row.Beleg_Nr }} öffnen" title="Details öffnen">
+      <i class="icon cil-magnifying-glass" aria-hidden="true"></i>
     </a>
     </a>
   </td>
   </td>
-</tr>
+</tr>{% if has_comments %}
+<tr class="gc-comment-row" id="{{ comments_id }}" hidden>
+  <td colspan="11">
+    <div class="gc-row-comments">
+      <section aria-label="Finanzbuchhaltung – {{ row.Beleg_Nr }}">
+        <h3>Finanzbuchhaltung</h3>
+        <p>{{ row.Kommentar_Fibu or 'Kein Kommentar vorhanden.' }}</p>
+      </section>
+      <section aria-label="Abteilung – {{ row.Beleg_Nr }}">
+        <h3>Abteilung</h3>
+        {% if row.Antrag_Nr %}
+        <p>{{ row.Antrag_Art }} {{ row.Antrag_Nr }} vom {{ row.Antrag_Datum|date_format }}<br>{{ row.Antrag_Benutzer_ID }}, Status: {{ row.Antrag_Status }}</p>
+        {% else %}
+        <p>{{ row.Kommentar_Abteilung or 'Kein Kommentar vorhanden.' }}</p>
+        {% endif %}
+      </section>
+    </div>
+  </td>
+</tr>
+{% endif %}

+ 27 - 0
templates/forderungen/liste/summary.html

@@ -0,0 +1,27 @@
+{% set active = namespace(filters=[]) %}
+{% for f in filter_config %}
+  {% if f.filter_type != 'hidden' and f.current_value and f.current_value != f.default_value %}
+    {% set active.filters = active.filters + [f] %}
+  {% endif %}
+{% endfor %}
+<footer class="gc-list-summary" aria-label="Zusammenfassung der gefilterten Forderungen">
+  <div class="gc-summary-inner">
+    <div><span>Treffer</span> <strong id="list-count">{{ summary.Anzahl }}</strong></div>
+    <details class="gc-active-filters">
+      <summary>Aktive Filter ({{ active.filters|length }})</summary>
+      <div class="gc-active-filter-panel">
+        {% for f in active.filters %}
+        {% set display = namespace(value=f.current_value) %}
+        {% for key, value in f.options.items() %}
+          {% if key|string == f.current_value|string %}{% set display.value = value %}{% endif %}
+        {% endfor %}
+        <div><strong>{{ f.text }}</strong><span>{{ display.value }}</span></div>
+        {% else %}
+        <p>Keine zusätzlichen Filter aktiv.</p>
+        {% endfor %}
+        <a href="#liste-filter" hx-boost="false">Zu den Filtern ↑</a>
+      </div>
+    </details>
+    <div class="gc-summary-total"><span>Offener Gesamtbetrag</span> <strong>{{ summary.Beleg_offen|number_format }} €</strong></div>
+  </div>
+</footer>

+ 145 - 0
tests/test_forderung_list.py

@@ -0,0 +1,145 @@
+"""List response contracts with an isolated query result (no SQL Server needed)."""
+from collections import namedtuple
+from datetime import date
+from html.parser import HTMLParser
+from types import SimpleNamespace
+import unittest
+
+from fastapi import FastAPI
+from fastapi.testclient import TestClient
+
+from app.db import get_session
+from app.routes import router
+
+
+def invoice(number=0, **changes):
+    data = dict(
+        Client_DB='1', Hauptbetrieb_Name='AHR', Standort_ID='10', Standort_Name='ULM',
+        Abteilung='SC', Verursacher_Text='dki', Rechnung_Gutschrift='Rechnung',
+        Fahrzeug_Nr='V1', Kunde_Text='Musterkunde', Beleg_Nr=f'R{number}',
+        Beleg_Datum=date(2026, 10, 1), Beleg_Faellig_Datum=date(2026, 10, 15),
+        Staffel_Text='> 12 Wochen', Mahnstufe='1', Bearbeitet='N', Abwarten='',
+        Wiedervorlage=date(2026, 11, 1), Wiedervorlage_Stufe='0',
+        Beleg_Betrag=20, Beleg_offen=10, Kunde_offen_gesamt=50, Kunde_gesamt_Bezug='',
+        Besitzer_Kunde_Text='', Kunde_Email='kunde@example.com', Beleg_Tage_offen=28,
+        Kommentar_Fibu='Fibu Kommentar', Kommentar_Abteilung='Abteilung Kommentar',
+        Antrag_Nr='', Antrag_Art='', Antrag_Datum=None, Antrag_Benutzer_ID='', Antrag_Status='',
+    )
+    data.update(changes)
+    return namedtuple('Invoice', data)(**data)
+
+
+class QueryResult:
+    def __init__(self, rows):
+        self.rows = rows
+
+    def keys(self):
+        return invoice()._fields
+
+    def fetchall(self):
+        return self.rows
+
+
+class ListDB:
+    def __init__(self):
+        self.rows = []
+        self.calls = []
+
+    def execute(self, query, values):
+        self.calls.append((str(query), values))
+        return QueryResult(self.rows)
+
+
+class Tags(HTMLParser):
+    def __init__(self, html):
+        super().__init__()
+        self.tags = []
+        self.feed(html)
+
+    def handle_starttag(self, tag, attrs):
+        self.tags.append((tag, dict(attrs)))
+
+
+class ForderungListTests(unittest.TestCase):
+    def setUp(self):
+        self.db = ListDB()
+        self.application = FastAPI()
+        self.application.include_router(router)
+        self.application.dependency_overrides[get_session] = lambda: self.db
+
+        @self.application.middleware('http')
+        async def fixture_principal(request, call_next):
+            request.state.principal = SimpleNamespace(username='tester', name='Tester', role='Buchhaltung', csrf='csrf')
+            return await call_next(request)
+
+        self.client = TestClient(self.application)
+        self.addCleanup(self.client.close)
+
+    def test_empty_first_page_retains_all_filters_and_zero_summary(self):
+        response = self.client.get('/app/forderungen/liste')
+        self.assertEqual(response.status_code, 200)
+        self.assertIn('Keine Forderungen', response.text)
+        self.assertIn('0,00 €', response.text)
+        tags = Tags(response.text).tags
+        fields = [a for t, a in tags if t in ('input', 'select') and a.get('id')]
+        self.assertEqual(len(fields), 16)
+        self.assertIn('id="list-count">0', response.text)
+
+    def test_empty_results_preserve_selected_filter_and_query_parameters(self):
+        response = self.client.get('/app/forderungen/liste?Filiale=10&Kunde=Nichtgefunden')
+        self.assertEqual(response.status_code, 200)
+        self.assertIn('<option value="10" selected>10</option>', response.text)
+        self.assertIn('value="Nichtgefunden"', response.text)
+        sql, params = self.db.calls[-1]
+        self.assertEqual(params['auth_username'], 'tester')
+        self.assertEqual(params['filter_filiale'], '%10%')
+        self.assertEqual(params['filter_kunde'], '%Nichtgefunden%')
+        self.assertIn('F.[Standort_ID] LIKE :filter_filiale', sql)
+
+    def test_summary_uses_all_matches_and_paging_preserves_filter_form(self):
+        self.db.rows = [invoice(n) for n in range(103)]
+        response = self.client.get('/app/forderungen/liste?Filiale=10')
+        self.assertIn('id="list-count">103', response.text)
+        self.assertIn('1.030,00 €', response.text)
+        tags = Tags(response.text).tags
+        rows = [a for t, a in tags if t == 'tr' and a.get('class') == 'gc-invoice-row']
+        self.assertEqual(len(rows), 100)
+        loader = next(a for t, a in tags if a.get('class') == 'gc-list-load')
+        self.assertEqual(loader['hx-include'], '#liste-filter')
+        self.assertIn('"page": 1', loader['hx-vals'])
+
+    def test_last_page_is_a_fragment_and_exhausted_page_is_empty_html(self):
+        self.db.rows = [invoice(n) for n in range(103)]
+        response = self.client.get('/app/forderungen/liste?page=1&Filiale=10')
+        self.assertEqual(response.status_code, 200)
+        self.assertNotIn('<html', response.text)
+        self.assertNotIn('gc-list-load', response.text)
+        self.assertEqual(response.text.count('class="gc-invoice-row"'), 3)
+        self.assertIn('R100', response.text)
+        exhausted = self.client.get('/app/forderungen/liste?page=2&Filiale=10')
+        self.assertEqual(exhausted.status_code, 200)
+        self.assertEqual(exhausted.text, '')
+        self.assertTrue(exhausted.headers['content-type'].startswith('text/html'))
+
+    def test_comments_are_escaped_and_unique_across_tenants(self):
+        self.db.rows = [invoice(1, Kommentar_Fibu='<script>unsafe</script>'), invoice(1, Client_DB='2')]
+        response = self.client.get('/app/forderungen/liste')
+        self.assertIn('&lt;script&gt;unsafe&lt;/script&gt;', response.text)
+        tags = Tags(response.text).tags
+        controls = [a['aria-controls'] for t, a in tags if 'data-gc-comments' in a]
+        self.assertEqual(len(set(controls)), 2)
+        for target in controls:
+            self.assertTrue(any(t == 'tr' and a.get('id') == target and 'hidden' in a for t, a in tags))
+
+    def test_application_information_precedes_department_comment(self):
+        self.db.rows = [invoice(1, Antrag_Nr='A42', Antrag_Art='Antrag', Antrag_Datum=date(2026, 10, 1),
+                                Antrag_Benutzer_ID='dki', Antrag_Status='Offen'),
+                        invoice(2, Kommentar_Fibu='', Kommentar_Abteilung='')]
+        response = self.client.get('/app/forderungen/liste')
+        self.assertIn('Antrag A42', response.text)
+        self.assertNotIn('Abteilung Kommentar', response.text)
+        self.assertEqual(response.text.count('data-gc-comments'), 1)
+
+
+if __name__ == '__main__':
+    unittest.main()