diff --git a/frontend/src/App.scss b/frontend/src/App.scss index bf0b1a2e5db142b6b61987e95dec2b76a8e31a32..63db7c524fefe6f96d4ccbe3a4e059218d4056fb 100644 --- a/frontend/src/App.scss +++ b/frontend/src/App.scss @@ -361,21 +361,18 @@ tr:hover { background-color: #D9ECFF !important; } - .cv-day.do-you-remember.the-21st .cv-day-number::after { - content: "\1F525"; - } - .cv-weeks { + .cv-week .cv-weekdays { div.offset1.span1.cv-item { - // top: calc(3.4em + 0px) !important; - - &:nth-child(1) { - top: calc(3.4em + 0px) !important; - } - &:nth-child(2) { - top: calc(3.4em + 0px) !important; - } + // top: initial !important; + + // &:nth-child(1) { + // top: calc(1.4em + 0px) !important; + // } + // &:nth-child(2) { + // top: calc(3.4em + 0px) !important; + // } } } } diff --git a/frontend/src/components/LecturerSchedule/LecturerSchedule.vue b/frontend/src/components/LecturerSchedule/LecturerSchedule.vue index ca05b7ac629e66386aae8b802aaf8c87fa7f94ca..0ccbd9bb766f261e3b72b16f4461792c74ae57b1 100644 --- a/frontend/src/components/LecturerSchedule/LecturerSchedule.vue +++ b/frontend/src/components/LecturerSchedule/LecturerSchedule.vue @@ -30,13 +30,26 @@ </tr> </thead> <tbody> - <tr> - <td>1</td> - <td>IF5122</td> - <td>Proyek Perangkat Lunak</td> + <tr + v-for="(course, index) in lecturerCourseData" + :key="course.id" + scope="row" + > + <td>{{ index + 1 }}</td> + <td>{{ course.code }}</td> + <td>{{ course.name }}</td> <td class="text-center">01</td> - <td class="text-center">2</td> - <td class="text-center">Selasa / 13:00 - 15:00</td> + <td class="text-center">{{ course.credits }}</td> + <td class="text-center"> + <div + v-for="defaultSchedule in courseDefaultSchedule[index]" + :key="defaultSchedule.id" + > + {{ convertDay(defaultSchedule.day) }} / + {{ convertTime(defaultSchedule.start) }} - + {{ convertTime(defaultSchedule.end) }} + </div> + </td> </tr> </tbody> </table> @@ -118,6 +131,7 @@ import { CalendarViewHeader, CalendarMath } from "vue-simple-calendar"; // published version +import axios from "axios"; //} from "../../vue-simple-calendar/src/components/bundle.js" // local repo export default { @@ -132,6 +146,9 @@ export default { year: 2021, /* Show the current month, and give it some fake items to show */ showDate: this.thisMonth(1), + lecturerCourseClassId: [], + lecturerCourseData: [], + courseDefaultSchedule: [], message: "", startingDayOfWeek: 1, disablePast: false, @@ -148,74 +165,7 @@ export default { useDefaultTheme: true, useHolidayTheme: true, useTodayIcons: false, - items: [ - { - id: "e0", - startDate: "2018-01-05" - }, - { - id: "e1", - startDate: this.thisMonth(15, 18, 30), - endDate: this.thisMonth(15, 19, 30) - }, - { - id: "e2", - startDate: this.thisMonth(15), - title: "Single-day item with a long title" - }, - { - id: "e4", - startDate: this.thisMonth(20), - title: "My Birthday!", - classes: "birthday", - url: "https://en.wikipedia.org/wiki/Birthday" - }, - { - id: "e5", - startDate: this.thisMonth(5), - endDate: this.thisMonth(12), - title: "Multi-day item", - classes: "purple" - }, - { - id: "foo", - startDate: this.thisMonth(29), - title: "Same day 1" - }, - { - id: "e6", - startDate: this.thisMonth(29), - title: "Same day 2", - classes: "orange" - }, - { - id: "e7", - startDate: this.thisMonth(29), - title: "Same day 3" - }, - { - id: "e8", - startDate: this.thisMonth(29), - title: "Same day 4", - classes: "orange" - }, - { - id: "e9", - startDate: this.thisMonth(29), - title: "Same day 5" - }, - { - id: "e10", - startDate: this.thisMonth(29), - title: "Same day 6", - classes: "orange" - }, - { - id: "e11", - startDate: this.thisMonth(29), - title: "Same day 7" - } - ] + items: [] }; }, computed: { @@ -227,9 +177,7 @@ export default { }, themeClasses() { return { - "theme-default": this.useDefaultTheme, - "holiday-us-traditional": this.useHolidayTheme, - "holiday-us-official": this.useHolidayTheme + "theme-default": this.useDefaultTheme }; }, myDateClasses() { @@ -250,9 +198,12 @@ export default { return o; } }, - mounted() { + async mounted() { this.newItemStartDate = CalendarMath.isoYearMonthDay(CalendarMath.today()); this.newItemEndDate = CalendarMath.isoYearMonthDay(CalendarMath.today()); + await this.getAllCourseClass(); + await this.getLecturerCourseClass(); + await this.getCourseClassMeeting(); }, methods: { periodChanged() { @@ -272,7 +223,10 @@ export default { this.message = `You clicked: ${d.toLocaleDateString()}`; }, onClickItem(e) { - this.$router.push("/lecturer-manage-class"); + this.$router.push({ + path: "/lecturer-manage-class", + query: { id: e.id } + }); this.message = `You clicked: ${e.title}`; }, setShowDate(d) { @@ -320,6 +274,164 @@ export default { "/" + (this.year + 1) ); + }, + async getAllCourseClass() { + const lecturerId = localStorage.uid; + await axios + .get(process.env.VUE_APP_API_ENDPOINT + "/lecturer/" + lecturerId) + .then((response) => { + if (response.status == 200) { + // Get all course class ID + axios + .get(process.env.VUE_APP_API_ENDPOINT + "/course-class") + .then((childResponse) => { + if (childResponse.status == 200) { + for (let i = 0; i < childResponse.data.length; i++) { + if (childResponse.data[i].lecturerId === response.data.id) { + this.lecturerCourseClassId.push( + childResponse.data[i].courseId + ); + this.courseDefaultSchedule.push( + childResponse.data[i].courseClassDefaultSchedules + ); + } + } + this.getLecturerCourseClass(); + } + }) + .catch((error) => { + console.error(error); + }); + } + }) + .catch((error) => { + console.error(error); + }); + }, + async getLecturerCourseClass() { + for (let i = 0; i < this.lecturerCourseClassId.length; i++) { + axios + .get( + process.env.VUE_APP_API_ENDPOINT + + "/course/" + + this.lecturerCourseClassId[i] + ) + .then((responseChild) => { + if (responseChild.status == 200) { + this.lecturerCourseData.push(responseChild.data); + } + }) + .catch((error) => { + console.error(error); + }); + } + }, + async getCourseClassMeeting() { + await axios + .get( + process.env.VUE_APP_API_ENDPOINT + + "/lecturer/" + + localStorage.getItem("uid") + ) + .then((response) => { + if (response.status == 200) { + let params = + "lecturerId=" + + response.data.id + + "&semester=" + + this.semester + + "&startYear=" + + this.year; + + axios + .get( + process.env.VUE_APP_API_ENDPOINT + + "/course-class-meeting/?" + + params + ) + .then((childResponse) => { + if (childResponse.status == 200) { + for (let i = 0; i < childResponse.data.length; i++) { + let item = { + id: childResponse.data[i].id, + startDate: childResponse.data[i].startTime, + endDate: childResponse.data[i].endTime, + courseCode: childResponse.data[i].CourseClass.Course.code, + courseName: childResponse.data[i].CourseClass.Course.name, + title: + "<br/>" + + childResponse.data[i].CourseClass.Course.code + + " " + + childResponse.data[i].CourseClass.Course.name + }; + this.items.push(item); + } + } + }) + .catch((error) => { + console.error(error); + }); + } + }) + .catch((error) => { + console.error(error); + }); + }, + convertTime(time) { + return time.slice(0, 5); + }, + convertDay(numDay) { + if (numDay === "SUNDAY") { + return "Minggu"; + } else if (numDay === "MONDAY") { + return "Senin"; + } else if (numDay === "TUESDAY") { + return "Selasa"; + } else if (numDay === "WEDNESDAY") { + return "Rabu"; + } else if (numDay === "THURSDAY") { + return "Kamis"; + } else if (numDay === "FRIDAY") { + return "Jumat"; + } else { + return "Sabtu"; + } + }, + convertDate(time) { + let fullDate; + let date = time.getDate().toString(); + let month; + if (time.getMonth() === 0) { + month = "Januari"; + } else if (time.getMonth() === 1) { + month = "Februari"; + } else if (time.getMonth() === 2) { + month = "Maret"; + } else if (time.getMonth() === 3) { + month = "April"; + } else if (time.getMonth() === 4) { + month = "Mei"; + } else if (time.getMonth() === 5) { + month = "Juni"; + } else if (time.getMonth() === 6) { + month = "Juli"; + } else if (time.getMonth() === 7) { + month = "Agustus"; + } else if (time.getMonth() === 8) { + month = "September"; + } else if (time.getMonth() === 9) { + month = "Oktober"; + } else if (time.getMonth() === 10) { + month = "November"; + } else { + month = "Desember"; + } + + let year = time.getFullYear().toString(); + + fullDate = date + " " + month + " " + year; + + return fullDate; } } }; diff --git a/frontend/src/components/StudentSchedule/StudentSchedule.vue b/frontend/src/components/StudentSchedule/StudentSchedule.vue index 83d13a196f4521a0a1e7a222da6bdd39436ad338..ab1cf4b5bd8fad729f82047ea457736f19287af2 100644 --- a/frontend/src/components/StudentSchedule/StudentSchedule.vue +++ b/frontend/src/components/StudentSchedule/StudentSchedule.vue @@ -320,7 +320,6 @@ export default { async onClickItem(e) { this.classModalData = {}; this.message = `You clicked: ${e.title}`; - console.log("PIJET COK"); await this.getClassDetail( e.id, e.originalItem.courseCode, @@ -466,7 +465,6 @@ export default { ) .then((childResponse) => { if (childResponse.status == 200) { - console.log(childResponse.data); for (let i = 0; i < childResponse.data.length; i++) { let item = { id: childResponse.data[i].id, diff --git a/frontend/src/views/LectureSchedule/CreateEditSchedule.vue b/frontend/src/views/LectureSchedule/CreateEditSchedule.vue index b4e1946cf7b7b3d58c8b729d33721a8affdc6b32..db0a6d5c6b7952d85dd16925d8c1cc1c74bb4db6 100644 --- a/frontend/src/views/LectureSchedule/CreateEditSchedule.vue +++ b/frontend/src/views/LectureSchedule/CreateEditSchedule.vue @@ -21,16 +21,16 @@ <div class="col p-4 container-manage-schedule"> <!-- Container Header --> <div class="row"> - <div class="col-md-9"> + <div class="col"> <h1 data-aos="fade-down" data-aos-duration="1500" class="mb-4"> Pengelolaan Perkuliahan </h1> </div> - <div class="col-md-3"> + <div class="col-auto"> <div> <button type="button" - class="btn btn-primary-six col-12" + class="btn btn-primary-six col-12 w-auto" data-aos="fade-down" data-aos-duration="1500" @click="$router.push('/lecture-schedule')"