Skip to content
Snippets Groups Projects
Commit c3d13441 authored by Alexis POYEN's avatar Alexis POYEN
Browse files

Feat : Open modal to clone candidateList

parent e945ff0c
No related branches found
No related tags found
1 merge request!69Resolve "Import candidateLists"
This commit is part of merge request !69. Comments created here will be created in the context of that merge request.
...@@ -62,6 +62,7 @@ class CandidateList { ...@@ -62,6 +62,7 @@ class CandidateList {
</div> </div>
`; `;
this.mountModal("candidateList-modal"); this.mountModal("candidateList-modal");
this.mountModalClone("candidateList-clone-modal");
this.handleDom(); this.handleDom();
} }
...@@ -153,7 +154,10 @@ class CandidateList { ...@@ -153,7 +154,10 @@ class CandidateList {
<div class="field"> <div class="field">
<label>Parti</label><br /> <label>Parti</label><br />
<div class="control select"> <div class="control select">
<select name="party" id="candidateList-modal-party"></select> <select
name="party"
id="candclone-cardidateList-modal-party"
></select>
</div> </div>
</div> </div>
</section> </section>
...@@ -169,6 +173,24 @@ class CandidateList { ...@@ -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() { async displayCandidates() {
document.getElementById("candidate-list").innerHTML = /* HTML */ `<div document.getElementById("candidate-list").innerHTML = /* HTML */ `<div
class="table-container" class="table-container"
...@@ -345,6 +367,11 @@ class CandidateList { ...@@ -345,6 +367,11 @@ class CandidateList {
.addEventListener("click", function () { .addEventListener("click", function () {
Common.toggleModal("candidateList-modal", "candidateList-modal-card"); 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 document
.getElementById(`candidateList-modal-save`) .getElementById(`candidateList-modal-save`)
.addEventListener("click", async function () { .addEventListener("click", async function () {
...@@ -522,9 +549,7 @@ class CandidateList { ...@@ -522,9 +549,7 @@ class CandidateList {
let election = await this.ElectionModel.getElection(this.area.ID); let election = await this.ElectionModel.getElection(this.area.ID);
let rounds = await this.RoundModel.getRounds(); let rounds = await this.RoundModel.getRounds();
rounds = rounds.filter((round) => round.ElectionID == election.ID); rounds = rounds.filter((round) => round.ElectionID == election.ID);
console.log(rounds);
let roundsID = []; let roundsID = [];
console.log(this.round.id);
rounds.forEach((round) => { rounds.forEach((round) => {
if (this.round.ID !== round.ID) roundsID.push(round.ID); if (this.round.ID !== round.ID) roundsID.push(round.ID);
}); });
...@@ -535,6 +560,10 @@ class CandidateList { ...@@ -535,6 +560,10 @@ class CandidateList {
roundsID.includes(candidateList.RoundID) roundsID.includes(candidateList.RoundID)
); );
console.log(candidateLists); console.log(candidateLists);
Common.toggleModal(
"candidateList-clone-modal",
"candidateList-clone-modal-card"
);
} }
async editCandidateList(candidateList) { async editCandidateList(candidateList) {
......
...@@ -35,6 +35,7 @@ class Round { ...@@ -35,6 +35,7 @@ class Round {
<div class="modal" id="round-modal"></div> <div class="modal" id="round-modal"></div>
<div class="modal" id="capturers-modal"></div> <div class="modal" id="capturers-modal"></div>
<div class="modal" id="candidateList-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.roundsHandler = await RoundsCard.mount("rounds-list", this);
this.deskRoundsHandler = await RoundDesks.mount("round-desks", this); this.deskRoundsHandler = await RoundDesks.mount("round-desks", this);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment