|
|
|
@ -3,11 +3,13 @@
|
|
|
|
|
import {getDifferenceTime,lastDateOfMonth,formatDate,getFirstDay,sortByDate,matrixFromList,sundayToTheEnd,getMarginTop,getHoursMinutes, monthFromList} from '../scheduleFunctions.js'
|
|
|
|
|
import {getAllSchedule, getOwnSchedule, getCurriculumSchedule} from "@/rest/scheduleRest.js";
|
|
|
|
|
import {getLessons, getOwnedLessons } from "@/rest/lessonSchedule.js"
|
|
|
|
|
import {isLogged, getSelf} from "@/rest/Users.js"
|
|
|
|
|
import {getAllCurriculums} from "@/rest/curriculum.js"
|
|
|
|
|
import {isLogged, getSelf,getTeachers} from "@/rest/Users.js"
|
|
|
|
|
import {getAllCurriculums, getcurriculum} from "@/rest/curriculum.js"
|
|
|
|
|
|
|
|
|
|
const trueSchedule = ref()
|
|
|
|
|
const log = await isLogged();
|
|
|
|
|
const schedule = ref();
|
|
|
|
|
const curriculum = ref();
|
|
|
|
|
const shift = ref(getFirstDay(new Date()).getDay());
|
|
|
|
|
let value = 1;
|
|
|
|
|
const len = ref(lastDateOfMonth(new Date()));
|
|
|
|
@ -18,8 +20,8 @@
|
|
|
|
|
const allSchedules = await getAllSchedule();
|
|
|
|
|
let counter = 0;
|
|
|
|
|
const ownSchedule = ref();
|
|
|
|
|
console.log(allSchedules)
|
|
|
|
|
|
|
|
|
|
const filter = ref("null");
|
|
|
|
|
const subFilter = ref("null");
|
|
|
|
|
let user;
|
|
|
|
|
|
|
|
|
|
if(log){
|
|
|
|
@ -34,8 +36,9 @@
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(user.role == "Student"){
|
|
|
|
|
const trueSchedule = await getOwnSchedule();
|
|
|
|
|
ownSchedule.value = trueSchedule.lessons;}
|
|
|
|
|
trueSchedule.value = await getOwnSchedule();
|
|
|
|
|
ownSchedule.value = trueSchedule.value.lessons;
|
|
|
|
|
curriculum.value = trueSchedule.value.curriculum;}
|
|
|
|
|
|
|
|
|
|
schedule.value = ownSchedule.value;
|
|
|
|
|
scheduleByWeek.value = sundayToTheEnd(matrixFromList(schedule.value,mondayOfWeek.value));
|
|
|
|
@ -46,8 +49,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const display =ref("Month")
|
|
|
|
|
const display =ref("Week");
|
|
|
|
|
const format = ref("Grid");
|
|
|
|
|
|
|
|
|
|
const filters = ["Type","Teacher","Course"];
|
|
|
|
|
const types = ["TP","TD","Course","Exam"];
|
|
|
|
|
const teachers = await getTeachers() ;
|
|
|
|
|
const courses = ref();
|
|
|
|
|
if(curriculum.value != null){
|
|
|
|
|
courses.value = curriculum.value.courses;
|
|
|
|
|
}
|
|
|
|
|
const days = ["Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi","Dimanche"];
|
|
|
|
|
const months = ["Janvier","Fevrier","Mars","Avril",'Mai',"Juin","Juillet","Aout","Septembre","Octobre","Novembre","Decembre"]
|
|
|
|
|
const firstDayOfMonth = ref(getFirstDay(new Date()))
|
|
|
|
@ -91,12 +102,97 @@
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function dateOfMonth(i){
|
|
|
|
|
|
|
|
|
|
async function changeSchedule(){
|
|
|
|
|
return new Date(currentDate.value.getFullYear(),currentDate.value.getMonth(),i);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function sortSchedule(){
|
|
|
|
|
schedule.value =trueSchedule.value.lessons;
|
|
|
|
|
console.log(filter.value)
|
|
|
|
|
if(filter.value =="Teacher"){
|
|
|
|
|
schedule.value = sortByTeacher(schedule.value,subFilter.value);
|
|
|
|
|
scheduleByWeek.value = sundayToTheEnd(matrixFromList(schedule.value,mondayOfWeek.value));
|
|
|
|
|
month.value = monthFromList(schedule.value,currentDate.value.getMonth());
|
|
|
|
|
value = 1;
|
|
|
|
|
counter=0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if(filter.value =="Type"){
|
|
|
|
|
schedule.value = sortByType(schedule.value,subFilter.value);
|
|
|
|
|
scheduleByWeek.value = sundayToTheEnd(matrixFromList(schedule.value,mondayOfWeek.value));
|
|
|
|
|
month.value = monthFromList(schedule.value,currentDate.value.getMonth());
|
|
|
|
|
value = 1;
|
|
|
|
|
counter=0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if(filter.value =="Course"){
|
|
|
|
|
schedule.value = sortByCourse(schedule.value,subFilter.value);
|
|
|
|
|
scheduleByWeek.value = sundayToTheEnd(matrixFromList(schedule.value,mondayOfWeek.value));
|
|
|
|
|
month.value = monthFromList(schedule.value,currentDate.value.getMonth());
|
|
|
|
|
value = 1;
|
|
|
|
|
counter=0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function sortByType(lessons,type){
|
|
|
|
|
if(type == null){
|
|
|
|
|
return lessons;
|
|
|
|
|
}
|
|
|
|
|
const matrix = [];
|
|
|
|
|
for (let element in lessons){
|
|
|
|
|
console.log(lessons[element].lessonType)
|
|
|
|
|
if(lessons[element].lessonType == type){
|
|
|
|
|
matrix.push(lessons[element])
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return matrix
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function sortByCourse(lessons,course){
|
|
|
|
|
if(course == null){
|
|
|
|
|
return lessons;
|
|
|
|
|
}
|
|
|
|
|
const matrix = [];
|
|
|
|
|
for (let element in lessons){
|
|
|
|
|
if(lessons[element].course.title == course.title){
|
|
|
|
|
matrix.push(lessons[element])
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return matrix
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function sortByTeacher(lessons, teacher){
|
|
|
|
|
if(teacher == null){
|
|
|
|
|
return lessons;
|
|
|
|
|
}
|
|
|
|
|
const matrix = [];
|
|
|
|
|
for (let element in lessons){
|
|
|
|
|
if(lessons[element].course.owner.regNo == teacher.regNo){
|
|
|
|
|
matrix.push(lessons[element])
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return matrix
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function changeSchedule(){
|
|
|
|
|
schedule.value =trueSchedule.value.lessons;
|
|
|
|
|
curriculum.value = trueSchedule.value.curriculum;
|
|
|
|
|
|
|
|
|
|
scheduleByWeek.value = sundayToTheEnd(matrixFromList(schedule.value,mondayOfWeek.value));
|
|
|
|
|
month.value = monthFromList(schedule.value,currentDate.value.getMonth());
|
|
|
|
|
value = 1;
|
|
|
|
|
counter=0;
|
|
|
|
|
courses.value = (await getcurriculum(curriculum.value.curriculumId)).courses;
|
|
|
|
|
filter.value = "null";
|
|
|
|
|
subFilter.value = "null"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function changeWeek(i){
|
|
|
|
@ -145,7 +241,7 @@
|
|
|
|
|
</script>
|
|
|
|
|
<template>
|
|
|
|
|
<div class="grid">
|
|
|
|
|
<div class="schedule">
|
|
|
|
|
<div class="schedule" v-if="format == 'Grid'">
|
|
|
|
|
<template v-if="display=='Week'">
|
|
|
|
|
<table class="table">
|
|
|
|
|
<tr style="background-color:rgb(24,24,24)">
|
|
|
|
@ -184,7 +280,8 @@
|
|
|
|
|
<div class="infos" v-bind:style="{}">
|
|
|
|
|
<p class="childInfos">{{element[index].course.title}}</p>
|
|
|
|
|
<p class="childInfos">{{element[index].local}}</p>
|
|
|
|
|
<p class="childInfos">{{element[index].course.teacher}}</p>
|
|
|
|
|
<p class="childInfos">{{element[index].lessonType}}</p>
|
|
|
|
|
<p class="childInfos">{{element[index].course.owner.lastName}}</p>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="hourEnd">
|
|
|
|
|
{{getHoursMinutes(element[index].lessonEnd)}}
|
|
|
|
@ -224,6 +321,7 @@
|
|
|
|
|
<div class="infos">
|
|
|
|
|
<p class="childInfos">{{element.course.title}}</p>
|
|
|
|
|
<p class="childInfos">{{element.local}}</p>
|
|
|
|
|
<p class="childInfos">{{element.lessonType}}</p>
|
|
|
|
|
<p class="childInfos">{{element.course.owner.lastName}}</p>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="hourEnd">
|
|
|
|
@ -234,21 +332,97 @@
|
|
|
|
|
</div>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
</table>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
<div class="schedule" v-else>
|
|
|
|
|
|
|
|
|
|
<div v-if="display == 'Week'">
|
|
|
|
|
<button @click="changeWeek(-7)">Previous</button>
|
|
|
|
|
<button @click="changeWeek(7)">Next</button>
|
|
|
|
|
<button @click="mondayOfWeek = getMonday(new Date());
|
|
|
|
|
scheduleByWeek != null ? scheduleByWeek = sundayToTheEnd(matrixFromList(schedule.value, mondayOfWeek)) : null;">Current</button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<template v-for="i,index in 7">
|
|
|
|
|
<div class="body" style="background-color:#181818;">{{days[index]}} {{formatDate(getAnyDays(index))}}
|
|
|
|
|
</div>
|
|
|
|
|
<template v-if="scheduleByWeek != null">
|
|
|
|
|
<div class="body" style="background-color:#353535;" >
|
|
|
|
|
<div class="containerList" v-for="n,j in scheduleByWeek[index].length">
|
|
|
|
|
<div class="colorList" v-bind:style="{background:scheduleByWeek[index][j].color}"></div>
|
|
|
|
|
<div class="hoursList">{{ getHoursMinutes(scheduleByWeek[index][j].lessonStart)}}-{{getHoursMinutes(scheduleByWeek[index][j].lessonEnd)}}</div>
|
|
|
|
|
<div class="titleList">{{scheduleByWeek[index][j].course.title}}</div>
|
|
|
|
|
<div class="teacherList">{{scheduleByWeek[index][j].course.owner.lastName}}</div>
|
|
|
|
|
<div class="localList">{{scheduleByWeek[index][j].local}}</div>
|
|
|
|
|
<div class="typeList">{{scheduleByWeek[index][j].lessonType}}</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</template>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div v-if="display == 'Month'">
|
|
|
|
|
<button @click="changeMonth(-1)">Previous</button>
|
|
|
|
|
<button @click="changeMonth(1)">Next</button>
|
|
|
|
|
<div class="body" >{{months[currentDate.getMonth()]}} {{currentDate.getFullYear()}}</div>
|
|
|
|
|
|
|
|
|
|
<template v-for="i,index in lastDateOfMonth(currentDate.getMonth())-1">
|
|
|
|
|
<div class="body" style="background-color:#181818;">{{ dateOfMonth(i).getDay()-1== -1 ? days[6] : days[dateOfMonth(i).getDay()-1] }} {{formatDate(dateOfMonth(i))}}
|
|
|
|
|
</div>
|
|
|
|
|
<template v-if="scheduleByWeek != null">
|
|
|
|
|
<div class="body" style="background-color:#353535;" >
|
|
|
|
|
<div class="containerList" v-for="n,j in month[i].length">
|
|
|
|
|
<div class="colorList" v-bind:style="{background:month[i][j].color}"></div>
|
|
|
|
|
<div class="hoursList">{{ getHoursMinutes(month[i][j].lessonStart)}}-{{getHoursMinutes(month[i][j].lessonEnd)}}</div>
|
|
|
|
|
<div class="titleList">{{month[i][j].course.title}}</div>
|
|
|
|
|
<div class="teacherList">{{month[i][j].course.owner.lastName}}</div>
|
|
|
|
|
<div class="localList">{{month[i][j].local}}</div>
|
|
|
|
|
<div class="typeList">{{month[i][j].lessonType}}</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="options">
|
|
|
|
|
<button v-if="display=='Week'" @click="display='Month'">Month</button>
|
|
|
|
|
<button v-if="display=='Month'" @click="display='Week'; value=1;">Week</button>
|
|
|
|
|
<button v-if="verifUser()" @click="displayOwnSchedule()">OwnSchedule</button>
|
|
|
|
|
<select @change="changeSchedule()" v-model="schedule">
|
|
|
|
|
<option v-for="item in allSchedules" :value='item.lessons'>{{item.curriculum.option}}</option>
|
|
|
|
|
<select @change="changeSchedule()" v-model="trueSchedule">
|
|
|
|
|
<option v-for="item in allSchedules" :value='item'>{{item.curriculum.option}}</option>
|
|
|
|
|
</select>
|
|
|
|
|
<button v-if="display=='Week'" @click="display='Month'">Week</button>
|
|
|
|
|
<button v-if="display=='Month'" @click="display='Week'; value=1;">Month</button>
|
|
|
|
|
<button v-if="format == 'Grid'" @click="format ='List'">Grid</button>
|
|
|
|
|
<button v-if="format == 'List'" @click ="format = 'Grid'">List</button>
|
|
|
|
|
<button v-if="verifUser()" @click="displayOwnSchedule()">OwnSchedule</button>
|
|
|
|
|
|
|
|
|
|
<select v-if="schedule != null" @change="subFilter = 'null'" v-model="filter">
|
|
|
|
|
<option :value ="null">No Filter</option>
|
|
|
|
|
<option v-for="item in filters" :value="item">{{item}}</option>
|
|
|
|
|
</select>
|
|
|
|
|
<select @change="sortSchedule()" v-if="filter == 'Teacher'" v-model="subFilter">
|
|
|
|
|
<option :value ="null">No Filter</option>
|
|
|
|
|
<option v-for="item in teachers" :value=item>{{item.lastName}}</option>
|
|
|
|
|
</select>
|
|
|
|
|
<select @change="sortSchedule()" v-if="filter == 'Course'" v-model="subFilter">
|
|
|
|
|
<option :value ="null">No Filter</option>
|
|
|
|
|
<option v-for="item in courses" :value=item>{{item.title}}</option>
|
|
|
|
|
</select>
|
|
|
|
|
<select @change="sortSchedule()" v-if="filter == 'Type'" v-model="subFilter">
|
|
|
|
|
<option :value ="null">No Filter</option>
|
|
|
|
|
<option v-for="item in types" :value='item'>{{item}}</option>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
@ -350,7 +524,7 @@
|
|
|
|
|
.infos{
|
|
|
|
|
height:100%;
|
|
|
|
|
width:100%;
|
|
|
|
|
font-size:0.85em;
|
|
|
|
|
font-size:0.75em;
|
|
|
|
|
display:flex;
|
|
|
|
|
flex-direction:column;
|
|
|
|
|
align-items:center;
|
|
|
|
@ -385,5 +559,58 @@
|
|
|
|
|
font-size:0.7em;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.containerList{
|
|
|
|
|
color:white;
|
|
|
|
|
height:100px;
|
|
|
|
|
font-size:20px;
|
|
|
|
|
display:grid;
|
|
|
|
|
grid-template-columns:5vw auto auto auto auto auto;
|
|
|
|
|
grid-template-areas:
|
|
|
|
|
"color hours title teacher local type";
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.colorList{
|
|
|
|
|
grid-area:color;
|
|
|
|
|
align-self:center;
|
|
|
|
|
|
|
|
|
|
width:75%;
|
|
|
|
|
height:75%;
|
|
|
|
|
border:1px solid black;
|
|
|
|
|
border-radius:20%;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.hoursList{
|
|
|
|
|
grid-area:hours;
|
|
|
|
|
align-self:center;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.titleList{
|
|
|
|
|
grid-area:title;
|
|
|
|
|
align-self:center;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.teacherList {
|
|
|
|
|
grid-area:teacher;
|
|
|
|
|
align-self:center;
|
|
|
|
|
}
|
|
|
|
|
.localList{
|
|
|
|
|
grid-area:local;
|
|
|
|
|
align-self:center;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.typeList{
|
|
|
|
|
grid-area:type;
|
|
|
|
|
align-self:center;
|
|
|
|
|
}
|
|
|
|
|
.body {
|
|
|
|
|
color:white;
|
|
|
|
|
margin-top:2%;
|
|
|
|
|
width:100%;
|
|
|
|
|
border:2px solid black;
|
|
|
|
|
border-radius:9px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</style>
|
|
|
|
|