<%- include("../../views/layout", {
  title: "Benutzerverwaltung",
  body: `
<h1>Benutzerverwaltung</h1>

<table class="table table-striped">
  <thead>
    <tr>
      <th>ID</th>
      <th>Benutzername</th>
      <th>Rolle zuweisen</th>
    </tr>
  </thead>
  <tbody>
    ${users
      .map(
        (u) => `
      <tr>
        <td>${u.id}</td>
        <td>${u.username}</td>
        <td>
          <form method="POST" action="/admin/users/assign-role" class="d-flex gap-2">
            <input type="hidden" name="userId" value="${u.id}">
            <select name="roleId" class="form-select">
              ${roles.map((r) => `<option value="${r.id}">${r.name}</option>`).join("")}
            </select>
            <button class="btn btn-primary btn-sm">Zuweisen</button>
          </form>
        </td>
      </tr>
    `
      )
      .join("")}
  </tbody>
</table>
` }) %>
