diff --git a/backend/static/js/pages/health.js b/backend/static/js/pages/health.js index 6408d9f..094ffa9 100644 --- a/backend/static/js/pages/health.js +++ b/backend/static/js/pages/health.js @@ -207,7 +207,9 @@ window.Page_health = (() => { }); const items = entries.map(e => { - const ampel = _impfAmpel(e.naechstes); + const ampel = _impfAmpel(e.naechstes); + const praxis = _praxen.find(p => p.id === e.tierarzt_id); + const vetName = praxis?.name || e.tierarzt_name || ''; return `
@@ -215,9 +217,9 @@ window.Page_health = (() => {
${_esc(e.bezeichnung)}
${UI.time.format(e.datum + 'T00:00:00')} - ${e.tierarzt_name ? ` · ${_esc(e.tierarzt_name)}` : ''} ${e.charge_nr ? ` · Ch.-Nr: ${_esc(e.charge_nr)}` : ''}
+ ${vetName ? `
🏥 ${_esc(vetName)}
` : ''} ${e.naechstes ? `
Nächste Impfung: ${UI.time.format(e.naechstes + 'T00:00:00')} ${ampel.icon}
` : ''} @@ -481,22 +483,31 @@ window.Page_health = (() => { icon: '📄', title: 'Noch keine Dokumente', text: 'Lade Impfpässe, Befunde und mehr hoch.', action: addBtn }); - const items = entries.map(e => ` -
-
- ${e.datei_url - ? (e.datei_typ === 'pdf' - ? `
📄
` - : `Dokument`) - : `
📎
`} -
+ const items = entries.map(e => { + const isPdf = e.datei_typ === 'pdf'; + const hasFile = !!e.datei_url; + return ` +
+ ${hasFile && !isPdf + ? `Vorschau` + : `
${isPdf ? '📄' : '📎'}
`} +
${_esc(e.bezeichnung)}
${UI.time.format(e.datum + 'T00:00:00')}
${e.notiz ? `
${_esc(e.notiz)}
` : ''} + ${hasFile + ? ` + ${isPdf ? '📄 PDF öffnen' : '🖼️ Bild öffnen'} + ` + : `Noch keine Datei hochgeladen`}
-
- `).join(''); + `; + }).join(''); return `
${items}
${addBtn}
`; @@ -728,6 +739,23 @@ window.Page_health = (() => { return ph[typ] || ''; } + // Wiederverwendbares Praxis-Dropdown für alle Formulare + function _praxisSelectField(entry) { + const aktivePraxen = _praxen.filter(p => p.aktiv); + if (!aktivePraxen.length) return ''; + return ` +
+ + +
`; + } + function _extraFormFields(entry, typ) { switch (typ) { case 'impfung': return ` @@ -735,10 +763,7 @@ window.Page_health = (() => {
-
- - -
+ ${_praxisSelectField(entry)}
@@ -749,10 +774,7 @@ window.Page_health = (() => {
-
- - -
+ ${_praxisSelectField(entry)} `; case 'tierarzt': { const aktivePraxen = _praxen.filter(p => p.aktiv); @@ -818,6 +840,7 @@ window.Page_health = (() => {
+ ${_praxisSelectField(entry)}