Sprint 14: Multi-Fix-Batch — SW by-v428, APP_VER 407
KI/Symptom-Check: JSON-Code-Fence stripping in ki.py, Dringlichkeit-Map mit Phosphor-Icons
Gewicht-Sync: health.js aktualisiert appState.activeDog.gewicht_kg auch bei Bearbeitung
Giftköder: icon:'check-circle' → UI.icon('check-circle') in emptyState-Call
Forum-Pills: overflow:hidden + text-overflow:ellipsis auf Desktop und Mobile
Moderation: Admins für Moderatoren unsichtbar, keine Aktions-Buttons auf Admins
Notizblock: Filter-Chips wrap 2-zeilig auf Desktop (min-width:1024px)
Tagebuch: Datenschutz-Hinweis "nur du kannst sie sehen", Sitter sieht keine bestehenden Einträge
diary.py: Sitter-Zugriff gibt leere Liste zurück (GET), Erstellen bleibt erlaubt
This commit is contained in:
parent
02120bb532
commit
016eb52d83
12 changed files with 111 additions and 33 deletions
|
|
@ -3,7 +3,7 @@
|
|||
Router, State-Management, Navigation, Initialisierung.
|
||||
============================================================ */
|
||||
|
||||
const APP_VER = '404'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen
|
||||
const APP_VER = '407'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen
|
||||
|
||||
const App = (() => {
|
||||
|
||||
|
|
|
|||
|
|
@ -736,6 +736,19 @@ window.Page_diary = (() => {
|
|||
const listEl = _container.querySelector('#diary-list');
|
||||
if (!listEl) return;
|
||||
|
||||
const dog = _appState.activeDog;
|
||||
const isSitter = dog?.is_guest === true;
|
||||
|
||||
// Sitter: Einträge grundsätzlich ausgeblendet — nur Hinweis + FAB bleibt aktiv
|
||||
if (isSitter) {
|
||||
listEl.innerHTML = UI.emptyState({
|
||||
icon: UI.icon('lock-simple'),
|
||||
title: 'Einträge nicht sichtbar',
|
||||
text: 'Du kannst neue Einträge hinzufügen, aber keine bestehenden Einträge sehen.',
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (_entries.length === 0) {
|
||||
listEl.innerHTML = UI.emptyState({
|
||||
icon: UI.icon('book-open'),
|
||||
|
|
@ -748,6 +761,16 @@ window.Page_diary = (() => {
|
|||
return;
|
||||
}
|
||||
|
||||
// Datenschutz-Hinweis: Einträge sind privat
|
||||
const privacyNotice = `
|
||||
<div style="font-size:var(--text-xs);color:var(--c-text-muted);background:var(--c-surface-2);
|
||||
border-radius:var(--radius-md);padding:var(--space-2) var(--space-3);
|
||||
display:flex;align-items:center;gap:var(--space-2);margin-bottom:var(--space-3)">
|
||||
<svg class="ph-icon" aria-hidden="true" style="width:14px;height:14px;flex-shrink:0">
|
||||
<use href="/icons/phosphor.svg#lock-simple"></use></svg>
|
||||
Deine Tagebucheinträge sind privat — nur du kannst sie sehen.
|
||||
</div>`;
|
||||
|
||||
// Gruppieren nach Jahr-Monat (Anzeigereihenfolge: chronologisch absteigend)
|
||||
const groups = new Map();
|
||||
_entries.forEach(e => {
|
||||
|
|
@ -756,7 +779,7 @@ window.Page_diary = (() => {
|
|||
groups.get(key).push(e);
|
||||
});
|
||||
|
||||
let html = '';
|
||||
let html = privacyNotice;
|
||||
groups.forEach((items, key) => {
|
||||
const monthLabel = key === 'unbekannt' ? 'Datum unbekannt' : _formatMonth(key);
|
||||
html += `<div class="diary-month-header">${monthLabel}</div>`;
|
||||
|
|
|
|||
|
|
@ -1209,9 +1209,16 @@ window.Page_health = (() => {
|
|||
if (!_data[t]) _data[t] = [];
|
||||
_data[t].unshift(saved);
|
||||
UI.toast.success('Eintrag erstellt.');
|
||||
if (t === 'gewicht' && saved.wert) {
|
||||
_appState.activeDog.gewicht_kg = saved.wert;
|
||||
}
|
||||
}
|
||||
|
||||
// Gewicht im App-State aktualisieren (für neuen Eintrag UND bei Bearbeitung)
|
||||
if (t === 'gewicht' && saved.wert) {
|
||||
_appState.activeDog.gewicht_kg = saved.wert;
|
||||
_appState.dogs = _appState.dogs.map(d =>
|
||||
d.id === _appState.activeDog.id
|
||||
? { ...d, gewicht_kg: saved.wert }
|
||||
: d
|
||||
);
|
||||
}
|
||||
|
||||
// Multi-File-Upload
|
||||
|
|
@ -1767,11 +1774,13 @@ window.Page_health = (() => {
|
|||
}
|
||||
|
||||
const DRINGLICHKEIT = {
|
||||
beobachten: { badgeClass: 'badge-success', label: '🟢 Beobachten' },
|
||||
tierarzt: { badgeClass: 'badge-warning', label: '🟡 Zum Tierarzt' },
|
||||
notfall: { badgeClass: 'badge-danger', label: '🔴 Notfall — sofort zum Tierarzt!' },
|
||||
beobachten: { badgeClass: 'badge-success', icon: 'check-circle', label: 'Beobachten' },
|
||||
tierarzt_heute:{ badgeClass: 'badge-warning', icon: 'warning', label: 'Heute zum Tierarzt' },
|
||||
tierarzt: { badgeClass: 'badge-warning', icon: 'warning', label: 'Zum Tierarzt' },
|
||||
tierarzt_sofort:{ badgeClass: 'badge-danger', icon: 'first-aid-kit', label: 'Sofort zum Tierarzt!' },
|
||||
notfall: { badgeClass: 'badge-danger', icon: 'first-aid-kit', label: 'Notfall — sofort zum Tierarzt!' },
|
||||
};
|
||||
const d = DRINGLICHKEIT[result.dringlichkeit] || { badgeClass: 'badge-primary', label: _esc(result.dringlichkeit) };
|
||||
const d = DRINGLICHKEIT[result.dringlichkeit] || { badgeClass: 'badge-primary', icon: 'info', label: _esc(result.dringlichkeit) };
|
||||
|
||||
const hinweiseHtml = (result.hinweise || []).length
|
||||
? `<ul style="margin:var(--space-2) 0 0;padding-left:var(--space-5);font-size:var(--text-sm)">
|
||||
|
|
@ -1789,7 +1798,8 @@ window.Page_health = (() => {
|
|||
|
||||
resultEl.innerHTML = `
|
||||
<div style="display:flex;align-items:center;gap:var(--space-2);margin-bottom:var(--space-3)">
|
||||
<span class="badge ${d.badgeClass}" style="font-size:var(--text-sm);padding:var(--space-1) var(--space-3)">
|
||||
<span class="badge ${d.badgeClass}" style="display:inline-flex;align-items:center;gap:var(--space-1);font-size:var(--text-sm);padding:var(--space-1) var(--space-3)">
|
||||
<svg class="ph-icon" aria-hidden="true"><use href="/icons/phosphor.svg#${d.icon}"></use></svg>
|
||||
${d.label}
|
||||
</span>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -267,7 +267,14 @@ window.Page_moderation = (() => {
|
|||
}
|
||||
|
||||
function _renderUserList(el, users, total, parentEl) {
|
||||
if (!users.length) {
|
||||
// Moderatoren (non-admins) sehen keine Admin-User — serverseitig bereits
|
||||
// gefiltert, aber zur Sicherheit auch clientseitig nochmal ausfiltern.
|
||||
const isAdmin = _appState?.user?.rolle === 'admin';
|
||||
const visible = isAdmin
|
||||
? users
|
||||
: users.filter(u => u.rolle !== 'admin' && !u.is_admin);
|
||||
|
||||
if (!visible.length) {
|
||||
el.innerHTML = _emptyState('users', 'Keine Nutzer gefunden', '');
|
||||
return;
|
||||
}
|
||||
|
|
@ -275,7 +282,10 @@ window.Page_moderation = (() => {
|
|||
<div style="margin-bottom:var(--space-2);font-size:var(--text-xs);
|
||||
color:var(--c-text-muted)">${total} Nutzer gefunden</div>
|
||||
<div style="display:flex;flex-direction:column;gap:var(--space-2)">
|
||||
${users.map(u => `
|
||||
${visible.map(u => {
|
||||
const isAdminUser = u.rolle === 'admin' || u.is_admin;
|
||||
const canAction = isAdmin && !isAdminUser;
|
||||
return `
|
||||
<div class="card" style="padding:var(--space-3) var(--space-4);
|
||||
${u.is_banned ? 'opacity:0.6;border-left:3px solid var(--c-danger)' : ''}">
|
||||
<div style="display:flex;align-items:center;gap:var(--space-3)">
|
||||
|
|
@ -304,22 +314,24 @@ window.Page_moderation = (() => {
|
|||
</div>
|
||||
</div>
|
||||
<div style="flex-shrink:0">
|
||||
${u.is_banned
|
||||
? `<button class="btn btn-sm btn-ghost mod-unban"
|
||||
data-uid="${u.id}" data-name="${_esc(u.name)}"
|
||||
title="Sperre aufheben" style="color:var(--c-success)">
|
||||
${UI.icon('lock-open')}
|
||||
</button>`
|
||||
: `<button class="btn btn-sm btn-ghost mod-ban"
|
||||
data-uid="${u.id}" data-name="${_esc(u.name)}"
|
||||
title="Sperren" style="color:var(--c-danger)">
|
||||
${UI.icon('lock')}
|
||||
</button>`
|
||||
${canAction
|
||||
? (u.is_banned
|
||||
? `<button class="btn btn-sm btn-ghost mod-unban"
|
||||
data-uid="${u.id}" data-name="${_esc(u.name)}"
|
||||
title="Sperre aufheben" style="color:var(--c-success)">
|
||||
${UI.icon('lock-open')}
|
||||
</button>`
|
||||
: `<button class="btn btn-sm btn-ghost mod-ban"
|
||||
data-uid="${u.id}" data-name="${_esc(u.name)}"
|
||||
title="Sperren" style="color:var(--c-danger)">
|
||||
${UI.icon('lock')}
|
||||
</button>`)
|
||||
: ''
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`).join('')}
|
||||
`}).join('')}
|
||||
</div>
|
||||
`;
|
||||
|
||||
|
|
|
|||
|
|
@ -213,6 +213,9 @@ window.Page_notes = (() => {
|
|||
/* Filter-Chips */
|
||||
.notes-filter-chips { display: flex; gap: var(--space-2); overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
|
||||
.notes-filter-chips::-webkit-scrollbar { display: none; }
|
||||
@media (min-width: 1024px) {
|
||||
.notes-filter-chips { flex-wrap: wrap; overflow-x: visible; }
|
||||
}
|
||||
.notes-chip { flex-shrink: 0; font-size: var(--text-xs); font-weight: var(--weight-semibold); padding: 4px var(--space-3); border-radius: 999px; border: 1.5px solid var(--c-border); background: var(--c-surface-2); color: var(--c-text-secondary); cursor: pointer; white-space: nowrap; transition: background .15s, color .15s, border-color .15s; }
|
||||
.notes-chip--active { background: var(--chip-color, var(--c-primary)); color: #fff; border-color: var(--chip-color, var(--c-primary)); }
|
||||
|
||||
|
|
|
|||
|
|
@ -223,7 +223,7 @@ window.Page_poison = (() => {
|
|||
|
||||
if (_reports.length === 0) {
|
||||
listEl.innerHTML = UI.emptyState({
|
||||
icon : 'check-circle',
|
||||
icon : UI.icon('check-circle'),
|
||||
title : 'Alles sicher',
|
||||
text : 'In deiner Nähe (10 km) gibt es aktuell keine Giftköder-Meldungen.',
|
||||
action: `<button class="btn btn-danger" id="poison-empty-report">⚠️ Trotzdem melden</button>`,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue