Praxissofttware/views/patient_overview.ejs

205 lines
6.4 KiB
Plaintext
Raw Permalink 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.

<div class="layout">
<!-- ✅ Sidebar: Patient -->
<!-- kommt automatisch über layout.ejs, wenn sidebarPartial gesetzt ist -->
<div class="main">
<!-- ✅ Neuer Header -->
<%- include("partials/page-header", {
user,
title: "Patient",
subtitle: patient.firstname + " " + patient.lastname,
showUserName: true
}) %>
<div class="content p-4">
<%- include("partials/flash") %>
<!-- ✅ PATIENTENDATEN -->
<div class="card shadow-sm mb-3 patient-data-box">
<div class="card-body">
<h4>Patientendaten</h4>
<table class="table table-sm">
<tr>
<th>Vorname</th>
<td><%= patient.firstname %></td>
</tr>
<tr>
<th>Nachname</th>
<td><%= patient.lastname %></td>
</tr>
<tr>
<th>Geburtsdatum</th>
<td>
<%= patient.birthdate ? new Date(patient.birthdate).toLocaleDateString("de-DE") : "-" %>
</td>
</tr>
<tr>
<th>E-Mail</th>
<td><%= patient.email || "-" %></td>
</tr>
<tr>
<th>Telefon</th>
<td><%= patient.phone || "-" %></td>
</tr>
</table>
</div>
</div>
<!-- ✅ UNTERER BEREICH -->
<div class="row g-3">
<!-- 📝 NOTIZEN -->
<div class="col-lg-5 col-md-12">
<div class="card shadow h-100">
<div class="card-body d-flex flex-column">
<h5>📝 Notizen</h5>
<form method="POST" action="/patients/<%= patient.id %>/notes">
<textarea
class="form-control mb-2"
name="note"
rows="3"
style="resize: none"
placeholder="Neue Notiz hinzufügen…"
></textarea>
<button class="btn btn-sm btn-primary">
Notiz speichern
</button>
</form>
<hr class="my-2" />
<div style="max-height: 320px; overflow-y: auto;">
<% if (!notes || notes.length === 0) { %>
<p class="text-muted">Keine Notizen vorhanden</p>
<% } else { %>
<% notes.forEach(n => { %>
<div class="mb-3 p-2 border rounded bg-light">
<div class="small text-muted">
<%= new Date(n.created_at).toLocaleString("de-DE") %>
<% if (n.first_name && n.last_name) { %>
<%= (n.title ? n.title + " " : "") %><%= n.first_name %> <%= n.last_name %>
<% } %>
</div>
<div><%= n.note %></div>
</div>
<% }) %>
<% } %>
</div>
</div>
</div>
</div>
<!-- 💊 MEDIKAMENT -->
<div class="col-lg-3 col-md-6">
<div class="card shadow h-100">
<div class="card-body">
<h5>💊 Rezept erstellen</h5>
<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 => { %>
<option value="<%= mv.variant_id %>">
<%= mv.medication_name %> <%= mv.form_name %> <%= mv.dosage %>
</option>
<% }) %>
</select>
<input
type="text"
name="dosage_instruction"
class="form-control mb-2"
placeholder="z. B. 101"
/>
<input
type="date"
name="start_date"
class="form-control mb-2"
value="<%= new Date().toISOString().split('T')[0] %>"
/>
<input type="date" name="end_date" class="form-control mb-3" />
<button class="btn btn-sm btn-success w-100">
Verordnen
</button>
</form>
</div>
</div>
</div>
<!-- 🧾 HEUTIGE LEISTUNGEN -->
<div class="col-lg-4 col-md-6">
<div class="card shadow h-100">
<div class="card-body d-flex flex-column">
<h5>🧾 Heutige Leistungen</h5>
<form method="POST" action="/patients/<%= patient.id %>/services">
<input
type="text"
id="serviceSearch"
class="form-control mb-2"
placeholder="Leistung suchen…"
/>
<select
name="service_id"
id="serviceSelect"
class="form-select mb-2"
size="5"
required
>
<% services.forEach(s => { %>
<option value="<%= s.id %>">
<%= s.name %> <%= Number(s.price || 0).toFixed(2) %> €
</option>
<% }) %>
</select>
<input
type="number"
name="quantity"
class="form-control mb-2"
value="1"
min="1"
/>
<button class="btn btn-sm btn-success w-100">
Leistung hinzufügen
</button>
</form>
<hr class="my-2" />
<div style="max-height: 320px; overflow-y: auto;">
<% if (!todayServices || todayServices.length === 0) { %>
<p class="text-muted">Noch keine Leistungen für heute.</p>
<% } else { %>
<% todayServices.forEach(ls => { %>
<div class="border rounded p-2 mb-2 bg-light">
<strong><%= ls.name %></strong><br />
Menge: <%= ls.quantity %><br />
Preis: <%= Number(ls.price).toFixed(2) %> €
</div>
<% }) %>
<% } %>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>