diff --git a/web/components/navbar/navbar.js b/web/components/navbar/navbar.js index 0e5145ca45d2b4e8c143e61c6f453a1e90375460..cf58c25d9a8daff949745745544d7f622ffab4ca 100644 --- a/web/components/navbar/navbar.js +++ b/web/components/navbar/navbar.js @@ -12,8 +12,16 @@ export function mount(mountpoint) { window.document.title = brand.windowTitle; where.innerHTML = /* HTML */ ` <div class="navbar-brand"> - <a class="navbar-item is-size-4" href="/"><img src="assets/brand/logo.png" alt="logo" />${brand.navTitle}</a> - <a role="button" id="navbar-burger" class="navbar-burger burger" aria-label="menu" aria-expanded="false"> + <a class="navbar-item is-size-4" href="/" + ><img src="assets/brand/logo.png" alt="logo" />${brand.navTitle}</a + > + <a + role="button" + id="navbar-burger" + class="navbar-burger burger" + aria-label="menu" + aria-expanded="false" + > <span aria-hidden="true"></span> <span aria-hidden="true"></span> <span aria-hidden="true"></span> @@ -51,11 +59,27 @@ export async function CreateMenu() { user === undefined ? `` : /* HTML */ ` - <a class="navbar-item" href="#home"><i class="navbar-menu-icon fas fa-home"></i>Accueil</a> + <a class="navbar-item" href="#home" + ><i class="navbar-menu-icon fas fa-home"></i>Accueil</a + > + ${user.role == "ADMIN" || "CAPTURER" + ? /* HTML */ ` + <a class="navbar-item" href="#votes" + ><i class="navbar-menu-icon fas fa-vote-yea"></i + >Votes</a + > + ` + : ""} ${user.role == "ADMIN" ? /* HTML */ ` - <a class="navbar-item" href="#management"><i class="navbar-menu-icon fas fa-edit"></i>Gestion</a> - <a class="navbar-item" href="#users"><i class="navbar-menu-icon fas fa-users"></i>Utilisateurs</a> + <a class="navbar-item" href="#management" + ><i class="navbar-menu-icon fas fa-edit"></i + >Gestion</a + > + <a class="navbar-item" href="#users" + ><i class="navbar-menu-icon fas fa-users"></i + >Utilisateurs</a + > ` : ""} ` @@ -64,8 +88,18 @@ export async function CreateMenu() { <div class="navbar-end"> ${ user === undefined - ? /* HTML */ ` <a class="navbar-item" href="#login"><i class="navbar-menu-icon fas fa-sign-in-alt"></i>Connexion</a> ` - : /* HTML */ ` <a class="navbar-item" href="/Logout"><i class="navbar-menu-icon fas fa-sign-out-alt"></i>Déconnexion</a> ` + ? /* HTML */ ` + <a class="navbar-item" href="#login" + ><i class="navbar-menu-icon fas fa-sign-in-alt"></i + >Connexion</a + > + ` + : /* HTML */ ` + <a class="navbar-item" href="/Logout" + ><i class="navbar-menu-icon fas fa-sign-out-alt"></i + >Déconnexion</a + > + ` } </div> `; diff --git a/web/components/vote/desk-round.js b/web/components/vote/desk-round.js new file mode 100644 index 0000000000000000000000000000000000000000..5aab8ce9dff710d02951baae999b2bbc1bc53d88 --- /dev/null +++ b/web/components/vote/desk-round.js @@ -0,0 +1,39 @@ +// Imports +import * as Auth from "/services/auth/auth.js"; + +export async function mount(where, parent) { + const deskRoundComponent = new DeskRoundSelector(parent); + await deskRoundComponent.mount(where); + return deskRoundComponent; +} + +class DeskRoundSelector { + constructor(parent) { + this.method = null; + this.parent = parent; + } + + async mount(where) { + const mountpoint = where; + document.getElementById(mountpoint).innerHTML = /* HTML */ ` + <header class="card-header"> + <p class="card-header-title"> + Choix du bureau de vote + </p> + </header> + <div class="card-content"> + <div class="columns"> + <div class="column"> + <div id="select-filters" class="card"></div> + </div> + <div class="column"> + <div id="select-desks" class="card"></div> + </div> + </div> + </div> + `; + this.handleDom(); + } + + handleDom() {} +} diff --git a/web/components/vote/vote-page.js b/web/components/vote/vote-page.js new file mode 100644 index 0000000000000000000000000000000000000000..cc23a71d6d384e770c5ecfeb1d5431a7986b9ce3 --- /dev/null +++ b/web/components/vote/vote-page.js @@ -0,0 +1,28 @@ +// Imports +import * as DeskRound from "/components/vote/desk-round.js"; +import * as Vote from "/components/vote/votes.js"; + +// DOM elements + +export async function mount(where) { + const votePage = new VotePage(); + await votePage.mount(where); +} + +class VotePage { + constructor() {} + + async mount(where) { + const mountpoint = where; + document.getElementById(mountpoint).innerHTML = /* HTML */ ` + <section style="margin-bottom: 230px;"> + <div class="container"><div id="vote-section" class="card"></div></div> + </section> + `; + this.deskRoundHandler = await DeskRound.mount("vote-section", this); + this.voteHandler = await Vote.mount(this); + this.handleDom(); + } + + handleDom() {} +} diff --git a/web/components/vote/votes.js b/web/components/vote/votes.js new file mode 100644 index 0000000000000000000000000000000000000000..5fbbdfc43872cbe1f4ef157c6135fe94caa27672 --- /dev/null +++ b/web/components/vote/votes.js @@ -0,0 +1,14 @@ +// Imports +import * as Auth from "/services/auth/auth.js"; + +export async function mount(parent) { + const voteComponent = new Vote(parent); + return voteComponent; +} + +class Vote { + constructor(parent) { + this.method = null; + this.parent = parent; + } +} diff --git a/web/main.js b/web/main.js index fd9f743b458ca29deacd92ac35777d18ade7bec3..fe61cd18771f4f63e5157746e6f697ae2f9d6ddb 100644 --- a/web/main.js +++ b/web/main.js @@ -1,6 +1,7 @@ import * as Home from "/components/home/home.js"; import * as Users from "/components/users/users.js"; import * as Management from "/components/management/management.js"; +import * as Votes from "/components/vote/vote-page.js"; import * as Login from "/components/login/login.js"; import * as Navbar from "/components/navbar/navbar.js"; import { AnimateCSS } from "/services/common/common.js"; @@ -23,6 +24,11 @@ async function navigate() { await Home.mount("main"); }); break; + case "#votes": + load(mountPoint, async function () { + await Votes.mount("main"); + }); + break; case "#users": load(mountPoint, async function () { await Users.mount("main");