From ad080f60a3d11d0ce4d27aaa3cb528e3d323c955 Mon Sep 17 00:00:00 2001 From: berinkrktt <73306985+berinkrktt@users.noreply.github.com> Date: Sat, 5 Mar 2022 18:15:45 +0300 Subject: [PATCH] Lesson Transaction | SIS-88_SIS-114 (#42) * Design lesson save and lesson list screen * done insert lesson transaction * done detail lesson transaction * done detail lesson transaction * Lesson List Page Updated and Fixed * Teacher Lesson List Page Updated and Fixed * Teacher Lesson Assignment Page Updated and Fixed * Teacher My lesson Page Updated and Fixed * Teacher My lesson Page Updated and Fixed * Teacher My lesson Page Updated and Fixed * Lesson List page updated and fixed * Done Lesson Save page and connection Api * Done Lesson Detail page and connection Api * Teacher Lesson Save and Detail Updated and Fixed * Teacher Lesson Save and Detail Updated and Fixed * Teacher Lesson Save and List Page Updated and Fixed * Lesson Save Page updated and Fixed * Lesson Detail Page updated and Fixed * Lesson Assignment Page updated and Fixed * Lesson Department Name Font Has Been Updated in Lesson Listing Page * Semester Name Color Has Been Fixed & Department Name Font Has Been Fixed & select-all Has Been Added to ID Fields * Faculty/Passivate Notifications Has Been Fixed * Officer Save Screen Faculty Name Field Has Been Updated * Faculty/Save Success Notification Has Been Fixed * Lesson/Save Department Name Field Has Been Fixed * Teacher Lesson List Page updated and Fixed * Teacher Lesson List Updated * Teacher My Lesson Page Updated and Fixed * Teacher Lesson List Page Updated and Fixed * Teacher Lesson List Page Updated and fixed. * Teacher Lesson List Updated and fixed. * Teacher Lesson List and Teache My Lesson Page Updated and fixed. * Teacher My Lesson Page Updated and fixed. * Teacher Lesson List Page Updated and fixed. * Teacher Lesson List and My Lesson List Page Updated and Fixed * Teacher Lesson List, Teacher My Lesson List and Lesson List page Updated and Fixed * Teacher My Lesson List page Updated and Fixed * Credit Field Font Has Been Updated in Teacher/MyLesson Page Co-authored-by: Agit Rubar Demir --- pages/officer/operation/lesson/index.js | 2 +- .../officer/operation/teacher/lesson/index.js | 263 +++++++++- .../lesson/information/detail/[id]/index.js | 488 ------------------ pages/teacher/lesson/index.js | 203 ++++---- 4 files changed, 355 insertions(+), 601 deletions(-) delete mode 100644 pages/officer/operation/teacher/lesson/information/detail/[id]/index.js 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 + + */} ))} + + +
+ + + + + + +
+ +
+ Atanan Ders Silme İşlemi Başarılı! +
+
+
+

+ Atanan Ders Silme İşlemi başarıyla gerçekleşti. +

+
+
+
+
+
+
+ + +
+ + + + + + +
+ +
+ Atanan Ders Silme İşlemi Başarısız! +
+
+
+

+ Lütfen girdiğiniz verileri kontrol ediniz. + Verilerinizi doğru girdiyseniz sistemsel bir + hatadan dolayı isteğiniz sonuçlandıralamamış olabilir. +

+
+
+
+
+
+
+ + + +
+ + + + + + +
+ + Atanan Ders Silme İsteğiniz İşleniyor... + +
+
+
+
+
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 - )} - -
-
-
-
-
-
-

- DERS BİLGİLERİ -

-
-
-
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- - -
- - -
- -
- - -
- -
- - -
- -
- - -
- - {( - modifiedDate !== null - ? - - : - null - )} -
-
- - - -
- - - - - - -
- -
- Ders Kayıt Silme İşlemi Başarılı! -
-
-
-

- Ders Kayıt Silme İşlemi başarıyla gerçekleşti. -

-
-
-
-
-
-
- - -
- - - - - - -
- -
- Ders Kayıt Silme İşlemi Başarısız! -
-
-
-

- Lütfen girdiğiniz verileri kontrol ediniz. - Verilerinizi doğru girdiyseniz sistemsel bir - hatadan dolayı isteğiniz sonuçlandıralamamış olabilir. -

-
-
-
-
-
-
- - - -
- - - - - - -
- - Ders Kayıt Silme İsteğiniz İşleniyor... - -
-
-
-
-
-
-
-
-
-
- - - - ) -} \ 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 (
-
+
-
-
-
-
- - - - - - - - - - - {lessons.map((lesson) => ( - lesson.teacherInfoResponse.teacherId === cookies.get('teacherNumber') - ? - - - - - + {( + lessons.length !== 0 + ? +
+
+
+
+
- DERS - - KREDİ - - ZORUNLU/SEÇMELİ - - BÖLÜM İSMİ -
-
{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}
-
+ + + + + + + - : - null - ))} - -
+ DERS + + AKADEMİK BİLGİLER + + KREDİ + + DERS DURUMU + + STATÜSÜ +
+ + + {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 + )}
)