{% extends "hdabo_base.html" %}
{% load static %}
    {% block title %}HDA - BO : Fiches pour {{ orga_name }}{% endblock %}

    {% block js_import %}
    {{block.super}}
    <script type="text/javascript" src="{% static 'hdabo/js/jquery.tablednd_0_5.js' %}"></script>
    <script type="text/javascript" src="{% static 'hdabo/js/jquery-ui.min.js' %}"></script>
    <script type="text/javascript" src="{% static 'hdabo/js/jquery.jeditable.js' %}"></script>
    {% endblock %}
    
    {% block js_declaration %}
    {{block.super}}
    {% if valid != "2" %}
    <script type="text/javascript">
    
    var global_csrf_token = "{{ csrf_token }}";
    var static_url = "{% static '' %}";
    var tag_up_down_url = "{% url 'hdabo.views.tag_up_down' %}";
    var remove_tag_from_list_url = "{% url 'hdabo.views.remove_tag_from_list' %}";
    var modify_tag_url = "{% url 'hdabo.views.modify_tag_datasheet' %}";
    var reset_wp_info_url = "{% url 'hdabo.views.reset_wikipedia_info' %}";
    var reorder_tag_datasheet_url = "{% url 'hdabo.views.reorder_tag_datasheet' %}";
    var add_tag_url = "{% url 'hdabo.views.add_tag' %}";
    var remove_wp_link_url = "{% url 'hdabo.views.remove_wp_link' %}";
    var validate_datasheet_url = "{% url 'hdabo.views.validate_datasheet' %}";
    var update_tag_alias_url = "{% url 'hdabo.views.update_tag_alias' %}";
    var update_tag_category_url = "{% url 'hdabo.views.update_tag_category' %}";
    var categories_list = '{{categories|safe}}';
    
    $(document).ready(function(){
        init_tags_events();
        init_datasheet_events();
    });
    </script>
    {% endif %}
    {% endblock %}

    {% block css_import %}
    {{block.super}}
    <link rel="stylesheet" href="{% static 'hdabo/css/smoothness/jquery-ui-1.8.13.custom.css' %}" type="text/css"/>
    {% endblock %}

    {% block css_declaration %}
    {{block.super}}
    <style type="text/css">
    .ui-autocomplete {
        max-height: 100px;
        overflow-y: auto;
        /* prevent horizontal scrollbar */
        overflow-x: hidden;
        /* add padding to account for vertical scrollbar */
        padding-right: 20px;
    }
    </style>
    {% endblock %}
    
    
    {% block content %}
    {{block.super}}
    <p>
    {% if tag %} Fiche(s) concernées par le tag <b>{{ tag.label }}</b>
    {% else %} Fiche(s) {% if valid %}<b>validées</b>{% else %}<b>non validées</b>{% endif %} pour l'organisation <b>{{ orga_name }}</b>
    {% endif %} : {{nb_sheets}} fiche(s)</p>
    <div id="count_nav_top">
        <p><a href="{% url 'hdabo.views.display_datasheet' ds_id=zero_id %}?{% if tag %}tag={{tag.id}}{% endif %}&nb_sheets={{nb_sheets}}&index=0">&lt;&lt;</a>&nbsp;&nbsp;
           <a href="{% url 'hdabo.views.display_datasheet' ds_id=prev_id%}?{% if tag %}tag={{tag.id}}{% endif %}&nb_sheets={{nb_sheets}}&index={{prev_index}}">&lt;</a>&nbsp;&nbsp;
           {{displayed_index}}/{{nb_sheets}}&nbsp;&nbsp;
           <a href="{% url 'hdabo.views.display_datasheet' ds_id=next_id%}?{% if tag %}tag={{tag.id}}{% endif %}&nb_sheets={{nb_sheets}}&index={{next_index}}">&gt;</a>&nbsp;&nbsp;
           <a href="{% url 'hdabo.views.display_datasheet' ds_id=last_id%}?{% if tag %}tag={{tag.id}}{% endif %}&nb_sheets={{nb_sheets}}&index={{last_index}}">&gt;&gt;</a></p>
    </div>
    <table>
    <tr class="imageline {% cycle 'hdabosimpleevenline' 'hdabosimpleoddline' %}"><td>
    {% include "partial/one_sheet.html" %}
    </td></tr>
    </table>
    <div id="count_nav_bottom">
        <p><a href="{% url 'hdabo.views.display_datasheet' ds_id=zero_id %}?{% if tag %}tag={{tag.id}}{% endif %}&nb_sheets={{nb_sheets}}&index=0">&lt;&lt;</a>&nbsp;&nbsp;
           <a href="{% url 'hdabo.views.display_datasheet' ds_id=prev_id%}?{% if tag %}tag={{tag.id}}{% endif %}&nb_sheets={{nb_sheets}}&index={{prev_index}}">&lt;</a>&nbsp;&nbsp;
           {{displayed_index}}/{{nb_sheets}}&nbsp;&nbsp;
           <a href="{% url 'hdabo.views.display_datasheet' ds_id=next_id%}?{% if tag %}tag={{tag.id}}{% endif %}&nb_sheets={{nb_sheets}}&index={{next_index}}">&gt;</a>&nbsp;&nbsp;
           <a href="{% url 'hdabo.views.display_datasheet' ds_id=last_id%}?{% if tag %}tag={{tag.id}}{% endif %}&nb_sheets={{nb_sheets}}&index={{last_index}}">&gt;&gt;</a></p>
    </div>
    {% endblock %}
