{% extends "elections/base.html" %}
{% load i18n %}


{% block content %}

<div class="level">
  <div class="level-left">
    <div class="level-item">
<h1 class="title">{% trans "Liste des élections créées" %}</h1>
    </div>
  </div>
  <div class="level-right">
    <div class="level-item">
      <a class="button is-light is-outlined is-primary" href={% url 'election.create' %}>
        <span class="icon">
          <i class="fas fa-plus"></i>
        </span>
        <span>{% trans "Créer une élection" %}</span>
      </a>
    </div>
  </div>
</div>
<hr>

{% for e in election_list %}
<div class="message is-primary">
  <div class="message-header is-size-6 is-radiusless">
    <div>
      <span class="mr-2">{{ e.name }}</span>
      <span class="tag is-primary is-light">{{ e.start_date|date:"d/m/Y H:i" }}</span>
      <span class="icon has-text-primary-light">
        <i class="fas fa-long-arrow-alt-right"></i>
      </span>
      <span class="tag is-primary is-light">{{ e.end_date|date:"d/m/Y H:i" }}</span>

      {% if e.tallied %}
      &nbsp;
      <span class="tag is-success is-light">{% trans "Élection dépouillée" %}</span>
      {% endif %}

      {% if e.results_public %}
      &nbsp;
      <span class="tag is-info is-light">{% trans "Élection publiée" %}</span>
      {% endif %}

      {% if e.archived %}
      &nbsp;
      <span class="tag is-danger is-light">{% trans "Élection archivée" %}</span>
      {% endif %}
    </div>
    <a class="has-text-primary-light" href="{% url 'election.admin' e.pk %}">
      <span class="icon">
        <i class="fas fa-tools"></i>
      </span>
      <span>{% trans "" %}</span>
    </a>
  </div>
  <p class="message-body">
    {{ e.description|linebreaksbr }}
  </p>
</div>
{% endfor %}

{% endblock %}
