Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Imports
import * as Auth from "/services/auth/auth.js";
import * as Election from "/components/management/election.js";
import * as Round from "/components/management/round.js";
// DOM elements
// local variables
let current_user;
export async function mount(where) {
const managementPage = new Management();
await managementPage.mount(where);
}
class Management {
constructor() {}
async mount(where) {
const mountpoint = where;
document.getElementById(mountpoint).innerHTML = /* HTML */ `
<div class="tabs is-boxed is-toggle is-fullwidth">
<ul>
<li id="election" class="is-active">
<a>
<span class="icon is-small"
><i class="fas fa-vote-yea" aria-hidden="true"></i
></span>
<span>Election</span>
</a>
</li>
<li id="round">
<a>
<span class="icon is-small"
><i class="fas fa-calendar" aria-hidden="true"></i
></span>
<span>Tour</span>
</a>
</li>
</ul>
</div>
<section class="section" id="management-section" style="margin-bottom: 230px;"></section>
`;
current_user = await Auth.GetUser();
this.handleDom();
document.getElementById("election").click()
}
handleDom(){
document.getElementById("election").addEventListener("click", async function (){
await Election.mount("management-section");
document.getElementById("election").setAttribute("class", "is-active")
document.getElementById("round").setAttribute("class", "")
});
document.getElementById("round").addEventListener("click", async function (){
await Round.mount("management-section");
document.getElementById("election").setAttribute("class", "")
document.getElementById("round").setAttribute("class", "is-active")
});
}
}