diff --git a/apps/schools/domains/employee/components/currentEmployee/index.tsx b/apps/schools/domains/employee/components/currentEmployee/index.tsx
index e1c451c1..9dd3d2f6 100644
--- a/apps/schools/domains/employee/components/currentEmployee/index.tsx
+++ b/apps/schools/domains/employee/components/currentEmployee/index.tsx
@@ -1,5 +1,5 @@
import React, { useEffect, useState } from 'react'
-import { Col, Row, Typography } from 'antd'
+import { Col, Row, Spin, Typography } from 'antd'
import Image from 'next/image'
import { getUuidFromUrl } from '@domains/common/utils/getUuidFromUrl'
@@ -22,6 +22,7 @@ const CurrentEmployee = () => {
const {
data: employee,
error: employeeError,
+ isLoading,
} = useGetEmployeeQuery({
employee_id: uuid[0],
})
@@ -35,7 +36,9 @@ const CurrentEmployee = () => {
if (isDeleteFinished.isSuccess) return null
if (uuid.length === 0) router.push('/404')
- return (
+ return isLoading ? (
+
+ ) : (
<>
diff --git a/apps/schools/domains/organization/redux/organizationApi.ts b/apps/schools/domains/organization/redux/organizationApi.ts
index 6e5bda07..c31bbedb 100644
--- a/apps/schools/domains/organization/redux/organizationApi.ts
+++ b/apps/schools/domains/organization/redux/organizationApi.ts
@@ -192,6 +192,7 @@ export const {
useExportStudentsQuery,
useGetAllTeachersQuery,
useGetAllQueriesOfOrganizationQuery,
+ useLazyGetAllStudentInvitationsQuery,
useGetAllStudentInvitationsQuery,
useGetAllCirclesQuery,
useGetAllJoinCircleQueriesQuery,
diff --git a/apps/schools/domains/student/components/currentStudent/index.tsx b/apps/schools/domains/student/components/currentStudent/index.tsx
index 2847ed28..921f201b 100644
--- a/apps/schools/domains/student/components/currentStudent/index.tsx
+++ b/apps/schools/domains/student/components/currentStudent/index.tsx
@@ -1,8 +1,8 @@
import React, { useEffect, useState } from 'react'
-import { Col, Row, Typography } from 'antd'
+import { Col, Row, Spin, Tooltip, Typography } from 'antd'
import Image from 'next/image'
-import { useGetStudentQuery } from '@domains/organization/redux/organizationApi'
+import { useGetStudentQuery, useLazyGetAllStudentInvitationsQuery } from '@domains/organization/redux/organizationApi'
import { getUuidFromUrl } from '@domains/common/utils/getUuidFromUrl'
import EmptyWrapper from '@domains/common/components/containers/EmptyWrapper'
@@ -15,101 +15,157 @@ import { Field } from '@domains/common/components/field'
import { useDeleteStudentMutation } from '@domains/student/redux/studentApi'
import { ActionBar } from '@domains/common/components/stickyBlock/actionBar'
import DeleteModal from '@domains/common/components/deleteModal'
+import { GetStudent } from '@domains/common/redux/serializers'
+import { useOrganization } from '@domains/organization/providers/organizationProvider'
+import parentAcceptedPhone from '@public/icons/parentAcceptedMobile.svg'
+import parentDeclinedPhone from '@public/icons/parentDeclinedMobile.svg'
const CurrentStudent = () => {
const [isModalVisible, setIsModalVisible] = useState(false)
- const [mutation, isDeleteFinished] = useDeleteStudentMutation()
+ const { organizationId } = useOrganization()
const uuid = getUuidFromUrl()
- const { data: student, error: studentError, isLoading } = useGetStudentQuery({ student_id: uuid[0] })
+ const [mutation, isDeleteFinished] = useDeleteStudentMutation()
+
+ const [student, setStudent] = useState(undefined)
+ const { data: studentInfo, error: studentError, isLoading } = useGetStudentQuery({ student_id: uuid[0] })
+ const [trigger, studentInfoAdditional] = useLazyGetAllStudentInvitationsQuery()
+ const isVerifiedStudent = studentInfo?.student.circle && studentInfo?.student.circle
useEffect(() => {
- if (studentError && (studentError as ErrorType).status == 404) {
+ if (studentError && ((studentError as ErrorType).status == 404 || (studentError as ErrorType).status == 403)) {
router.push('/student')
}
}, [studentError])
+ useEffect(() => {
+ if (isVerifiedStudent) {
+ setStudent(studentInfo.student)
+ } else {
+ trigger({ student__id: uuid[0], circle__organization__id: organizationId })
+ }
+ }, [studentInfo])
+
+ useEffect(() => {
+ const info = studentInfoAdditional.data?.results[0]
+ if (info)
+ setStudent({
+ id: uuid[0],
+ name: info.body.name,
+ student_profile: {
+ parent_phones: info.recipient?.parent_phones,
+ name: '',
+ phone: info.additional.phone,
+ photo: {},
+ },
+ circle: {
+ name: info.sender.name,
+ },
+ })
+ }, [studentInfoAdditional])
+
if (isDeleteFinished.isSuccess) return null
if (uuid.length === 0) router.push('/404')
return (
-
-
-
-
-
-
-
-
- {student?.student.name ? student?.student.name : 'Имя не определено'}
-
-
-
-
-
router.push(`/student/${uuid[0]}/change`)}
- >
- Редактировать профиль
- ,
- ,
- ]}
- />
-
+
+
+
+
+
+
+
router.push(`/student/${uuid[0]}/change`)}
+ >
+ Редактировать профиль
+ ,
+ ,
+ ]}
+ />
+
+
+
+ {student?.circle && (
+
+
+ Семья
+
+
+
+
+
+ )}
-
-
-
- Семья
-
-
-
-
-
-
-
+
+ >
+ )}
)
}
diff --git a/apps/schools/domains/student/components/currentStudent/styles/styles.module.scss b/apps/schools/domains/student/components/currentStudent/styles/styles.module.scss
index fa3c4127..4ab1c52a 100644
--- a/apps/schools/domains/student/components/currentStudent/styles/styles.module.scss
+++ b/apps/schools/domains/student/components/currentStudent/styles/styles.module.scss
@@ -63,6 +63,7 @@
}
.title {
+ gap: 20px;
margin-bottom: 50px;
}
diff --git a/apps/schools/public/icons/parentAcceptedMobile.svg b/apps/schools/public/icons/parentAcceptedMobile.svg
new file mode 100644
index 00000000..2d82ae74
--- /dev/null
+++ b/apps/schools/public/icons/parentAcceptedMobile.svg
@@ -0,0 +1 @@
+
diff --git a/apps/schools/public/icons/parentDeclinedMobile.svg b/apps/schools/public/icons/parentDeclinedMobile.svg
new file mode 100644
index 00000000..54207f5b
--- /dev/null
+++ b/apps/schools/public/icons/parentDeclinedMobile.svg
@@ -0,0 +1 @@
+