diff --git a/pages/officer/operation/lesson/index.js b/pages/officer/operation/lesson/index.js
index fb8f3b6b..50391faf 100644
--- a/pages/officer/operation/lesson/index.js
+++ b/pages/officer/operation/lesson/index.js
@@ -78,7 +78,7 @@ export default function TeacherLessonList({isPagePermissionSuccess, lessons}) {
scope="col"
className="select-none px-6 py-3 tracking-wider"
>
- DERSİN ADI
+ DERS
{
+ openProcessingModalDelete();
+
+ event.preventDefault()
+ const deleteRes = await fetch(`${SIS_API_URL}/teacher/lesson/delete`, {
+ headers: {'Content-Type': 'application/json'},
+ method: 'DELETE',
+ body: JSON.stringify({
+ teacherLessonInfoRequest: {
+ lessonId: 0,
+ teacherId: 0
+ }
+ }),
+ });
+ const deleteData = await deleteRes.json();
+ if (deleteData.success) {
+ closeProcessingModalDelete();
+ openSuccessModalDelete()
+ } else {
+ closeProcessingModalDelete();
+ openFailModalDelete();
+ }
+ }
return (
@@ -48,7 +105,7 @@ export default function TeacherLessonList({lessons}) {
{(
- lessons != null
+ lessons.length !== 0
?
@@ -61,13 +118,13 @@ export default function TeacherLessonList({lessons}) {
scope="col"
className="select-none px-6 py-3 tracking-wider"
>
- DERSİN ADI
+ ÖĞRETMEN ADI
|
- ÖĞRETMEN ADI
+ DERS
|
- DERS ZORUNLULUĞU
+ DERS DURUMU
|
{lessons.map((lesson) => (
|
+
+
+
+ {lesson.teacherInfoResponse.name} {lesson.teacherInfoResponse.surname}
+ {lesson.teacherInfoResponse.teacherId}
+
+
+ |
@@ -110,16 +177,6 @@ export default function TeacherLessonList({lessons}) {
|
-
-
-
- {lesson.teacherInfoResponse.name} {lesson.teacherInfoResponse.surname}
- {lesson.teacherInfoResponse.teacherId}
-
-
- |
{lesson.lessonResponse.departmentResponse.facultyResponse.name}
@@ -148,15 +205,173 @@ export default function TeacherLessonList({lessons}) {
))}
|
-
-
- DETAY
-
- |
+ {/*
+
+ SİL
+
+ | */}
))}
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/officer/operation/teacher/lesson/information/detail/[id]/index.js b/pages/officer/operation/teacher/lesson/information/detail/[id]/index.js
deleted file mode 100644
index db8875a0..00000000
--- a/pages/officer/operation/teacher/lesson/information/detail/[id]/index.js
+++ /dev/null
@@ -1,488 +0,0 @@
-import {Fragment, useState} from "react";
-import {useRouter} from "next/router";
-import {Dialog, Transition} from "@headlessui/react";
-import SISTitle from "../../../../../../../../public/components/page-titles";
-import OfficerNavbar from "../../../../../../../../public/components/navbar/officer/officer-navbar";
-import {lessonCompulsory, lessonSemesters, lessonStatuses} from "../../../../../../../../public/constants/lesson";
-
-
-export async function getServerSideProps({query}) {
- const SIS_API_URL = process.env.SIS_API_URL;
- const {id} = query;
- const lessonResponse = await fetch(`${SIS_API_URL}/teacher/lesson/get?teacherId=` + id , {
- headers: {'Content-Type': 'application/json'},
- method: 'GET'
- });
- const lessonData = await lessonResponse.json();
- if (lessonData.success) {
- return {
- props: {
- lessons: lessonData.response,
- SIS_API_URL: SIS_API_URL
- }
- }
- }
-}
-
-
-export default function LessonDetail({lessons, SIS_API_URL}) {
- const {teacherInfoResponse} = lessons ;
- const {lessonResponse} = lessons;
-
- const {lessonId, name, credit, semester, compulsoryOrElective, status, departmentResponse, modifiedDate} = lessonResponse;
- const {facultyResponse} = departmentResponse;
-
- const teacherId = teacherInfoResponse.teacherId;
- const departmentId = departmentResponse.departmentId;
- const facultyId = facultyResponse.facultyId;
- const facultyName = facultyResponse.name;
- const departmentName = departmentResponse.name;
-
-
- const router = useRouter();
-
-
- let [isOpenSuccessDelete, setIsOpenSuccessDelete] = useState(false);
-
- function closeSuccessModalDelete() {
- setIsOpenSuccessDelete(false);
- router.reload();
- }
-
- function openSuccessModalDelete() {
- setIsOpenSuccessDelete(true);
- }
-
- let [isOpenFailDelete, setIsOpenFailDelete] = useState(false);
-
- function closeFailModalDelete() {
- setIsOpenFailDelete(false);
- }
-
- function openFailModalDelete() {
- setIsOpenFailDelete(true);
- }
-
- let [isOpenProcessingDelete, setIsOpenProcessingDelete] = useState(false);
-
- function closeProcessingModalDelete() {
- setIsOpenProcessingDelete(false);
- }
-
- function openProcessingModalDelete() {
- setIsOpenProcessingDelete(true);
- }
-
-
- const lessonDelete = async (event) => {
- openProcessingModalDelete();
-
- event.preventDefault()
- const deleteRes = await fetch(`${SIS_API_URL}/teacher/lesson/delete`, {
- headers: {'Content-Type': 'application/json'},
- method: 'DELETE',
- body: JSON.stringify({
- lessonId: lessonId,
- teacherId:teacherId
- }),
- });
- const deleteData = await deleteRes.json();
- if (deleteData.success) {
- closeProcessingModalDelete();
- openSuccessModalDelete()
- } else {
- closeProcessingModalDelete();
- openFailModalDelete();
- }
- }
-
- return (
- <>
-
-
-
-
-
-
- {name}
-
- {lessonStatuses.map((lessonStatus) => (
- status === lessonStatus.enum
- ?
- lessonStatus.component
- :
- null
- ))}
- {(
- status !== 'DELETED'
- ?
-
- :
- null
- )}
-
-
-
-
-
-
-
- >
- )
-}
\ No newline at end of file
diff --git a/pages/teacher/lesson/index.js b/pages/teacher/lesson/index.js
index d7ac4795..aa861788 100644
--- a/pages/teacher/lesson/index.js
+++ b/pages/teacher/lesson/index.js
@@ -1,115 +1,142 @@
import SISTitle from "../../../public/components/page-titles";
-import Cookies from 'universal-cookie';
import TeacherNavbar from "../../../public/components/navbar/teacher/teacher-navbar";
-import {lessonCompulsory, lessonSemesters} from "../../../public/constants/lesson";
+import {lessonCompulsory, lessonSemesters, lessonStatuses} from "../../../public/constants/lesson";
-export const getStaticProps = async () => {
- const lessonResponse = await fetch("http://localhost:8585/teacher/lesson/", {
+export async function getServerSideProps(context) {
+ const SIS_API_URL = process.env.SIS_API_URL;
+ const teacherId = context.req.cookies['teacherNumber']
+ const lessonsResponse = await fetch(`${SIS_API_URL}/teacher/lesson/get/` + teacherId, {
headers: {'Content-Type': 'application/json'},
method: 'GET'
});
- const lessonData = await lessonResponse.json();
- if (lessonData.success) {
+ const lessonsData = await lessonsResponse.json();
+ if (lessonsData.success) {
return {
- props: {lessons: lessonData.response}
+ props: {
+ lessons: lessonsData.response
+ }
}
}
}
export default function TeacherLessonList({lessons}) {
-
- const cookies = new Cookies();
-
return (
-
+
-
-
-
-
-
-
-
-
- DERS
- |
-
- KREDİ
- |
-
- ZORUNLU/SEÇMELİ
- |
-
- BÖLÜM İSMİ
- |
-
-
-
- {lessons.map((lesson) => (
- lesson.teacherInfoResponse.teacherId === cookies.get('teacherNumber')
- ?
-
-
- {lesson.lessonResponse.name}
- {lesson.lessonResponse.lessonId}
- {lessonSemesters.map((lSemester) => (
- lesson.lessonResponse.semester === lSemester.enum
- ?
- {lSemester.tr}
- :
- null
- ))}
- |
-
- {lesson.lessonResponse.credit}
- |
-
- {lessonCompulsory.map((lCompulsory) => (
- lesson.lessonResponse.compulsoryOrElective === lCompulsory.enum
- ?
- {lCompulsory.tr}
- :
- null
- ))}
- |
-
- {lesson.lessonResponse.departmentResponse.name}
- |
+ {(
+ lessons.length !== 0
+ ?
+
+
+
+
+
+
+
+
+ DERS
+ |
+
+ AKADEMİK BİLGİLER
+ |
+
+ KREDİ
+ |
+
+ DERS DURUMU
+ |
+
+ STATÜSÜ
+ |
- :
- null
- ))}
-
-
+
+
+ {lessons.map((lesson) => (
+
+
+
+
+ {lesson.lessonResponse.name}
+ {lesson.lessonResponse.lessonId}
+ {lessonSemesters.map((lSemester) => (
+ lesson.lessonResponse.semester === lSemester.enum
+ ?
+ {lSemester.tr}
+ :
+ null
+ ))}
+
+
+ |
+
+ {lesson.lessonResponse.departmentResponse.facultyResponse.name}
+
+ {lesson.lessonResponse.departmentResponse.name}
+ |
+
+ {lesson.lessonResponse.credit}
+
+ |
+
+ {lessonCompulsory.map((lCompulsory) => (
+ lesson.lessonResponse.compulsoryOrElective === lCompulsory.enum
+ ?
+ {lCompulsory.tr}
+ :
+ null
+ ))}
+ |
+
+
+ {lessonStatuses.map((lStatus) => (
+ lesson.lessonResponse.status === lStatus.enum
+ ?
+ lStatus.miniComponent
+ :
+ null
+ ))}
+
+ |
+
+ ))}
+
+
+
+
-
-
+ :
+ null
+ )}
)