+
+ {courseInfo.name}
+
+
+
+
+
+ Дата |
+ Название занятия |
+ {data.students.map((student) => (
+ {student.name} |
+ ))}
+
+
+
+ {attendance.map((lesson, index) => (
+
+ {dayjs(lesson.date).format('DD.MM.YYYY')} |
+ {lesson.name} |
+ {data.students.map((st) => {
+ const wasThere =
+ lesson.students.findIndex((u) => u.sub === st.sub) !== -1
+ return {wasThere ? '+' : '-'} |
+ })}
+
+ ))}
+
+
+
+ {/* {JSON.stringify(attendance, null, 2)}
*/}
+
+ )
+}
diff --git a/src/pages/attendance/index.ts b/src/pages/attendance/index.ts
new file mode 100644
index 0000000..89790d1
--- /dev/null
+++ b/src/pages/attendance/index.ts
@@ -0,0 +1,3 @@
+import { Attendance } from './attendance'
+
+export default Attendance
diff --git a/src/pages/course-list/course-card.tsx b/src/pages/course-list/course-card.tsx
index 81e6c6a..1641baa 100644
--- a/src/pages/course-list/course-card.tsx
+++ b/src/pages/course-list/course-card.tsx
@@ -1,20 +1,20 @@
import React, { useCallback, useEffect, useState } from 'react'
import dayjs from 'dayjs'
-import { Link as ConnectedLink } from 'react-router-dom'
+import { Link as ConnectedLink, generatePath } from 'react-router-dom'
import { getNavigationsValue } from '@brojs/cli'
import {
- Box,
- CardHeader,
- CardBody,
- CardFooter,
- ButtonGroup,
- Stack,
- StackDivider,
- Button,
- Card,
- Heading,
- Tooltip,
- Spinner,
+ Box,
+ CardHeader,
+ CardBody,
+ CardFooter,
+ ButtonGroup,
+ Stack,
+ StackDivider,
+ Button,
+ Card,
+ Heading,
+ Tooltip,
+ Spinner,
} from '@chakra-ui/react'
import { api } from '../../__data__/api/api'
@@ -22,72 +22,94 @@ import { ArrowUpIcon, LinkIcon } from '@chakra-ui/icons'
import { Course } from '../../__data__/model'
import { CourseDetails } from './course-details'
-export const CourseCard = ({
- course,
-}: {
- course: Course
-}) => {
- const [getLessonList, populatedCourse] = api.useLazyGetCourseByIdQuery()
- const [isOpened, setIsOpened] = useState(false)
- useEffect(() => {
- if (isOpened) {
- getLessonList(course.id, true)
- }
- }, [isOpened])
+export const CourseCard = ({ course }: { course: Course }) => {
+ const [getLessonList, populatedCourse] = api.useLazyGetCourseByIdQuery()
+ const [isOpened, setIsOpened] = useState(false)
+ useEffect(() => {
+ if (isOpened) {
+ getLessonList(course.id, true)
+ }
+ }, [isOpened])
- const handleToggleOpene = useCallback(() => {
- setIsOpened(opened => !opened)
- }, [setIsOpened])
+ const handleToggleOpene = useCallback(() => {
+ setIsOpened((opened) => !opened)
+ }, [setIsOpened])
- return (
-