Calender View Module and Semester names and Numbers are shown

Also in the Dashboard for Lecturers
This commit is contained in:
brausjonas committed 2023-06-16 11:59:06 +02:00
1 parent 8205b7d9d9
commit 7983e23815
5 files changed
+66510 -30

No files matched your search

+47 -25
View File
@@ -66,12 +66,10 @@ export default function CalenderView(p) {
errorState[i] = ErrorType.TooLate
isDayOkay[i] = false
break
}
else if(new Date(currentYear, 0, elem.daynumber).getUTCDay() === 5) {
} else if (new Date(currentYear, 0, elem.daynumber).getUTCDay() === 5) {
errorState[i] = ErrorType.Saturday
isDayOkay[i] = false
}
else {
} else {
if ((elem.timestart - 1) / 4 <= 11 && (elem.timeend - 1) / 4 >= 14) {
errorState[i] = ErrorType.NotEnoughLunchTime
isDayOkay[i] = false
@@ -111,8 +109,7 @@ export default function CalenderView(p) {
for (let k = 0; k < 20; k++) {
if (en[i][k] != null) {
if (en[i][k].semesterid != currentsid)
{
if (en[i][k].semesterid != currentsid) {
for (let l = 0; l < 20; l++) {
if (en[i][l] != null && en[i][l].usercreatedbyid != userid) {
if (en[i][l].timestart <= en[i][k].timestart && en[i][l].timeend >= en[i][k].timeend) {
@@ -144,8 +141,7 @@ export default function CalenderView(p) {
}
let j = 0;
for(let i = Math.round(((new Date(currentYear, 0, currentWeekStartDay) - new Date(currentYear, 0, 0)) / (1000 * 60 * 60 * 24))); i <= Math.round(((new Date(currentYear, 0, currentWeekStartDay + 5) - new Date(currentYear, 0, 0)) / (1000 * 60 * 60 * 24))); i++)
{
for (let i = Math.round(((new Date(currentYear, 0, currentWeekStartDay) - new Date(currentYear, 0, 0)) / (1000 * 60 * 60 * 24))); i <= Math.round(((new Date(currentYear, 0, currentWeekStartDay + 5) - new Date(currentYear, 0, 0)) / (1000 * 60 * 60 * 24))); i++) {
grayedOut[j] = i % Math.round(((new Date(currentYear, 11, 31) - new Date(currentYear, 0, 0)) / (1000 * 60 * 60 * 24))) < semesterStart && semesterEnd && new Date(currentYear, 0, currentWeekStartDay + j).getFullYear() == semesterStartYear || i % Math.round(((new Date(currentYear, 11, 31) - new Date(currentYear, 0, 0)) / (1000 * 60 * 60 * 24))) > semesterEnd && new Date(currentYear, 0, currentWeekStartDay + j).getFullYear() == semesterEndYear
j++
}
@@ -347,8 +343,7 @@ export default function CalenderView(p) {
setHighlightMonth(date.getMonth())
setHighlightYear(date.getFullYear())
for(let i = 0; i < errorState.length; i++)
{
for (let i = 0; i < errorState.length; i++) {
errorState[i] = ErrorType.Okay
}
@@ -361,8 +356,7 @@ export default function CalenderView(p) {
setHighlightMonth(date.getMonth())
setHighlightYear(date.getFullYear())
for(let i = 0; i < errorState.length; i++)
{
for (let i = 0; i < errorState.length; i++) {
errorState[i] = ErrorType.Okay
}
@@ -393,11 +387,9 @@ export default function CalenderView(p) {
if (id == userCreatedByID) {
if (isDayOkay[columnID] && moduleid == localStorage.getItem("moduleid")) {
return "#5a6c20";
} else if(moduleid != localStorage.getItem("moduleid"))
{
} else if (moduleid != localStorage.getItem("moduleid")) {
return "#346991"
}
else {
} else {
return "#c08809";
}
} else {
@@ -434,6 +426,7 @@ export default function CalenderView(p) {
semesterEndYear = s.endyear;
setStartDayCalenderSideBar(semesterStart)
setEndDayCalenderSideBar(s.endday)
}).then(readEntries)
scrollRef.current.scrollTop = 600;
@@ -488,8 +481,7 @@ export default function CalenderView(p) {
setHighlightMonth(date.getMonth())
setHighlightYear(currentYear)
for(let i = 0; i < errorState.length; i++)
{
for (let i = 0; i < errorState.length; i++) {
errorState[i] = ErrorType.Okay
}
@@ -498,6 +490,16 @@ export default function CalenderView(p) {
return (
<div style={{
display: "flex",
flexDirection: "column",
justifyContent: "center",
alignItems: "center"
}}>
<p style={{
fontSize: 40,
marginBottom: 60
}}>{p.semesterName}</p>
<div className={"calender-direction-wrapper"}>
<div>
<BasicDateCalendar startyear={startYearCalenderSideBar} startday={startDayCalenderSideBar}
@@ -522,7 +524,8 @@ export default function CalenderView(p) {
backgroundColor: "white",
gap: 5,
}}>
<div style={{borderRadius: 10, padding: 10, backgroundColor: "#f1f1f1"}} className={"box-shadow"}>
<div style={{borderRadius: 10, padding: 10, backgroundColor: "#f1f1f1"}}
className={"box-shadow"}>
<div>
<div className={"wochen-tag-container"}>
<div
@@ -551,7 +554,10 @@ export default function CalenderView(p) {
<div className={"spalte"}
id={"0"} style={{gridTemplateRows: `repeat(96, ${cellHeight}px)`, backgroundColor: grayedOut[0] ? "#aaaaaa" : "#ffffff"}}
id={"0"} style={{
gridTemplateRows: `repeat(96, ${cellHeight}px)`,
backgroundColor: grayedOut[0] ? "#aaaaaa" : "#ffffff"
}}
onMouseDown={e => onMouseDown(e)}
onMouseMove={e => onMouseMove(e)}
onMouseUp={e => onMouseUp(e)}>
@@ -577,7 +583,10 @@ export default function CalenderView(p) {
<div className={"spalte"}
id={"1"} style={{gridTemplateRows: `repeat(96, ${cellHeight}px)`, backgroundColor: grayedOut[1] ? "#aaaaaa" : "#ffffff"}}
id={"1"} style={{
gridTemplateRows: `repeat(96, ${cellHeight}px)`,
backgroundColor: grayedOut[1] ? "#aaaaaa" : "#ffffff"
}}
onMouseDown={e => onMouseDown(e)}
onMouseMove={e => onMouseMove(e)}
onMouseUp={e => onMouseUp(e)}>
@@ -604,7 +613,10 @@ export default function CalenderView(p) {
<div className={"spalte"}
id={"2"} style={{gridTemplateRows: `repeat(96, ${cellHeight}px)`, backgroundColor: grayedOut[2] ? "#aaaaaa" : "#ffffff"}}
id={"2"} style={{
gridTemplateRows: `repeat(96, ${cellHeight}px)`,
backgroundColor: grayedOut[2] ? "#aaaaaa" : "#ffffff"
}}
onMouseDown={e => onMouseDown(e)}
onMouseMove={e => onMouseMove(e)}
onMouseUp={e => onMouseUp(e)}>
@@ -632,7 +644,10 @@ export default function CalenderView(p) {
<div className={"spalte"}
id={"3"} style={{gridTemplateRows: `repeat(96, ${cellHeight}px)`, backgroundColor: grayedOut[3] ? "#aaaaaa" : "#ffffff"}}
id={"3"} style={{
gridTemplateRows: `repeat(96, ${cellHeight}px)`,
backgroundColor: grayedOut[3] ? "#aaaaaa" : "#ffffff"
}}
onMouseDown={e => onMouseDown(e)}
onMouseMove={e => onMouseMove(e)}
onMouseUp={e => onMouseUp(e)}>
@@ -659,7 +674,10 @@ export default function CalenderView(p) {
<div className={"spalte"}
id={"4"} style={{gridTemplateRows: `repeat(96, ${cellHeight}px)`, backgroundColor: grayedOut[4] ? "#aaaaaa" : "#ffffff"}}
id={"4"} style={{
gridTemplateRows: `repeat(96, ${cellHeight}px)`,
backgroundColor: grayedOut[4] ? "#aaaaaa" : "#ffffff"
}}
onMouseDown={e => onMouseDown(e)}
onMouseMove={e => onMouseMove(e)}
onMouseUp={e => onMouseUp(e)}>
@@ -686,7 +704,10 @@ export default function CalenderView(p) {
<div className={"spalte"}
id={"5"} style={{gridTemplateRows: `repeat(96, ${cellHeight}px)`, backgroundColor: grayedOut[5] ? "#aaaaaa" : "#ffffff"}}
id={"5"} style={{
gridTemplateRows: `repeat(96, ${cellHeight}px)`,
backgroundColor: grayedOut[5] ? "#aaaaaa" : "#ffffff"
}}
onMouseDown={e => onMouseDown(e)}
onMouseMove={e => onMouseMove(e)}
onMouseUp={e => onMouseUp(e)}>
@@ -814,5 +835,6 @@ export default function CalenderView(p) {
</div>))}
</div>
</div>
</div>
)
}
+1 -1
View File
@@ -18,7 +18,7 @@ export default function planning(p)
<Back onClick={() => router.back()}/>
<HelpButton/>
<Background/>
<CalenderView/>
<CalenderView semesterName={localStorage.getItem("semestername") + " " + (localStorage.getItem("admin") == 1 ? "" : localStorage.getItem("currentmodulename"))}/>
<SubmitButton />
</div>
)
@@ -26,19 +26,20 @@ export default function SemesteroverviewLecturer(p) {
let semesterURL = baseURL + "/semester/id/all?ids=" + args + "&sessionid=" + localStorage.getItem("sessionid");
fetch(semesterURL).then(r => r.json()).then(sem => {
sem.map(e => {
temp.push(e.name)
temp.push(e.name + " Sem. " + (e.number + 1))
})
}).then(() => setSemesterNames(temp))
})
}
function onClickSemester(e, m) {
function onClickSemester(e, m, name) {
if (e.activated == 1) {
if (m.target === m.currentTarget) {
localStorage.setItem("currentsid", e.semesterid)
localStorage.setItem("currentmodulename", e.name)
localStorage.setItem("moduleid", e.id)
localStorage.setItem("semestername", name)
router.push("/planning")
}
}
@@ -62,10 +63,10 @@ export default function SemesteroverviewLecturer(p) {
{entries.map((e, index) => (
<div className={"semester-tile box-shadow"} style={{
backgroundColor: e.activated == 1 ? "#ffffff" : "#aaaaaa"
}} onClick={(f) => onClickSemester(e, f)}>
}} onClick={(f) => onClickSemester(e, f, semesterNames[index])}>
<SemesterTile
editable={false} text={semesterNames[index]} text2={e.name}
onClick={(f) => onClickSemester(e, f)}
onClick={(f) => onClickSemester(e, f, semesterNames[index])}
/>
<StatusBar progress={0} modules={entries}/>
</div>
Binary file not shown.
File diff suppressed because it is too large. Load diff