<!-- KEIN layout, KEINE sidebar, KEIN main -->

<%- include("partials/page-header", {
  user,
  title: t.dashboard.title,
  subtitle: "",
  showUserName: true,
  hideDashboardButton: true
}) %>

<div class="content p-4">

  <%- include("partials/flash") %>

  <div class="waiting-monitor">
    <h5 class="mb-3">🪑 <%= t.dashboard.waitingRoom %></h5>

    <div class="waiting-grid">
      <% if (waitingPatients && waitingPatients.length > 0) { %>
        <% waitingPatients.forEach(p => { %>

          <% if (user.role === "arzt") { %>
            <form method="POST" action="/patients/<%= p.id %>/call">
              <button class="waiting-slot occupied clickable">
                <div><%= p.firstname %> <%= p.lastname %></div>
              </button>
            </form>
          <% } else { %>
            <div class="waiting-slot occupied">
              <div><%= p.firstname %> <%= p.lastname %></div>
            </div>
          <% } %>

        <% }) %>
      <% } else { %>
        <div class="text-muted">
          <%= t.dashboard.noWaitingPatients %>
        </div>
      <% } %>
    </div>
  </div>

</div>
