diff --git a/web/components/management/candidate-lists.js b/web/components/management/candidate-lists.js index d525bfe02832f0e9f43a9cf1f289cbcd5dadc1dd..f9701a61d5d462f5ff780e14c42c46b12ac545de 100644 --- a/web/components/management/candidate-lists.js +++ b/web/components/management/candidate-lists.js @@ -80,6 +80,7 @@ class CandidateList { id="candidate-list-clone" class="button large-button is-primary" title="Importer une liste" + disabled > <span class="icon is-small"> <i class="fas fa-download"></i> @@ -89,6 +90,7 @@ class CandidateList { id="candidate-list-new" class="button large-button is-success" title="Ajouter une liste" + disabled > <span class="icon is-small"> <i class="fas fa-plus"></i> @@ -427,6 +429,17 @@ class CandidateList { handleDom() { let candidateListHandler = this; + document + .getElementById(`candidate-list-new`) + .addEventListener("click", function () { + candidateListHandler.newCandidateList(); + }); + + document + .getElementById(`candidate-list-clone`) + .addEventListener("click", function () { + candidateListHandler.cloneCandidateListModal(); + }); document .getElementById(`candidateList-modal-close`) .addEventListener("click", function () { @@ -563,18 +576,8 @@ class CandidateList { await candidateListHandler.displayCandidates(); }); }); - - document - .getElementById(`candidate-list-new`) - .addEventListener("click", function () { - candidateListHandler.newCandidateList(); - }); - - document - .getElementById(`candidate-list-clone`) - .addEventListener("click", function () { - candidateListHandler.cloneCandidateListModal(); - }); + document.getElementById(`candidate-list-new`).removeAttribute("disabled"); + document.getElementById(`candidate-list-clone`).removeAttribute("disabled"); } async updateCandidateLists() { @@ -773,6 +776,12 @@ class CandidateList { this.area = null; document.getElementById("candidate-lists-list").innerHTML = ""; this.emptyCandidate(); + document + .getElementById(`candidate-list-new`) + .setAttribute("disabled", "true"); + document + .getElementById(`candidate-list-clone`) + .setAttribute("disabled", "true"); } emptyCandidate() {