<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table class="table table-hover table-bordered">
<thead>
<tr>
<th><%= _('Name') %> <%= paginable_sort_link('firstname') %></th>
<th><%= _('Email') %> <%= paginable_sort_link('email') %></th>
<th class="text-center"><%= _('Last activity') %> <%= paginable_sort_link('last_sign_in_at') %></th>
<th class="text-center sorter-false"><%= _('Plans') %></th>
<th class="text-center sorter-false"><%= _('Current Privileges') %></th>
<th class="text-center sorter-false"><%= _('Edit Privileges') %></th>
</tr>
</thead>
<tbody>
<% scope.each do |user| %>
<% if !user.nil? then%>
<tr>
<td>
<% if !user.name.nil? %>
<%= user.name(false) %>
<% end %>
</td>
<td>
<%= user.email %>
</td>
<td class="text-center">
<% if !user.last_sign_in_at.nil? %>
<%= l user.last_sign_in_at.to_date, :formats => :short %>
<% end %>
</td>
<td class="text-center">
<% unless user.roles.nil? %>
<%= user.roles.where(Role.not_reviewer_condition).length %>
<% end %>
</td>
<%# The content of this column get updated through AJAX whenever the permission for an user are updated %>
<td class="text-center" data-descriptor="current_privileges">
<%= render partial: 'users/current_privileges', locals: { user: user } %>
</td>
<td class="text-center">
<%# Do not allow a user to change their own permissions or a super admin's permissions if they are not a super admin %>
<% unless current_user == user ||
!current_user.can_super_admin? && user.can_super_admin? %>
<% b_label = _('Edit') %>
<%= link_to( b_label, admin_grant_permissions_user_path(user)) %>
<% end %>
</td>
</tr>
<% end %>
<% end %>
</tbody>
</table>
<div id="modal-permissions" class="modal" tabindex="-1" role="dialog"></div>
</div>
</div>
</div>