FINAL WITHOUT CLEAN
This commit is contained in:
		@ -234,6 +234,7 @@ window.addEventListener('hashchange', () => {
 | 
			
		||||
	  .text {
 | 
			
		||||
		right: 0%;
 | 
			
		||||
		width: 0%;
 | 
			
		||||
		visibility: collapse;
 | 
			
		||||
		opacity: 0;
 | 
			
		||||
		color: white;
 | 
			
		||||
		font-size: 1.2em;
 | 
			
		||||
@ -242,7 +243,8 @@ window.addEventListener('hashchange', () => {
 | 
			
		||||
	  }
 | 
			
		||||
 | 
			
		||||
	  ul.vertical:hover .text {
 | 
			
		||||
		opacity: 1;
 | 
			
		||||
		opacity:1;
 | 
			
		||||
		visibility:visible;
 | 
			
		||||
		width: 60%;
 | 
			
		||||
		transition-duration: .3s;
 | 
			
		||||
		padding-left: 15px;
 | 
			
		||||
 | 
			
		||||
@ -4,6 +4,7 @@ import i18n from "@/i18n.js"
 | 
			
		||||
import {ref} from 'vue'
 | 
			
		||||
import {changeRequestState, getAllRequests} from "@/rest/LessonRequests.js";
 | 
			
		||||
import {getLesson} from "@/rest/lessonSchedule.js";
 | 
			
		||||
import {getCourse} from "@/rest/courses.js"
 | 
			
		||||
import {formatDate, getHoursMinutes} from "@/scheduleFunctions.js";
 | 
			
		||||
 | 
			
		||||
const requests = ref(await getAllRequests());
 | 
			
		||||
@ -22,7 +23,8 @@ async function upPage(id,review){
 | 
			
		||||
 | 
			
		||||
async function AcceptSetup(id,type){
 | 
			
		||||
  if(type !== 2 ){
 | 
			
		||||
    AcceptMod.value = !AcceptMod.value;
 | 
			
		||||
    editElementID.value = id
 | 
			
		||||
    AcceptMod.value = true;
 | 
			
		||||
  }
 | 
			
		||||
  else{
 | 
			
		||||
    await upPage(id,{local: null,state:'Accepted'});
 | 
			
		||||
@ -34,21 +36,26 @@ function editItem(item){
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
async function setMoreInfos(item){
 | 
			
		||||
    
 | 
			
		||||
    moreInfos.value = Object.assign({},{})
 | 
			
		||||
    moreInfos.value["requestType"] = requestTypes[item.requestType]
 | 
			
		||||
    moreInfos.value["day"] = formatDate(new Date(item.lessonStart))
 | 
			
		||||
    moreInfos.value["start"] = getHoursMinutes(new Date(item.lessonStart));
 | 
			
		||||
    moreInfos.value["end"] = getHoursMinutes(new Date(item.lessonEnd));
 | 
			
		||||
    if(item.requestType == 0 || item.requestType == 1){
 | 
			
		||||
    moreInfos.value["day"] = item.lessonStart == null ? null : formatDate(new Date(item.lessonStart))
 | 
			
		||||
    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;
 | 
			
		||||
  [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){
 | 
			
		||||
    let temp = await getLesson(item.lessonId);
 | 
			
		||||
    if(item.requestType == 1){
 | 
			
		||||
      let temp = await getLesson(item.lessonId);
 | 
			
		||||
    if(item.requestType == 1 || item.requestType == 2){
 | 
			
		||||
    moreInfos.value["course"] = temp.course.title;
 | 
			
		||||
    moreInfos.value["old_day"] =  formatDate(new Date(temp.lessonStart));
 | 
			
		||||
    moreInfos.value["old_start"] = getHoursMinutes(new Date(temp.lessonStart));
 | 
			
		||||
    moreInfos.value["old_end"] = getHoursMinutes(new Date(temp.lessonEnd));
 | 
			
		||||
    moreInfos.value["old_type"] = temp.lessonType;
 | 
			
		||||
    moreInfos.value[item.requestType == 2 ? "day" : "old_day"] =  formatDate(new Date(temp.lessonStart));
 | 
			
		||||
    moreInfos.value[item.requestType == 2 ? "start" : "old_start"] = getHoursMinutes(new Date(temp.lessonStart));
 | 
			
		||||
    moreInfos.value[item.requestType == 2 ? "end":"old_end"] = getHoursMinutes(new Date(temp.lessonEnd));
 | 
			
		||||
    moreInfos.value[item.requestType == 2 ? "lessonType":"old_type"] = temp.lessonType;
 | 
			
		||||
  }}
 | 
			
		||||
  editElementID.value = item.id ;
 | 
			
		||||
  moreInfosMod.value =true;
 | 
			
		||||
}
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
@ -59,8 +66,7 @@ async function setMoreInfos(item){
 | 
			
		||||
    <div  class="body">
 | 
			
		||||
    <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 class="containerElement" v-if="editElementID !== item.id">
 | 
			
		||||
          <div class="id">{{requestTypes[item.requestType]}}</div>
 | 
			
		||||
@ -68,20 +74,20 @@ async function setMoreInfos(item){
 | 
			
		||||
          <div class="firstname">{{item.user.lastName}}</div>
 | 
			
		||||
          
 | 
			
		||||
          <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")}}
 | 
			
		||||
            </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>
 | 
			
		||||
 | 
			
		||||
      <div v-else class="containerElement" style="width:auto; height:auto;">
 | 
			
		||||
          <div v-if="AcceptMod">
 | 
			
		||||
          <div v-if="AcceptMod" style="margin-left:20%;">
 | 
			
		||||
            Local:
 | 
			
		||||
            <select v-model="chosenLocal">
 | 
			
		||||
              <option v-for="item in locals">{{item}}</option>
 | 
			
		||||
            </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>
 | 
			
		||||
          <template  v-if="moreInfosMod" v-for="(key,value) in moreInfos">
 | 
			
		||||
 | 
			
		||||
@ -92,7 +98,6 @@ async function setMoreInfos(item){
 | 
			
		||||
              </div>
 | 
			
		||||
              </div>
 | 
			
		||||
          </template>
 | 
			
		||||
              <button @click = "moreInfosMod = !moreInfosMod; editElementID = ''">back</button>
 | 
			
		||||
      </div>
 | 
			
		||||
      </div>
 | 
			
		||||
      </div>
 | 
			
		||||
 | 
			
		||||
@ -1,7 +1,7 @@
 | 
			
		||||
<script setup>
 | 
			
		||||
import { ref } from 'vue'
 | 
			
		||||
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 {getSelf} from "@/rest/Users.js";
 | 
			
		||||
import {createRequest} from "@/rest/LessonRequests.js"
 | 
			
		||||
@ -12,6 +12,7 @@ import {getAllSchedule} from "@/rest/scheduleRest.js";
 | 
			
		||||
const curriculum = ref();
 | 
			
		||||
const allSchedules = ref(await getAllSchedule());
 | 
			
		||||
const schedule = ref(await getOwnedLessons());
 | 
			
		||||
schedule.value.sort((a,b) => sortByDate(b,a))
 | 
			
		||||
const createMod = ref(false);
 | 
			
		||||
const user = await getSelf();
 | 
			
		||||
const editElementID = ref();
 | 
			
		||||
@ -85,6 +86,11 @@ function setModify(lesson){
 | 
			
		||||
  toModify.value.lessonType = lesson.lessonType
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function setCreate(){
 | 
			
		||||
  toModify.value = ref(Object.assign({},pattern));
 | 
			
		||||
  createMod.value = !createMod.value;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
async function createLessonRequest(){
 | 
			
		||||
  if(requestType.value === 0 || requestType.value === 1){
 | 
			
		||||
    //modify
 | 
			
		||||
@ -126,7 +132,6 @@ async function askChanges(i){
 | 
			
		||||
<template>
 | 
			
		||||
 | 
			
		||||
  <div class="body">
 | 
			
		||||
    <button @click="createMod = !createMod">Ask Create Request</button>
 | 
			
		||||
    <div v-if="createMod">
 | 
			
		||||
    <form class="listElement" style="width:40%; margin:0 auto 0 auto;">
 | 
			
		||||
      <div style="margin-bottom:20px;">
 | 
			
		||||
@ -168,7 +173,8 @@ async function askChanges(i){
 | 
			
		||||
  </div>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
    <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="editElementID !== element.lessonID" style ="padding:15px 15px 15px 15px;">
 | 
			
		||||
        <button  v-if="inFuture(element)" @click="editElementID = element.lessonID;setModify(element);">
 | 
			
		||||
 | 
			
		||||
@ -9,9 +9,13 @@
 | 
			
		||||
  const trueSchedule = ref()
 | 
			
		||||
  const log = await isLogged();
 | 
			
		||||
  const schedule = ref();
 | 
			
		||||
  const importedJSON = ref();  
 | 
			
		||||
  const jsonSchedule = ref();
 | 
			
		||||
  const jsonMod = ref(false);
 | 
			
		||||
  const curriculum = ref();
 | 
			
		||||
  const shift = ref(getFirstDay(new Date()).getDay());
 | 
			
		||||
  let value = 1;
 | 
			
		||||
  let done = false;
 | 
			
		||||
  const len = ref(lastDateOfMonth(new Date()));
 | 
			
		||||
  const scheduleByWeek = ref();
 | 
			
		||||
  const month = ref();
 | 
			
		||||
@ -43,10 +47,13 @@
 | 
			
		||||
        curriculum.value = trueSchedule.value.curriculum;}
 | 
			
		||||
 | 
			
		||||
      schedule.value = ownSchedule.value;
 | 
			
		||||
 | 
			
		||||
      schedule.value.sort((a,b) => sortByDate(a,b));
 | 
			
		||||
      scheduleByWeek.value = sundayToTheEnd(matrixFromList(schedule.value,mondayOfWeek.value));
 | 
			
		||||
      month.value = monthFromList(schedule.value,new Date().getMonth());
 | 
			
		||||
 | 
			
		||||
      
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -101,10 +108,79 @@
 | 
			
		||||
      month.value = monthFromList(schedule.value,currentDate.value.getMonth());
 | 
			
		||||
      value = 1;
 | 
			
		||||
      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){
 | 
			
		||||
    if(!jsonMod.value){
 | 
			
		||||
    focus.value = element;
 | 
			
		||||
    var lessonsList = [];
 | 
			
		||||
    for (let element in schedule.value){
 | 
			
		||||
@ -112,7 +188,7 @@
 | 
			
		||||
        lessonsList.push(schedule.value[element]);  
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    focusLessons.value = lessonsList;
 | 
			
		||||
      focusLessons.value = lessonsList;}
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -161,7 +237,6 @@
 | 
			
		||||
    }
 | 
			
		||||
    const matrix = [];
 | 
			
		||||
    for (let element in lessons){
 | 
			
		||||
      console.log(lessons[element].lessonType)
 | 
			
		||||
      if(lessons[element].lessonType == type){
 | 
			
		||||
        matrix.push(lessons[element])
 | 
			
		||||
      }
 | 
			
		||||
@ -207,18 +282,24 @@
 | 
			
		||||
      month.value = monthFromList(schedule.value,currentDate.value.getMonth());
 | 
			
		||||
      value = 1;
 | 
			
		||||
      counter=0;
 | 
			
		||||
      done = false;
 | 
			
		||||
      courses.value = (await getcurriculum(curriculum.value.curriculumId)).courses;
 | 
			
		||||
      filter.value = "null";
 | 
			
		||||
      subFilter.value = "null"
 | 
			
		||||
      focus.value = null;
 | 
			
		||||
      focusLessons.value = null;
 | 
			
		||||
      jsonMod.value = false;
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
  function changeWeek(i){
 | 
			
		||||
    const temp = getAnyDays(i);
 | 
			
		||||
    mondayOfWeek.value = temp;
 | 
			
		||||
    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){
 | 
			
		||||
@ -228,8 +309,14 @@
 | 
			
		||||
    len.value= lastDateOfMonth(currentDate.value);
 | 
			
		||||
    value = 1;
 | 
			
		||||
    counter = 0;
 | 
			
		||||
    done=false;
 | 
			
		||||
    if(month.value != null){
 | 
			
		||||
      if(jsonMod.value){
 | 
			
		||||
        month.value = monthFromList(jsonSchedule.value,currentDate.value.getMonth())}
 | 
			
		||||
      }
 | 
			
		||||
    else{
 | 
			
		||||
      month.value = monthFromList(schedule.value,currentDate.value.getMonth())}
 | 
			
		||||
  
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -245,11 +332,14 @@
 | 
			
		||||
      return true;}
 | 
			
		||||
    
 | 
			
		||||
    if(value-shift.value==len.value){
 | 
			
		||||
      done = true;
 | 
			
		||||
      counter++;
 | 
			
		||||
       
 | 
			
		||||
      
 | 
			
		||||
      if(counter> 35){
 | 
			
		||||
        counter=1;
 | 
			
		||||
        value = 2;
 | 
			
		||||
        done = false;
 | 
			
		||||
        return true; }
 | 
			
		||||
      return false;
 | 
			
		||||
    }
 | 
			
		||||
@ -298,10 +388,11 @@
 | 
			
		||||
 | 
			
		||||
              </div>
 | 
			
		||||
              <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>
 | 
			
		||||
                <p class="childInfos">{{element[index].course.owner.lastName}}</p>
 | 
			
		||||
                <p class="childInfos" >{{jsonMod ? element[index].title : element[index].course.title}}</p>
 | 
			
		||||
                <p class="childInfos"v-if="!jsonMod">{{element[index].local}}</p>
 | 
			
		||||
                <p class="childInfos"v-if="!jsonMod">{{element[index].lessonType}}</p>
 | 
			
		||||
                <p class="childInfos"v-if="!jsonMod">{{element[index].course.owner.lastName}}</p>
 | 
			
		||||
 | 
			
		||||
              </div> 
 | 
			
		||||
              <div class="hourEnd">
 | 
			
		||||
                {{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="month != null" style="overflow-y:scroll; height:100%;" >
 | 
			
		||||
              <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">
 | 
			
		||||
                {{getHoursMinutes(element.lessonStart)}}
 | 
			
		||||
              </div>
 | 
			
		||||
              <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>
 | 
			
		||||
                <p class="childInfos" >{{jsonMod ? element.title : element.course.title}}</p>
 | 
			
		||||
                <p class="childInfos"v-if="!jsonMod">{{element.local}}</p>
 | 
			
		||||
                <p class="childInfos"v-if="!jsonMod">{{element.lessonType}}</p>
 | 
			
		||||
                <p class="childInfos"v-if="!jsonMod">{{element.course.owner.lastName}}</p>
 | 
			
		||||
 | 
			
		||||
              </div> 
 | 
			
		||||
              <div class="hourEnd">
 | 
			
		||||
                {{getHoursMinutes(element.lessonEnd)}}
 | 
			
		||||
@ -421,9 +513,10 @@
 | 
			
		||||
      <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>
 | 
			
		||||
      <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 v-for="item in filters" :value="item">{{item}}</option>
 | 
			
		||||
      </select>
 | 
			
		||||
@ -439,8 +532,14 @@
 | 
			
		||||
        <option :value ="null">No Filter</option>
 | 
			
		||||
        <option v-for="item in types" :value='item'>{{item}}</option>
 | 
			
		||||
      </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 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:focus.color,height:auto,fontSize:1.2+'em', alignItems:center}">
 | 
			
		||||
          {{focus.course.title}}</div>
 | 
			
		||||
@ -465,16 +564,18 @@
 | 
			
		||||
</template>
 | 
			
		||||
<style scoped>
 | 
			
		||||
  .grid{
 | 
			
		||||
    min-width:1200px;
 | 
			
		||||
    display:grid;
 | 
			
		||||
    margin-top:2%;
 | 
			
		||||
    align-items:center;
 | 
			
		||||
    justify-content:center;
 | 
			
		||||
    grid-template-columns:72vw 14.5vw;
 | 
			
		||||
    grid-template-columns:72% 14.5%;
 | 
			
		||||
    column-gap:2vw;
 | 
			
		||||
    overflow:hidden;
 | 
			
		||||
    grid-template-areas:"schedule options";
 | 
			
		||||
  }
 | 
			
		||||
  .schedule{
 | 
			
		||||
    min-width:900px;
 | 
			
		||||
    position:relative; 
 | 
			
		||||
    overflow-y:scroll;
 | 
			
		||||
    border-radius:20px;
 | 
			
		||||
@ -490,8 +591,9 @@
 | 
			
		||||
    background-color:rgba(255,255,255,0.1);
 | 
			
		||||
    width:100%;
 | 
			
		||||
    height:85vh;
 | 
			
		||||
    min-width:240px;
 | 
			
		||||
 | 
			
		||||
    grid-template-rows:30% 70%;
 | 
			
		||||
    grid-template-rows:40% 60%;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  .settings{
 | 
			
		||||
 | 
			
		||||
@ -15,11 +15,9 @@ export async function createRequest(request){
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export async function changeRequestState(id, infos){
 | 
			
		||||
    console.log(infos)
 | 
			
		||||
    console.log(await getLessonRequest(id))
 | 
			
		||||
    return restPatch("/requests/lessonRequest/" + id, infos);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export async function deleteRequest(id){
 | 
			
		||||
    return restDelete("/requests/lessonRequest/"+id);
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -45,7 +45,6 @@ async function _rest(endPoint, config){
 | 
			
		||||
		'Content-Type': 'application/json',
 | 
			
		||||
	});
 | 
			
		||||
	config['headers'] = config['headers'] == null ? headers : config['headers'];
 | 
			
		||||
  console.log(config)
 | 
			
		||||
	return toast.promise(fetch(restURL + endPoint, config),
 | 
			
		||||
		{ 
 | 
			
		||||
			pending: config['pending'] != null ? config['pending'] : 'pending',
 | 
			
		||||
 | 
			
		||||
@ -24,9 +24,9 @@
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  export function sortByDate(a, b) {
 | 
			
		||||
    const nameA = a.lessonStart; // ignore upper and lowercase
 | 
			
		||||
    const nameB = b.lessonStart; // ignore upper and lowercase
 | 
			
		||||
    
 | 
			
		||||
    const nameA = new Date(a.lessonStart); // ignore upper and lowercase
 | 
			
		||||
    const nameB = new Date(b.lessonStart); // ignore upper and lowercase
 | 
			
		||||
      
 | 
			
		||||
    if (nameA < nameB) {
 | 
			
		||||
      return -1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user