2020-12-22 01:17:38 +01:00
{% extends "base.html" %}
{% load i18n %}
{% block extra_head %}
< script >
2021-05-26 20:54:22 +02:00
{% if not election.sent_mail %}
document.addEventListener('DOMContentLoaded', () => {
2020-12-22 01:17:38 +01:00
const fileInput = document.querySelector('#import-voters input[type=file]');
fileInput.onchange = () => {
if (fileInput.files.length > 0) {
const fileName = document.querySelector('#import-voters .file-name');
fileName.textContent = fileInput.files[0].name;
}
2020-12-23 16:28:38 +01:00
};
2020-12-22 01:17:38 +01:00
});
2021-05-26 20:54:22 +02:00
{% endif %}
2020-12-22 01:17:38 +01:00
< / script >
{% endblock %}
{% block content %}
2020-12-24 01:10:05 +01:00
< div class = "level is-flex-widescreen" >
2020-12-24 00:41:29 +01:00
< div class = "level-left" >
< div class = "item-level" >
< h1 class = "title" > {% trans "Gestion de la liste de votant·e·s" %}< / h1 >
< / div >
< / div >
< div class = "level-right" >
{% if not election.sent_mail %}
< div class = "level-item" >
< a class = "button is-light is-outlined is-primary" href = "{% url 'election.mail-voters' election.pk %}" >
< span class = "icon" >
< i class = "fas fa-envelope-open" > < / i >
< / span >
< span > {% trans "Envoyer le mail d'annonce" %}< / span >
< / a >
< / div >
{% endif %}
< div class = "level-item" >
< a class = "button is-primary" href = "{% url 'election.admin' election.pk %}" >
2021-04-13 15:22:53 +02:00
< span class = "icon" >
2020-12-24 00:41:29 +01:00
< i class = "fas fa-undo-alt" > < / i >
< / span >
< span > {% trans "Retour" %}< / span >
< / a >
< / div >
< / div >
< / div >
2020-12-22 01:17:38 +01:00
< hr >
2020-12-24 00:41:29 +01:00
{# Si on a déjà envoyé le mail avec les identifiants, on ne peut plus changer la liste #}
{% if not election.sent_mail %}
2020-12-22 01:17:38 +01:00
< div class = "message is-warning" >
< div class = "message-body" >
2020-12-23 11:19:30 +01:00
{% trans "Importez un fichier au format CSV, avec sur la première colonne le login, sur la deuxième, le nom et prénom et enfin l'adresse email sur la troisième. Soit :< br > < br > < pre > Login_1,Prénom/Nom_1,mail_1@machin.test< br > Login_2,Prénom/Nom_2,mail_2@bidule.test< br > ...< / pre > " %}
2020-12-22 01:17:38 +01:00
< / div >
< / div >
< div class = "columns is-centered" >
< div class = "column is-two-thirds" >
2020-12-23 16:28:38 +01:00
{% if form.non_field_errors %}
< div class = "notification is-danger" >
< button class = "delete" > < / button >
{% for error in form.non_field_errors %}
{{ error }}< br >
{% endfor %}
< / div >
{% endif %}
2020-12-23 17:09:04 +01:00
2020-12-23 11:19:30 +01:00
< form action = "" method = "post" enctype = "multipart/form-data" id = "import-voters" >
2020-12-22 01:17:38 +01:00
{% csrf_token %}
{% include "forms/form.html" with errors=False %}
< div class = "field is-grouped is-centered" >
< div class = "control is-expanded" >
2021-05-26 23:44:46 +02:00
< button class = "button is-fullwidth is-outlined is-primary is-light" type = "submit" >
2021-04-13 15:22:53 +02:00
< span class = "icon" >
2020-12-22 01:17:38 +01:00
< i class = "fas fa-check" > < / i >
< / span >
2020-12-24 00:41:29 +01:00
< span > {% trans "Importer" %}< / span >
2020-12-22 01:17:38 +01:00
< / button >
< / div >
2020-12-23 17:09:04 +01:00
2020-12-22 01:17:38 +01:00
< / div >
< / form >
< / div >
< / div >
2020-12-23 17:09:04 +01:00
< br >
2020-12-24 00:41:29 +01:00
{% endif %}
2020-12-23 17:09:04 +01:00
{# Liste des votant·e·s #}
{% if voters %}
< h3 class = "subtitle" > {% trans "Liste des votant·e·s pour cette élection" %}< / h3 >
< hr >
< div class = "columns is-centered" >
< div class = "column is-two-thirds" >
< table class = "table is-fullwidth is-bordered is-striped has-text-centered" >
< thead >
< tr >
< th > {% trans "Login" %}< / th >
< th > {% trans "Nom" %}< / th >
< th > {% trans "Email" %}< / th >
< / tr >
< / thead >
< tbody >
{% for v in voters %}
< tr >
2021-04-26 17:54:07 +02:00
< td > {{ v.base_username }}< / td >
2020-12-23 17:09:04 +01:00
< td > {{ v.full_name }}< / td >
< td > {{ v.email }}< / td >
< / tr >
{% endfor %}
< / tbody >
< / table >
< / div >
< / div >
{% endif %}
2020-12-22 01:17:38 +01:00
{% endblock %}