{% 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 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>Fiche(s) {% if valid == "1" %}<b>validées</b>{% else %}{% if valid != "2" %}<b>non validées</b>{% endif %}{% endif %}
    pour l'organisation <b>{{ orga_name }}</b> : {{nb_sheets}} fiche(s)</p>
    {% if valid != "2" %}
    <div id="count_nav_top">
        <p><a href="{% url hdabo.views.list_for_orga orga_id=orga_id valid=valid start_index=0 %}">&lt;&lt;</a>&nbsp;&nbsp;
           <a href="{% url hdabo.views.list_for_orga orga_id=orga_id valid=valid start_index=prev_index %}">&lt;</a>&nbsp;&nbsp;
           {{displayed_index}}/{{nb_sheets}}&nbsp;&nbsp;
           <a href="{% url hdabo.views.list_for_orga orga_id=orga_id valid=valid start_index=next_index %}">&gt;</a>&nbsp;&nbsp;
           <a href="{% url hdabo.views.list_for_orga orga_id=orga_id valid=valid start_index=last_index %}">&gt;&gt;</a></p>
    </div>
    {% endif %}
    <table>
    {% for ds in datasheets %}
    <tr class="imageline {% cycle 'hdabosimpleevenline' 'hdabosimpleoddline' %}"><td>
    {% include "partial/one_sheet.html" %}
    </td></tr>
    {% endfor %}
    </table>
    {% if valid != "2" %}
    <div id="count_nav_bottom">
        <p><a href="{% url hdabo.views.list_for_orga orga_id=orga_id valid=valid start_index=0 %}">&lt;&lt;</a>&nbsp;&nbsp;
           <a href="{% url hdabo.views.list_for_orga orga_id=orga_id valid=valid start_index=prev_index %}">&lt;</a>&nbsp;&nbsp;
           {{displayed_index}}/{{nb_sheets}}&nbsp;&nbsp;
           <a href="{% url hdabo.views.list_for_orga orga_id=orga_id valid=valid start_index=next_index %}">&gt;</a>&nbsp;&nbsp;
           <a href="{% url hdabo.views.list_for_orga orga_id=orga_id valid=valid start_index=last_index %}">&gt;&gt;</a></p>
    </div>
    {% endif %}
    {% endblock %}
