FINAL WITHOUT CLEAN
This commit is contained in:
parent
0ffc8077db
commit
be23c3ab91
@ -108,6 +108,8 @@ public class LessonRequestsController {
|
|||||||
|
|
||||||
else{
|
else{
|
||||||
lessonRequestServ.modifyDeleteRequest(lessonRequest, state);
|
lessonRequestServ.modifyDeleteRequest(lessonRequest, state);
|
||||||
|
lessonRequest.setState(state);
|
||||||
|
|
||||||
}
|
}
|
||||||
lessonRequestServ.save(lessonRequest);
|
lessonRequestServ.save(lessonRequest);
|
||||||
return new ResponseEntity<>(HttpStatus.OK);
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
|
@ -11,4 +11,7 @@ public interface LessonChangesRequestRepository extends CrudRepository<LessonCha
|
|||||||
|
|
||||||
@Query("select lr from LessonChangesRequest lr where lr.user = ?1")
|
@Query("select lr from LessonChangesRequest lr where lr.user = ?1")
|
||||||
Iterable<LessonChangesRequest> findOwnRequests(User user);
|
Iterable<LessonChangesRequest> findOwnRequests(User user);
|
||||||
|
|
||||||
|
@Query("select lr from LessonChangesRequest lr where lr.lessonId = ?1")
|
||||||
|
Iterable<LessonChangesRequest> findRequestByLessonId(long id);
|
||||||
}
|
}
|
||||||
|
@ -74,6 +74,17 @@ public class LessonRequestService {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Iterable<LessonChangesRequest> findRequestByLessonId(long id){
|
||||||
|
return lessonChangesRepo.findRequestByLessonId(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void refuseAllByLessonId(long id){
|
||||||
|
Iterable<LessonChangesRequest> toRefuse = findRequestByLessonId(id);
|
||||||
|
for(LessonChangesRequest element : toRefuse)
|
||||||
|
element.setState(RequestState.Refused);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public boolean modifyChangeRequestState(Map<String, Object> updates, long lessonId,RequestState state){
|
public boolean modifyChangeRequestState(Map<String, Object> updates, long lessonId,RequestState state){
|
||||||
if(state == RequestState.Accepted){
|
if(state == RequestState.Accepted){
|
||||||
|
|
||||||
@ -87,7 +98,8 @@ public class LessonRequestService {
|
|||||||
public void modifyDeleteRequest(LessonChangesRequest lessonChangesRequest, RequestState state){
|
public void modifyDeleteRequest(LessonChangesRequest lessonChangesRequest, RequestState state){
|
||||||
if(state == RequestState.Accepted){
|
if(state == RequestState.Accepted){
|
||||||
lessonServ.delete(lessonServ.findById(lessonChangesRequest.getLessonId()));
|
lessonServ.delete(lessonServ.findById(lessonChangesRequest.getLessonId()));
|
||||||
lessonChangesRequest.setState(state);}
|
refuseAllByLessonId(lessonChangesRequest.getLessonId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public LessonChangesRequest createLessonRequest(Map<String,Object> lessonInfos) {
|
public LessonChangesRequest createLessonRequest(Map<String,Object> lessonInfos) {
|
||||||
|
@ -234,6 +234,7 @@ window.addEventListener('hashchange', () => {
|
|||||||
.text {
|
.text {
|
||||||
right: 0%;
|
right: 0%;
|
||||||
width: 0%;
|
width: 0%;
|
||||||
|
visibility: collapse;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
color: white;
|
color: white;
|
||||||
font-size: 1.2em;
|
font-size: 1.2em;
|
||||||
@ -242,7 +243,8 @@ window.addEventListener('hashchange', () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ul.vertical:hover .text {
|
ul.vertical:hover .text {
|
||||||
opacity: 1;
|
opacity:1;
|
||||||
|
visibility:visible;
|
||||||
width: 60%;
|
width: 60%;
|
||||||
transition-duration: .3s;
|
transition-duration: .3s;
|
||||||
padding-left: 15px;
|
padding-left: 15px;
|
||||||
|
@ -4,6 +4,7 @@ import i18n from "@/i18n.js"
|
|||||||
import {ref} from 'vue'
|
import {ref} from 'vue'
|
||||||
import {changeRequestState, getAllRequests} from "@/rest/LessonRequests.js";
|
import {changeRequestState, getAllRequests} from "@/rest/LessonRequests.js";
|
||||||
import {getLesson} from "@/rest/lessonSchedule.js";
|
import {getLesson} from "@/rest/lessonSchedule.js";
|
||||||
|
import {getCourse} from "@/rest/courses.js"
|
||||||
import {formatDate, getHoursMinutes} from "@/scheduleFunctions.js";
|
import {formatDate, getHoursMinutes} from "@/scheduleFunctions.js";
|
||||||
|
|
||||||
const requests = ref(await getAllRequests());
|
const requests = ref(await getAllRequests());
|
||||||
@ -22,7 +23,8 @@ async function upPage(id,review){
|
|||||||
|
|
||||||
async function AcceptSetup(id,type){
|
async function AcceptSetup(id,type){
|
||||||
if(type !== 2 ){
|
if(type !== 2 ){
|
||||||
AcceptMod.value = !AcceptMod.value;
|
editElementID.value = id
|
||||||
|
AcceptMod.value = true;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
await upPage(id,{local: null,state:'Accepted'});
|
await upPage(id,{local: null,state:'Accepted'});
|
||||||
@ -34,21 +36,26 @@ function editItem(item){
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function setMoreInfos(item){
|
async function setMoreInfos(item){
|
||||||
|
|
||||||
|
moreInfos.value = Object.assign({},{})
|
||||||
moreInfos.value["requestType"] = requestTypes[item.requestType]
|
moreInfos.value["requestType"] = requestTypes[item.requestType]
|
||||||
moreInfos.value["day"] = formatDate(new Date(item.lessonStart))
|
if(item.requestType == 0 || item.requestType == 1){
|
||||||
moreInfos.value["start"] = getHoursMinutes(new Date(item.lessonStart));
|
moreInfos.value["day"] = item.lessonStart == null ? null : formatDate(new Date(item.lessonStart))
|
||||||
moreInfos.value["end"] = getHoursMinutes(new Date(item.lessonEnd));
|
moreInfos.value["start"] = item.lessonStart == null ? null : getHoursMinutes(new Date(item.lessonStart))
|
||||||
|
moreInfos.value["end"] = item.lessonEnd == null ? null : getHoursMinutes(new Date(item.lessonEnd))
|
||||||
moreInfos.value["lessonType"] = item.lessonType;
|
moreInfos.value["lessonType"] = item.lessonType;
|
||||||
[item["course"] == null ? moreInfos.value["course"] = null: moreInfos.value["course"]=item.course.title]
|
moreInfos.value["course"] = item["course"] == null ? null:item.course.title}
|
||||||
if (item.requestType==1 || item.requestType == 2){
|
if (item.requestType==1 || item.requestType == 2){
|
||||||
let temp = await getLesson(item.lessonId);
|
let temp = await getLesson(item.lessonId);
|
||||||
if(item.requestType == 1){
|
if(item.requestType == 1 || item.requestType == 2){
|
||||||
moreInfos.value["course"] = temp.course.title;
|
moreInfos.value["course"] = temp.course.title;
|
||||||
moreInfos.value["old_day"] = formatDate(new Date(temp.lessonStart));
|
moreInfos.value[item.requestType == 2 ? "day" : "old_day"] = formatDate(new Date(temp.lessonStart));
|
||||||
moreInfos.value["old_start"] = getHoursMinutes(new Date(temp.lessonStart));
|
moreInfos.value[item.requestType == 2 ? "start" : "old_start"] = getHoursMinutes(new Date(temp.lessonStart));
|
||||||
moreInfos.value["old_end"] = getHoursMinutes(new Date(temp.lessonEnd));
|
moreInfos.value[item.requestType == 2 ? "end":"old_end"] = getHoursMinutes(new Date(temp.lessonEnd));
|
||||||
moreInfos.value["old_type"] = temp.lessonType;
|
moreInfos.value[item.requestType == 2 ? "lessonType":"old_type"] = temp.lessonType;
|
||||||
}}
|
}}
|
||||||
|
editElementID.value = item.id ;
|
||||||
|
moreInfosMod.value =true;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -59,8 +66,7 @@ async function setMoreInfos(item){
|
|||||||
<div class="body">
|
<div class="body">
|
||||||
<div v-for="item of requests" :key="item.id" :style="{width:[moreInfosMod ? 95:70] + '%'}" class="centerer">
|
<div v-for="item of requests" :key="item.id" :style="{width:[moreInfosMod ? 95:70] + '%'}" class="centerer">
|
||||||
|
|
||||||
|
<button v-if="moreInfosMod && editElementID == item.id" @click="moreInfosMod = false; editElementID = ''; moreInfos='';">back</button>
|
||||||
|
|
||||||
<div v-if ="item.state === 'Pending'" class="listElement">
|
<div v-if ="item.state === 'Pending'" class="listElement">
|
||||||
<div class="containerElement" v-if="editElementID !== item.id">
|
<div class="containerElement" v-if="editElementID !== item.id">
|
||||||
<div class="id">{{requestTypes[item.requestType]}}</div>
|
<div class="id">{{requestTypes[item.requestType]}}</div>
|
||||||
@ -68,20 +74,20 @@ async function setMoreInfos(item){
|
|||||||
<div class="firstname">{{item.user.lastName}}</div>
|
<div class="firstname">{{item.user.lastName}}</div>
|
||||||
|
|
||||||
<div class="infos">
|
<div class="infos">
|
||||||
<button @click=" editItem(item);moreInfosMod=!moreInfosMod; setMoreInfos(item); console.log(item);" style="background-color:rgb(105,05,105);" >
|
<button @click=" setMoreInfos(item); console.log(item);" style="background-color:rgb(105,05,105);" >
|
||||||
{{i18n("request.moreInfos")}}
|
{{i18n("request.moreInfos")}}
|
||||||
</button></div>
|
</button></div>
|
||||||
<div class="accept"><button @click="editItem(item); AcceptSetup(item.id,item.requestType);" style="background-color:rgb(0,105,50);">{{i18n("request.accept")}}</button></div>
|
<div class="accept"><button @click="AcceptSetup(item.id,item.requestType);" style="background-color:rgb(0,105,50);">{{i18n("request.accept")}}</button></div>
|
||||||
<div class="refuse"><button @click="upPage(item.id,{local: null,state:'Refused'})" style="background-color:rgb(105,0,0);">{{i18n("request.refuse")}}</button></div>
|
<div class="refuse"><button @click="upPage(item.id,{local: null,state:'Refused'})" style="background-color:rgb(105,0,0);">{{i18n("request.refuse")}}</button></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-else class="containerElement" style="width:auto; height:auto;">
|
<div v-else class="containerElement" style="width:auto; height:auto;">
|
||||||
<div v-if="AcceptMod">
|
<div v-if="AcceptMod" style="margin-left:20%;">
|
||||||
Local:
|
Local:
|
||||||
<select v-model="chosenLocal">
|
<select v-model="chosenLocal">
|
||||||
<option v-for="item in locals">{{item}}</option>
|
<option v-for="item in locals">{{item}}</option>
|
||||||
</select>
|
</select>
|
||||||
<button @click="AcceptMod = !AcceptMod;upPage(item.id,{local: chosenLocal, state:'Accepted'})"></button>
|
<button @click="AcceptMod = false;upPage(item.id,{local: chosenLocal, state:'Accepted'})">Accept</button>
|
||||||
</div>
|
</div>
|
||||||
<template v-if="moreInfosMod" v-for="(key,value) in moreInfos">
|
<template v-if="moreInfosMod" v-for="(key,value) in moreInfos">
|
||||||
|
|
||||||
@ -92,7 +98,6 @@ async function setMoreInfos(item){
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<button @click = "moreInfosMod = !moreInfosMod; editElementID = ''">back</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import i18n from '@/i18n.js'
|
import i18n from '@/i18n.js'
|
||||||
import {formatDate,getHoursMinutes} from '../scheduleFunctions.js'
|
import {formatDate,getHoursMinutes,sortByDate} from '../scheduleFunctions.js'
|
||||||
import {getOwnedLessons} from "@/rest/lessonSchedule.js";
|
import {getOwnedLessons} from "@/rest/lessonSchedule.js";
|
||||||
import {getSelf} from "@/rest/Users.js";
|
import {getSelf} from "@/rest/Users.js";
|
||||||
import {createRequest} from "@/rest/LessonRequests.js"
|
import {createRequest} from "@/rest/LessonRequests.js"
|
||||||
@ -12,6 +12,7 @@ import {getAllSchedule} from "@/rest/scheduleRest.js";
|
|||||||
const curriculum = ref();
|
const curriculum = ref();
|
||||||
const allSchedules = ref(await getAllSchedule());
|
const allSchedules = ref(await getAllSchedule());
|
||||||
const schedule = ref(await getOwnedLessons());
|
const schedule = ref(await getOwnedLessons());
|
||||||
|
schedule.value.sort((a,b) => sortByDate(b,a))
|
||||||
const createMod = ref(false);
|
const createMod = ref(false);
|
||||||
const user = await getSelf();
|
const user = await getSelf();
|
||||||
const editElementID = ref();
|
const editElementID = ref();
|
||||||
@ -85,6 +86,11 @@ function setModify(lesson){
|
|||||||
toModify.value.lessonType = lesson.lessonType
|
toModify.value.lessonType = lesson.lessonType
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setCreate(){
|
||||||
|
toModify.value = ref(Object.assign({},pattern));
|
||||||
|
createMod.value = !createMod.value;
|
||||||
|
}
|
||||||
|
|
||||||
async function createLessonRequest(){
|
async function createLessonRequest(){
|
||||||
if(requestType.value === 0 || requestType.value === 1){
|
if(requestType.value === 0 || requestType.value === 1){
|
||||||
//modify
|
//modify
|
||||||
@ -126,7 +132,6 @@ async function askChanges(i){
|
|||||||
<template>
|
<template>
|
||||||
|
|
||||||
<div class="body">
|
<div class="body">
|
||||||
<button @click="createMod = !createMod">Ask Create Request</button>
|
|
||||||
<div v-if="createMod">
|
<div v-if="createMod">
|
||||||
<form class="listElement" style="width:40%; margin:0 auto 0 auto;">
|
<form class="listElement" style="width:40%; margin:0 auto 0 auto;">
|
||||||
<div style="margin-bottom:20px;">
|
<div style="margin-bottom:20px;">
|
||||||
@ -169,6 +174,7 @@ async function askChanges(i){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<button v-if="!createMod" @click="setCreate()" style="display:flex; margin:0 auto 0 auto;">Ask Create Request</button>
|
||||||
<div v-if="!createMod"v-for="element in schedule" style="width:50%;margin-left:auto; margin-right:auto;" >
|
<div v-if="!createMod"v-for="element in schedule" style="width:50%;margin-left:auto; margin-right:auto;" >
|
||||||
<div v-if="editElementID !== element.lessonID" style ="padding:15px 15px 15px 15px;">
|
<div v-if="editElementID !== element.lessonID" style ="padding:15px 15px 15px 15px;">
|
||||||
<button v-if="inFuture(element)" @click="editElementID = element.lessonID;setModify(element);">
|
<button v-if="inFuture(element)" @click="editElementID = element.lessonID;setModify(element);">
|
||||||
|
@ -9,9 +9,13 @@
|
|||||||
const trueSchedule = ref()
|
const trueSchedule = ref()
|
||||||
const log = await isLogged();
|
const log = await isLogged();
|
||||||
const schedule = ref();
|
const schedule = ref();
|
||||||
|
const importedJSON = ref();
|
||||||
|
const jsonSchedule = ref();
|
||||||
|
const jsonMod = ref(false);
|
||||||
const curriculum = ref();
|
const curriculum = ref();
|
||||||
const shift = ref(getFirstDay(new Date()).getDay());
|
const shift = ref(getFirstDay(new Date()).getDay());
|
||||||
let value = 1;
|
let value = 1;
|
||||||
|
let done = false;
|
||||||
const len = ref(lastDateOfMonth(new Date()));
|
const len = ref(lastDateOfMonth(new Date()));
|
||||||
const scheduleByWeek = ref();
|
const scheduleByWeek = ref();
|
||||||
const month = ref();
|
const month = ref();
|
||||||
@ -43,10 +47,13 @@
|
|||||||
curriculum.value = trueSchedule.value.curriculum;}
|
curriculum.value = trueSchedule.value.curriculum;}
|
||||||
|
|
||||||
schedule.value = ownSchedule.value;
|
schedule.value = ownSchedule.value;
|
||||||
|
|
||||||
|
schedule.value.sort((a,b) => sortByDate(a,b));
|
||||||
scheduleByWeek.value = sundayToTheEnd(matrixFromList(schedule.value,mondayOfWeek.value));
|
scheduleByWeek.value = sundayToTheEnd(matrixFromList(schedule.value,mondayOfWeek.value));
|
||||||
month.value = monthFromList(schedule.value,new Date().getMonth());
|
month.value = monthFromList(schedule.value,new Date().getMonth());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -101,10 +108,79 @@
|
|||||||
month.value = monthFromList(schedule.value,currentDate.value.getMonth());
|
month.value = monthFromList(schedule.value,currentDate.value.getMonth());
|
||||||
value = 1;
|
value = 1;
|
||||||
counter=0;
|
counter=0;
|
||||||
|
done = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function createJSON(){
|
||||||
|
const json = {"data":[]};
|
||||||
|
for(let element in schedule.value){
|
||||||
|
let item = {};
|
||||||
|
item["title"] = schedule.value[element].course.title + "\n" + schedule.value[element].course.owner.lastName+ "\n" + schedule.value[element].local
|
||||||
|
item["start"] = schedule.value[element].lessonStart;
|
||||||
|
item["end"] = schedule.value[element].lessonEnd;
|
||||||
|
item["color"] = schedule.value[element].color;
|
||||||
|
json.data.push(item)
|
||||||
|
}
|
||||||
|
return json
|
||||||
|
}
|
||||||
|
|
||||||
|
function exportJSON(){
|
||||||
|
let json = createJSON();
|
||||||
|
const data = JSON.stringify(json);
|
||||||
|
const blob = new Blob([data], {type:"application/json"});
|
||||||
|
const a = document.createElement('a');
|
||||||
|
a.href = URL.createObjectURL(blob);
|
||||||
|
a.download = "Schedule.json";
|
||||||
|
a.click();
|
||||||
|
|
||||||
|
}
|
||||||
|
function onFileChange(e) {
|
||||||
|
let files = e.target.files || e.dataTransfer.files;
|
||||||
|
if (!files.length) return;
|
||||||
|
readFile(files[0]);
|
||||||
|
}
|
||||||
|
function readFile(file) {
|
||||||
|
let reader = new FileReader();
|
||||||
|
reader.onload = e => {
|
||||||
|
let json = JSON.parse(e.target.result);
|
||||||
|
importedJSON.value = json
|
||||||
|
createScheduleFromJSON();
|
||||||
|
jsonMod.value= true;
|
||||||
|
};
|
||||||
|
reader.readAsText(file);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function createScheduleFromJSON(){
|
||||||
|
let jsonBrut = importedJSON.value;
|
||||||
|
let toEventList = [];
|
||||||
|
for(let element in jsonBrut["data"]){
|
||||||
|
let temp = {}
|
||||||
|
temp["title"] = jsonBrut["data"][element].title;
|
||||||
|
temp["lessonStart"] = jsonBrut["data"][element].start;
|
||||||
|
temp["lessonEnd"] = jsonBrut["data"][element].end;
|
||||||
|
temp["color"] = jsonBrut["data"][element].color;
|
||||||
|
toEventList.push(temp);
|
||||||
|
}
|
||||||
|
jsonSchedule.value = toEventList;
|
||||||
|
scheduleByWeek.value = sundayToTheEnd(matrixFromList(jsonSchedule.value,mondayOfWeek.value));
|
||||||
|
month.value = monthFromList(jsonSchedule.value,new Date().getMonth());
|
||||||
|
}
|
||||||
|
|
||||||
|
function switchToJSON(){
|
||||||
|
jsonMod.value = true;
|
||||||
|
scheduleByWeek.value = sundayToTheEnd(matrixFromList(jsonSchedule.value,mondayOfWeek.value));
|
||||||
|
month.value = monthFromList(jsonSchedule.value,new Date().getMonth());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function lessonFocus(element){
|
function lessonFocus(element){
|
||||||
|
if(!jsonMod.value){
|
||||||
focus.value = element;
|
focus.value = element;
|
||||||
var lessonsList = [];
|
var lessonsList = [];
|
||||||
for (let element in schedule.value){
|
for (let element in schedule.value){
|
||||||
@ -112,7 +188,7 @@
|
|||||||
lessonsList.push(schedule.value[element]);
|
lessonsList.push(schedule.value[element]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
focusLessons.value = lessonsList;
|
focusLessons.value = lessonsList;}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -161,7 +237,6 @@
|
|||||||
}
|
}
|
||||||
const matrix = [];
|
const matrix = [];
|
||||||
for (let element in lessons){
|
for (let element in lessons){
|
||||||
console.log(lessons[element].lessonType)
|
|
||||||
if(lessons[element].lessonType == type){
|
if(lessons[element].lessonType == type){
|
||||||
matrix.push(lessons[element])
|
matrix.push(lessons[element])
|
||||||
}
|
}
|
||||||
@ -207,18 +282,24 @@
|
|||||||
month.value = monthFromList(schedule.value,currentDate.value.getMonth());
|
month.value = monthFromList(schedule.value,currentDate.value.getMonth());
|
||||||
value = 1;
|
value = 1;
|
||||||
counter=0;
|
counter=0;
|
||||||
|
done = false;
|
||||||
courses.value = (await getcurriculum(curriculum.value.curriculumId)).courses;
|
courses.value = (await getcurriculum(curriculum.value.curriculumId)).courses;
|
||||||
filter.value = "null";
|
filter.value = "null";
|
||||||
subFilter.value = "null"
|
subFilter.value = "null"
|
||||||
focus.value = null;
|
focus.value = null;
|
||||||
focusLessons.value = null;
|
focusLessons.value = null;
|
||||||
|
jsonMod.value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeWeek(i){
|
function changeWeek(i){
|
||||||
const temp = getAnyDays(i);
|
const temp = getAnyDays(i);
|
||||||
mondayOfWeek.value = temp;
|
mondayOfWeek.value = temp;
|
||||||
if(scheduleByWeek.value != null)
|
if(scheduleByWeek.value != null)
|
||||||
scheduleByWeek.value = sundayToTheEnd(matrixFromList(schedule.value, mondayOfWeek.value))
|
if(jsonMod.value){
|
||||||
|
scheduleByWeek.value = sundayToTheEnd(matrixFromList(jsonSchedule.value, mondayOfWeek.value))}
|
||||||
|
else{
|
||||||
|
scheduleByWeek.value = sundayToTheEnd(matrixFromList(schedule.value, mondayOfWeek.value))}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeMonth(i){
|
function changeMonth(i){
|
||||||
@ -228,8 +309,14 @@
|
|||||||
len.value= lastDateOfMonth(currentDate.value);
|
len.value= lastDateOfMonth(currentDate.value);
|
||||||
value = 1;
|
value = 1;
|
||||||
counter = 0;
|
counter = 0;
|
||||||
|
done=false;
|
||||||
if(month.value != null){
|
if(month.value != null){
|
||||||
|
if(jsonMod.value){
|
||||||
|
month.value = monthFromList(jsonSchedule.value,currentDate.value.getMonth())}
|
||||||
|
}
|
||||||
|
else{
|
||||||
month.value = monthFromList(schedule.value,currentDate.value.getMonth())}
|
month.value = monthFromList(schedule.value,currentDate.value.getMonth())}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -245,11 +332,14 @@
|
|||||||
return true;}
|
return true;}
|
||||||
|
|
||||||
if(value-shift.value==len.value){
|
if(value-shift.value==len.value){
|
||||||
|
done = true;
|
||||||
counter++;
|
counter++;
|
||||||
|
|
||||||
|
|
||||||
if(counter> 35){
|
if(counter> 35){
|
||||||
counter=1;
|
counter=1;
|
||||||
value = 2;
|
value = 2;
|
||||||
|
done = false;
|
||||||
return true; }
|
return true; }
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -298,10 +388,11 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="infos">
|
<div class="infos">
|
||||||
<p class="childInfos">{{element[index].course.title}}</p>
|
<p class="childInfos" >{{jsonMod ? element[index].title : element[index].course.title}}</p>
|
||||||
<p class="childInfos">{{element[index].local}}</p>
|
<p class="childInfos"v-if="!jsonMod">{{element[index].local}}</p>
|
||||||
<p class="childInfos">{{element[index].lessonType}}</p>
|
<p class="childInfos"v-if="!jsonMod">{{element[index].lessonType}}</p>
|
||||||
<p class="childInfos">{{element[index].course.owner.lastName}}</p>
|
<p class="childInfos"v-if="!jsonMod">{{element[index].course.owner.lastName}}</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="hourEnd">
|
<div class="hourEnd">
|
||||||
{{getHoursMinutes(element[index].lessonEnd)}}
|
{{getHoursMinutes(element[index].lessonEnd)}}
|
||||||
@ -333,16 +424,17 @@
|
|||||||
<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="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%;" >
|
<div v-if="month != null" style="overflow-y:scroll; height:100%;" >
|
||||||
<template v-for="element in month[value-shift]">
|
<template v-for="element in month[value-shift]">
|
||||||
<div class="course" @click.native="lessonFocus(element)" v-bind:style="{background:element.color, height:100+'%'}">
|
<div v-if="!done"class="course" @click.native="lessonFocus(element)" v-bind:style="{background:element.color, height:100+'%'}">
|
||||||
|
|
||||||
<div class="hourStart">
|
<div class="hourStart">
|
||||||
{{getHoursMinutes(element.lessonStart)}}
|
{{getHoursMinutes(element.lessonStart)}}
|
||||||
</div>
|
</div>
|
||||||
<div class="infos">
|
<div class="infos">
|
||||||
<p class="childInfos">{{element.course.title}}</p>
|
<p class="childInfos" >{{jsonMod ? element.title : element.course.title}}</p>
|
||||||
<p class="childInfos">{{element.local}}</p>
|
<p class="childInfos"v-if="!jsonMod">{{element.local}}</p>
|
||||||
<p class="childInfos">{{element.lessonType}}</p>
|
<p class="childInfos"v-if="!jsonMod">{{element.lessonType}}</p>
|
||||||
<p class="childInfos">{{element.course.owner.lastName}}</p>
|
<p class="childInfos"v-if="!jsonMod">{{element.course.owner.lastName}}</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="hourEnd">
|
<div class="hourEnd">
|
||||||
{{getHoursMinutes(element.lessonEnd)}}
|
{{getHoursMinutes(element.lessonEnd)}}
|
||||||
@ -421,9 +513,10 @@
|
|||||||
<button v-if="display=='Month'" @click="display='Week'; value=1;">Month</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 == 'Grid'" @click="format ='List'">Grid</button>
|
||||||
<button v-if="format == 'List'" @click ="format = 'Grid'">List</button>
|
<button v-if="format == 'List'" @click ="format = 'Grid'">List</button>
|
||||||
<button v-if="verifUser()" @click="displayOwnSchedule()">OwnSchedule</button>
|
<button v-if="verifUser()" @click="jsonMod=false ;displayOwnSchedule();">OwnSchedule</button>
|
||||||
|
<button v-if="importedJSON != null" @click="switchToJSON()">Switch to JSON FILE</button>
|
||||||
|
|
||||||
<select v-if="schedule != null" @change="subFilter = 'null'" v-model="filter">
|
<select v-if="schedule != null && !jsonMod" @change="subFilter = 'null'" v-model="filter">
|
||||||
<option :value ="null">No Filter</option>
|
<option :value ="null">No Filter</option>
|
||||||
<option v-for="item in filters" :value="item">{{item}}</option>
|
<option v-for="item in filters" :value="item">{{item}}</option>
|
||||||
</select>
|
</select>
|
||||||
@ -439,8 +532,14 @@
|
|||||||
<option :value ="null">No Filter</option>
|
<option :value ="null">No Filter</option>
|
||||||
<option v-for="item in types" :value='item'>{{item}}</option>
|
<option v-for="item in types" :value='item'>{{item}}</option>
|
||||||
</select>
|
</select>
|
||||||
|
<button @click="exportJSON()" >Export JSON</button>
|
||||||
|
|
||||||
|
<div style="color:white;">IMPORT JSON</div>
|
||||||
|
<input type="file" @change="onFileChange" accept="application/JSON" ></input>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div v-if="focus != null" class="moreInfos">
|
<div v-if="focus != null && !jsonMod" 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-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}">
|
<div class="body" :style="{background:focus.color,height:auto,fontSize:1.2+'em', alignItems:center}">
|
||||||
{{focus.course.title}}</div>
|
{{focus.course.title}}</div>
|
||||||
@ -465,16 +564,18 @@
|
|||||||
</template>
|
</template>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.grid{
|
.grid{
|
||||||
|
min-width:1200px;
|
||||||
display:grid;
|
display:grid;
|
||||||
margin-top:2%;
|
margin-top:2%;
|
||||||
align-items:center;
|
align-items:center;
|
||||||
justify-content:center;
|
justify-content:center;
|
||||||
grid-template-columns:72vw 14.5vw;
|
grid-template-columns:72% 14.5%;
|
||||||
column-gap:2vw;
|
column-gap:2vw;
|
||||||
overflow:hidden;
|
overflow:hidden;
|
||||||
grid-template-areas:"schedule options";
|
grid-template-areas:"schedule options";
|
||||||
}
|
}
|
||||||
.schedule{
|
.schedule{
|
||||||
|
min-width:900px;
|
||||||
position:relative;
|
position:relative;
|
||||||
overflow-y:scroll;
|
overflow-y:scroll;
|
||||||
border-radius:20px;
|
border-radius:20px;
|
||||||
@ -490,8 +591,9 @@
|
|||||||
background-color:rgba(255,255,255,0.1);
|
background-color:rgba(255,255,255,0.1);
|
||||||
width:100%;
|
width:100%;
|
||||||
height:85vh;
|
height:85vh;
|
||||||
|
min-width:240px;
|
||||||
|
|
||||||
grid-template-rows:30% 70%;
|
grid-template-rows:40% 60%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.settings{
|
.settings{
|
||||||
|
@ -15,8 +15,6 @@ export async function createRequest(request){
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function changeRequestState(id, infos){
|
export async function changeRequestState(id, infos){
|
||||||
console.log(infos)
|
|
||||||
console.log(await getLessonRequest(id))
|
|
||||||
return restPatch("/requests/lessonRequest/" + id, infos);
|
return restPatch("/requests/lessonRequest/" + id, infos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,6 @@ async function _rest(endPoint, config){
|
|||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
});
|
});
|
||||||
config['headers'] = config['headers'] == null ? headers : config['headers'];
|
config['headers'] = config['headers'] == null ? headers : config['headers'];
|
||||||
console.log(config)
|
|
||||||
return toast.promise(fetch(restURL + endPoint, config),
|
return toast.promise(fetch(restURL + endPoint, config),
|
||||||
{
|
{
|
||||||
pending: config['pending'] != null ? config['pending'] : 'pending',
|
pending: config['pending'] != null ? config['pending'] : 'pending',
|
||||||
|
@ -24,8 +24,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function sortByDate(a, b) {
|
export function sortByDate(a, b) {
|
||||||
const nameA = a.lessonStart; // ignore upper and lowercase
|
const nameA = new Date(a.lessonStart); // ignore upper and lowercase
|
||||||
const nameB = b.lessonStart; // ignore upper and lowercase
|
const nameB = new Date(b.lessonStart); // ignore upper and lowercase
|
||||||
|
|
||||||
if (nameA < nameB) {
|
if (nameA < nameB) {
|
||||||
return -1;
|
return -1;
|
||||||
|
Loading…
Reference in New Issue
Block a user