diff --git a/web/components/management/candidate-lists.js b/web/components/management/candidate-lists.js index 072e7f7a3c182014e96ba95bcf9a6a2b0aaecb22..18fefaa0be280b3fae2a49da937d0b0e662bc7e1 100644 --- a/web/components/management/candidate-lists.js +++ b/web/components/management/candidate-lists.js @@ -62,6 +62,7 @@ class CandidateList { </div> `; this.mountModal("candidateList-modal"); + this.mountModalClone("candidateList-clone-modal"); this.handleDom(); } @@ -153,7 +154,10 @@ class CandidateList { <div class="field"> <label>Parti</label><br /> <div class="control select"> - <select name="party" id="candidateList-modal-party"></select> + <select + name="party" + id="candclone-cardidateList-modal-party" + ></select> </div> </div> </section> @@ -169,6 +173,24 @@ class CandidateList { `; } + mountModalClone(where) { + const mountpoint = where; + document.getElementById(mountpoint).innerHTML = /* HTML */ ` + <div class="modal-background"></div> + <div class="modal-card" id="candidateList-clone-modal-card"> + <header class="modal-card-head"> + <p class="modal-card-title">Importer une liste</p> + <button + class="delete" + aria-label="close" + id="candidateList-clone-modal-close" + ></button> + </header> + <section class="modal-card-body"></section> + </div> + `; + } + async displayCandidates() { document.getElementById("candidate-list").innerHTML = /* HTML */ `<div class="table-container" @@ -345,6 +367,11 @@ class CandidateList { .addEventListener("click", function () { Common.toggleModal("candidateList-modal", "candidateList-modal-card"); }); + document + .getElementById(`candidateList-clone-modal-close`) + .addEventListener("click", function () { + Common.toggleModal("candidateList-clone-modal", "candidateList-clone-modal-card"); + }); document .getElementById(`candidateList-modal-save`) .addEventListener("click", async function () { @@ -522,9 +549,7 @@ class CandidateList { let election = await this.ElectionModel.getElection(this.area.ID); let rounds = await this.RoundModel.getRounds(); rounds = rounds.filter((round) => round.ElectionID == election.ID); - console.log(rounds); let roundsID = []; - console.log(this.round.id); rounds.forEach((round) => { if (this.round.ID !== round.ID) roundsID.push(round.ID); }); @@ -535,6 +560,10 @@ class CandidateList { roundsID.includes(candidateList.RoundID) ); console.log(candidateLists); + Common.toggleModal( + "candidateList-clone-modal", + "candidateList-clone-modal-card" + ); } async editCandidateList(candidateList) { diff --git a/web/components/management/round.js b/web/components/management/round.js index 2cbfbdfb30b80ea6a914e9f72b487ee3799e6183..830361257d77f9d58e0aecd8d0a0590822f8b643 100644 --- a/web/components/management/round.js +++ b/web/components/management/round.js @@ -35,6 +35,7 @@ class Round { <div class="modal" id="round-modal"></div> <div class="modal" id="capturers-modal"></div> <div class="modal" id="candidateList-modal"></div> + <div class="modal" id="candidateList-clone-modal"></div> `; this.roundsHandler = await RoundsCard.mount("rounds-list", this); this.deskRoundsHandler = await RoundDesks.mount("round-desks", this);