125 lines
3.6 KiB
Plaintext
125 lines
3.6 KiB
Plaintext
<!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">
|
||
|
||
<%
|
||
/* =========================
|
||
HILFSFUNKTION
|
||
========================== */
|
||
function formatDate(d) {
|
||
return d ? new Date(d).toLocaleDateString("de-DE") : "-";
|
||
}
|
||
%>
|
||
|
||
<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">
|
||
|
||
<% } else { %>
|
||
|
||
<div class="alert alert-info">
|
||
ℹ️ Nur Administratoren dürfen Medikamente eintragen.
|
||
</div>
|
||
|
||
<% } %>
|
||
|
||
<!-- =========================
|
||
AKTUELLE MEDIKATION
|
||
========================== -->
|
||
|
||
<h4>Aktuelle Medikation</h4>
|
||
|
||
<table class="table table-bordered table-sm mt-3">
|
||
<thead class="table-light">
|
||
<tr>
|
||
<th>Medikament</th>
|
||
<th>Dosierung</th>
|
||
<th>Packung</th>
|
||
<th>Anweisung</th>
|
||
<th>Zeitraum</th>
|
||
<% if (user && user.role === 'arzt') { %>
|
||
<th>Aktionen</th>
|
||
<% } %>
|
||
</tr>
|
||
</thead>
|
||
|
||
<tbody>
|
||
|
||
<% if (!currentMeds || currentMeds.length === 0) { %>
|
||
|
||
<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>
|
||
<%= formatDate(m.start_date) %> –
|
||
<%= m.end_date ? formatDate(m.end_date) : "laufend" %>
|
||
</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>
|
||
<% } %>
|
||
</tr>
|
||
<% }) %>
|
||
|
||
<% } %>
|
||
|
||
</tbody>
|
||
</table>
|
||
|
||
</div>
|
||
|
||
</body>
|
||
</html>
|