<% define_admin_breadcrumbs do %>
  <% add_admin_breadcrumb('项目列表') %>
<% end %>

<div class="box search-form-container project-list-form">
  <%= form_tag(admins_projects_path, method: :get, class: 'form-inline search-form flex-1', id: 'project-list-form', remote: true) do %>
    <%= text_field_tag(:search, params[:search], class: 'form-control col-12 col-md-2 mr-3', placeholder: '项目ID/项目名称/标识检索') %>
    <%= submit_tag('搜索', class: 'btn btn-primary ml-3', 'data-disable-with': '搜索中...') %>
    <input type="reset" class="btn btn-secondary clear-btn" value="清空"/>

    <%= link_to '导出', export_admins_projects_path(format: :xlsx), class: 'btn btn-outline-primary export-action', style:'margin-left:50px;',:target => '_blank' %>

    <div class="form-group mr-2 pull-right" style='margin-left:auto'>
      <label for="status">项目类别：</label>
      <% type_options = [['全部项目', ''], ['公开项目', 'public'], ['私有项目', 'private'], ['Fork项目', 'fork'], ['原创项目', 'original']] %>
      <%= select_tag(:category, options_for_select(type_options, params[:category]), class: 'form-control', id: 'project-category') %>
    </div>
  <% end %>
</div>

<div class="box admin-list-container project-list-container">
  <%= render partial: 'admins/projects/shared/list', locals: { projects: @projects } %>
</div>

<div id="projects-modals">
</div>

<script>
  $("#project-category").on('change', function() {
    $("#project-list-form").submit()
  });
</script>