<table class="table table-hover text-center subject-list-table">
  <thead class="thead-light">
  <tr>
    <th width="5%">序号</th>
    <th width="30%">岗位标题</th>
    <th width="20%"><%= sort_tag('是否上架', name: 'is_top', path: admins_recruitments_path) %></th>
    <th width="20%"><%= sort_tag('创建时间', name: 'created_at', path: admins_recruitments_path) %></th>
    <th width="25%">操作</th>
  </tr>
  </thead>
  <tbody>
  <% if recruitments.present? %>
    <% recruitments.each_with_index do |recruitment, index| %>
      <tr class="recruitment-item-<%= recruitment.id %>">
        <td><%= list_index_no((params[:page] || 1).to_i, index) %></td>
        <td><%= recruitment.title %></td>
        <td class="recruitment_is_public"><%= recruitment.is_public ? '√' : '' %></td>
        <td><%= recruitment.created_at&.strftime('%Y-%m-%d %H:%M') %></td>
        <td class="action-container">
        <%= javascript_void_link '上架', class: 'action unclose-action', data: { id: recruitment.id }, style: recruitment.is_public ? 'display: none;' : '' %>
        <%= javascript_void_link '取消上架', class: 'action close-action', data: { id: recruitment.id }, style: recruitment.is_public ? '' : 'display: none;' %>
        <%= link_to "编辑", edit_admins_recruitment_path(recruitment), remote: true, class: "action" %>
        <%= link_to "删除", admins_recruitment_path(recruitment), method: :delete, data:{confirm: "确认删除的吗？"}, class: "action" %>
        </td>
      </tr>
    <% end %>
  <% else %>
    <%= render 'admins/shared/no_data_for_table' %>
  <% end %>
  </tbody>
</table>

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