diff --git a/frontend/src/Apps/Schedule.vue b/frontend/src/Apps/Schedule.vue index 1fab1bc..0c3f640 100644 --- a/frontend/src/Apps/Schedule.vue +++ b/frontend/src/Apps/Schedule.vue @@ -1,145 +1,152 @@ @@ -167,13 +242,14 @@ margin-top:2%; align-items:center; justify-content:center; - grid-template-columns:15vw 70vw; - column-gap:2.5vw; - - grid-template-areas:"options schedule"; + grid-template-columns:72vw 14.5vw; + column-gap:2vw; + overflow:hidden; + grid-template-areas:"schedule options"; } .schedule{ - position:relative; + position:relative; + overflow-y:scroll; border-radius:20px; grid-area:schedule; width:100%; @@ -181,6 +257,8 @@ background-color:rgba(255,255,255,0.1); } .options{ + display:flex; + flex-direction:column; border-radius:20px; grid-area:options; background-color:rgba(255,255,255,0.1); @@ -203,9 +281,17 @@ } .header{ - align-items:center; width:12.5%; color:#FFFFFF; + position:relative; + } + + + .childHeader{ + margin-top:0; + margin-bottom:0; + max-height:14.28% + } table th:not(:last-child), table td:not(:last-child) { @@ -228,8 +314,7 @@ grid-template-columns:repeat(7,1fr); } - - + .course{ position:relative; border: 1px solid black; @@ -244,5 +329,44 @@ .dayCourse{ display:block; } + + .infos{ + height:100%; + width:100%; + font-size:0.85em; + display:flex; + flex-direction:column; + align-items:center; + justify-content:center; + position:absolute; + } + .childInfos{ + text-align:center; + margin-top:0%; + margin-bottom:0%; + overflow:hidden; + } + + .hourStart{ + background-color:rgb(200,200,200); + border-radius:5px; + position:absolute; + top:2%; + left:2%; + font-size:0.75em; + + border: 1px solid black; + } + + .hourEnd{ + background-color:rgb(200,200,200); + border-radius:3px; + position:absolute; + bottom:2%; + left:2%; + font-size:0.7em; + } + + diff --git a/frontend/src/schedule.js b/frontend/src/schedule.js new file mode 100644 index 0000000..4c80099 --- /dev/null +++ b/frontend/src/schedule.js @@ -0,0 +1,114 @@ + import {ref} from 'vue' + export function formatDate(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 [day, month, year].join('-'); + } + + + + export function durationCourse(element){ + const hour = element.end.substring(3,5) -element.start.substring(3,5); + + + return (element.end - element.start)%2; + } + + export function sortByDate(a, b) { + const nameA = a.start; // ignore upper and lowercase + const nameB = b.start; // ignore upper and lowercase + + if (nameA < nameB) { + return -1; + } + if (nameA > nameB) { + return 1; + } + return 0; + } + + + export function getFirstDay(d){ + var date = new Date(d); + return new Date(date.getFullYear(), date.getMonth(), 1); + } + + + + export function matrixFromList(list,weekMonday){ + const weekStart = new Date(weekMonday); + const matrix = new Array(7); + for (let i = 0; i < matrix.length; i++) { + matrix[i] = []; + } + for(let key in list){ + const temp = list[key]; + const day = new Date(list[key].start); + if((((day.getTime()-weekStart.getTime())/60000)<10080) && (((day.getTime()-weekStart.getTime())/60000)>0)){ + matrix[day.getDay()].push(temp); + matrix[day.getDay()].sort((a,b) => sortByDate(a,b)); + } + } + return matrix; + } + + export function lastDateOfMonth(d){ + const date = new Date(d); + const temp = new Date(date.getFullYear(), date.getMonth() + 1, 0); + return temp.getDate(); + } + + export function monthFromList(list,month){ + const beginning = getFirstDay(month); + const matrix = new Array(lastDateOfMonth(month)) + for (let i = 0; i < matrix.length; i++) { + matrix[i] = []; + + } + for(let key in list){ + const temp = list[key]; + const day = new Date(list[key].start); + if(day.getMonth()==month){ + matrix[day.getDate()].push(temp); + matrix[day.getDay()].sort((a,b) => sortByDate(a,b)); + }} + + + return matrix; + } + + + + export function sundayToTheEnd(list){ + const newlist = list; + const sunday = newlist.shift(); + newlist.push(sunday); + return newlist; + } + + export function getDifferenceTime(date1,date2){ + return Math.abs((new Date(date2).getTime() - new Date(date1).getTime())/60000); + } + + export function getMarginTop(list, index1, index2){ + if(index2 < 0){ + const temp = new Date(list[index1].start); + temp.setHours(8,0,0); + return Math.abs((new Date(list[index1].start).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); + } + + export function getHoursMinutes(date){ + const d = new Date(date); + return d.getHours()+ ":" + d.getMinutes(); + } +