140 lines
4.6 KiB
Plaintext
140 lines
4.6 KiB
Plaintext
<%
|
|
// =========================
|
|
// BASISDATEN
|
|
// =========================
|
|
const role = user?.role || null;
|
|
// ✅ Bereich 1: Arzt + Mitarbeiter
|
|
const canDoctorAndStaff = role === "arzt" || role === "mitarbeiter";
|
|
|
|
// Arzt + Mitarbeiter dürfen Patienten bedienen
|
|
const canPatientArea = role === "arzt" || role === "mitarbeiter";
|
|
|
|
const pid = patient && patient.id ? patient.id : null;
|
|
const isActive = patient && patient.active ? true : false;
|
|
const isWaiting = patient && patient.waiting_room ? true : false;
|
|
|
|
const canUsePatient = canPatientArea && !!pid;
|
|
|
|
function lockClass(allowed) {
|
|
return allowed ? "" : "locked";
|
|
}
|
|
|
|
function hrefIfAllowed(allowed, href) {
|
|
return allowed ? href : "#";
|
|
}
|
|
%>
|
|
|
|
<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 -->
|
|
<a href="<%= backUrl || '/patients' %>" class="nav-item">
|
|
<i class="bi bi-arrow-left-circle"></i> Zurück
|
|
</a>
|
|
|
|
<div style="margin:10px 0; border-top:1px solid rgba(255,255,255,0.12);"></div>
|
|
|
|
<!-- =========================
|
|
Rechnungen
|
|
========================= -->
|
|
<a
|
|
href="<%= hrefIfAllowed(canDoctorAndStaff, '/invoices/open') %>"
|
|
class="nav-item <%= active === 'open_invoices' ? 'active' : '' %> <%= lockClass(canDoctorAndStaff) %>"
|
|
title="<%= canDoctorAndStaff ? '' : 'Nur Arzt + Mitarbeiter' %>"
|
|
>
|
|
<i class="bi bi-receipt"></i> <%= t.openinvoices.openinvoices %>
|
|
<% if (!canDoctorAndStaff) { %>
|
|
<span style="margin-left:auto;"><i class="bi bi-lock-fill"></i></span>
|
|
<% } %>
|
|
</a>
|
|
|
|
|
|
<a
|
|
href="<%= hrefIfAllowed(canDoctorAndStaff, '/patients') %>"
|
|
class="nav-item <%= active === 'patients' ? 'active' : '' %> <%= lockClass(canDoctorAndStaff) %>"
|
|
title="<%= canDoctorAndStaff ? '' : 'Nur Arzt + Mitarbeiter' %>"
|
|
>
|
|
<i class="bi bi-people"></i> <%= t.sidebar.patients %>
|
|
<% if (!canDoctorAndStaff) { %>
|
|
<span style="margin-left:auto;"><i class="bi bi-lock-fill"></i></span>
|
|
<% } %>
|
|
</a>
|
|
|
|
<a
|
|
href="<%= hrefIfAllowed(canDoctorAndStaff, '/patients') %>"
|
|
class="nav-item <%= active === 'patients' ? 'active' : '' %> <%= lockClass(canDoctorAndStaff) %>"
|
|
title="<%= canDoctorAndStaff ? '' : 'Nur Arzt + Mitarbeiter' %>"
|
|
>
|
|
<i class="bi bi-people"></i> <%= t.sidebar.patients %>
|
|
<% if (!canDoctorAndStaff) { %>
|
|
<span style="margin-left:auto;"><i class="bi bi-lock-fill"></i></span>
|
|
<% } %>
|
|
</a>
|
|
|
|
<a
|
|
href="<%= hrefIfAllowed(canDoctorAndStaff, '/patients') %>"
|
|
class="nav-item <%= active === 'patients' ? 'active' : '' %> <%= lockClass(canDoctorAndStaff) %>"
|
|
title="<%= canDoctorAndStaff ? '' : 'Nur Arzt + Mitarbeiter' %>"
|
|
>
|
|
<i class="bi bi-people"></i> <%= t.sidebar.patients %>
|
|
<% if (!canDoctorAndStaff) { %>
|
|
<span style="margin-left:auto;"><i class="bi bi-lock-fill"></i></span>
|
|
<% } %>
|
|
</a>
|
|
|
|
|
|
<!-- =========================
|
|
ÜBERSICHT (Dashboard)
|
|
========================= -->
|
|
<a
|
|
href="<%= hrefIfAllowed(canUsePatient, '/patients/' + pid) %>"
|
|
class="nav-item <%= active === 'patient_dashboard' ? 'active' : '' %> <%= lockClass(canUsePatient) %>"
|
|
title="<%= canUsePatient ? '' : 'Bitte zuerst einen Patienten auswählen' %>"
|
|
>
|
|
<i class="bi bi-clipboard2-heart"></i> Übersicht
|
|
<% if (!canUsePatient) { %>
|
|
<span style="margin-left:auto;"><i class="bi bi-lock-fill"></i></span>
|
|
<% } %>
|
|
</a>
|
|
|
|
<!-- =========================
|
|
STATUS TOGGLE
|
|
========================= -->
|
|
<form
|
|
method="POST"
|
|
action="<%= canUsePatient ? (isActive ? '/patients/deactivate/' + pid : '/patients/activate/' + pid) : '#' %>"
|
|
>
|
|
<button
|
|
type="submit"
|
|
class="nav-item <%= lockClass(canUsePatient) %>"
|
|
style="width:100%; border:none; background:transparent; text-align:left;"
|
|
<%= canUsePatient ? '' : 'disabled' %>
|
|
title="<%= canUsePatient ? 'Status wechseln' : 'Bitte zuerst einen Patienten auswählen' %>"
|
|
>
|
|
<% if (isActive) { %>
|
|
<i class="bi bi-x-circle"></i> Patient sperren (Inaktiv)
|
|
<% } else { %>
|
|
<i class="bi bi-check-circle"></i> Patient aktivieren
|
|
<% } %>
|
|
|
|
<% if (!canUsePatient) { %>
|
|
<span style="margin-left:auto;"><i class="bi bi-lock-fill"></i></span>
|
|
<% } %>
|
|
</button>
|
|
</form>
|
|
|
|
<div class="spacer"></div>
|
|
|
|
<!-- ✅ Logout -->
|
|
<a href="/logout" class="nav-item">
|
|
<i class="bi bi-box-arrow-right"></i> Logout
|
|
</a>
|
|
|
|
</div>
|