{% extends "agenda/base_agenda.html" %}

{% load tags %}
{% load i18n %}
{% load mptt_tags %}
{% load staticfiles %}

{% block title %}{{ block.super }} – {% trans "Agenda" %}{% endblock %}

{% block header %}
    <link type="text/css" rel="stylesheet" media="all" href="{% static 'styles/tabledrag.css' %}" />
    <link type="text/css" rel="stylesheet" media="all" href="{% static 'styles/agenda.css' %}" />
    <script type="text/javascript" src="{% static 'javascript/agenda.js' %}"></script>
    <script type="text/javascript" src="{% static 'javascript/jquery.cookie.js' %}"></script>
    {% if perms.agenda.can_manage_agenda %}
        <script type="text/javascript" src="{% static 'javascript/jquery.once.js' %}"></script>

        <script type="text/javascript" src="{% static 'javascript/jquery.tmpl.js' %}"></script>
        <script type="text/javascript" src="{% static 'javascript/tabledrag.js' %}"></script>
        <script type="text/javascript">
        <!--//--><![CDATA[//><!--
        //This is Drupal Code
        jQuery.extend(
          Drupal.settings,
        {
        "tableDrag":
          { "menu-overview":
            { "menu-plid":
              [ { "target": "menu-plid", "source": "menu-mlid", "relationship": "parent", "action": "match", "hidden": true, "limit": 8 } ],
              "menu-weight":
              [ { "target": "menu-weight", "source": "menu-weight", "relationship": "sibling", "action": "order", "hidden": true, "limit": 0 } ]
            }
          }
        });
        //--><!]]>
        </script>
    {% endif %}
{% endblock %}


{% block content %}
   <form action="" method="post">{% csrf_token %}
       {% if perms.agenda.can_manage_agenda %}
       <div id="changed-order-message" style="display:none" class="notification warning">
           <em>{% trans "Do you want to save the changed order of agenda items?" %}<br>
               <input type="submit" value="{% trans 'Yes' %}">
               <input type="button" onclick="window.location.href='{% url item_overview %}';" value="{% trans 'No' %}">
           </em>
       </div>
       {% endif %}

        <h1>{% trans "Agenda" %}</h1>

        <p>
        {% trans "Filter" %}:
        <input type="checkbox" id="hide_closed_items"> {% trans "Hide closed items" %}
        </p>
        {{ items|length }}
        {% blocktrans count counter=items|length %}item{% plural %}items{% endblocktrans %}<span id="hiddencount"></span>
        <table id="menu-overview" class="agendatable">
            <tr>
                <th width="50">{% trans "Done" %}</th>
                <th>{% trans "Item" %}</th>
                {% if perms.agenda.can_manage_agenda %}
                    <th width="200">{% trans "Comment" %}</th>
                {% endif %}
                {% if perms.agenda.can_manage_agenda or perms.projector.can_manage_projector %}
                    <th width="50">{% trans "Actions" %}</th>
                {% endif %}
                {% if perms.agenda.can_manage_agenda %}
                    <th class="tabledrag-hide">{% trans "Weight" %}</th>
                {% endif %}
            </tr>
            <tr class="topline{% if active_sid == 'agenda' %} activeline{% endif %}">
                <td></td>
                <td>
                    <strong>{% trans "Agenda" %}</strong>
                </td>
                {% if perms.agenda.can_manage_agenda %}
                <td></td>
                {% endif %}
                {% if perms.agenda.can_manage_agenda or perms.projector.can_manage_projector %}
                <td>
                {% if perms.projector.can_manage_projector %}
                    <span>
                        <a class="activate_link{% if active_sid == 'agenda' %} active{% endif %}" href="{% url projector_activate_slide 'agenda' %}" title="{% trans 'Activate item' %}">
                            <span></span>
                        </a>
                    </span>
                {% endif %}
                </td>
                {% endif %}
            </tr>
        {% if items %}
            {% for item in items %}
            <tr class="itemline draggable{% cycle ' odd' '' %}{% if item.active %} activeline{% endif %}">
                {% include "agenda/item_row.html" %}
            </tr>
            {% endfor %}
        {% else %}
            <tr>
                <td colspan="4"><i>{% trans "No items available." %}</i></td>
            </tr>
        {% endif %}
        </table>
    </form>
{% endblock %}
