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


{% block extra_head %}
{# DateTimePicker #}
<script src={% static 'vendor/datepicker/datetimepicker.js' %}></script>
<link rel="stylesheet" href="{% static 'vendor/datepicker/datetimepicker.css' %}">

<script>
  $(document).ready(function($) {
    $('#id_start_date').datetimepicker({
      format: 'Y-m-d H:i'
    });
    $('#id_end_date').datetimepicker({
      format: 'Y-m-d H:i'
    });
  });

</script>
{% endblock %}

{% block content %}

{% for error in form.non_field_errors %}
<div class="notification is-danger">
  {{ error }}
</div>
{% endfor %}

<h1 class="title">{% trans "Modification d'une élection" %}</h1>
<hr>

<form action="" method="post">
  {% csrf_token %}

  {% include "elections/forms/form.html" with errors=False %}

  <div class="field is-grouped is-centered">
    <div class="control is-expanded">
      <button class="button is-fullwidth is-outlined is-primary is-light">
        <span class="icon is-small">
          <i class="fas fa-check"></i>
        </span>
        <span>{% trans "Enregistrer" %}</span>
      </button>
    </div>
    <div class="control">
      <a class="button is-primary" href="{% url 'election.admin' election.pk %}">
        <span class="icon is-small">
          <i class="fas fa-undo-alt"></i>
        </span>
        <span>{% trans "Retour" %}</span>
      </a>
    </div>
  </div>
</form>

{% endblock %}
