From bc7dfc02101ec9a1967f22747845234311613600 Mon Sep 17 00:00:00 2001 From: Cay Date: Thu, 22 Jan 2026 19:03:20 +0000 Subject: [PATCH] Medikamentenseite Button und Sidebar erstellt. --- controllers/patient.controller.js | 4 +- public/css/style.css | 27 +++ routes/patient.routes.js | 2 +- views/dashboard.ejs | 18 +- views/partials/page-header.ejs | 7 - views/partials/patient-doctor-sidebar.ejs | 67 +++++++ views/patient_medications.ejs | 226 ++++++++++++---------- views/patient_overview.ejs | 32 +-- 8 files changed, 234 insertions(+), 149 deletions(-) create mode 100644 views/partials/patient-doctor-sidebar.ejs diff --git a/controllers/patient.controller.js b/controllers/patient.controller.js index a174682..5d8d507 100644 --- a/controllers/patient.controller.js +++ b/controllers/patient.controller.js @@ -252,7 +252,7 @@ function showPatientMedications(req, res) { res.render("patient_medications", { title: "Medikamente", - sidebarPartial: "partials/patient-sidebar", + sidebarPartial: "partials/patient-doctor-sidebar", active: "patient_medications", patient: patients[0], @@ -391,7 +391,7 @@ function showPatientOverview(req, res) { res.render("patient_overview", { title: "Patient Übersicht", - sidebarPartial: "partials/patient-sidebar", + sidebarPartial: "partials/patient-doctor-sidebar", active: "patient_overview", patient, diff --git a/public/css/style.css b/public/css/style.css index 5a7b65d..136be1c 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -258,3 +258,30 @@ a.waiting-slot { color: #fff; margin-bottom: 15px; } + +/* ========================================================= + ✅ Patientendaten maximal so breit wie die maximalen Daten sind +========================================================= */ +.patient-data-box { + max-width: 900px; /* ✅ maximale Breite (kannst du ändern) */ + width: 100%; + margin: 0 auto; /* ✅ zentriert */ +} + +/* ✅ Button im Wartezimmer-Monitor soll aussehen wie ein Link-Block */ +.waiting-btn { + width: 100%; + border: none; + background: transparent; + padding: 10px; /* genau wie waiting-slot vorher */ + margin: 0; + + text-align: center; + cursor: pointer; +} + +/* ✅ Entfernt Focus-Rahmen (falls Browser blau umrandet) */ +.waiting-btn:focus { + outline: none; + box-shadow: none; +} diff --git a/routes/patient.routes.js b/routes/patient.routes.js index 5353b81..1b10c47 100644 --- a/routes/patient.routes.js +++ b/routes/patient.routes.js @@ -61,7 +61,7 @@ router.get("/waiting-room", requireLogin, showWaitingRoom); router.post("/waiting-room/:id", requireLogin, moveToWaitingRoom); router.post( - "/move-to-waiting-room/:id", + "/:id/back-to-waiting-room", requireLogin, movePatientToWaitingRoom, ); diff --git a/views/dashboard.ejs b/views/dashboard.ejs index 29c7409..62975ed 100644 --- a/views/dashboard.ejs +++ b/views/dashboard.ejs @@ -31,15 +31,17 @@ <% waitingPatients.forEach(p => { %> - <% if (user.role === 'arzt' || user.role === 'mitarbeiter') { %> - -
-
<%= p.firstname %> <%= p.lastname %>
-
- <%= new Date(p.birthdate).toLocaleDateString("de-DE") %> + <% if (user.role === 'arzt') { %> +
+
-
+ + <% } else { %>
diff --git a/views/partials/page-header.ejs b/views/partials/page-header.ejs index f047f2f..69ca15a 100644 --- a/views/partials/page-header.ejs +++ b/views/partials/page-header.ejs @@ -34,13 +34,6 @@
- - <% if (!hideDashboard) { %> - - ⬅️ Dashboard - - <% } %> -
diff --git a/views/partials/patient-doctor-sidebar.ejs b/views/partials/patient-doctor-sidebar.ejs new file mode 100644 index 0000000..4bda126 --- /dev/null +++ b/views/partials/patient-doctor-sidebar.ejs @@ -0,0 +1,67 @@ +<% + const pid = patient?.id || null; + + // ✅ Wenn wir in der Medikamentenseite sind → nur Zurück anzeigen + const onlyBack = active === "patient_medications"; +%> + + diff --git a/views/patient_medications.ejs b/views/patient_medications.ejs index 13065f1..1b7e10f 100644 --- a/views/patient_medications.ejs +++ b/views/patient_medications.ejs @@ -1,124 +1,148 @@ - - - - - Medikation – <%= patient.firstname %> <%= patient.lastname %> - - - - +<%- include("partials/page-header", { + user, + title: "💊 Medikation", + subtitle: patient.firstname + " " + patient.lastname, + showUserName: true, + showDashboardButton: false +}) %> -<% -/* ========================= - HILFSFUNKTION -========================== */ -function formatDate(d) { - return d ? new Date(d).toLocaleDateString("de-DE") : "-"; -} -%> +
- +
-
- <%- include("partials/flash") %> - - <% if (user && user.role === 'arzt') { %> - -
- - <% } else { %> - -
- ℹ️ Nur Administratoren dürfen Medikamente eintragen. + +
+
+
+ <%= patient.firstname %> <%= patient.lastname %> +
+
+ Geboren am: + <%= new Date(patient.birthdate).toLocaleDateString("de-DE") %>
+
+
- <% } %> +
- + +
+
+
+ ➕ Medikament zuweisen +
-

Aktuelle Medikation

+
- - - - - - - - - <% if (user && user.role === 'arzt') { %> - - <% } %> - - + - +
+ + +
- <% if (!currentMeds || currentMeds.length === 0) { %> +
+ + +
- - - +
+
+ + +
- <% } else { %> +
+ + +
+
- <% currentMeds.forEach(m => { %> - - - - - - + - <% if (user && user.role === 'arzt') { %> - -
MedikamentDosierungPackungAnweisungZeitraumAktionen
- Keine Medikation vorhanden -
<%= m.medication %> (<%= m.form %>)<%= m.dosage %><%= m.package %><%= m.dosage_instruction || "-" %> - <%= formatDate(m.start_date) %> – - <%= m.end_date ? formatDate(m.end_date) : "laufend" %> - + + ⬅️ Zur Übersicht + - - - + -
- -
+ + + + +
+
+
+ 📋 Aktuelle Medikation +
+ +
+ + <% if (!currentMeds || currentMeds.length === 0) { %> +
+ Keine Medikation vorhanden. +
+ <% } else { %> + +
+ + + + + + + + + + + + + + <% currentMeds.forEach(cm => { %> + + + + + + - <% } %> - - <% }) %> + + + <% }) %> + +
MedikamentFormDosierungAnweisungVonBis
<%= cm.medication %><%= cm.form %><%= cm.dosage %><%= cm.dosage_instruction || "-" %> + <%= cm.start_date ? new Date(cm.start_date).toLocaleDateString("de-DE") : "-" %>
+ <%= cm.end_date ? new Date(cm.end_date).toLocaleDateString("de-DE") : "-" %> +
+
- <% } %> + <% } %> -
+
+
+
+
+ +
- - - diff --git a/views/patient_overview.ejs b/views/patient_overview.ejs index dfc6a60..32ba926 100644 --- a/views/patient_overview.ejs +++ b/views/patient_overview.ejs @@ -18,7 +18,7 @@ <%- include("partials/flash") %> -
+

Patientendaten

@@ -49,34 +49,6 @@
- - -
@@ -130,7 +102,7 @@
💊 Rezept erstellen
-
+