{{>header}}
<script type="text/javascript">
$(document).ready(function(){
    $('.backtrace').click(function() {
        $(this).next().toggle();
        return false;
    });
});
function retry_all(){
    if(confirm('Are you sure you want to retry all?')){
        window.location.href = '/failed/retry_all/';
    }
}
function delete_all(){
    if(confirm('Are you sure you want to delete all?')){
        window.location.href = '/failed/delete_all';
    }

}
</script>
<h1>Failed Jobs</h1>
<div class="buttons"><button onclick='retry_all()'>retry all</button> <button onclick='delete_all()'>delete all</button></div>
<p class='sub'>Showing {{start}} to {{end}} of <b>{{size}}</b> jobs</p>
<ul class='pagination'>
{{#pagination}}
      <li>
          {{#current}}<a href='{{link}}'>{{/current}}{{link_name}}{{#current}}</a>{{/current}}
      </li>
  {{/pagination}}
 </ul>
<ul class='failed'>
    {{#failed_jobs}}
    <li>
      <dl>
        <dt>Worker</dt>
        <dd>
            <a href="{{worker_url}}">{{worker}}</a> on <b class='queue-tag'>{{queue}}</b > at <b>
            <span class="time">{{failed_at}}</span></b>
        </dd>
        <dt>Class</dt>
        <dd><code>{{payload_class}}</code></dd>
        <dt>Arguments</dt>
        <dd><pre>{{payload_args}}</pre></dd>
        <dt>Exception</dt>
        <dd><pre>{{exception}}</pre></dd>
        <dt>Error</dt>
        <dd>
          <a href="#" class="backtrace">{{error}}</a>
          <pre style='display:none'>{{traceback}}</pre>
        </dd>
		<dt>
		  Payload Actions
		</dt>
		<dd>
			<form action="/failed/retry/" method="post" accept-charset="utf-8">
				<p><input type="hidden" name="failed_job" value="{{redis_value}}" id="failed_job" />
				<p><input type="submit" value="Requeue" /></p>
			</form>
			<form action="/failed/delete/" method="post" accept-charset="utf-8">
				<p><input type="hidden" name="failed_job" value="{{redis_value}}" id="failed_job" />
				<p><input type="submit" value="Delete" /></p>
			</form>
		</dd>
      </dl>
      <div class='r'>
      </div>
    </li>
  {{/failed_jobs}}
</ul>

{{>footer}}
