<% school = laboratory.school %>
<td><%= list_index_no((params[:page] || 1).to_i, index) %></td>
<td class="text-left"><%= school&.name || 'EduCoder主站' %></td>
<td class="text-left">
  <% if laboratory.identifier %>
    <%= link_to laboratory.site, "https://#{laboratory.site}", target: '_blank'  %>
  <% else %>
    --
  <% end %>
</td>
<td>
  <% if school && school.identifier.present? %>
    <%= link_to school.identifier.to_s, "/colleges/#{school.identifier}/statistics", target: '_blank' %>
  <% else %>
    --
  <% end %>
</td>
<td class="member-container">
  <div class="laboratory-user">
    <% laboratory.users.each do |user| %>
    <span class="laboratory-user-item laboratory-user-item-<%= user.id %>">
      <%= link_to user.real_name, "/users/#{user.login}", target: '_blank', data: { toggle: 'tooltip', title: '个人主页' } %>
      <%= link_to(admins_laboratory_laboratory_user_path(laboratory, user_id: user.id),
                  method: :delete, remote: true, class: 'ml-1 delete-laboratory-user-action',
                  data: { confirm: '确认删除吗？' }) do %>
        <i class="fa fa-close"></i>
      <% end %>
    </span>
    <% end %>
  </div>
</td>
<td><%= laboratory.created_at.strftime('%Y-%m-%d %H:%M') %></td>
<td>
  <% if school.present? && laboratory.id != 1 %>
    <%= check_box_tag :sync_course,!laboratory.sync_course,laboratory.sync_course,remote:true,data:{id:laboratory.id},class:"laboratory-sync-form" %>
  <% end %>
</td>
<td>
  <% if school.present? && laboratory.id != 1 %>
    <%= check_box_tag :sync_subject,!laboratory.sync_subject,laboratory.sync_subject,remote:true,data:{id:laboratory.id},class:"laboratory-sync-form" %>
  <% end %>
</td>
<td>
  <% if school.present? && laboratory.id != 1 %>
    <%= check_box_tag :sync_shixun,!laboratory.sync_shixun,laboratory.sync_shixun,remote:true,data:{id:laboratory.id},class:"laboratory-sync-form" %>
  <% end %>
</td>
<td class="action-container">
  <%= link_to '定制', admins_laboratory_laboratory_setting_path(laboratory), class: 'action' %>

  <% if school.present? && laboratory.id != 1 %>
    <%= javascript_void_link '添加管理员', class: 'action', data: { laboratory_id: laboratory.id, toggle: 'modal', target: '.admin-add-laboratory-user-modal' } %>
    <%= link_to '同步用户', synchronize_user_admins_laboratory_path(laboratory), remote: true, data: { confirm: '确认同步该单位下的所有用户到云上实验室吗？' }, class: 'action' %>
<% end %>

  <div class="d-inline">
    <%= javascript_void_link('更多', class: 'action dropdown-toggle', 'data-toggle': 'dropdown', 'aria-haspopup': true, 'aria-expanded': false) %>
    <div class="dropdown-menu more-action-dropdown">
      <%= link_to '轮播图', admins_laboratory_carousels_path(laboratory), class: 'dropdown-item' %>

      <%= link_to '查看实训项目', admins_laboratory_laboratory_shixuns_path(laboratory), class: 'dropdown-item' %>
      <%= link_to '查看实践课程', admins_laboratory_laboratory_subjects_path(laboratory), class: 'dropdown-item' %>

      <% if school.present? && laboratory.id != 1 %>
        <%= delete_link '删除', admins_laboratory_path(laboratory, element: ".laboratory-item-#{laboratory.id}"), class: 'dropdown-item delete-laboratory-action' %>
      <% end %>
    </div>
  </div>
</td>