{% extends 'pirati_cz.html' %}

{%block body%}
<div class="row">
  <div class="medium-12 large-12 columns">
    <section class="o-section o-section--spaceBot">
      <div class="o-section-inner">
        <div class="o-section-block">
          <h2>Seznam dostupných newsletterů{% if 'add_news_list' in actions %}<small>(<a href="{% url 'nalodeni:news_list_create'%}">nový</a>)</small>{%endif%}</h2>
          <br/>
          {% if newsletters|length > 0 %}
          <form action="/news/update/" method="POST">
          {%csrf_token%}
          <table class="table-list">
              <tr>
                  {%comment%}<th><!--<input type="checkbox" name="r[]" value="all"/>--></th>{%endcomment%}
                  <th>Název</th>
                  <th>Perioda</th>
                  <th>Popis</th>
                  {% if 'news_list_details' in actions %}
                  <th>Správce</th>
                  <th>Rozesílatelé</th>
                  <th>Odběratelů</th>
                  <th>Aktivní</th>
                  {%endif%}
                  {% if 'news_list_actions' in actions %}
                  <th>Akce</th>
                  {%endif%}
              </tr>
              {% for nl in newsletters %}
              <tr>
                  {%comment%}<td><input type="checkbox" name="r[]" value="{{nl.id}}"/></td>{%endcomment%}
                  <td><a href="{% url 'nalodeni:news_list_show' nl.id %}">{{nl.name}}</a>
                  <td>{{nl.get_period_display}}</td>
                  <td>{{nl.desc}}</td>
                  {% if 'news_list_details' in actions %}
                  <td>{{nl.managed_by}}</td>
                  <td>{% for u in nl.sent_by.all %}{{u}}<br/>{%endfor%}</td>
                  <td>{{nl.get_recip_users_count}}</td>
                  <td>{% if nl.enabled %}ano{%else%}ne{%endif%}</td>
                  {%endif%}
                  {% if 'news_list_actions' in actions %}
                  <td><a href="{% url 'nalodeni:news_list_edit' nl.id %}">Upravit</a>
                  {%endif%}
                  </td>
              </tr>
              {% endfor %}
          </table>
          {%comment%}<button name="setStatus" value="new" class="button">Nastavit stav 'nový'</button>{%endcomment%}
          </form>
          {%else%}
          <em>Žádné položky</em>
          {%endif%}
        </div>
      </div>
    </section>
  </div>
</div>

<div class="row">
  <div class="medium-12 large-12 columns">
    <section class="o-section o-section--spaceBot">
      <div class="o-section-inner">
      &nbsp;
      </div>
    </section>
  </div>
</div>


{%endblock%}
