Connected SemesterOverviewLecturer and Calenderview

This commit is contained in:
brausjonas
2023-06-07 21:58:54 +02:00
parent 7446fca94d
commit 530047ac68
6 changed files with 27308 additions and 10 deletions
+9 -7
View File
@@ -43,7 +43,7 @@ export default function CalenderView(p) {
"usercreatedbyid": localStorage.getItem("userid"), "usercreatedbyid": localStorage.getItem("userid"),
"timestart": row, "timestart": row,
"timeend": row + 3, "timeend": row + 3,
"info": "" "info": localStorage.getItem("currentmodulename")
} }
fetch(url, { fetch(url, {
method: "POST", method: "POST",
@@ -250,6 +250,8 @@ export default function CalenderView(p) {
let url = baseURL + "/semester/id?sessionid=" + localStorage.getItem("sessionid") + let url = baseURL + "/semester/id?sessionid=" + localStorage.getItem("sessionid") +
"&id=" + localStorage.getItem("currentsid"); "&id=" + localStorage.getItem("currentsid");
console.log(localStorage.getItem("currentsid"))
fetch(url).then(r => r.json()).then(s => { fetch(url).then(r => r.json()).then(s => {
currentWeekStartDay = s.startday - new Date(s.startyear, 0, s.startday).getUTCDay(); currentWeekStartDay = s.startday - new Date(s.startyear, 0, s.startday).getUTCDay();
currentYear = s.startyear; currentYear = s.startyear;
@@ -363,7 +365,7 @@ export default function CalenderView(p) {
}}></div> }}></div>
<div style={{maxHeight: "60%"}} className={"no-pointer-events"}> <div style={{maxHeight: "60%"}} className={"no-pointer-events"}>
<p>{internal_to_time(d.timestart) + " - " + internal_to_time(d.timeend)}</p> <p>{internal_to_time(d.timestart) + " - " + internal_to_time(d.timeend)}</p>
<p>Modul</p> <p>{d.info}</p>
</div> </div>
<div className={"resize-grab"} id={"grabdown"} style={{ <div className={"resize-grab"} id={"grabdown"} style={{
backgroundColor: getResizeBarColor(d.usercreatedbyid) backgroundColor: getResizeBarColor(d.usercreatedbyid)
@@ -390,7 +392,7 @@ export default function CalenderView(p) {
}}></div> }}></div>
<div style={{maxHeight: "60%"}} className={"no-pointer-events"}> <div style={{maxHeight: "60%"}} className={"no-pointer-events"}>
<p>{internal_to_time(d.timestart) + " - " + internal_to_time(d.timeend)}</p> <p>{internal_to_time(d.timestart) + " - " + internal_to_time(d.timeend)}</p>
<p>Modul</p> <p>{d.info}</p>
</div> </div>
<div className={"resize-grab"} id={"grabdown"} style={{ <div className={"resize-grab"} id={"grabdown"} style={{
backgroundColor: getResizeBarColor(d.usercreatedbyid) backgroundColor: getResizeBarColor(d.usercreatedbyid)
@@ -418,7 +420,7 @@ export default function CalenderView(p) {
}}></div> }}></div>
<div style={{maxHeight: "60%"}} className={"no-pointer-events"}> <div style={{maxHeight: "60%"}} className={"no-pointer-events"}>
<p>{internal_to_time(d.timestart) + " - " + internal_to_time(d.timeend)}</p> <p>{internal_to_time(d.timestart) + " - " + internal_to_time(d.timeend)}</p>
<p>Modul</p> <p>{d.info}</p>
</div> </div>
<div className={"resize-grab"} id={"grabdown"} style={{ <div className={"resize-grab"} id={"grabdown"} style={{
backgroundColor: getResizeBarColor(d.usercreatedbyid) backgroundColor: getResizeBarColor(d.usercreatedbyid)
@@ -445,7 +447,7 @@ export default function CalenderView(p) {
}}></div> }}></div>
<div style={{maxHeight: "60%"}} className={"no-pointer-events"}> <div style={{maxHeight: "60%"}} className={"no-pointer-events"}>
<p>{internal_to_time(d.timestart) + " - " + internal_to_time(d.timeend)}</p> <p>{internal_to_time(d.timestart) + " - " + internal_to_time(d.timeend)}</p>
<p>Moduel etc.</p> <p>{d.info}</p>
</div> </div>
<div className={"resize-grab"} id={"grabdown"} style={{ <div className={"resize-grab"} id={"grabdown"} style={{
backgroundColor: getResizeBarColor(d.usercreatedbyid) backgroundColor: getResizeBarColor(d.usercreatedbyid)
@@ -472,7 +474,7 @@ export default function CalenderView(p) {
}}></div> }}></div>
<div style={{maxHeight: "60%"}} className={"no-pointer-events"}> <div style={{maxHeight: "60%"}} className={"no-pointer-events"}>
<p>{internal_to_time(d.timestart) + " - " + internal_to_time(d.timeend)}</p> <p>{internal_to_time(d.timestart) + " - " + internal_to_time(d.timeend)}</p>
<p>Modul</p> <p>{d.info}</p>
</div> </div>
<div className={"resize-grab"} id={"grabdown"} style={{ <div className={"resize-grab"} id={"grabdown"} style={{
backgroundColor: getResizeBarColor(d.usercreatedbyid) backgroundColor: getResizeBarColor(d.usercreatedbyid)
@@ -499,7 +501,7 @@ export default function CalenderView(p) {
}}></div> }}></div>
<div style={{maxHeight: "60%"}} className={"no-pointer-events"}> <div style={{maxHeight: "60%"}} className={"no-pointer-events"}>
<p>{internal_to_time(d.timestart) + " - " + internal_to_time(d.timeend)}</p> <p>{internal_to_time(d.timestart) + " - " + internal_to_time(d.timeend)}</p>
<p>Modul</p> <p>{d.info}</p>
</div> </div>
<div className={"resize-grab"} id={"grabdown"} style={{ <div className={"resize-grab"} id={"grabdown"} style={{
backgroundColor: getResizeBarColor(d.usercreatedbyid) backgroundColor: getResizeBarColor(d.usercreatedbyid)
+2 -1
View File
@@ -1 +1,2 @@
export const baseURL = "http://185.245.96.48:8080" // export const baseURL = "http://185.245.96.48:8080"
export const baseURL = "http://localhost:8080"
@@ -38,7 +38,8 @@ export default function SemesteroverviewLecturer(p) {
function onClickSemester(e, m) { function onClickSemester(e, m) {
if (m.target === m.currentTarget) { if (m.target === m.currentTarget) {
localStorage.setItem("currentsid", e.id) localStorage.setItem("currentsid", e.semesterid)
localStorage.setItem("currentmodulename", e.name)
router.push("/planning") router.push("/planning")
} }
Binary file not shown.
File diff suppressed because it is too large Load Diff
@@ -3,6 +3,7 @@ package com.example.backend.anwprj.controller;
import com.example.backend.anwprj.Database.DataBaseHandler; import com.example.backend.anwprj.Database.DataBaseHandler;
import com.example.backend.anwprj.Entries.Entry; import com.example.backend.anwprj.Entries.Entry;
import com.example.backend.anwprj.Users.User; import com.example.backend.anwprj.Users.User;
import com.example.backend.anwprj.Users.UserPermissions;
import com.example.backend.anwprj.Users.UserSessionIDHandler; import com.example.backend.anwprj.Users.UserSessionIDHandler;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
@@ -50,7 +51,7 @@ public class EntriesController
{ {
User sessionUser = UserSessionIDHandler.getUserBySessionID(sessionid); User sessionUser = UserSessionIDHandler.getUserBySessionID(sessionid);
if (sessionUser != null) if (sessionUser != null && sessionUser.getPermissions() == UserPermissions.self.getValue())
{ {
db.addEntry(entry); db.addEntry(entry);
return new ResponseEntity<>(true, HttpStatus.OK); return new ResponseEntity<>(true, HttpStatus.OK);