{% 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> {{obj}} <small>(<a href="{% url 'nalodeni:news_all'%}">zpět</a>)</small></h2>
          <br/>
          {% if actions %}
          Akce:
          {% if 'nwslt_edit' in actions %}
          <a href="{% url 'nalodeni:news_list_edit' obj.id %}">Upravit</a>
          {%endif%}
          {% if 'nwsl_actions' in actions %}
          <a href="{% url 'nalodeni:news_msg_create' obj.id %}">Vytvořit novou zprávu</a>
          {% endif%}
          {% if 'show_newsletter_recipients' in actions %}
          <a href="{% url 'nalodeni:news_list_show_recipients' obj.id %}">Zobrazit aktuální seznam příjemců</a>
          {%endif%}
          <br/>
          <br/>
          {%endif%}
          {% if msgs|length > 0 %}
          {%csrf_token%}
          <table class="table-list">
              <tr>
                  {%comment%}<th><!--<input type="checkbox" name="r[]" value="all"/>--></th>{%endcomment%}
                  <th>Název</th>
                  {% if 'nwsl_details' in actions %}
                  <th>Vytvořil</th>
                  <th>Datum vytvoření</th>
                  <th>Plánované odeslání</th>
                  {% endif %}
                  <th>Rozesláno</th>
                  {% if 'nwsl_actions' in actions %}
                  <th colspan="3">Akce</th>
                  {% endif%}
              </tr>
              {% for msg in msgs %}
              <tr>
                  {%comment%}<td><input type="checkbox" name="r[]" value="{{msg.id}}"/></td>{%endcomment%}
                  <td><a href="{% url 'nalodeni:news_msg_show' msg.id %}">{{msg.title}}</a>
                  {% if 'nwsl_details' in actions %}
                  <td>{{msg.created_by}}</td>
                  <td>{{msg.created_ts}}</td>
                  <td>{{msg.delivery_ts|default_if_none:'-'}}</td>
                  {% endif%}
                  <td>{{msg.sent_ts|default_if_none:'-'}}</td>
                  {% if 'nwsl_actions' in actions %}
                  <td><a href="{% url 'nalodeni:news_msg_edit' msg.news_id msg.id %}">Upravit</a></td>
                  <td><a href="{% url 'nalodeni:news_msg_preview' msg.id %}" target="_blank">Náhled</a></td>
                  <td><a href="{% url 'nalodeni:news_msg_send' msg.id %}">Testovací email</a></td>
                  {% endif%}
              </tr>
              {% endfor %}
          </table>
          {%else%}
          <em>Tento newsletter ještě nemá žádné zprávy.</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%}
