diff --git a/web/components/management/round.js b/web/components/management/round.js index f802a4951c435a343cbea34cf38145849e790d6f..01589ab1109e83e5082e9862750c3de667b497d7 100644 --- a/web/components/management/round.js +++ b/web/components/management/round.js @@ -22,7 +22,7 @@ class Round { Liste des tours </div> </div> - <div class="column" style="padding-right:40px;"> + <div id="rounds-panel" class="column" style="padding-right:40px;"> <div id="round-desks" class="card-no-hover card-list"> Liste des bureaux d'un tour </div> diff --git a/web/components/management/rounds-card.js b/web/components/management/rounds-card.js index 03708238ba7d5e56aaba6d75be589ad7b75295f4..8a5f7d8f40cb501ba8d04ea76fc0ee57c720c245 100644 --- a/web/components/management/rounds-card.js +++ b/web/components/management/rounds-card.js @@ -5,6 +5,7 @@ import * as ElectionModel from "/services/model/election-model.js"; import * as RoundModel from "/services/model/round-model.js"; import * as Messages from "/services/messages/messages.js"; import { Delete } from "/services/common/delete.js"; +import { AnimateCSS } from "/services/common/common.js"; // DOM elements @@ -353,23 +354,34 @@ class Round { } hideRounds() { + let roundList = document.getElementById("rounds-list"); + let roundPanel = document.getElementById("rounds-panel"); + let roundsHandler = this; - document.getElementById("rounds-list").innerHTML = - '<p id="display-rounds">Afficher la liste des tours</p>'; - document.getElementById("rounds-list").className = "upper-text"; - document.getElementById("rounds-list").parentElement.className = - "column upper-text"; - document.getElementById("candidate-lists").parentElement.className = - "column is-full"; - document - .getElementById("display-rounds") - .addEventListener("click", async function () { - await roundsHandler.mount("rounds-list"); - document.getElementById("rounds-list").className = "card"; - document.getElementById("rounds-list").parentElement.className = - "column is-full"; - document.getElementById("candidate-lists").parentElement.className = - "column"; - }); + AnimateCSS(roundList, "fadeOutLeft", function () { + roundList.innerHTML = + '<p id="display-rounds">Afficher la liste des tours</p>'; + roundList.className = "upper-text"; + roundList.parentElement.className = "column upper-text"; + document.getElementById("candidate-lists").parentElement.className = + "column is-full"; + document + .getElementById("display-rounds") + .addEventListener("click", async function () { + AnimateCSS(roundPanel, "fadeOutRight", async function () { + roundPanel.style.display = "none"; + roundList.style.display = "none"; + await roundsHandler.mount("rounds-list"); + roundList.className = "card"; + roundList.parentElement.className = "column is-full"; + document.getElementById("candidate-lists").parentElement.className = + "column"; + AnimateCSS(roundList, "fadeInLeft", function () {}); + roundList.style.display = "block"; + }); + }); + roundPanel.style.display = "block"; + AnimateCSS(roundPanel, "fadeInRight", function () {}); + }); } }