Praxissofttware/views/patient_medications.ejs

149 lines
4.5 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<%- include("partials/page-header", {
user,
title: "💊 Medikation",
subtitle: patient.firstname + " " + patient.lastname,
showUserName: true,
showDashboardButton: false
}) %>
<div class="content">
<%- include("partials/flash") %>
<div class="container-fluid">
<!-- ✅ 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>
<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>
<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>
<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>Anweisung</th>
<th>Von</th>
<th>Bis</th>
</tr>
</thead>
<tbody>
<% currentMeds.forEach(cm => { %>
<tr>
<td><%= cm.medication %></td>
<td><%= cm.form %></td>
<td><%= cm.dosage %></td>
<td><%= cm.dosage_instruction || "-" %></td>
<td>
<%= cm.start_date ? new Date(cm.start_date).toLocaleDateString("de-DE") : "-" %>
</td>
<td>
<%= cm.end_date ? new Date(cm.end_date).toLocaleDateString("de-DE") : "-" %>
</td>
</tr>
<% }) %>
</tbody>
</table>
</div>
<% } %>
</div>
</div>
</div>
</div>
</div>
</div>