From b4879d615f00cc057d810dc2715ef983bbc34b33 Mon Sep 17 00:00:00 2001 From: rene Date: Sat, 9 May 2026 21:50:27 +0200 Subject: [PATCH] =?UTF-8?q?Feature:=20KI-Berichte=20einzeln=20durchbl?= =?UTF-8?q?=C3=A4ttern=20(=E2=80=B9=20=C3=84lter=20/=20Neuer=20=E2=80=BA),?= =?UTF-8?q?=20Navigation=20per=20Index=20(SW=20by-v809)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/main.py | 2 +- backend/static/index.html | 14 +++++----- backend/static/js/app.js | 2 +- backend/static/js/pages/health.js | 43 +++++++++++++++++++++---------- backend/static/sw.js | 2 +- 5 files changed, 39 insertions(+), 24 deletions(-) diff --git a/backend/main.py b/backend/main.py index b1748e9..31c6cdd 100644 --- a/backend/main.py +++ b/backend/main.py @@ -341,7 +341,7 @@ MEDIA_DIR = os.getenv("MEDIA_DIR", "/data/media") os.makedirs(MEDIA_DIR, exist_ok=True) app.mount("/media", StaticFiles(directory=MEDIA_DIR), name="media") -APP_VER = "808" # muss mit APP_VER in app.js übereinstimmen +APP_VER = "809" # 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 b6933c2..3537837 100644 --- a/backend/static/index.html +++ b/backend/static/index.html @@ -96,9 +96,9 @@ - - - + + + @@ -578,10 +578,10 @@ - - - - + + + + diff --git a/backend/static/js/app.js b/backend/static/js/app.js index bce2f8d..788681e 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 = '808'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen +const APP_VER = '809'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen const APP_VERSION = '1.5.0'; // ← 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/health.js b/backend/static/js/pages/health.js index 07a3f67..91f082f 100644 --- a/backend/static/js/pages/health.js +++ b/backend/static/js/pages/health.js @@ -2346,19 +2346,34 @@ window.Page_health = (() => { ${berichte.length > 1 ? `
${berichte.length} Berichte gespeichert — zum Öffnen tippen
` : ''} `; el.querySelector('.health-ki-bericht-banner').addEventListener('click', () => { - const listeHtml = berichte.map((b, i) => { - const d = b.erstellt_at - ? new Date(b.erstellt_at).toLocaleDateString('de-DE', { day: '2-digit', month: '2-digit', year: 'numeric' }) - : ''; - return `
- ${d ? `
${d}
` : ''} -
${_esc(b.bericht)}
-
`; - }).join(''); - UI.modal.open({ - title: `${UI.icon('star')} KI-Gesundheitsberichte`, - body: listeHtml, - }); + let idx = 0; + const fmtDate = b => b.erstellt_at + ? new Date(b.erstellt_at).toLocaleDateString('de-DE', { day: '2-digit', month: '2-digit', year: 'numeric' }) + : ''; + + function showBericht() { + const b = berichte[idx]; + const nav = berichte.length > 1 ? ` +
+ + ${idx+1} / ${berichte.length} + +
` : ''; + UI.modal.open({ + title: `${UI.icon('star')} KI-Gesundheitsberichte`, + body: `${nav} +
${fmtDate(b)}
+
${_esc(b.bericht)}
`, + }); + } + + window._kiPrev = () => { if (idx < berichte.length - 1) { idx++; showBericht(); } }; + window._kiNext = () => { if (idx > 0) { idx--; showBericht(); } }; + showBericht(); }); } catch (_) { // Silently ignore — Berichte sind optional @@ -2796,7 +2811,7 @@ window.Page_health = (() => { const res = await API.health.kiZusammenfassung(_appState.activeDog.id); const zusammenfassung = res.zusammenfassung ?? res; if (res.save_error) UI.toast.warning(`Speichern fehlgeschlagen: ${res.save_error}`); - else if (res.saved_count !== undefined) UI.toast.info(`${res.saved_count} Bericht(e) gespeichert`); + else if (res.saved_count !== undefined) UI.toast.info(`${res.saved_count} Bericht(e) in DB`, { duration: 8000 }); UI.modal.open({ title: `${UI.icon('star')} KI-Gesundheitsbericht`, body: `
${_esc(zusammenfassung)}
`, diff --git a/backend/static/sw.js b/backend/static/sw.js index 2e8c879..55cca0f 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-v808'; +const CACHE_VERSION = 'by-v809'; 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