Medikamentenseite Button und Sidebar erstellt.
This commit is contained in:
parent
87fc63b3b0
commit
bc7dfc0210
@ -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,
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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,
|
||||
);
|
||||
|
||||
@ -31,15 +31,17 @@
|
||||
|
||||
<% waitingPatients.forEach(p => { %>
|
||||
|
||||
<% if (user.role === 'arzt' || user.role === 'mitarbeiter') { %>
|
||||
<a href="/patients/<%= p.id %>/overview" class="waiting-slot occupied clickable">
|
||||
<% if (user.role === 'arzt') { %>
|
||||
<form method="POST" action="/patients/<%= p.id %>/call" style="width:100%; margin:0;">
|
||||
<button type="submit" class="waiting-slot occupied clickable waiting-btn">
|
||||
<div class="patient-text">
|
||||
<div class="name"><%= p.firstname %> <%= p.lastname %></div>
|
||||
<div class="birthdate">
|
||||
<%= new Date(p.birthdate).toLocaleDateString("de-DE") %>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</button>
|
||||
</form>
|
||||
<% } else { %>
|
||||
<div class="waiting-slot occupied">
|
||||
<div class="patient-text">
|
||||
|
||||
@ -34,13 +34,6 @@
|
||||
|
||||
<!-- rechts -->
|
||||
<div class="page-header-right">
|
||||
|
||||
<% if (!hideDashboard) { %>
|
||||
<a href="/dashboard" class="btn btn-outline-light btn-sm">
|
||||
⬅️ Dashboard
|
||||
</a>
|
||||
<% } %>
|
||||
|
||||
<span id="datetime" class="page-header-datetime"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
67
views/partials/patient-doctor-sidebar.ejs
Normal file
67
views/partials/patient-doctor-sidebar.ejs
Normal file
@ -0,0 +1,67 @@
|
||||
<%
|
||||
const pid = patient?.id || null;
|
||||
|
||||
// ✅ Wenn wir in der Medikamentenseite sind → nur Zurück anzeigen
|
||||
const onlyBack = active === "patient_medications";
|
||||
%>
|
||||
|
||||
<div class="sidebar">
|
||||
|
||||
<!-- ✅ Logo -->
|
||||
<div style="margin-bottom: 30px; display: flex; flex-direction: column; gap: 10px;">
|
||||
<div style="padding: 20px; text-align: center">
|
||||
<div class="logo" style="margin: 0">🩺 Praxis System</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ✅ Zurück (immer sichtbar) -->
|
||||
<a href="<%= pid ? '/patients/' + pid + '/overview' : '/dashboard' %>" class="nav-item">
|
||||
<i class="bi bi-arrow-left-circle"></i> Zurück
|
||||
</a>
|
||||
|
||||
<% if (!onlyBack && pid) { %>
|
||||
|
||||
<div style="margin: 10px 0; border-top: 1px solid rgba(255, 255, 255, 0.12)"></div>
|
||||
|
||||
<!-- ✅ Medikamentenverwaltung -->
|
||||
<a
|
||||
href="/patients/<%= pid %>/medications?returnTo=overview"
|
||||
class="nav-item <%= active === 'patient_medications' ? 'active' : '' %>"
|
||||
>
|
||||
<i class="bi bi-capsule"></i> Medikamentenverwaltung
|
||||
</a>
|
||||
|
||||
<!-- ✅ Patient bearbeiten -->
|
||||
<a
|
||||
href="/patients/edit/<%= pid %>?returnTo=overview"
|
||||
class="nav-item <%= active === 'patient_edit' ? 'active' : '' %>"
|
||||
>
|
||||
<i class="bi bi-pencil-square"></i> Patient bearbeiten
|
||||
</a>
|
||||
|
||||
<!-- ✅ Ins Wartezimmer -->
|
||||
<form method="POST" action="/patients/<%= pid %>/back-to-waiting-room">
|
||||
<button
|
||||
type="submit"
|
||||
class="nav-item"
|
||||
style="width:100%; border:none; background:transparent; text-align:left;"
|
||||
>
|
||||
<i class="bi bi-door-open"></i> Ins Wartezimmer
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<!-- ✅ Entlassen -->
|
||||
<form method="POST" action="/patients/<%= pid %>/discharge">
|
||||
<button
|
||||
type="submit"
|
||||
class="nav-item"
|
||||
style="width:100%; border:none; background:transparent; text-align:left;"
|
||||
onclick="return confirm('Patient wirklich entlassen?')"
|
||||
>
|
||||
<i class="bi bi-check2-circle"></i> Entlassen
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<% } %>
|
||||
|
||||
</div>
|
||||
@ -1,124 +1,148 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Medikation – <%= patient.firstname %> <%= patient.lastname %></title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="/css/bootstrap.min.css">
|
||||
</head>
|
||||
<body class="bg-light">
|
||||
<%- 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") : "-";
|
||||
}
|
||||
%>
|
||||
<div class="content">
|
||||
|
||||
<nav class="navbar navbar-dark bg-dark px-3">
|
||||
<span class="navbar-brand">
|
||||
💊 Medikation – <%= patient.firstname %> <%= patient.lastname %>
|
||||
</span>
|
||||
|
||||
<a href="<%= returnTo === 'overview'
|
||||
? `/patients/${patient.id}/overview`
|
||||
: '/patients' %>"
|
||||
class="btn btn-outline-light btn-sm">
|
||||
Zurück
|
||||
</a>
|
||||
</nav>
|
||||
|
||||
<div class="container mt-4">
|
||||
<%- include("partials/flash") %>
|
||||
<!-- =========================
|
||||
FORMULAR (NUR ADMIN)
|
||||
========================== -->
|
||||
<% if (user && user.role === 'arzt') { %>
|
||||
|
||||
<div class="card shadow mb-4">
|
||||
<div class="container-fluid">
|
||||
|
||||
<% } else { %>
|
||||
|
||||
<div class="alert alert-info">
|
||||
ℹ️ Nur Administratoren dürfen Medikamente eintragen.
|
||||
<!-- ✅ Patient Info -->
|
||||
<div class="card shadow-sm mb-3 patient-box">
|
||||
<div class="card-body">
|
||||
<h5 class="mb-1">
|
||||
<%= patient.firstname %> <%= patient.lastname %>
|
||||
</h5>
|
||||
<div class="text-muted small">
|
||||
Geboren am:
|
||||
<%= new Date(patient.birthdate).toLocaleDateString("de-DE") %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row g-3">
|
||||
|
||||
<!-- ✅ Medikament hinzufügen -->
|
||||
<div class="col-lg-6">
|
||||
<div class="card shadow-sm h-100">
|
||||
<div class="card-header fw-semibold">
|
||||
➕ Medikament zuweisen
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
|
||||
<form method="POST" action="/patients/<%= patient.id %>/medications/assign">
|
||||
|
||||
<div class="mb-2">
|
||||
<label class="form-label">Medikament auswählen</label>
|
||||
<select name="medication_variant_id" class="form-select" required>
|
||||
<option value="">-- auswählen --</option>
|
||||
<% meds.forEach(m => { %>
|
||||
<option value="<%= m.id %>">
|
||||
<%= m.medication %> | <%= m.form %> | <%= m.dosage %>
|
||||
<% if (m.package) { %>
|
||||
| <%= m.package %>
|
||||
<% } %>
|
||||
</option>
|
||||
<% }) %>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- =========================
|
||||
AKTUELLE MEDIKATION
|
||||
========================== -->
|
||||
<div class="mb-2">
|
||||
<label class="form-label">Dosierungsanweisung</label>
|
||||
<input
|
||||
type="text"
|
||||
class="form-control"
|
||||
name="dosage_instruction"
|
||||
placeholder="z.B. 1-0-1"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<h4>Aktuelle Medikation</h4>
|
||||
<div class="row g-2 mb-2">
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Startdatum</label>
|
||||
<input type="date" class="form-control" name="start_date" />
|
||||
</div>
|
||||
|
||||
<table class="table table-bordered table-sm mt-3">
|
||||
<thead class="table-light">
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Enddatum</label>
|
||||
<input type="date" class="form-control" name="end_date" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button class="btn btn-primary">
|
||||
✅ Speichern
|
||||
</button>
|
||||
|
||||
<a href="/patients/<%= patient.id %>/overview" class="btn btn-outline-secondary">
|
||||
⬅️ Zur Übersicht
|
||||
</a>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ✅ Aktuelle Medikation -->
|
||||
<div class="col-lg-6">
|
||||
<div class="card shadow-sm h-100">
|
||||
<div class="card-header fw-semibold">
|
||||
📋 Aktuelle Medikation
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
|
||||
<% if (!currentMeds || currentMeds.length === 0) { %>
|
||||
<div class="text-muted">
|
||||
Keine Medikation vorhanden.
|
||||
</div>
|
||||
<% } else { %>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-sm table-striped align-middle">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Medikament</th>
|
||||
<th>Form</th>
|
||||
<th>Dosierung</th>
|
||||
<th>Packung</th>
|
||||
<th>Anweisung</th>
|
||||
<th>Zeitraum</th>
|
||||
<% if (user && user.role === 'arzt') { %>
|
||||
<th>Aktionen</th>
|
||||
<% } %>
|
||||
<th>Von</th>
|
||||
<th>Bis</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
|
||||
<% if (!currentMeds || currentMeds.length === 0) { %>
|
||||
|
||||
<% currentMeds.forEach(cm => { %>
|
||||
<tr>
|
||||
<td colspan="6" class="text-center text-muted">
|
||||
Keine Medikation vorhanden
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<% } else { %>
|
||||
|
||||
<% currentMeds.forEach(m => { %>
|
||||
<tr>
|
||||
<td><%= m.medication %> (<%= m.form %>)</td>
|
||||
<td><%= m.dosage %></td>
|
||||
<td><%= m.package %></td>
|
||||
<td><%= m.dosage_instruction || "-" %></td>
|
||||
<td><%= cm.medication %></td>
|
||||
<td><%= cm.form %></td>
|
||||
<td><%= cm.dosage %></td>
|
||||
<td><%= cm.dosage_instruction || "-" %></td>
|
||||
<td>
|
||||
<%= formatDate(m.start_date) %> –
|
||||
<%= m.end_date ? formatDate(m.end_date) : "laufend" %>
|
||||
<%= cm.start_date ? new Date(cm.start_date).toLocaleDateString("de-DE") : "-" %>
|
||||
</td>
|
||||
|
||||
<% if (user && user.role === 'arzt') { %>
|
||||
<td class="d-flex gap-1">
|
||||
|
||||
<form method="POST"
|
||||
action="/patient-medications/end/<%= m.id %>?returnTo=<%= returnTo || '' %>">
|
||||
<button class="btn btn-sm btn-warning">
|
||||
⏹ Beenden
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<form method="POST"
|
||||
action="/patient-medications/delete/<%= m.id %>?returnTo=<%= returnTo || '' %>"
|
||||
onsubmit="return confirm('Medikation wirklich löschen?')">
|
||||
<button class="btn btn-sm btn-danger">
|
||||
🗑️ Löschen
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<td>
|
||||
<%= cm.end_date ? new Date(cm.end_date).toLocaleDateString("de-DE") : "-" %>
|
||||
</td>
|
||||
<% } %>
|
||||
</tr>
|
||||
<% }) %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<% } %>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
<%- include("partials/flash") %>
|
||||
|
||||
<!-- ✅ PATIENTENDATEN -->
|
||||
<div class="card shadow mb-4">
|
||||
<div class="card shadow-sm mb-3 patient-data-box">
|
||||
<div class="card-body">
|
||||
<h4>Patientendaten</h4>
|
||||
|
||||
@ -49,34 +49,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ✅ AKTIONEN -->
|
||||
<div class="d-flex gap-2 mb-4 flex-wrap">
|
||||
|
||||
<a
|
||||
href="/patients/<%= patient.id %>/medications?returnTo=overview"
|
||||
class="btn btn-primary"
|
||||
>
|
||||
💊 Medikation verwalten
|
||||
</a>
|
||||
|
||||
<a
|
||||
href="/patients/edit/<%= patient.id %>?returnTo=overview"
|
||||
class="btn btn-outline-info"
|
||||
>
|
||||
✏️ Patient bearbeiten
|
||||
</a>
|
||||
|
||||
<form method="POST" action="/patients/<%= patient.id %>/discharge">
|
||||
<button
|
||||
class="btn btn-danger"
|
||||
onclick="return confirm('Patient wirklich entlassen?')"
|
||||
>
|
||||
✅ Entlassen
|
||||
</button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- ✅ UNTERER BEREICH -->
|
||||
<div class="row g-3">
|
||||
|
||||
@ -130,7 +102,7 @@
|
||||
<div class="card-body">
|
||||
<h5>💊 Rezept erstellen</h5>
|
||||
|
||||
<form method="POST" action="/patients/<%= patient.id %>/medications/assign">
|
||||
<form method="POST" action="/patients/<%= patient.id %>/medications">
|
||||
<select name="medication_variant_id" class="form-select mb-2" required>
|
||||
<option value="">Bitte auswählen…</option>
|
||||
<% medicationVariants.forEach(mv => { %>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user