<% if @users.length > 0 %>
<div class="resultsContainer">
<table class="list">
  <tr>
    <th><%= t('activeldap.attributes.user.displayName') %> (<%= t('activeldap.attributes.user.uid') %>)</th>
    <th><%= t('activeldap.attributes.school.displayName') %></th>
    <th><%= t('groups.index.actions') %></th>
  </tr>
  <% @users.each do |user| %>
  <tr>
    <td data-title="Name">
      <% if @owner || @admin.include?(user['school_dn']) %>
      <%= link_to "#{h(user['name'])} (#{h(user['uid'])})", user_path(user['school_id'], user['id']) %>
      <% else %>
      <%= h user['name'] %> (<%= h user['uid'] %>)
      <% end %>
    </td>
    <td data-title="<%= t('activeldap.attributes.school.displayName') %>">
      <%= h @schools[user['school_id']] %>
    </td>
    <td id="member_status_<%= @group.puavoId.to_s %>_<%= user['id'].to_s %>">
      <% if @group.member?(user['id']) %>
        <%= t('.member')%>
      <% else %>
        <%= link_to(t('.add_to_group'),
                    add_user_group_path(school_id: user['school_id'],
                    id: @group.puavoId, user_id: user['id']),
                    remote: true,
                    method: :put,
                    class: 'btn') %>
      <% end %>
    </td>
  </tr>
  <% end %>
</table>
</div>
<% end %>
