<table class="standard-table">
  <thead>
    <tr>
      <th><% loc('User') %></th>
      <th><% loc('Email') %></th>
      <th><% loc('Memberships') %></th>
      <th><% loc('Created') %></th>
      <th></th>
      <th></th>
    </tr>
  </thead>

% while ( my $user = $users->next() ) {
  <tbody>
    <tr class="<% $users->index() % 2 ? 'odd' : 'even' %>">
      <td>
        <a href="<% $user->uri() %>"><% $user->best_name() %></a>
%   if ( $user->username() ne $user->email_address() ) {
        (<% $user->username() %>)
%   }
      </td>
      <td><% $user->email_address() %></td>
      <td><% $user->member_wiki_count() %></td>
      <td><%  loc( '%datetime(%1)', $c->user()->set_time_zone_for_dt( $user->creation_datetime() ) ) %></td>
      <td>
        <strong>
%   if ( $user->is_admin() ) {
<% loc('site admin') %>
% } elsif ( $user->is_system_user() ) {
<% loc('created by system') %>
% } elsif ( $user->is_disabled() ) {
<% loc('disabled') %>
% }
        </strong>
      </td>
      <td>
%   if ( $user->is_disabled() ) {
        <form action="<% $user->uri() %>" method="post">
          <input type="hidden" name="x-tunneled-method" value="PUT" />
          <input type="hidden" name="is_disabled" value="0" />
          <input type="submit" value="<% loc('Enable') %>" />
        </form>
%   }
%   elsif ( ! ( $user->user_id() == $c->user()->user_id() || $user->is_system_user() ) ) {
        <form action="<% $user->uri() %>" method="post">
          <input type="hidden" name="x-tunneled-method" value="PUT" />
          <input type="hidden" name="is_disabled" value="1" />
          <input type="submit" value="<% loc('Disable') %>" />
        </form>
%   }
      </td>
    </tr>
  </tbody>
% }

<& /lib/table/pager.mas,
   index     => $users->index(),
   pager     => $pager,
   uri_maker => sub { site_uri( path => '/users', @_ ) } &>

</table>     

<%args>
$users
$pager
</%args>

<%method title>
All Users
</%method>

<%attr>
sidebar => [ 'admin' ]
</%attr>
