{% load i18n humanize %}

{% for announcement in announcements %}
  <figure class="alert primary">
      {% if show_interval %}
        <em class="right hide-on-small-and-down">
          {% if announcement.valid_from.date == announcement.valid_until.date %}
            {% blocktrans with from=announcement.valid_from|naturalday %}
              Valid for {{ from }}
            {% endblocktrans %}
          {% else %}
            {% blocktrans with from=announcement.valid_from|naturalday until=announcement.valid_until|naturalday %}
              Valid from {{ from }} until {{ until }}
            {% endblocktrans %}
          {% endif %}
        </em>
      {% endif %}

      <i class="material-icons iconify left" data-icon="mdi:message-alert-outline"></i>

      {% if show_recipients and announcement.recipients %}
        <p>
          {{ announcement.recipients.all|join:", " }}:
        </p>
      {% endif %}

      <figcaption>{{ announcement.title }}</figcaption>
      <p>
        {{ announcement.description }}
      </p>

      {% if show_interval %}
        <em class="hide-on-med-and-up">
          {% if announcement.valid_from.date == announcement.valid_until.date %}
            {% blocktrans with from=announcement.valid_from|naturalday %}
              Valid for {{ from }}
            {% endblocktrans %}
          {% else %}
            {% blocktrans with from=announcement.valid_from|naturalday until=announcement.valid_until|naturalday %}
              Valid for {{ from }} – {{ until }}
            {% endblocktrans %}
          {% endif %}
        </em>
      {% endif %}
  </figure>
{% endfor %}
