<table class="table table-hover laboratory-user-list-table">
  <thead class="thead-light">
  <tr>
    <th width="8%">头像</th>
    <th width="12%" class="text-left">真实姓名</th>
    <th width="20%">邮件地址</th>
    <th width="20%">手机号码</th>
    <th width="30%">单位部门</th>
    <th width="10%">操作</th>
  </tr>
  </thead>
  <tbody>
  <% if laboratory_users.present? %>
    <% laboratory_users.each do |laboratory_user| %>
      <% user = laboratory_user.user %>
      <tr class="laboratory-user-item-<%= laboratory_user.id %>">
        <td class="text-left">
          <%= link_to "/users/#{user.login}", target: '_blank' do %>
            <img src="/images/<%= url_to_avatar(user) %>" class="rounded-circle" width="40" height="40" />
          <% end %>
        </td>
        <td class="text-left">
          <%= link_to "/users/#{user.login}", target: '_blank' do %>
            <%= overflow_hidden_span user.real_name, width: 100 %>
          <% end %>
        </td>
        <td><%= overflow_hidden_span display_text(user.mail), width: 150 %></td>
        <td><%= overflow_hidden_span display_text(user.phone), width: 100 %></td>
        <td><%= [user.school_name.presence, user.department_name.presence].compact.join('-') %></td>
        <td class="action-container">
          <% if current_user.id != laboratory_user.user_id %>
            <%= delete_link '删除', cooperative_laboratory_user_path(laboratory_user, element: ".laboratory-user-item-#{laboratory_user.id}"), class: 'delete-laboratory-user-action' %>
          <% end %>
        </td>
      </tr>
    <% end %>
  <% else %>
    <%= render 'cooperative/shared/no_data_for_table' %>
  <% end %>
  </tbody>
</table>

<%= render partial: 'cooperative/shared/paginate', locals: { objects: laboratory_users } %>