From 99842909e481989173629a62556bcc56c4e18a5e Mon Sep 17 00:00:00 2001 From: rene Date: Wed, 13 May 2026 16:52:39 +0200 Subject: [PATCH] =?UTF-8?q?Fix:=20Warteliste=20=E2=80=94=20besserer=20Empt?= =?UTF-8?q?y-State,=20Badge-Count=20am=20Button,=20Status-=C3=9Cbersicht?= =?UTF-8?q?=20(SW=20by-v892)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/main.py | 2 +- backend/static/index.html | 8 ++++---- backend/static/js/app.js | 2 +- backend/static/js/pages/litters.js | 33 ++++++++++++++++++++++++++++-- backend/static/sw.js | 2 +- 5 files changed, 38 insertions(+), 9 deletions(-) diff --git a/backend/main.py b/backend/main.py index 4485c8d..6d96fc8 100644 --- a/backend/main.py +++ b/backend/main.py @@ -404,7 +404,7 @@ async def serve_media(path: str, request: _Request): raise _HE(404, "Nicht gefunden.") return _media_response(filepath) -APP_VER = "891" # muss mit APP_VER in app.js übereinstimmen +APP_VER = "892" # muss mit APP_VER in app.js übereinstimmen @app.get("/.well-known/assetlinks.json") async def assetlinks(): diff --git a/backend/static/index.html b/backend/static/index.html index 49a2065..5bbd100 100644 --- a/backend/static/index.html +++ b/backend/static/index.html @@ -583,10 +583,10 @@ - - - - + + + + diff --git a/backend/static/js/app.js b/backend/static/js/app.js index b84cbc0..def8158 100644 --- a/backend/static/js/app.js +++ b/backend/static/js/app.js @@ -3,7 +3,7 @@ Router, State-Management, Navigation, Initialisierung. ============================================================ */ -const APP_VER = '891'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen +const APP_VER = '892'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen const APP_VERSION = '1.5.1'; // ← semantische Version, wird bei make release gesetzt const IS_STAGING = location.hostname === 'staging.banyaro.app'; // Cache-Bust-Parameter nach Update-Reload sofort entfernen diff --git a/backend/static/js/pages/litters.js b/backend/static/js/pages/litters.js index 9675f67..d1f42d7 100644 --- a/backend/static/js/pages/litters.js +++ b/backend/static/js/pages/litters.js @@ -613,17 +613,46 @@ window.Page_litters = (() => { try { const entries = await API.litters.waitlist(litterId); _renderWaitlist(inner, litterId, entries); + // Badge am Button aktualisieren + const btn = document.querySelector(`.litters-waitlist-btn[data-id="${litterId}"]`); + if (btn) { + const active = entries.filter(e => e.status !== 'abgesagt').length; + btn.innerHTML = `${UI.icon('list-bullets')} Warteliste${active ? ` ${active}` : ''}`; + } } catch (err) { inner.innerHTML = `

${_esc(err.message || 'Fehler.')}

`; } } function _renderWaitlist(container, litterId, entries) { + const active = entries.filter(e => e.status !== 'abgesagt'); + const statusCounts = {}; + entries.forEach(e => { statusCounts[e.status] = (statusCounts[e.status] || 0) + 1; }); + + const summaryPills = Object.entries(statusCounts).map(([s, n]) => { + const cfg = _WL_STATUS[s] || _WL_STATUS.anfrage; + return `${cfg.label}: ${n}`; + }).join(''); + + const header = ` +
+
+ ${entries.length} Interessent${entries.length !== 1 ? 'en' : ''} + ${summaryPills} +
+
`; + if (!entries.length) { - container.innerHTML = `

Noch keine Interessenten eingetragen.

`; + container.innerHTML = ` +
+
${UI.icon('users')}
+

Noch keine Interessenten

+

Trage Anfragen ein — mit Wunsch-Geschlecht, Kontaktdaten und Status.

+
`; return; } - container.innerHTML = ` + + container.innerHTML = header + `
${entries.map((e, i) => `
diff --git a/backend/static/sw.js b/backend/static/sw.js index 4b9693e..c73e179 100644 --- a/backend/static/sw.js +++ b/backend/static/sw.js @@ -3,7 +3,7 @@ Offline-Cache + Push Notifications + Tile-Cache ============================================================ */ -const CACHE_VERSION = 'by-v891'; +const CACHE_VERSION = 'by-v892'; const CACHE_STATIC = `${CACHE_VERSION}-static`; const CACHE_TILES = 'ban-yaro-tiles-v1'; // bleibt über SW-Updates erhalten const CACHE_API = 'ban-yaro-api-v1'; // API-Response-Cache