<% define_admin_breadcrumbs do %>
  <% add_admin_breadcrumb('云上实验室', admins_laboratories_path) %>
  <% add_admin_breadcrumb("#{current_laboratory.name} - 实训项目") %>
<% end %>


<div class="box search-form-container laboratory-shixun-list-form">
  <%= form_tag(admins_laboratory_laboratory_shixuns_path(current_laboratory), method: :get, class: 'form-inline search-form', remote: true) do %>
    <div class="form-group mr-1">
      <label for="status">状态：</label>
      <% status_options = [['全部', ''], ['编辑中', 0], ['审核中', 1], ['已发布', 2], ['已关闭', 3]] %>
      <%= select_tag(:status, options_for_select(status_options), class: 'form-control') %>
    </div>

    <div class="form-group mr-4">
      <label for="status">技术平台：</label>
      <%= select_tag(:tag_id, options_for_select(MirrorRepository.pluck(:type_name,:id).unshift(['']), params[:tag_id]), class: 'form-control') %>
    </div>

    <%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-12 col-md-2 mr-3', placeholder: '创建者/实训名称检索') %>

    <div class="form-check mr-2">
      <%= hidden_field_tag(:homepage, false, id:'') %>
      <%= check_box_tag(:homepage, true, params[:homepage].to_s == 'true', class: 'form-check-input') %>
      <label class="form-check-label" for="homepage">只看首页展示</label>
    </div>

    <div class="form-check mr-2">
      <%= hidden_field_tag(:ownership, false, id:'') %>
      <%= check_box_tag(:ownership, true, params[:ownership].to_s == 'true', class: 'form-check-input') %>
      <label class="form-check-label" for="ownership">只看自建</label>
    </div>

    <%= submit_tag('搜索', class: 'btn btn-primary ml-3', 'data-disable-with': '搜索中...') %>
    <%= link_to '清空', admins_laboratory_laboratory_shixuns_path(current_laboratory), class: 'btn btn-default','data-disable-with': '清空中...' %>
  <% end %>

  <%= javascript_void_link('添加实训', class: 'btn btn-primary', data: { toggle: 'modal', target: '.admin-add-laboratory-shixun-modal' }) %>
</div>

<div class="box admin-list-container laboratory-shixun-list-container" data-id="<%= current_laboratory.id %>">
  <%= render partial: 'admins/laboratory_shixuns/shared/list', locals: { laboratory_shixuns: @laboratory_shixuns } %>
</div>

<%= render partial: 'admins/laboratory_shixuns/shared/add_laboratory_shixun_modal' %>