link front and back part 1
This commit is contained in:
parent
aa3e1cb868
commit
142ea996d8
@ -81,6 +81,7 @@ public class ProtectionService {
|
|||||||
toReturn.put("lessonEnd", lesson.getLessonEnd());
|
toReturn.put("lessonEnd", lesson.getLessonEnd());
|
||||||
toReturn.put("course",courseWithoutPassword(lesson.getCourse()));
|
toReturn.put("course",courseWithoutPassword(lesson.getCourse()));
|
||||||
toReturn.put("local",lesson.getLocal());
|
toReturn.put("local",lesson.getLocal());
|
||||||
|
toReturn.put("color", lesson.getColor());
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,6 +44,7 @@ public class ScheduleLessonService {
|
|||||||
}
|
}
|
||||||
toReturn.put("lessons",lessons);
|
toReturn.put("lessons",lessons);
|
||||||
toReturn.put("scheduleId" , scheduleLessonRepo.findScheduleByCurriculum(curriculum).getScheduleID());
|
toReturn.put("scheduleId" , scheduleLessonRepo.findScheduleByCurriculum(curriculum).getScheduleID());
|
||||||
|
toReturn.put("curriculum", curriculum);
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,6 +61,7 @@ public class ScheduleLessonService {
|
|||||||
}
|
}
|
||||||
toReturn.put("lessons",lessons);
|
toReturn.put("lessons",lessons);
|
||||||
toReturn.put("scheduleId" , schedule.getScheduleID());
|
toReturn.put("scheduleId" , schedule.getScheduleID());
|
||||||
|
toReturn.put("curriculum", schedule.getCurriculum());
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,69 +3,17 @@
|
|||||||
import {getDifferenceTime,lastDateOfMonth,formatDate,getFirstDay,sortByDate,matrixFromList,sundayToTheEnd,getMarginTop,getHoursMinutes, monthFromList} from '../scheduleFunctions.js'
|
import {getDifferenceTime,lastDateOfMonth,formatDate,getFirstDay,sortByDate,matrixFromList,sundayToTheEnd,getMarginTop,getHoursMinutes, monthFromList} from '../scheduleFunctions.js'
|
||||||
import {getAllSchedule} from "@/rest/scheduleRest.js";
|
import {getAllSchedule} from "@/rest/scheduleRest.js";
|
||||||
|
|
||||||
const test = await getAllSchedule();
|
const allSchedule = await getAllSchedule();
|
||||||
|
|
||||||
console.log(test);
|
|
||||||
|
const schedule = ref(allSchedule[0].lessons)
|
||||||
|
|
||||||
const schedule = [
|
|
||||||
{
|
|
||||||
course:{
|
|
||||||
id:14,
|
|
||||||
name:"Math Pour L'info",
|
|
||||||
faculty:"Science",
|
|
||||||
teacher:"Doofenschmirtz",
|
|
||||||
assistants:[14,25,13],},
|
|
||||||
|
|
||||||
start:"Mon Apr 01 2024 08:15",
|
|
||||||
|
|
||||||
end:"Mon Apr 01 2024 10:15",
|
|
||||||
color:"rgb(0,50,100)",
|
|
||||||
local:"A0B2"
|
|
||||||
},
|
|
||||||
{course:{
|
|
||||||
id:12,
|
|
||||||
name:"Calculus",
|
|
||||||
faculty:"Science",
|
|
||||||
teacher:"Doofenschmirtz",
|
|
||||||
assistants:[],
|
|
||||||
|
|
||||||
},
|
|
||||||
start:"Wed Mar 27 2024 08:15",
|
|
||||||
end:"Wed Mar 27 2024 09:15",
|
|
||||||
color:"rgb(100,50,0)",
|
|
||||||
local:"A0B2"
|
|
||||||
},
|
|
||||||
{course:{
|
|
||||||
id:2,
|
|
||||||
name:"Physique II",
|
|
||||||
faculty:"Science",
|
|
||||||
teacher:3,
|
|
||||||
assistants:[],
|
|
||||||
|
|
||||||
},
|
|
||||||
start:"Sun Mar 24 2024 10:30 ",
|
|
||||||
end:"Sun Mar 24 2024 12:30 ",
|
|
||||||
color:"rgb(100,50,100)",
|
|
||||||
local:"A0B2"
|
|
||||||
},
|
|
||||||
{course:{
|
|
||||||
id:14,
|
|
||||||
name:"Math Pour L'info",
|
|
||||||
faculty:"Science",
|
|
||||||
teacher:14,
|
|
||||||
assistants:[14,25,13],
|
|
||||||
},
|
|
||||||
start:"Sun Mar 24 2024 13:30",
|
|
||||||
end:"Sun Mar 24 2024 15:30",
|
|
||||||
color:"rgb(100,0,50)",
|
|
||||||
local:"A0B2"
|
|
||||||
}]
|
|
||||||
|
|
||||||
const display =ref("Month")
|
const display =ref("Month")
|
||||||
|
|
||||||
const days = ["Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi","Dimanche"];
|
const days = ["Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi","Dimanche"];
|
||||||
const months = ["Janvier","Fevrier","Mars","Avril",'Mai',"Juin","Juillet","Aout","Septembre","Octobre","Novembre","Decembre"]
|
const months = ["Janvier","Fevrier","Mars","Avril",'Mai',"Juin","Juillet","Aout","Septembre","Octobre","Novembre","Decembre"]
|
||||||
const firstDayOfMonth = ref(getFirstDay(new Date(schedule[1].start)))
|
const firstDayOfMonth = ref(getFirstDay(new Date()))
|
||||||
|
|
||||||
function getMonday(d) {
|
function getMonday(d) {
|
||||||
d = new Date(d);
|
d = new Date(d);
|
||||||
@ -90,11 +38,11 @@
|
|||||||
|
|
||||||
|
|
||||||
function durationCourse(element){
|
function durationCourse(element){
|
||||||
const hour = element.end.substring(3,5) -element.start.substring(3,5);
|
const hour = element.lessonEnd.substring(3,5) -element.lessonStart.substring(3,5);
|
||||||
return (element.end - element.start)%2;
|
return (element.lessonEnd - element.lessonStart)%2;
|
||||||
}
|
}
|
||||||
const scheduleByWeek = ref(sundayToTheEnd(matrixFromList(schedule,mondayOfWeek.value)));
|
const scheduleByWeek = ref(sundayToTheEnd(matrixFromList(schedule.value,mondayOfWeek.value)));
|
||||||
const month = ref(monthFromList(schedule,new Date().getMonth()));
|
const month = ref(monthFromList(schedule.value,new Date().getMonth()));
|
||||||
const shift = ref(getFirstDay(new Date()).getDay());
|
const shift = ref(getFirstDay(new Date()).getDay());
|
||||||
let value = 1;
|
let value = 1;
|
||||||
const len = ref(lastDateOfMonth(new Date()));
|
const len = ref(lastDateOfMonth(new Date()));
|
||||||
@ -102,13 +50,13 @@
|
|||||||
function changeWeek(i){
|
function changeWeek(i){
|
||||||
const temp = getAnyDays(i);
|
const temp = getAnyDays(i);
|
||||||
mondayOfWeek.value = temp;
|
mondayOfWeek.value = temp;
|
||||||
scheduleByWeek.value = sundayToTheEnd(matrixFromList(schedule, mondayOfWeek.value))
|
scheduleByWeek.value = sundayToTheEnd(matrixFromList(schedule.value, mondayOfWeek.value))
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeMonth(i){
|
function changeMonth(i){
|
||||||
const temp = currentDate.value;
|
const temp = currentDate.value;
|
||||||
currentDate.value = new Date( ( 0< temp.getMonth()+i < 13 ? temp.getFullYear() : temp.getFullYear()+i), (0< temp.getMonth()+i <13 ? temp.getMonth()+i : 12 ),1);
|
currentDate.value = new Date( ( 0< temp.getMonth()+i < 13 ? temp.getFullYear() : temp.getFullYear()+i), (0< temp.getMonth()+i <13 ? temp.getMonth()+i : 12 ),1);
|
||||||
month.value = monthFromList(schedule,currentDate.value.getMonth())
|
month.value = monthFromList(schedule.value,currentDate.value.getMonth())
|
||||||
shift.value= getFirstDay(currentDate.value).getDay();
|
shift.value= getFirstDay(currentDate.value).getDay();
|
||||||
len.value= lastDateOfMonth(currentDate.value);
|
len.value= lastDateOfMonth(currentDate.value);
|
||||||
value = 1;
|
value = 1;
|
||||||
@ -139,7 +87,7 @@
|
|||||||
<th>
|
<th>
|
||||||
<button @click="changeWeek(-7)">Previous</button>
|
<button @click="changeWeek(-7)">Previous</button>
|
||||||
<button @click="changeWeek(7)">Next</button>
|
<button @click="changeWeek(7)">Next</button>
|
||||||
<button @click="mondayOfWeek = getMonday(new Date()); scheduleByWeek = sundayToTheEnd(matrixFromList(schedule, mondayOfWeek))">Current</button>
|
<button @click="mondayOfWeek = getMonday(new Date()); scheduleByWeek = sundayToTheEnd(matrixFromList(schedule.value, mondayOfWeek))">Current</button>
|
||||||
|
|
||||||
</th>
|
</th>
|
||||||
<th class="header" v-for='d,index in 7' >
|
<th class="header" v-for='d,index in 7' >
|
||||||
@ -162,18 +110,18 @@
|
|||||||
<div class="dayCourse" v-for="element in scheduleByWeek">
|
<div class="dayCourse" v-for="element in scheduleByWeek">
|
||||||
<template v-for="i,index in element.length">
|
<template v-for="i,index in element.length">
|
||||||
<div class="course" v-bind:style="{background:element[index].color,
|
<div class="course" v-bind:style="{background:element[index].color,
|
||||||
height:((getDifferenceTime(element[index].end,element[index].start)/7.2)-0.5)+'%', top:((getMarginTop(element, index, index-1)/7.20))+'%'}">
|
height:((getDifferenceTime(element[index].lessonEnd,element[index].lessonStart)/7.2)-0.5)+'%', top:((getMarginTop(element, index, index-1)/7.20))+'%'}">
|
||||||
<div class="hourStart">
|
<div class="hourStart">
|
||||||
{{getHoursMinutes(element[index].start)}}
|
{{getHoursMinutes(element[index].lessonStart)}}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="infos" v-bind:style="{}">
|
<div class="infos" v-bind:style="{}">
|
||||||
<p class="childInfos">{{element[index].course.name}}</p>
|
<p class="childInfos">{{element[index].course.title}}</p>
|
||||||
<p class="childInfos">{{element[index].local}}</p>
|
<p class="childInfos">{{element[index].local}}</p>
|
||||||
<p class="childInfos">{{element[index].course.teacher}}</p>
|
<p class="childInfos">{{element[index].course.teacher}}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="hourEnd">
|
<div class="hourEnd">
|
||||||
{{getHoursMinutes(element[index].end)}}
|
{{getHoursMinutes(element[index].lessonEnd)}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -211,15 +159,15 @@
|
|||||||
<div class="course" v-bind:style="{background:element.color, height:100+'%'}">
|
<div class="course" v-bind:style="{background:element.color, height:100+'%'}">
|
||||||
|
|
||||||
<div class="hourStart">
|
<div class="hourStart">
|
||||||
{{getHoursMinutes(element.start)}}
|
{{getHoursMinutes(element.lessonStart)}}
|
||||||
</div>
|
</div>
|
||||||
<div class="infos">
|
<div class="infos">
|
||||||
<p class="childInfos">{{element.course.name}}</p>
|
<p class="childInfos">{{element.course.title}}</p>
|
||||||
<p class="childInfos">{{element.local}}</p>
|
<p class="childInfos">{{element.local}}</p>
|
||||||
<p class="childInfos">{{element.course.teacher}}</p>
|
<p class="childInfos">{{element.course.owner.lastName}}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="hourEnd">
|
<div class="hourEnd">
|
||||||
{{getHoursMinutes(element.end)}}
|
{{getHoursMinutes(element.lessonEnd)}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -16,15 +16,15 @@
|
|||||||
|
|
||||||
|
|
||||||
export function durationCourse(element){
|
export function durationCourse(element){
|
||||||
const hour = element.end.substring(3,5) -element.start.substring(3,5);
|
const hour = element.lessonEnd.substring(3,5) -element.lessonStart.substring(3,5);
|
||||||
|
|
||||||
|
|
||||||
return (element.end - element.start)%2;
|
return (element.lessonEnd - element.lessonStart)%2;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function sortByDate(a, b) {
|
export function sortByDate(a, b) {
|
||||||
const nameA = a.start; // ignore upper and lowercase
|
const nameA = a.lessonStart; // ignore upper and lowercase
|
||||||
const nameB = b.start; // ignore upper and lowercase
|
const nameB = b.lessonStart; // ignore upper and lowercase
|
||||||
|
|
||||||
if (nameA < nameB) {
|
if (nameA < nameB) {
|
||||||
return -1;
|
return -1;
|
||||||
@ -51,7 +51,7 @@
|
|||||||
}
|
}
|
||||||
for(let key in list){
|
for(let key in list){
|
||||||
const temp = list[key];
|
const temp = list[key];
|
||||||
const day = new Date(list[key].start);
|
const day = new Date(list[key].lessonStart);
|
||||||
if((((day.getTime()-weekStart.getTime())/60000)<10080) && (((day.getTime()-weekStart.getTime())/60000)>0)){
|
if((((day.getTime()-weekStart.getTime())/60000)<10080) && (((day.getTime()-weekStart.getTime())/60000)>0)){
|
||||||
matrix[day.getDay()].push(temp);
|
matrix[day.getDay()].push(temp);
|
||||||
matrix[day.getDay()].sort((a,b) => sortByDate(a,b));
|
matrix[day.getDay()].sort((a,b) => sortByDate(a,b));
|
||||||
@ -75,7 +75,7 @@
|
|||||||
}
|
}
|
||||||
for(let key in list){
|
for(let key in list){
|
||||||
const temp = list[key];
|
const temp = list[key];
|
||||||
const day = new Date(list[key].start);
|
const day = new Date(list[key].lessonStart);
|
||||||
if(day.getMonth()==month){
|
if(day.getMonth()==month){
|
||||||
matrix[day.getDate()].push(temp);
|
matrix[day.getDate()].push(temp);
|
||||||
matrix[day.getDay()].sort((a,b) => sortByDate(a,b));
|
matrix[day.getDay()].sort((a,b) => sortByDate(a,b));
|
||||||
@ -100,11 +100,11 @@
|
|||||||
|
|
||||||
export function getMarginTop(list, index1, index2){
|
export function getMarginTop(list, index1, index2){
|
||||||
if(index2 < 0){
|
if(index2 < 0){
|
||||||
const temp = new Date(list[index1].start);
|
const temp = new Date(list[index1].lessonStart);
|
||||||
temp.setHours(8,0,0);
|
temp.setHours(8,0,0);
|
||||||
return Math.abs((new Date(list[index1].start).getTime()- temp.getTime())/60000);
|
return Math.abs((new Date(list[index1].lessonStart).getTime()- temp.getTime())/60000);
|
||||||
}
|
}
|
||||||
return Math.abs((new Date(list[index1].start).getTime()- new Date(list[index2].end).getTime())/60000)+getMarginTop(list,index2,index2-1);
|
return Math.abs((new Date(list[index1].lessonStart).getTime()- new Date(list[index2].lessonEnd).getTime())/60000)+getMarginTop(list,index2,index2-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getHoursMinutes(date){
|
export function getHoursMinutes(date){
|
||||||
|
Loading…
Reference in New Issue
Block a user