[% WRAPPER layout.tt title="Users" %]
[% PROCESS common.tt %]

<table class="table table-striped table-condensed clickable-rows">
  <thead>
    <tr>
      <th>User name</th>
      <th>Name</th>
      <th>Email</th>
      <th>Roles</th>
      <th>Eval. notifications</th>
    </tr>
  </thead>
  <tbody>
    [% FOREACH u IN users %]
      <tr>
        <td><a class="row-link" href="[% c.uri_for(c.controller('User').action_for('edit'), [u.username]) %]">[% HTML.escape(u.username) %]</a></td>
        <td>[% HTML.escape(u.fullname) %]</td>
        <td>[% HTML.escape(u.emailaddress) %]</td>
        <td>[% FOREACH r IN u.userroles %]<i>[% r.role %]</i> [% END %]</td>
        <td>[% IF u.emailonerror %]Yes[% ELSE %]No[% END %]</td>
      </tr>
    [% END %]
  </tbody>
</table>

<a class="btn btn-primary" href="[% c.uri_for(c.controller('Root').action_for('register')) %]">
  <i class="fas fa-plus"></i> Add a new user
</a>

[% END %]