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 {
</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) {
......
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment