{% extends "docbow/base_user.html" %}
{% load i18n %}
{% load render_table from django_tables2 %}
{% load url from future %}

{% block extra_scripts %}
{{ block.super }}
<link rel="stylesheet" href="{{ STATIC_URL }}django_tables2/themes/paleblue/css/screen.css" />
{{ filter_form.media.css }}

{% comment %}
<script type="text/javascript" src="/static/js/listing-delete.js"></script>
{% endcomment %}
{% endblock %}

{% block main-column %}
{% block box_title %}
<h3>{% trans "Documents" %}</h3>
{% endblock %}

<div id="mailbox-table">
  <form method="get" action=".">
    {% if filter_form.non_field_errors %}
      <p>{{ filter_form.non_field_errors }}</p>
    {% endif %}
    {% if filter_form.sort %}{{ filter_form.sort }}{% endif %}
    {% if filter_form.page %}{{ filter_form.page }}{% endif %}
    <p>
      Messages du {{ filter_form.not_before }} au {{ filter_form.not_after }}
      {{ filter_form.not_before.errors }}
      {{ filter_form.not_after.errors }}
      <input type="submit" name="submit" value="Filtrer"/>
      <input type="submit" name="clear" value="Effacer les filtres"/>
    </p>
  </form>
  {% block mailbox.table %}
    {% render_table table "docbow/mailbox_table.html" %}
  {% endblock %}
</div>
{% endblock %}

{% block endscripts %}
{{ filter_form.media.js }}
<script>
  $('.js-mailbox-row').live('click',
    function () {
      var id = $(this).data('id');
      var href = "{% block mailbox.url %}{% endblock %}".replace('99999999', id);
      document.location.href = href;
    });
</script>
{% endblock %}
