Skip to content
1 change: 1 addition & 0 deletions components/AskResetPassword.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export default {
message: "Impossible de se connecter au serveur ❌",
type: "is-danger",
});
this.$emit("close");
})
.finally(() => {
this.isLoading = false;
Expand Down
116 changes: 116 additions & 0 deletions components/BuilderNewUser.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
<template>
<section>
<b-field grouped group-multiline>
<b-button
label = "Désélectionner"
type="is-info"
icon-left="close"
class="field"
@click="checkedRows = []" />

<b-field>
<b-button
label = "Valider"
type="is-primary"
icon-left="close"
class="field"
@click="accept" />

<b-button
label = "Refuser"
type="is-danger"
icon-left="close"
class="field"
@click="decline" />

</b-field>
</b-field>

<b-tabs>
<b-tab-item label="Étudiants">
<b-table
checkable
:data="allUsers"
:columns="columns"
:checked-rows.sync="checkedRows"
:checkbox-position="checkboxPosition">

<template #bottom-left>
<b>Nombre d'étudiants sélectionnés </b>: {{ checkedRows.length }}
</template>
</b-table>
</b-tab-item>

<!-- <b-tab-item label="Checked rows">-->
<!-- <pre>{{ checkedRows }}</pre>-->
<!-- </b-tab-item>-->
</b-tabs>
</section>
</template>

<script>
import gql from 'graphql-tag';

export default {
name: 'BuilderNewUser',
apollo: {
allUsers: gql`{
allUsers {
firstname,lastname,email
}
}`,
},
data() {
return {
allUsers : [],
checkboxPosition: 'left',
checkedRows: [],
columns: [
{
field: 'firstname',
label: 'Prénom',
},
{
field: 'lastname',
label: 'Nom de famille',
},
{
field: 'email',
label: 'Email',
},
]
}
},

methods: {
async accept() {
for (let i = 0; i < this.checkedRows.length; i++) {
await this.$apollo.mutate({
mutation: gql`mutation ($mail: String!) {
validateUser(mail:$mail) {
email
}
}`,
variables: {
mail: this.checkedRows[i].email
}
});
}
},
async decline () {
for (let i = 0; i < this.checkedRows.length; i++) {
await this.$apollo.mutate({
mutation: gql`mutation ($mail: String!) {
deleteUser(mail:$mail) {
email
}
}`,
variables: {
mail: this.checkedRows[i].email
}
});
}
},
}
}
</script>
60 changes: 0 additions & 60 deletions components/BuilderTeam.vue

This file was deleted.

2 changes: 1 addition & 1 deletion components/Login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export default {
})
.catch(() => {
this.$buefy.toast.open({
message: 'Impossible de se connecter au serveur ❌',
message: 'Adresse mail ou mot de passe incorrect ❌',
type: 'is-danger',
});
})
Expand Down
73 changes: 56 additions & 17 deletions components/Navbar.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<template>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll rework navbar later, it's a complete mess 😄

<nav class="navbar is-fixed-top">
<div class="navbar-brand">
<NuxtLink to="/">
<NuxtLink
to="/"
@click="toggle('burger')"
>
<img
style="height: 4rem; padding: 0.3rem"
src="~assets/img/logo.png"
Expand Down Expand Up @@ -33,7 +36,7 @@
<div class="level-item">
<p>
<strong
>{{ bureau.emoji }}
>{{ bureau.emoji }}
{{ capitalize(bureau.nom) }}</strong
>
<br />
Expand Down Expand Up @@ -191,31 +194,37 @@
</div>
</div>
</div>

<NuxtLink
:to="'/equipe/'"
:to="'/compte/'"
class="navbar-item"
v-if="$auth.loggedIn"
>
<div class="navbar-item is-hoverable is-arrowless">
<div
class="navbar-item is-hoverable is-arrowless is-mega"
@click="toggle('burger')"
>
<p class="navbar-link flex is-arrowless">
L'équipe
Mon compte
</p>
<div
id="members"
>
</div>
</div>
</NuxtLink>


<div
<NuxtLink
:to="'/validationMembres/'"
class="navbar-item"
v-if="$auth.loggedIn"
@click="toggle('burger')"
v-if="$auth.loggedIn && $auth.user.roles.length !== 0"
>
<NuxtLink to="/compte">
<p style="color: #4a4a4a">Mon compte</p>
</NuxtLink>
</div>
<!-- if the user is logged in and its an admin -->
<div
class="navbar-item is-hoverable is-arrowless is-mega"
@click="toggle('burger')"
>
<p class="navbar-link flex is-arrowless">
Validation membres
</p>
</div>
</NuxtLink>
</div>

<div class="navbar-end mr-4">
Expand Down Expand Up @@ -247,10 +256,30 @@
>
Connexion
</b-button>

<b-button
type="is-light"
v-if='!$auth.loggedIn'
@click ="isSignInModalActive = true"
>
Inscription
</b-button>

</div>
</div>
</div>

<b-modal
v-model="isSignInModalActive"
:can-cancel="[false, false, false]"
aria-role="dialog"
has-modal-card
>
<div>
<SignIn @close="isSignInModalActive = false" @signin="handleSignIn()" />
</div>
</b-modal>

<b-modal
v-model="isLoginModalActive"
:can-cancel="[false, false, false]"
Expand All @@ -267,9 +296,11 @@
<script>
import website from '~/static/website.json';
import social from '~/static/social-networks.json';
import SignIn from '~/components/SignIn';

export default {
name: 'Navbar',
components: { SignIn },
data() {
return {
hdr: website,
Expand All @@ -281,6 +312,7 @@ export default {
associations: '',
},
isLoginModalActive: false,
isSignInModalActive: false,
};
},
methods: {
Expand Down Expand Up @@ -310,6 +342,13 @@ export default {
type: 'is-success',
});
},
handleSignIn(){
this.isSignInModalActive = false;
this.$buefy.toast.open({
message: 'Ton compte est maintenant en attente de validation 🛡️',
type: 'is-success',
});
},
handleLogout() {
this.$auth.logout().then(() => {
this.hdr = `${this.hdr}`; // Workaround to trigger a refresh of the view
Expand Down
Loading