-
${_esc(e.bezeichnung)}
-
- `).join('');
+ `;
+ }).join('');
return `
${items}
${addBtn}
`;
@@ -574,7 +583,16 @@ window.Page_health = (() => {
const rows = [];
if (e.datum) rows.push(['Datum', UI.time.format(e.datum + 'T00:00:00')]);
if (e.naechstes) rows.push(['Nächstes', UI.time.format(e.naechstes + 'T00:00:00')]);
- if (e.tierarzt_name) rows.push(['Tierarzt', _esc(e.tierarzt_name)]);
+ if (e.tierarzt_id) {
+ const praxis = _praxen.find(p => p.id === e.tierarzt_id);
+ if (praxis) {
+ const adresse = [praxis.strasse, [praxis.plz, praxis.ort].filter(Boolean).join(' ')].filter(Boolean).join(', ');
+ const tel = praxis.telefon ? ` ·
${_esc(praxis.telefon)}` : '';
+ rows.push(['Praxis', `🏥 ${_esc(praxis.name)}${adresse ? `
${_esc(adresse)}${tel}` : tel}`]);
+ }
+ } else if (e.tierarzt_name) {
+ rows.push(['Tierarzt', _esc(e.tierarzt_name)]);
+ }
if (e.charge_nr) rows.push(['Charge-Nr.', _esc(e.charge_nr)]);
if (e.kosten != null) rows.push(['Kosten', `${Number(e.kosten).toFixed(2)} €`]);
if (e.diagnose) rows.push(['Diagnose', _esc(e.diagnose)]);
@@ -648,17 +666,12 @@ window.Page_health = (() => {
const form = document.getElementById('health-form');
setTimeout(() => {
form?.querySelector('[name="bezeichnung"]')?.focus();
- // Praxis-Dropdown: Name auto-befüllen
- const praxisSelect = document.getElementById('health-praxis-select');
- const nameInput = document.getElementById('health-tierarzt-name-input');
- if (praxisSelect && nameInput) {
- praxisSelect.addEventListener('change', () => {
- const selected = praxisSelect.options[praxisSelect.selectedIndex];
- if (selected.value) {
- nameInput.value = selected.dataset.name || selected.textContent.trim();
- }
- });
- }
+ // "Praxis anlegen" Button im Formular
+ form?.querySelector('[data-action="goto-praxen"]')?.addEventListener('click', () => {
+ UI.modal.close();
+ _activeTab = 'praxen';
+ _renderTab();
+ });
}, 150);
document.getElementById('health-form-cancel')?.addEventListener('click', UI.modal.close);
@@ -743,25 +756,31 @@ window.Page_health = (() => {
`;
case 'tierarzt': {
const aktivePraxen = _praxen.filter(p => p.aktiv);
- const praxisDropdown = aktivePraxen.length ? `
-
-
-
-
` : '';
+ const praxisField = aktivePraxen.length
+ ? `
+
+
+
`
+ : `
`;
return `
- ${praxisDropdown}
-
-
-
-
+ ${praxisField}
@@ -845,7 +864,12 @@ window.Page_health = (() => {
if (typ === 'gewicht') p.bezeichnung = `${p.wert} kg`;
}
if (fd.kosten) p.kosten = parseFloat(fd.kosten.toString().replace(',', '.'));
- if (fd.tierarzt_id) p.tierarzt_id = parseInt(fd.tierarzt_id);
+ if (fd.tierarzt_id) {
+ p.tierarzt_id = parseInt(fd.tierarzt_id);
+ // Praxisname auch als tierarzt_name sichern (bleibt lesbar wenn Praxis inaktiv/gelöscht)
+ const praxis = _praxen.find(x => x.id === p.tierarzt_id);
+ if (praxis) p.tierarzt_name = praxis.name;
+ }
if (typ === 'medikament') {
p.aktiv = 'aktiv' in fd ? 1 : 0;
}
diff --git a/backend/static/sw.js b/backend/static/sw.js
index eb5a0fd..286df93 100644
--- a/backend/static/sw.js
+++ b/backend/static/sw.js
@@ -3,7 +3,7 @@
Offline-Cache + Push Notifications
============================================================ */
-const CACHE_VERSION = 'by-v11';
+const CACHE_VERSION = 'by-v12';
const CACHE_STATIC = `${CACHE_VERSION}-static`;
// Diese Dateien werden beim Install gecacht (App Shell)