<% url = "#{x.root_path}scheduled" %>
<header class="row">
  <div class="col-sm-5">
    <h3><%= x.t("ScheduledJobs") %></h3>
  </div>
  <% if scheduled.size > 0 && total_size > count %>
    <div class="col-sm-4">
      <%= ecr "_paging" %>
    </div>
  <% end %>
  <%= x.filtering("scheduled") %>
</header>

<% if scheduled.size > 0 %>

  <form action="<%= x.root_path %>scheduled" method="post">
    <%= x.csrf_tag %>
    <div class="table_container">
      <table class="table table-striped table-bordered table-white">
        <thead>
          <tr>
            <th width="20px">
              <input type="checkbox" class="check_all" />
            </th>
            <th><%= x.t("When") %></th>
            <th><%= x.t("Queue") %></th>
            <th><%= x.t("Job") %></th>
            <th><%= x.t("Arguments") %></th>
          </tr>
        </thead>
        <% scheduled.each do |entry| %>
          <tr>
            <td>
              <input type="checkbox" name="key[]" value="<%= x.job_params(entry, entry.score) %>" />
            </td>
            <td>
               <a href="<%= x.root_path %>scheduled/<%= x.job_params(entry, entry.score) %>"><%= x.relative_time(entry.at) %></a>
            </td>
            <td>
              <a href="<%= x.root_path %>queues/<%= entry.queue %>"><%= entry.queue %></a>
            </td>
            <td><%= entry.display_class %></td>
            <td>
               <div class="args"><%= x.display_args(entry.display_args) %></div>
            </td>
          </tr>
        <% end %>
      </table>
    </div>
    <input class="btn btn-danger pull-right" type="submit" name="delete" value="<%= x.t("Delete") %>" />
    <input class="btn btn-danger pull-right" type="submit" name="add_to_queue" value="<%= x.t("AddToQueue") %>" />
  </form>
<% else %>
  <div class="alert alert-success"><%= x.t("NoScheduledFound") %></div>
<% end %>
