Calender View Module and Semester names and Numbers are shown
Also in the Dashboard for Lecturers
This commit is contained in:
@@ -66,12 +66,10 @@ export default function CalenderView(p) {
|
|||||||
errorState[i] = ErrorType.TooLate
|
errorState[i] = ErrorType.TooLate
|
||||||
isDayOkay[i] = false
|
isDayOkay[i] = false
|
||||||
break
|
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
|
errorState[i] = ErrorType.Saturday
|
||||||
isDayOkay[i] = false
|
isDayOkay[i] = false
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if ((elem.timestart - 1) / 4 <= 11 && (elem.timeend - 1) / 4 >= 14) {
|
if ((elem.timestart - 1) / 4 <= 11 && (elem.timeend - 1) / 4 >= 14) {
|
||||||
errorState[i] = ErrorType.NotEnoughLunchTime
|
errorState[i] = ErrorType.NotEnoughLunchTime
|
||||||
isDayOkay[i] = false
|
isDayOkay[i] = false
|
||||||
@@ -111,8 +109,7 @@ export default function CalenderView(p) {
|
|||||||
for (let k = 0; k < 20; k++) {
|
for (let k = 0; k < 20; k++) {
|
||||||
if (en[i][k] != null) {
|
if (en[i][k] != null) {
|
||||||
|
|
||||||
if (en[i][k].semesterid != currentsid)
|
if (en[i][k].semesterid != currentsid) {
|
||||||
{
|
|
||||||
for (let l = 0; l < 20; l++) {
|
for (let l = 0; l < 20; l++) {
|
||||||
if (en[i][l] != null && en[i][l].usercreatedbyid != userid) {
|
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) {
|
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;
|
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
|
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++
|
j++
|
||||||
}
|
}
|
||||||
@@ -347,8 +343,7 @@ export default function CalenderView(p) {
|
|||||||
setHighlightMonth(date.getMonth())
|
setHighlightMonth(date.getMonth())
|
||||||
setHighlightYear(date.getFullYear())
|
setHighlightYear(date.getFullYear())
|
||||||
|
|
||||||
for(let i = 0; i < errorState.length; i++)
|
for (let i = 0; i < errorState.length; i++) {
|
||||||
{
|
|
||||||
errorState[i] = ErrorType.Okay
|
errorState[i] = ErrorType.Okay
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -361,8 +356,7 @@ export default function CalenderView(p) {
|
|||||||
setHighlightMonth(date.getMonth())
|
setHighlightMonth(date.getMonth())
|
||||||
setHighlightYear(date.getFullYear())
|
setHighlightYear(date.getFullYear())
|
||||||
|
|
||||||
for(let i = 0; i < errorState.length; i++)
|
for (let i = 0; i < errorState.length; i++) {
|
||||||
{
|
|
||||||
errorState[i] = ErrorType.Okay
|
errorState[i] = ErrorType.Okay
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -393,11 +387,9 @@ export default function CalenderView(p) {
|
|||||||
if (id == userCreatedByID) {
|
if (id == userCreatedByID) {
|
||||||
if (isDayOkay[columnID] && moduleid == localStorage.getItem("moduleid")) {
|
if (isDayOkay[columnID] && moduleid == localStorage.getItem("moduleid")) {
|
||||||
return "#5a6c20";
|
return "#5a6c20";
|
||||||
} else if(moduleid != localStorage.getItem("moduleid"))
|
} else if (moduleid != localStorage.getItem("moduleid")) {
|
||||||
{
|
|
||||||
return "#346991"
|
return "#346991"
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return "#c08809";
|
return "#c08809";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -434,6 +426,7 @@ export default function CalenderView(p) {
|
|||||||
semesterEndYear = s.endyear;
|
semesterEndYear = s.endyear;
|
||||||
setStartDayCalenderSideBar(semesterStart)
|
setStartDayCalenderSideBar(semesterStart)
|
||||||
setEndDayCalenderSideBar(s.endday)
|
setEndDayCalenderSideBar(s.endday)
|
||||||
|
|
||||||
}).then(readEntries)
|
}).then(readEntries)
|
||||||
|
|
||||||
scrollRef.current.scrollTop = 600;
|
scrollRef.current.scrollTop = 600;
|
||||||
@@ -488,8 +481,7 @@ export default function CalenderView(p) {
|
|||||||
setHighlightMonth(date.getMonth())
|
setHighlightMonth(date.getMonth())
|
||||||
setHighlightYear(currentYear)
|
setHighlightYear(currentYear)
|
||||||
|
|
||||||
for(let i = 0; i < errorState.length; i++)
|
for (let i = 0; i < errorState.length; i++) {
|
||||||
{
|
|
||||||
errorState[i] = ErrorType.Okay
|
errorState[i] = ErrorType.Okay
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -498,6 +490,16 @@ export default function CalenderView(p) {
|
|||||||
|
|
||||||
return (
|
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 className={"calender-direction-wrapper"}>
|
||||||
<div>
|
<div>
|
||||||
<BasicDateCalendar startyear={startYearCalenderSideBar} startday={startDayCalenderSideBar}
|
<BasicDateCalendar startyear={startYearCalenderSideBar} startday={startDayCalenderSideBar}
|
||||||
@@ -522,7 +524,8 @@ export default function CalenderView(p) {
|
|||||||
backgroundColor: "white",
|
backgroundColor: "white",
|
||||||
gap: 5,
|
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>
|
||||||
<div className={"wochen-tag-container"}>
|
<div className={"wochen-tag-container"}>
|
||||||
<div
|
<div
|
||||||
@@ -551,7 +554,10 @@ export default function CalenderView(p) {
|
|||||||
|
|
||||||
|
|
||||||
<div className={"spalte"}
|
<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)}
|
onMouseDown={e => onMouseDown(e)}
|
||||||
onMouseMove={e => onMouseMove(e)}
|
onMouseMove={e => onMouseMove(e)}
|
||||||
onMouseUp={e => onMouseUp(e)}>
|
onMouseUp={e => onMouseUp(e)}>
|
||||||
@@ -577,7 +583,10 @@ export default function CalenderView(p) {
|
|||||||
|
|
||||||
|
|
||||||
<div className={"spalte"}
|
<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)}
|
onMouseDown={e => onMouseDown(e)}
|
||||||
onMouseMove={e => onMouseMove(e)}
|
onMouseMove={e => onMouseMove(e)}
|
||||||
onMouseUp={e => onMouseUp(e)}>
|
onMouseUp={e => onMouseUp(e)}>
|
||||||
@@ -604,7 +613,10 @@ export default function CalenderView(p) {
|
|||||||
|
|
||||||
|
|
||||||
<div className={"spalte"}
|
<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)}
|
onMouseDown={e => onMouseDown(e)}
|
||||||
onMouseMove={e => onMouseMove(e)}
|
onMouseMove={e => onMouseMove(e)}
|
||||||
onMouseUp={e => onMouseUp(e)}>
|
onMouseUp={e => onMouseUp(e)}>
|
||||||
@@ -632,7 +644,10 @@ export default function CalenderView(p) {
|
|||||||
|
|
||||||
|
|
||||||
<div className={"spalte"}
|
<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)}
|
onMouseDown={e => onMouseDown(e)}
|
||||||
onMouseMove={e => onMouseMove(e)}
|
onMouseMove={e => onMouseMove(e)}
|
||||||
onMouseUp={e => onMouseUp(e)}>
|
onMouseUp={e => onMouseUp(e)}>
|
||||||
@@ -659,7 +674,10 @@ export default function CalenderView(p) {
|
|||||||
|
|
||||||
|
|
||||||
<div className={"spalte"}
|
<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)}
|
onMouseDown={e => onMouseDown(e)}
|
||||||
onMouseMove={e => onMouseMove(e)}
|
onMouseMove={e => onMouseMove(e)}
|
||||||
onMouseUp={e => onMouseUp(e)}>
|
onMouseUp={e => onMouseUp(e)}>
|
||||||
@@ -686,7 +704,10 @@ export default function CalenderView(p) {
|
|||||||
|
|
||||||
|
|
||||||
<div className={"spalte"}
|
<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)}
|
onMouseDown={e => onMouseDown(e)}
|
||||||
onMouseMove={e => onMouseMove(e)}
|
onMouseMove={e => onMouseMove(e)}
|
||||||
onMouseUp={e => onMouseUp(e)}>
|
onMouseUp={e => onMouseUp(e)}>
|
||||||
@@ -814,5 +835,6 @@ export default function CalenderView(p) {
|
|||||||
</div>))}
|
</div>))}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -18,7 +18,7 @@ export default function planning(p)
|
|||||||
<Back onClick={() => router.back()}/>
|
<Back onClick={() => router.back()}/>
|
||||||
<HelpButton/>
|
<HelpButton/>
|
||||||
<Background/>
|
<Background/>
|
||||||
<CalenderView/>
|
<CalenderView semesterName={localStorage.getItem("semestername") + " " + (localStorage.getItem("admin") == 1 ? "" : localStorage.getItem("currentmodulename"))}/>
|
||||||
<SubmitButton />
|
<SubmitButton />
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -26,19 +26,20 @@ export default function SemesteroverviewLecturer(p) {
|
|||||||
let semesterURL = baseURL + "/semester/id/all?ids=" + args + "&sessionid=" + localStorage.getItem("sessionid");
|
let semesterURL = baseURL + "/semester/id/all?ids=" + args + "&sessionid=" + localStorage.getItem("sessionid");
|
||||||
fetch(semesterURL).then(r => r.json()).then(sem => {
|
fetch(semesterURL).then(r => r.json()).then(sem => {
|
||||||
sem.map(e => {
|
sem.map(e => {
|
||||||
temp.push(e.name)
|
temp.push(e.name + " Sem. " + (e.number + 1))
|
||||||
})
|
})
|
||||||
}).then(() => setSemesterNames(temp))
|
}).then(() => setSemesterNames(temp))
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function onClickSemester(e, m) {
|
function onClickSemester(e, m, name) {
|
||||||
if (e.activated == 1) {
|
if (e.activated == 1) {
|
||||||
if (m.target === m.currentTarget) {
|
if (m.target === m.currentTarget) {
|
||||||
localStorage.setItem("currentsid", e.semesterid)
|
localStorage.setItem("currentsid", e.semesterid)
|
||||||
localStorage.setItem("currentmodulename", e.name)
|
localStorage.setItem("currentmodulename", e.name)
|
||||||
localStorage.setItem("moduleid", e.id)
|
localStorage.setItem("moduleid", e.id)
|
||||||
|
localStorage.setItem("semestername", name)
|
||||||
router.push("/planning")
|
router.push("/planning")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -62,10 +63,10 @@ export default function SemesteroverviewLecturer(p) {
|
|||||||
{entries.map((e, index) => (
|
{entries.map((e, index) => (
|
||||||
<div className={"semester-tile box-shadow"} style={{
|
<div className={"semester-tile box-shadow"} style={{
|
||||||
backgroundColor: e.activated == 1 ? "#ffffff" : "#aaaaaa"
|
backgroundColor: e.activated == 1 ? "#ffffff" : "#aaaaaa"
|
||||||
}} onClick={(f) => onClickSemester(e, f)}>
|
}} onClick={(f) => onClickSemester(e, f, semesterNames[index])}>
|
||||||
<SemesterTile
|
<SemesterTile
|
||||||
editable={false} text={semesterNames[index]} text2={e.name}
|
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}/>
|
<StatusBar progress={0} modules={entries}/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user