Skip to content
Snippets Groups Projects

Resolve "Import candidateLists"

Merged Alexis POYEN requested to merge 59-import-candidatelists into master
2 files
+ 33
3
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -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) {
Loading