Nantes Université

Skip to content
Extraits de code Groupes Projets
Valider 602c403e rédigé par Guilhem LOMELET's avatar Guilhem LOMELET
Parcourir les fichiers

add some comments

parent c22cba56
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion!7add some comments
<template> <template>
<!--LE COMPOSANT APP EST LE PRINCIPALE C'EST LUI QUI APPELE LES AUTRES-->
<div id="app"> <div id="app">
<!--Boutton pour accéder à l'ajout des cours-->
<div id="add-course-button"> <div id="add-course-button">
<SimpleButton @click.native="popupVisible=true" value="Ajouter" color="#2A27D8" size="15px" /> <SimpleButton @click.native="popupVisible=true" value="Ajouter" color="#2A27D8" size="15px" />
</div> </div>
<div id="Choice"> <div id="Choice">
<!--FILTER are not implemented for the moment-->
<div id="ChooseFilter"> <div id="ChooseFilter">
<p>Filtre</p> <p>Filtre</p>
<button>Groupe</button> <button>Groupe</button>
<button>Professeur</button> <button>Professeur</button>
<button>Module</button> <button>Module</button>
</div> </div>
<!--Allow to choose the way to display (by teacher or by group)-->
<div id="ChooseDisplay"> <div id="ChooseDisplay">
<button :class="ShowGroupe ? 'active' : 'inactive'" @click="ShowGroupe = true; ShowProf = false;">Groupe</button> <button :class="ShowGroupe ? 'active' : 'inactive'" @click="ShowGroupe = true; ShowProf = false;">Groupe</button>
<button :class="ShowProf ? 'active' : 'inactive'" @click="ShowGroupe = false; ShowProf = true;">Professeur</button> <button :class="ShowProf ? 'active' : 'inactive'" @click="ShowGroupe = false; ShowProf = true;">Professeur</button>
...@@ -19,10 +27,14 @@ ...@@ -19,10 +27,14 @@
</div> </div>
<!--Buttons to change the weeks to dipslay-->
<div class="button-container"> <div class="button-container">
<!--If you want to change the gap when we click on one of the button : Change -2 and 2 in getlistWeek()-->
<button class="custom-button" @click="listeWeek = getlistWeek(-2)">&lt;</button> <button class="custom-button" @click="listeWeek = getlistWeek(-2)">&lt;</button>
<button class="custom-button" @click="listeWeek = getlistWeek(2)">></button> <button class="custom-button" @click="listeWeek = getlistWeek(2)">></button>
</div> </div>
<!--Creation of all the composants week to display-->
<div class="weeks"> <div class="weeks">
<Week class="main" v-for="i in listeWeek" :key="i" :nbweek="i" :ShowGroupe="ShowGroupe" :ShowProf="ShowProf"></Week> <Week class="main" v-for="i in listeWeek" :key="i" :nbweek="i" :ShowGroupe="ShowGroupe" :ShowProf="ShowProf"></Week>
</div> </div>
...@@ -48,14 +60,17 @@ export default { ...@@ -48,14 +60,17 @@ export default {
data() { data() {
return { return {
//ShowGroupe, ShowProf, popupVisible are booleans that permits to choose what is currently displaying
ShowGroupe: false, ShowGroupe: false,
ShowProf: false, ShowProf: false,
popupVisible: false, popupVisible: false,
//listWeek is a list of number corresponding to all the week number to display. Ex: [19,20,21,22,23,24]
listeWeek : [] listeWeek : []
}; };
}, },
created(){ created(){
//Init of listeWeek
setTimeout(() => { setTimeout(() => {
this.listeWeek = this.getlistWeek(0); this.listeWeek = this.getlistWeek(0);
}, 1000); }, 1000);
...@@ -64,6 +79,7 @@ export default { ...@@ -64,6 +79,7 @@ export default {
methods :{ methods :{
//Methods that allows to return the listWeek
getlistWeek(delay){ getlistWeek(delay){
let currentWeek = 0; let currentWeek = 0;
...@@ -78,6 +94,7 @@ export default { ...@@ -78,6 +94,7 @@ export default {
const weekList = []; const weekList = [];
//If you want to display more week : change the stop limit condition
for (let i = currentWeek - 4; i <= currentWeek + 1; i++) { for (let i = currentWeek - 4; i <= currentWeek + 1; i++) {
weekList.push(i); weekList.push(i);
} }
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
<div class="Cours"> <div class="Cours">
<div class="affich" :style="cssVars" @click="showPopup = !showPopup"></div> <div class="affich" :style="cssVars" @click="showPopup = !showPopup"></div>
<!--Class Popup is only displaying when we click on a cours to have more information about this one-->
<div class="popup" v-if="showPopup"> <div class="popup" v-if="showPopup">
<div class="info" > <div class="info" >
<h2 class="Titre"> Module : {{ module }}</h2> <h2 class="Titre"> Module : {{ module }}</h2>
...@@ -12,8 +14,10 @@ ...@@ -12,8 +14,10 @@
<p class="Date">Date : {{ date }}</p> <p class="Date">Date : {{ date }}</p>
<button class="close-button" @click="showPopup = !showPopup">&times;</button> <button class="close-button" @click="showPopup = !showPopup">&times;</button>
</div> </div>
<!--This class is only use to add the blanck behing when we click on a Cours componant-->
<div class="overlay"></div> <div class="overlay"></div>
</div> </div>
</div> </div>
</template> </template>
...@@ -36,6 +40,8 @@ export default{ ...@@ -36,6 +40,8 @@ export default{
salle : String, salle : String,
}, },
computed: { computed: {
//If you want to change the way to show a Cours (bigger, smaler ....)
cssVars () { cssVars () {
return{ return{
/* variables you want to pass to css */ /* variables you want to pass to css */
......
<template> <template>
<!--The comments are the same as Prof.vue-->
<div class="Groupe"> <div class="Groupe">
<p class="GroupeName" @mouseover="showFullGroupName" @mouseout="hideFullGroupName">{{GroupeName}}</p> <p class="GroupeName" @mouseover="showFullGroupName" @mouseout="hideFullGroupName">{{GroupeName}}</p>
<div v-for="(cours, index) in listeCours" :key="index"> <div v-for="(cours, index) in listeCours" :key="index">
......
<template> <template>
<!--Componant Prof-->
<div class="Prof" > <div class="Prof" >
<p class="ProfName" @mouseover="showFullGroupName" @mouseout="hideFullGroupName">{{ProfName}}</p> <p class="ProfName" @mouseover="showFullGroupName" @mouseout="hideFullGroupName">{{ProfName}}</p>
<!--Creation of all the Cours that corresponds to this Prof-->
<div v-for="(cours, index) in listeCours" :key="index"> <div v-for="(cours, index) in listeCours" :key="index">
<Cours :salle="cours.salle" :date="cours.day" :module="cours.titre" :prof="cours.prof" :groupe="cours.groupe" :heure="cours.heure" :duree="cours.duree" :color="cours.color" :nbCoursOnThisTime="cours.nbCoursOnThisTime"/> <Cours :salle="cours.salle" :date="cours.day" :module="cours.titre" :prof="cours.prof" :groupe="cours.groupe" :heure="cours.heure" :duree="cours.duree" :color="cours.color" :nbCoursOnThisTime="cours.nbCoursOnThisTime"/>
</div> </div>
...@@ -34,6 +36,7 @@ export default{ ...@@ -34,6 +36,7 @@ export default{
}, },
methods :{ methods :{
//Function to Show the name of the prof. It useful when there is a lot of Prof/Groups
showFullGroupName(event) { showFullGroupName(event) {
// Récupère le texte complet du groupe // Récupère le texte complet du groupe
const fullGroupName = this.ProfName; const fullGroupName = this.ProfName;
......
<template> <template>
<!--Componant Week that created Componant Groupe and Prof-->
<div class="week" :id="nbweek"> <div class="week" :id="nbweek">
<p class="numberoftheweek">SEMAINE {{nbweek}}</p> <p class="numberoftheweek">SEMAINE {{nbweek}}</p>
<div class="theweek"> <div class="theweek">
<!--if ShowGroupe = True : diplay, else not display
Even if ShowGroupe = False, the componants are created (they are just not diplaied)-->
<div v-for="groupe in listeGroupe" class="ByGroup" v-if="ShowGroupe"> <div v-for="groupe in listeGroupe" class="ByGroup" v-if="ShowGroupe">
<Groupe :GroupeName="groupe" :nbweek="nbweek"></Groupe> <Groupe :GroupeName="groupe" :nbweek="nbweek"></Groupe>
</div> </div>
<!--if ShowProf = True : diplay, else not display-->
<div v-for="prof in listeProf" class="ByProf" v-if="ShowProf" > <div v-for="prof in listeProf" class="ByProf" v-if="ShowProf" >
<Prof :ProfName="prof" :nbweek="nbweek"></Prof> <Prof :ProfName="prof" :nbweek="nbweek"></Prof>
</div> </div>
...@@ -33,6 +38,7 @@ export default{ ...@@ -33,6 +38,7 @@ export default{
data(){ data(){
return { return {
//Each list contains all the names of all the groups and prof
listeGroupe: [""], listeGroupe: [""],
listeProf: [""], listeProf: [""],
} }
...@@ -45,7 +51,9 @@ export default{ ...@@ -45,7 +51,9 @@ export default{
}, },
methods:{ methods:{
//This function : get the data and after organise it.
async fetchData() { async fetchData() {
//WARNING : The arguments Year and Dept are here. You have to change it !
const courseData = await getCourse(this.nbweek,"2023","HES3"); const courseData = await getCourse(this.nbweek,"2023","HES3");
this.listeProf= getListeProf(courseData,this.nbweek); this.listeProf= getListeProf(courseData,this.nbweek);
this.listeGroupe = getListeGroupe(courseData,this.nbweek); this.listeGroupe = getListeGroupe(courseData,this.nbweek);
......
...@@ -134,12 +134,14 @@ export function getCoursByGroupe(GroupeName,NbWeek){ ...@@ -134,12 +134,14 @@ export function getCoursByGroupe(GroupeName,NbWeek){
} }
//Fonction qui renvoi le numero du jours dans la semaine a partir des initiales du jour
function getDayNumber(day) { function getDayNumber(day) {
const daysOfWeek = ["su", "m", "tu", "w", "th", "f", "sa"]; const daysOfWeek = ["su", "m", "tu", "w", "th", "f", "sa"];
return daysOfWeek.indexOf(day); return daysOfWeek.indexOf(day);
} }
//Fonction pour obtenir une date de type : "Vendredi 19 Mai 2023", a partir du jour de la semaine, l'année et le numéro de semaine)
function getDateFromWeekdayYearWeek(dayOf, year, week) { function getDateFromWeekdayYearWeek(dayOf, year, week) {
const weekday = getDayNumber(dayOf); const weekday = getDayNumber(dayOf);
const date = new Date(year, 0, 1 + (week - 1) * 7); const date = new Date(year, 0, 1 + (week - 1) * 7);
...@@ -150,7 +152,7 @@ function getDateFromWeekdayYearWeek(dayOf, year, week) { ...@@ -150,7 +152,7 @@ function getDateFromWeekdayYearWeek(dayOf, year, week) {
return date.toLocaleDateString("fr-FR", options); return date.toLocaleDateString("fr-FR", options);
} }
//Modif du prototype Date de JS pour lui ajouter la fonction getWeek qui retourner le numero de semaine d'une date
Date.prototype.getWeek = function() { Date.prototype.getWeek = function() {
const date = new Date(this.getTime()); const date = new Date(this.getTime());
date.setHours(0, 0, 0, 0); date.setHours(0, 0, 0, 0);
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter