<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%">副标题</th>
    <th width="20%"><%= sort_tag('是否置顶', name: 'is_top', path: admins_system_notifications_path) %></th>
    <th width="20%"><%= sort_tag('创建时间', name: 'created_at', path: admins_system_notifications_path) %></th>
    <th width="25%">操作</th>
  </tr>
  </thead>
  <tbody>
  <% if notifications.present? %>
    <% notifications.each_with_index do |notification, index| %>
      <tr class="system-notification-item-<%= notification.id %>">
        <td><%= list_index_no((params[:page] || 1).to_i, index) %></td>
        <td><%= notification.subject %></td>
        <td><%= notification.sub_subject %></td>
        <td class="notification_is_top"><%= notification.is_top ? '√' : '' %></td>
        <td><%= notification.created_at&.strftime('%Y-%m-%d %H:%M') %></td>
        <td class="action-container">
        <%= javascript_void_link '置顶', class: 'action unclose-action', data: { id: notification.id }, style: notification.is_top ? 'display: none;' : '' %>
        <%= javascript_void_link '取消置顶', class: 'action close-action', data: { id: notification.id }, style: notification.is_top ? '' : 'display: none;' %>
        <%= link_to "编辑", edit_admins_system_notification_path(notification), remote: true, class: "action" %>
        <%= link_to "删除", admins_system_notification_path(notification), 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: notifications } %>