Schedule management
This commit is contained in:
parent
adaa828810
commit
9112004326
@ -70,7 +70,8 @@ public class ApplicationsController {
|
||||
authorizedApps.add(Applications.StudentsList);}
|
||||
|
||||
if (!authServ.isNotIn(new Role[]{Role.Secretary,Role.Admin},token)){
|
||||
authorizedApps.add(Applications.UsersList);}
|
||||
authorizedApps.add(Applications.UsersList);
|
||||
authorizedApps.add(Applications.ManageSchedules);}
|
||||
return authorizedApps;
|
||||
}
|
||||
}
|
||||
|
@ -46,7 +46,6 @@ public class LessonController {
|
||||
public ResponseEntity<Iterable<HashMap<String,Object>>> getOwnedLessons(@RequestHeader("Authorization") String token){
|
||||
System.out.println(authServ);
|
||||
if (authServ.isNotIn(new Role[]{Role.Admin,Role.Teacher},token)){
|
||||
System.out.println("problem ici");
|
||||
return new UnauthorizedResponse<>(null);}
|
||||
return new ResponseEntity<>(ProtectionService.lessonsWithoutPassword(lessonServ.findAllOwnedLesson(authServ.getUserFromToken(token))),HttpStatus.OK);
|
||||
}
|
||||
@ -58,7 +57,6 @@ public class LessonController {
|
||||
if(authServ.isNotIn(new Role[]{Role.Secretary,Role.Admin},token))
|
||||
return new UnauthorizedResponse<>(null);
|
||||
Lesson createdLesson = lessonServ.save(lesson);
|
||||
|
||||
if(createdLesson==null)
|
||||
return new ResponseEntity<>(null,HttpStatus.BAD_REQUEST);
|
||||
return new ResponseEntity<>(ProtectionService.lessonWithoutPassword(createdLesson), HttpStatus.OK);
|
||||
|
@ -12,6 +12,8 @@ import ovh.herisson.Clyde.Services.CurriculumService;
|
||||
import ovh.herisson.Clyde.Tables.Curriculum;
|
||||
import ovh.herisson.Clyde.Tables.Role;
|
||||
import ovh.herisson.Clyde.Tables.Schedule;
|
||||
import ovh.herisson.Clyde.Tables.ScheduleLesson;
|
||||
import ovh.herisson.Clyde.Services.LessonService;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@ -20,6 +22,7 @@ import java.util.Map;
|
||||
public class ScheduleController {
|
||||
|
||||
private final ScheduleService scheduleServ;
|
||||
private final LessonService lessonServ;
|
||||
|
||||
private final UserCurriculumService userCurriculumService;
|
||||
|
||||
@ -28,12 +31,13 @@ public class ScheduleController {
|
||||
|
||||
private final ScheduleLessonService scheduleLessonServ;
|
||||
|
||||
public ScheduleController(ScheduleService scheduleServ, UserCurriculumService userCurriculumService, AuthenticatorService authServ, ScheduleLessonService scheduleLessonServ, CurriculumService curriculumServ) {
|
||||
public ScheduleController(ScheduleService scheduleServ, UserCurriculumService userCurriculumService, AuthenticatorService authServ, ScheduleLessonService scheduleLessonServ, CurriculumService curriculumServ,LessonService lessonServ) {
|
||||
this.scheduleServ = scheduleServ;
|
||||
this.userCurriculumService = userCurriculumService;
|
||||
this.authServ = authServ;
|
||||
this.scheduleLessonServ = scheduleLessonServ;
|
||||
this.curriculumServ = curriculumServ;
|
||||
this.lessonServ = lessonServ;
|
||||
}
|
||||
|
||||
@GetMapping("/schedule/{id}")
|
||||
@ -76,4 +80,18 @@ public class ScheduleController {
|
||||
return new UnauthorizedResponse<>(null);
|
||||
return new ResponseEntity<>(scheduleServ.save(schedule),HttpStatus.OK);
|
||||
}
|
||||
@PostMapping("/schedule/{id}")
|
||||
public ResponseEntity<String> postLessonToSchedule(@RequestHeader("Authorization") String token,
|
||||
@RequestBody Long lessonId,
|
||||
@PathVariable long id)
|
||||
{
|
||||
|
||||
if (authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary},token))
|
||||
return new UnauthorizedResponse<>(null);
|
||||
|
||||
if (!scheduleLessonServ.save(new ScheduleLesson( scheduleServ.findById(id), lessonServ.findById(lessonId))))
|
||||
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
|
||||
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
@ -23,8 +23,11 @@ public class ScheduleLessonService {
|
||||
this.scheduleRepo = scheduleRepo;
|
||||
}
|
||||
|
||||
public void save(ScheduleLesson scheduleLesson){
|
||||
public boolean save(ScheduleLesson scheduleLesson){
|
||||
if(scheduleLesson == null)
|
||||
return false;
|
||||
scheduleLessonRepo.save(scheduleLesson);
|
||||
return true;
|
||||
}
|
||||
|
||||
public Schedule getScheduleByCurriculum(Curriculum curriculum){
|
||||
|
@ -18,6 +18,9 @@ public enum Applications {
|
||||
ManageCourses,
|
||||
UsersList,
|
||||
|
||||
//Secretary authorization
|
||||
ManageSchedules,
|
||||
|
||||
// InscriptionService authorization
|
||||
Inscription,
|
||||
StudentsList
|
||||
|
@ -9,7 +9,7 @@ public class Lesson {
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
private int lessonID;
|
||||
|
||||
@ManyToOne
|
||||
@ManyToOne(fetch = FetchType.EAGER)
|
||||
@JoinColumn(name= "Course")
|
||||
private Course course;
|
||||
|
||||
|
@ -22,6 +22,7 @@ app.settings=Settings
|
||||
app.messages=Messages
|
||||
app.forum=Forum
|
||||
app.schedules=Schedules
|
||||
app.manageSchedules=Manage Schedules
|
||||
app.inscription.requests=Inscription Requests
|
||||
app.manage.courses=Manage Courses
|
||||
app.language=Language
|
||||
|
@ -22,6 +22,7 @@ app.settings=Options
|
||||
app.messages=Messages
|
||||
app.forum=Forum
|
||||
app.schedules=Horaires
|
||||
app.manageSchedules=Gérer les horaires
|
||||
app.inscription.requests=Demandes d'Inscription
|
||||
app.manage.courses=Gérer les cours
|
||||
app.language=Langue
|
||||
|
@ -35,7 +35,6 @@
|
||||
let isnull= false;
|
||||
|
||||
for(const [key, value] of Object.entries(toAdd)){
|
||||
console.log(toAdd.owner);
|
||||
if(value === null){
|
||||
isnull=true;
|
||||
}
|
||||
@ -64,9 +63,6 @@
|
||||
|
||||
async function patchCourse(course){
|
||||
for (let element in toModify){
|
||||
console.log(toModify,1)
|
||||
console.log(toModify[element],2)
|
||||
|
||||
if (element =="owner" && (toModify[element].regNo != course.owner.regNo)){
|
||||
await alterCourse(course.courseId,{owner:toModify[element].regNo});
|
||||
}
|
||||
|
398
frontend/src/Apps/ManageSchedule.vue
Normal file
398
frontend/src/Apps/ManageSchedule.vue
Normal file
@ -0,0 +1,398 @@
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import i18n from '@/i18n.js'
|
||||
import {getDifferenceTime,lastDateOfMonth,formatDate,getFirstDay,sortByDate,matrixFromList,sundayToTheEnd,getMarginTop,getHoursMinutes, monthFromList} from '../scheduleFunctions.js'
|
||||
import {getAllSchedule, getOwnSchedule, getCurriculumSchedule,addLessonToSchedule} from "@/rest/scheduleRest.js";
|
||||
import {getLessons, getOwnedLessons, createLesson } from "@/rest/lessonSchedule.js"
|
||||
import {isLogged, getSelf,getTeachers} from "@/rest/Users.js"
|
||||
import {getAllCurriculums, getcurriculum} from "@/rest/curriculum.js"
|
||||
import {getCourse} from "@/rest/courses.js"
|
||||
|
||||
const trueSchedule = ref()
|
||||
const schedule = ref();
|
||||
const lessonFinder = ref();
|
||||
const curriculum = ref();
|
||||
const allSchedules = await getAllSchedule();
|
||||
const filter = ref("null");
|
||||
const subFilter = ref("null");
|
||||
const lesson = ref();
|
||||
const filters = ["Type","Teacher","Course"];
|
||||
const types = ["TP","TD","Course","Exam"];
|
||||
const locals = ["A0B1","A1B1","A2B1","A0B2"]
|
||||
const teachers = await getTeachers() ;
|
||||
const courses = ref();
|
||||
|
||||
const createMod = ref(false);
|
||||
const deleteMod = ref(false);
|
||||
|
||||
const colors = {"TP":"rgb(36,175,255)","TD":"rgb(255,36,175)","Exam":"rgb(175,255,36)","Course":"rgb(255,36,175)"}
|
||||
const currentDate = new Date();
|
||||
|
||||
|
||||
|
||||
function invertedFormatDate(date) {
|
||||
var d = new Date(date),
|
||||
month = '' + (d.getMonth() + 1),
|
||||
day = '' + d.getDate(),
|
||||
year = d.getFullYear();
|
||||
|
||||
if (month.length < 2)
|
||||
month = '0' + month;
|
||||
if (day.length < 2)
|
||||
day = '0' + day;
|
||||
|
||||
return [year, month, day].join('-');
|
||||
}
|
||||
|
||||
const maxDate = ref(invertedFormatDate(new Date([currentDate.getMonth()<7 ? currentDate.getFullYear() : (currentDate.getFullYear())+1],7,31)));
|
||||
|
||||
const minDate = ref(invertedFormatDate((new Date()).setDate(currentDate.getDate()+1)))
|
||||
console.log(minDate.value)
|
||||
|
||||
function createLessonEvent(date,hour){
|
||||
const str = date.concat(' ',hour);
|
||||
return new Date(str);
|
||||
}
|
||||
|
||||
|
||||
|
||||
const pattern = {
|
||||
"course": null,
|
||||
"day":null,
|
||||
"lessonStart": null,
|
||||
"lessonEnd": null,
|
||||
"lessonType": null,
|
||||
"local": null,
|
||||
"color": null,
|
||||
}
|
||||
|
||||
const lessonBuffer = ref(Object.assign({}, pattern));
|
||||
|
||||
async function setCourses(){
|
||||
courses.value = (await getcurriculum(curriculum.value.curriculumId)).courses
|
||||
}
|
||||
|
||||
function sortSchedule(){
|
||||
schedule.value =trueSchedule.value.lessons;
|
||||
if(filter.value =="Teacher"){
|
||||
schedule.value = sortByTeacher(schedule.value,subFilter.value);
|
||||
|
||||
}
|
||||
else if(filter.value =="Type"){
|
||||
schedule.value = sortByType(schedule.value,subFilter.value);
|
||||
}
|
||||
else if(filter.value =="Course"){
|
||||
schedule.value = sortByCourse(schedule.value,subFilter.value);
|
||||
}
|
||||
}
|
||||
|
||||
function sortByType(lessons,type){
|
||||
if(type == null){
|
||||
return lessons;
|
||||
}
|
||||
const matrix = [];
|
||||
for (let element in lessons){
|
||||
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.courseId == course.courseId){
|
||||
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;
|
||||
|
||||
courses.value = (await getcurriculum(curriculum.value.curriculumId)).courses;
|
||||
filter.value = "null";
|
||||
subFilter.value = "null"
|
||||
}
|
||||
|
||||
function findCreatedLesson(){
|
||||
console.log(lessonFinder.value);
|
||||
for(let element in lessonFinder.value){
|
||||
console.log(lessonFinder.value[element].course.courseId, lessonFinder.value[element].local);
|
||||
|
||||
console.log(lessonBuffer.value.course.courseId, lessonBuffer.value.local)
|
||||
|
||||
if((lessonFinder.value[element].course.courseId ==lessonBuffer.value.course.courseId) && (lessonFinder.value[element].local == lessonBuffer.value.local) ){
|
||||
return lessonFinder.value[element];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
async function newLesson(){
|
||||
let isnull = false;
|
||||
if (lessonBuffer.value.lessonType != null){
|
||||
lessonBuffer.value.color = colors[lessonBuffer.value.lessonType];
|
||||
for(let element in lessonBuffer.value){
|
||||
if(lessonBuffer.value[element] == null){
|
||||
isnull=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!isnull){
|
||||
let course = await getCourse(lessonBuffer.value.course.courseId);
|
||||
console.log(course)
|
||||
let start = createLessonEvent(lessonBuffer.value.day,lessonBuffer.value.lessonStart)
|
||||
let end = createLessonEvent(lessonBuffer.value.day,lessonBuffer.value.lessonEnd)
|
||||
await createLesson(course,
|
||||
start,
|
||||
end,
|
||||
lessonBuffer.value.lessonType,
|
||||
lessonBuffer.value.color,lessonBuffer.value.local)
|
||||
|
||||
lessonFinder.value = await getLessons();
|
||||
lesson.value = findCreatedLesson();
|
||||
trueSchedule.value = await getCurriculumSchedule(curriculum.value.curriculumId)
|
||||
await addLessonToSchedule(trueSchedule.value.scheduleId,lesson.value.lessonID)
|
||||
|
||||
}
|
||||
}
|
||||
lessonBuffer.value = Object.assign({}, pattern);
|
||||
trueSchedule.value = null;
|
||||
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
<template>
|
||||
<div class="body">
|
||||
<div class="listTitle buttonGrid"v-if="!deleteMod && !createMod" >
|
||||
<button class="create" @click="createMod = true;">Create</button>
|
||||
<button class="delete" @click="deleteMod = true;">Delete</button>
|
||||
</div>
|
||||
<div v-if="createMod">
|
||||
<form class="listElement" style="width:40%; margin:0 auto 0 auto;">
|
||||
<div style="margin-bottom:20px;">
|
||||
Schedule :
|
||||
<select @change="setCourses()"v-model="curriculum">
|
||||
<option v-for="item in allSchedules" :value='item.curriculum'>{{item.curriculum.option}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div style="margin-bottom:20px;">
|
||||
Lesson :
|
||||
<select v-if="curriculum != null" v-model="lessonBuffer.course">
|
||||
<option v-for="item in courses" :value='item'>{{item.title}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div style="margin-bottom:20px;">
|
||||
Day:
|
||||
<input type="date" :min="minDate" :max="maxDate" v-model="lessonBuffer.day">
|
||||
</div>
|
||||
<div style="margin-bottom:20px;">
|
||||
Start:
|
||||
<input v-model="lessonBuffer.lessonStart" type="time" min="08:00" max="18:00" required />
|
||||
</div>
|
||||
<div style="margin-bottom:20px;">
|
||||
End:
|
||||
<input v-model="lessonBuffer.lessonEnd" type="time" min="10:00" max="20:00" required />
|
||||
</div>
|
||||
<div style="margin-bottom:20px;">
|
||||
Type:
|
||||
<select v-model="lessonBuffer.lessonType">
|
||||
<option v-for="item in types" :value='item'>{{item}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div style="margin-bottom:20px;">
|
||||
Local:
|
||||
<select v-model="lessonBuffer.local">
|
||||
<option v-for="item in locals" :value='item'>{{item}}</option>
|
||||
</select>
|
||||
|
||||
|
||||
</div>
|
||||
<div></div>
|
||||
|
||||
|
||||
|
||||
<button class="create" @click="createMod=!createMod; newLesson();"> {{i18n("courses.confirm")}} </button>
|
||||
<button style="float:right;" @click="createMod=!createMod">{{i18n("courses.back")}}</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div v-if="!deleteMod && !createMod">
|
||||
<select @change="changeSchedule()" v-model="trueSchedule">
|
||||
<option v-for="item in allSchedules" :value='item'>{{item.curriculum.option}}</option>
|
||||
</select>
|
||||
<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 v-for="element in schedule" style="width:50%;margin-left:auto; margin-right:auto;" >
|
||||
<div class="listElement">
|
||||
<div class="containerElement">
|
||||
<div>
|
||||
{{element.course.title}}
|
||||
</div>
|
||||
<div>{{formatDate(element.lessonStart)}}</div>
|
||||
<div>{{getHoursMinutes(element.lessonStart)}}-{{getHoursMinutes(element.lessonEnd)}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</template>
|
||||
<style scoped>
|
||||
.body {
|
||||
width:100%;
|
||||
margin-top:3.5%;
|
||||
}
|
||||
|
||||
.infosContainer {
|
||||
min-width:350px;
|
||||
padding-bottom:50px;
|
||||
border:2px solid black;
|
||||
font-size:25px;
|
||||
color:white;
|
||||
padding:20px;
|
||||
background-color:rgb(50,50,50);
|
||||
border-radius:20px;
|
||||
}
|
||||
|
||||
.containerElement{
|
||||
justify-content:center;
|
||||
display:grid;
|
||||
grid-template-columns:38.8% 38.8% 22.4%;
|
||||
grid-template-areas:
|
||||
"name teacher credits";
|
||||
column-gap:10px; }
|
||||
|
||||
.name {
|
||||
grid-area:name;
|
||||
align-self:center;
|
||||
}
|
||||
|
||||
.teacher{
|
||||
grid-area:teacher;
|
||||
align-self:center;
|
||||
}
|
||||
|
||||
.credits{
|
||||
grid-area:credits;
|
||||
align-self:center;
|
||||
}
|
||||
|
||||
.listElement{
|
||||
min-width:625px;
|
||||
border:2px solid black;
|
||||
font-size:25px;
|
||||
color:white;
|
||||
padding:20px;
|
||||
background-color:rgb(50,50,50);
|
||||
border-radius:20px;
|
||||
margin-bottom:10px;
|
||||
|
||||
}
|
||||
|
||||
.modify{
|
||||
font-size:25px;
|
||||
padding:10px 10px 10px 10px;
|
||||
background-color: rgb(239,60,168);
|
||||
cursor: pointer;
|
||||
border:none;
|
||||
border-radius:15px;
|
||||
}
|
||||
|
||||
input, select{
|
||||
padding:10px 10px 10px 10px;
|
||||
font-size:25px;
|
||||
cursor: pointer;
|
||||
border:none;
|
||||
border-radius:15px;
|
||||
}
|
||||
button{
|
||||
font-size:15px;
|
||||
height:50px;
|
||||
width:100px;
|
||||
border:none;
|
||||
border-radius:20px;
|
||||
|
||||
}
|
||||
|
||||
.buttonGrid{
|
||||
display:grid;
|
||||
grid-template-columns: auto auto;
|
||||
column-gap:50px;
|
||||
grid-template-areas:
|
||||
"create delete";
|
||||
}
|
||||
|
||||
.create{
|
||||
grid-area:create;
|
||||
|
||||
background-color:rgb(0,200,0);
|
||||
|
||||
}
|
||||
|
||||
.delete{
|
||||
grid-area:delete;
|
||||
background-color:rgb(200,0,0);
|
||||
}
|
||||
|
||||
.listTitle{
|
||||
min-width:380px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width:25%;
|
||||
margin-left:auto;
|
||||
margin-right:auto;
|
||||
border:2px solid black;
|
||||
font-size:25px;
|
||||
color:white;
|
||||
padding:20px;
|
||||
background-color:rgb(50,50,50);
|
||||
border-radius:20px;
|
||||
margin-bottom:10px;
|
||||
|
||||
button:hover{
|
||||
opacity:0.8;
|
||||
}
|
||||
}
|
||||
</style>
|
@ -22,6 +22,8 @@
|
||||
const ownSchedule = ref();
|
||||
const filter = ref("null");
|
||||
const subFilter = ref("null");
|
||||
const focus = ref();
|
||||
const focusLessons = ref();
|
||||
let user;
|
||||
|
||||
if(log){
|
||||
@ -102,6 +104,18 @@
|
||||
|
||||
}
|
||||
|
||||
function lessonFocus(element){
|
||||
focus.value = element;
|
||||
var lessonsList = [];
|
||||
for (let element in schedule.value){
|
||||
if (schedule.value[element].course.courseId == focus.value.course.courseId){
|
||||
lessonsList.push(schedule.value[element]);
|
||||
}
|
||||
}
|
||||
focusLessons.value = lessonsList;
|
||||
}
|
||||
|
||||
|
||||
function dateOfMonth(i){
|
||||
|
||||
return new Date(currentDate.value.getFullYear(),currentDate.value.getMonth(),i);
|
||||
@ -109,7 +123,6 @@
|
||||
|
||||
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));
|
||||
@ -136,6 +149,10 @@
|
||||
value = 1;
|
||||
counter=0;
|
||||
}
|
||||
|
||||
if(focus.value != null){
|
||||
lessonFocus(focus.value)
|
||||
}
|
||||
}
|
||||
|
||||
function sortByType(lessons,type){
|
||||
@ -161,7 +178,7 @@
|
||||
}
|
||||
const matrix = [];
|
||||
for (let element in lessons){
|
||||
if(lessons[element].course.title == course.title){
|
||||
if(lessons[element].course.courseId == course.courseId){
|
||||
matrix.push(lessons[element])
|
||||
}
|
||||
}
|
||||
@ -193,6 +210,8 @@
|
||||
courses.value = (await getcurriculum(curriculum.value.curriculumId)).courses;
|
||||
filter.value = "null";
|
||||
subFilter.value = "null"
|
||||
focus.value = null;
|
||||
focusLessons.value = null;
|
||||
}
|
||||
|
||||
function changeWeek(i){
|
||||
@ -271,13 +290,14 @@
|
||||
<div v-if="scheduleByWeek != null " class="courseGrid">
|
||||
<div class="dayCourse" v-for="element in scheduleByWeek">
|
||||
<template v-for="i,index in element.length">
|
||||
<div class="course" v-bind:style="{background:element[index].color,
|
||||
<div class="course" @click.native="lessonFocus(element[index])" v-bind:style="{background:element[index].color,
|
||||
|
||||
height:((getDifferenceTime(element[index].lessonEnd,element[index].lessonStart)/7.2)-0.5)+'%', top:((getMarginTop(element, index, index-1)/7.20))+'%'}">
|
||||
<div class="hourStart">
|
||||
{{getHoursMinutes(element[index].lessonStart)}}
|
||||
|
||||
</div>
|
||||
<div class="infos" v-bind:style="{}">
|
||||
<div class="infos">
|
||||
<p class="childInfos">{{element[index].course.title}}</p>
|
||||
<p class="childInfos">{{element[index].local}}</p>
|
||||
<p class="childInfos">{{element[index].lessonType}}</p>
|
||||
@ -313,7 +333,7 @@
|
||||
<div v-if="isAValue()" style="top:0; right:2%; border-radius:20%;color:rgb(200,200,200) ; position:absolute;z-index:50;">{{value-shift}}</div>
|
||||
<div v-if="month != null" style="overflow-y:scroll; height:100%;" >
|
||||
<template v-for="element in month[value-shift]">
|
||||
<div class="course" v-bind:style="{background:element.color, height:100+'%'}">
|
||||
<div class="course" @click.native="lessonFocus(element)" v-bind:style="{background:element.color, height:100+'%'}">
|
||||
|
||||
<div class="hourStart">
|
||||
{{getHoursMinutes(element.lessonStart)}}
|
||||
@ -349,7 +369,7 @@
|
||||
</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="containerList"v-for="n,j in scheduleByWeek[index].length" @click.native="lessonFocus(scheduleByWeek[index][j])" >
|
||||
<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>
|
||||
@ -374,7 +394,7 @@
|
||||
</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="containerList" v-for="n,j in month[i].length" @click.native="lessonFocus( month[i][j])">
|
||||
<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>
|
||||
@ -391,11 +411,9 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="options">
|
||||
<div class="settings">
|
||||
<div class="body" style="background-color:rgb(50,50,50);margin:5% 0 5% 0;">Settings</div>
|
||||
<select @change="changeSchedule()" v-model="trueSchedule">
|
||||
<option v-for="item in allSchedules" :value='item'>{{item.curriculum.option}}</option>
|
||||
</select>
|
||||
@ -421,9 +439,27 @@
|
||||
<option :value ="null">No Filter</option>
|
||||
<option v-for="item in types" :value='item'>{{item}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div v-if="focus != null" class="moreInfos">
|
||||
<div class="body" style="background-color:rgb(50,50,50); height:10%; font-size:2em;" >More infos</div>
|
||||
<div class="body" :style="{background:focus.color,height:auto,fontSize:1.2+'em', alignItems:center}">
|
||||
{{focus.course.title}}</div>
|
||||
|
||||
<div class="body" style="background-color:rgb(50,50,50);">Teacher(s)</div>
|
||||
<div class="body" style="background-color:#484848;">
|
||||
<div>{{focus.course.owner.lastName}}</div>
|
||||
<div v-for="element in focus.course.owner.assistants">
|
||||
{{element.lastName}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="body" style="background-color:rgb(50,50,50);">Lessons</div>
|
||||
<div class="body" style="background-color:#484848;"v-for="lesson in focusLessons">
|
||||
{{ getHoursMinutes(lesson.lessonStart)}}-{{getHoursMinutes(lesson.lessonEnd)}}
|
||||
{{ lesson.local}}
|
||||
{{lesson.lessonType}}
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@ -448,13 +484,36 @@
|
||||
background-color:rgba(255,255,255,0.1);
|
||||
}
|
||||
.options{
|
||||
display:flex;
|
||||
flex-direction:column;
|
||||
display:grid;
|
||||
border-radius:20px;
|
||||
grid-area:options;
|
||||
background-color:rgba(255,255,255,0.1);
|
||||
width:100%;
|
||||
height:85vh;
|
||||
|
||||
grid-template-rows:30% 70%;
|
||||
}
|
||||
|
||||
.settings{
|
||||
display:flex;
|
||||
flex-direction:column;
|
||||
width:80%;
|
||||
margin:0 auto 0 auto;
|
||||
}
|
||||
|
||||
|
||||
.settings select,.settings button{
|
||||
margin-top:2%;
|
||||
width:100%;
|
||||
}
|
||||
|
||||
.moreInfos{
|
||||
width:90%;
|
||||
display:flex;
|
||||
flex-direction:column;
|
||||
margin:0 auto 0 auto;
|
||||
overflow-y:scroll;
|
||||
overflow-x:hidden;
|
||||
}
|
||||
|
||||
.table{
|
||||
@ -607,9 +666,10 @@
|
||||
.body {
|
||||
color:white;
|
||||
margin-top:2%;
|
||||
width:100%;
|
||||
width:98%;
|
||||
border:2px solid black;
|
||||
border-radius:9px;
|
||||
text-align:center;
|
||||
}
|
||||
|
||||
|
||||
|
@ -10,9 +10,11 @@ import Courses from "@/Apps/ManageCourses.vue"
|
||||
import Users from "@/Apps/UsersList.vue"
|
||||
import Students from "@/Apps/StudentsList.vue"
|
||||
import Schedule from "@/Apps/Schedule.vue"
|
||||
import ManageSchedule from "@/Apps/ManageSchedule.vue"
|
||||
|
||||
const apps = {
|
||||
'/schedule': Schedule,
|
||||
'/manage-schedule': ManageSchedule,
|
||||
'/login': LoginPage,
|
||||
'/inscription': Inscription,
|
||||
'/profil': Profil,
|
||||
@ -26,10 +28,12 @@ const appsList = {
|
||||
'Notification': { path: '#/notifs', icon: 'fa-bell', text: i18n("app.notifications") },
|
||||
'Forum': { path: '#/forum', icon: 'fa-envelope', text: i18n("app.forum") },
|
||||
'Schedule': { path: '#/schedule', icon: 'fa-calendar-days', text: i18n("app.schedules") },
|
||||
'ManageSchedules': { path: '#/manage-schedule', icon: 'fa-calendar-days', text: i18n("app.manageSchedules")},
|
||||
'Inscription': { path: '#/inscription', icon: 'fa-users', text: i18n("app.inscription.requests") },
|
||||
'ManageCourses': { path: '#/manage-courses', icon: 'fa-book', text: i18n("app.manage.courses") },
|
||||
'StudentsList':{ path: '#/students-list',icon: 'fa-users',text: i18n("app.studentList")},
|
||||
'UsersList':{ path: '#/users-list',icon: 'fa-users',text: i18n("app.users")},
|
||||
|
||||
}
|
||||
|
||||
const currentPath = ref(window.location.hash)
|
||||
|
@ -3,8 +3,8 @@ import {restGet,restPatch,restPost,restDelete} from "@/rest/restConsumer.js";
|
||||
/**
|
||||
* Create a new lesson
|
||||
*/
|
||||
export async function createLesson(course, start, end, color, local){
|
||||
return restPost("/lesson", {course: course , start: start, end: end, color : color , local : local} )
|
||||
export async function createLesson(course, lessonStart, lessonEnd, lessonType, color, local){
|
||||
return restPost("/lesson", {course: course , lessonStart: lessonStart, lessonEnd: lessonEnd,lessonType:lessonType ,color : color , local : local} )
|
||||
}
|
||||
|
||||
/**
|
||||
@ -62,5 +62,5 @@ export async function getOwnedLessons(){
|
||||
* - assistants: should be a list and will replace all assistants
|
||||
*/
|
||||
export async function alterLesson(id, changes){
|
||||
return restPatch("/course/" + id, changes);
|
||||
return restPatch("/lesson/" + id, changes);
|
||||
}
|
||||
|
@ -15,3 +15,7 @@ export async function createSchedule(curriculum) {
|
||||
export async function getCurriculumSchedule(id){
|
||||
return restGet('/schedule/curriculum/' + id)
|
||||
}
|
||||
|
||||
export async function addLessonToSchedule(id,lessonId){
|
||||
return restPost('/schedule/' + id, lessonId)
|
||||
}
|
||||
|
@ -67,8 +67,6 @@
|
||||
}
|
||||
|
||||
export function monthFromList(list,month){
|
||||
console.log(month)
|
||||
console.log(list)
|
||||
const beginning = getFirstDay(month);
|
||||
const matrix = new Array(lastDateOfMonth(month))
|
||||
for (let i = 0; i < matrix.length; i++) {
|
||||
|
Loading…
Reference in New Issue
Block a user