128 lines
4.8 KiB
Plaintext
128 lines
4.8 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' %>"
|
||
<% if (!canDoctorAndStaff) { %>data-locked="Kein Zugriff – nur für Ärzte und 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, '/invoices/cancelled') %>"
|
||
class="nav-item <%= active === 'cancelled_invoices' ? 'active' : '' %> <%= lockClass(canDoctorAndStaff) %>"
|
||
title="<%= canDoctorAndStaff ? '' : 'Nur Arzt + Mitarbeiter' %>"
|
||
<% if (!canDoctorAndStaff) { %>data-locked="Kein Zugriff – nur für Ärzte und Mitarbeiter"<% } %>
|
||
>
|
||
<i class="bi bi-people"></i> <%= t.openinvoices.canceledinvoices %>
|
||
<% if (!canDoctorAndStaff) { %>
|
||
<span style="margin-left:auto;"><i class="bi bi-lock-fill"></i></span>
|
||
<% } %>
|
||
</a>
|
||
|
||
<a
|
||
href="<%= hrefIfAllowed(canDoctorAndStaff, '/reportview') %>"
|
||
class="nav-item <%= active === 'reportview' ? 'active' : '' %> <%= lockClass(canDoctorAndStaff) %>"
|
||
title="<%= canDoctorAndStaff ? '' : 'Nur Arzt + Mitarbeiter' %>"
|
||
<% if (!canDoctorAndStaff) { %>data-locked="Kein Zugriff – nur für Ärzte und Mitarbeiter"<% } %>
|
||
>
|
||
<i class="bi bi-people"></i> <%= t.openinvoices.report %>
|
||
<% if (!canDoctorAndStaff) { %>
|
||
<span style="margin-left:auto;"><i class="bi bi-lock-fill"></i></span>
|
||
<% } %>
|
||
</a>
|
||
|
||
<a
|
||
href="<%= hrefIfAllowed(canDoctorAndStaff, '/invoices/paid') %>"
|
||
class="nav-item <%= active === 'paid' ? 'active' : '' %> <%= lockClass(canDoctorAndStaff) %>"
|
||
title="<%= canDoctorAndStaff ? '' : 'Nur Arzt + Mitarbeiter' %>"
|
||
<% if (!canDoctorAndStaff) { %>data-locked="Kein Zugriff – nur für Ärzte und Mitarbeiter"<% } %>
|
||
>
|
||
<i class="bi bi-people"></i> <%= t.openinvoices.payedinvoices %>
|
||
<% if (!canDoctorAndStaff) { %>
|
||
<span style="margin-left:auto;"><i class="bi bi-lock-fill"></i></span>
|
||
<% } %>
|
||
</a>
|
||
|
||
<a
|
||
href="<%= hrefIfAllowed(canDoctorAndStaff, '/invoices/credit-overview') %>"
|
||
class="nav-item <%= active === 'credit-overview' ? 'active' : '' %> <%= lockClass(canDoctorAndStaff) %>"
|
||
title="<%= canDoctorAndStaff ? '' : 'Nur Arzt + Mitarbeiter' %>"
|
||
<% if (!canDoctorAndStaff) { %>data-locked="Kein Zugriff – nur für Ärzte und Mitarbeiter"<% } %>
|
||
>
|
||
<i class="bi bi-people"></i> <%= t.openinvoices.creditoverview %>
|
||
<% if (!canDoctorAndStaff) { %>
|
||
<span style="margin-left:auto;"><i class="bi bi-lock-fill"></i></span>
|
||
<% } %>
|
||
</a>
|
||
|
||
<div class="spacer"></div>
|
||
|
||
<!-- ✅ Logout -->
|
||
<a href="/logout" class="nav-item">
|
||
<i class="bi bi-box-arrow-right"></i> Logout
|
||
</a>
|
||
|
||
</div>
|
||
|
||
<!-- ✅ Kein-Zugriff Toast (wird von /js/sidebar-lock.js gesteuert) -->
|
||
<div class="position-fixed top-0 start-50 translate-middle-x p-3" style="z-index:9999; margin-top:16px;">
|
||
<div id="lockToast" class="toast align-items-center text-bg-danger border-0" role="alert" aria-live="assertive">
|
||
<div class="d-flex">
|
||
<div class="toast-body d-flex align-items-center gap-2">
|
||
<i class="bi bi-lock-fill"></i>
|
||
<span id="lockToastMsg">Kein Zugriff</span>
|
||
</div>
|
||
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast"></button>
|
||
</div>
|
||
</div>
|
||
</div>
|