@@ -130,8 +125,20 @@ export function QueryList() {
['Телефон родителя', 'parent_phone'],
['Кружок', 'circle_name'],
]}
- data={reformattedData}
- isLoading={isQueriesLoading}
+ pagination={{
+ current: paginationParams.page,
+ pageSize: paginationParams.pageSize,
+ total: queries?.count,
+ onChange: (page, pageSize) => {
+ setPaginationParams({
+ page,
+ pageSize,
+ })
+ scrollToTop()
+ },
+ }}
+ data={queries}
+ isLoading={isQueriesFetching}
mainRoute={RoutePath[AppRoutes.QUERY_LIST]}
searchFields={[
'created_at',
diff --git a/apps/schools/domains/student/components/studentList/index.tsx b/apps/schools/domains/student/components/studentList/index.tsx
index f72267d6..f5af871a 100644
--- a/apps/schools/domains/student/components/studentList/index.tsx
+++ b/apps/schools/domains/student/components/studentList/index.tsx
@@ -12,6 +12,8 @@ import { useGetAllStudentInvitationsQuery, useGetAllStudentsQuery } from '@domai
import { StatusesEnum } from '@domains/common/constants/Enums'
import EmptyWrapper from '@domains/common/components/containers/EmptyWrapper'
import { AppRoutes, RoutePath } from '@domains/common/constants/routerEnums'
+import { defaultPaginationTablePage, defaultPaginationTablePageSize } from '@domains/common/constants/Table'
+import { scrollToTop } from '@domains/common/utils/scrollInDirection'
export function StudentList() {
const [searchRequestText, setSearchRequestText] = useState('')
@@ -23,9 +25,16 @@ export function StudentList() {
or_search: createSearchTextForRequest(searchRequestText, searchInvitesColumns),
})
- const { data: students, isLoading: isLoadingStudents } = useGetAllStudentsQuery({
+ const [paginationParams, setPaginationParams] = useState({
+ page: defaultPaginationTablePage,
+ pageSize: defaultPaginationTablePageSize,
+ })
+
+ const { data: students, isFetching: isFetchingStudents } = useGetAllStudentsQuery({
circle__organization: organizationId,
or_search: createSearchTextForRequest(searchRequestText, searchStudentsColumns),
+ page: paginationParams.page,
+ page_size: paginationParams.pageSize,
})
const data = {
@@ -64,7 +73,7 @@ export function StudentList() {
buttonText={'Добавить обучающегося'}
pageTitle={'Обучающиеся'}
data={data}
- isLoading={isLoadingStudents || isLoadingInvites}
+ isLoading={isFetchingStudents || isLoadingInvites}
handleRunTask={() => router.push(RoutePath[AppRoutes.STUDENT_CREATE])}
searchTrigger={searchRequestText}
>
@@ -87,9 +96,21 @@ export function StudentList() {
['Телефон обучающегося', 'student_phone'],
['Телефон родителя', 'parent_phone'],
]}
+ pagination={{
+ current: paginationParams.page,
+ pageSize: paginationParams.pageSize,
+ total: students?.count,
+ onChange: (page, pageSize) => {
+ setPaginationParams({
+ page,
+ pageSize,
+ })
+ scrollToTop()
+ },
+ }}
filterFields={['circle_name']}
data={data}
- isLoading={isLoadingInvites || isLoadingStudents}
+ isLoading={isLoadingInvites || isFetchingStudents}
mainRoute={RoutePath[AppRoutes.STUDENT_LIST]}
searchFields={['student_name', 'student_phone', 'parent_phone', 'circle_name']}
searchRequestText={searchRequestText}
diff --git a/apps/schools/domains/ticket/components/ticketList/index.tsx b/apps/schools/domains/ticket/components/ticketList/index.tsx
index 163a6a14..7245b37a 100644
--- a/apps/schools/domains/ticket/components/ticketList/index.tsx
+++ b/apps/schools/domains/ticket/components/ticketList/index.tsx
@@ -8,7 +8,6 @@ import { RowType, TableType } from './interfaces'
import { searchTicketsColumns, StatusDictionary } from './constants'
import { useGetAllTicketsQuery, useGetTicketsAnalyticsQuery } from '@domains/organization/redux/organizationApi'
import EmptyWrapper from '@domains/common/components/containers/EmptyWrapper'
-import { mapReturnedData } from '@domains/common/redux/utils'
import { HighlightText } from '@domains/common/components/table/forming'
import { isReactElement } from '@domains/common/utils/react'
import { BubbleFilter } from '@domains/common/components/bubbleFilter'
@@ -20,6 +19,8 @@ import Image from 'next/image'
import dot from '@public/icons/dot.svg'
import SearchInput from '@domains/common/components/searchInput'
import { FilterValue, SorterResult, TableCurrentDataSource } from 'antd/es/table/interface'
+import { defaultPaginationTablePage, defaultPaginationTablePageSize } from '@domains/common/constants/Table'
+import { scrollToTop } from '@domains/common/utils/scrollInDirection'
type HandleInputChange = (text: React.ChangeEvent
| string) => void
type HandleChange = (
@@ -42,7 +43,7 @@ export function TicketList() {
}),
)
- const { data: analytics, isLoading: isAnalyticsLoading } = useGetTicketsAnalyticsQuery({
+ const { data: analytics } = useGetTicketsAnalyticsQuery({
organization_id: organizationId,
})
@@ -69,26 +70,23 @@ export function TicketList() {
} as BubbleFilterListItem
}
- const { data: tickets, isLoading: isTicketsLoading } = useGetAllTicketsQuery({
- organization_id: organizationId,
- or_search: createSearchTextForRequest(searchRequestText, searchTicketsColumns),
+ const [paginationParams, setPaginationParams] = useState({
+ page: defaultPaginationTablePage,
+ pageSize: defaultPaginationTablePageSize,
})
- const reformattedData = mapReturnedData(tickets, (query) => {
- const transformedQuery = structuredClone(query) as unknown as TableType
- transformedQuery.content = query.last_comment.value
- if (transformedQuery.content.length > 200) {
- transformedQuery.content = transformedQuery.content.slice(0, 200) + '…'
- }
- transformedQuery.sender = 'Семья ' + query.sender?.name
- return transformedQuery
+ const { data: tickets, isFetching: isTicketsFetching } = useGetAllTicketsQuery({
+ organization_id: organizationId,
+ or_search: createSearchTextForRequest(searchRequestText, searchTicketsColumns),
+ page: paginationParams.page,
+ page_size: paginationParams.pageSize,
})
useEffect(() => {
- if (!isTicketsLoading) {
+ if (!isTicketsFetching && tickets) {
setIsTableLoading(false)
}
- }, [isTicketsLoading])
+ }, [isTicketsFetching, tickets])
const handleInputChange: HandleInputChange = useCallback(
(text) => {
@@ -123,7 +121,7 @@ export function TicketList() {
descriptionText={'Дождитесь первого обращения'}
pageTitle={'Обращения'}
data={tickets}
- isLoading={isTicketsLoading}
+ isLoading={isTicketsFetching}
searchTrigger={searchRequestText}
>
@@ -134,16 +132,28 @@ export function TicketList() {
loading={isTableLoading}
+ pagination={{
+ current: paginationParams.page,
+ pageSize: paginationParams.pageSize,
+ total: tickets?.count,
+ onChange: (page, pageSize) => {
+ setPaginationParams({
+ page,
+ pageSize,
+ })
+ scrollToTop()
+ },
+ }}
customType={'tableWithoutSearch'}
columnsTitlesAndKeys={[
['Создано', 'created_at'],
['Статус', 'status'],
['Содержание', 'content'],
- ['Отправитель', 'sender'],
+ ['Семья', 'sender'],
]}
customWidths={[10, 10, 40, 30]}
- data={reformattedData}
- isLoading={isTicketsLoading}
+ data={tickets}
+ isLoading={isTicketsFetching}
mainRoute={RoutePath[AppRoutes.TICKETS_LIST]}
searchFields={['created_at', 'content', 'sender']}
customFields={{
@@ -158,12 +168,11 @@ export function TicketList() {
return (
- {reformattedData?.results[index].unread_sender_comments_count > 0 && (
+ {(tickets?.results[index] as TableType).unread_sender_comments_count > 0 && (
)}
-
diff --git a/apps/schools/domains/ticket/components/ticketList/interfaces.ts b/apps/schools/domains/ticket/components/ticketList/interfaces.ts
index 23ecccc0..b5a81bce 100644
--- a/apps/schools/domains/ticket/components/ticketList/interfaces.ts
+++ b/apps/schools/domains/ticket/components/ticketList/interfaces.ts
@@ -12,4 +12,5 @@ export interface TableType {
status?: string
content?: string
sender?: string
+ unread_sender_comments_count: number
}
diff --git a/apps/schools/domains/ticket/redux/serializers.ts b/apps/schools/domains/ticket/redux/serializers.ts
index c8b9edc7..2290bbc9 100644
--- a/apps/schools/domains/ticket/redux/serializers.ts
+++ b/apps/schools/domains/ticket/redux/serializers.ts
@@ -6,7 +6,7 @@ export interface GetTicket {
last_comment: GetTicketComment
recipient: GetOrganization
created_at: string
- unread_sender_comments_count?: string
+ unread_sender_comments_count: number
unread_recipient_comments_count?: string
sender?: GetFamily
status?: QueriesTypes
diff --git a/apps/schools/domains/user/components/auth/containers/PopupCookie.tsx b/apps/schools/domains/user/components/auth/containers/PopupCookie.tsx
index a93dcc70..11c89f04 100644
--- a/apps/schools/domains/user/components/auth/containers/PopupCookie.tsx
+++ b/apps/schools/domains/user/components/auth/containers/PopupCookie.tsx
@@ -7,6 +7,7 @@ import { Button } from '@domains/common/components/button'
import { Typography } from 'antd'
import Cookie from 'universal-cookie'
import { COOKIE_AGREEMENT_KEY } from '@domains/user/components/auth/constants/variables'
+import { oneYearExpiresDate } from '@domains/common/constants/Cookies'
export const PopupCookie = () => {
const cookies = new Cookie()
@@ -15,7 +16,7 @@ export const PopupCookie = () => {
const [cookiesNotAccepted, setCookiesNotAccepted] = useState(true)
const acceptCookieAgreement = useCallback(() => {
- cookies.set(COOKIE_AGREEMENT_KEY, 'true')
+ cookies.set(COOKIE_AGREEMENT_KEY, 'true', { expires: oneYearExpiresDate })
setCookiesNotAccepted(false)
setIsShown(false)
}, [])
diff --git a/apps/schools/domains/user/components/auth/registerForm/index.tsx b/apps/schools/domains/user/components/auth/registerForm/index.tsx
index 4cb4b579..a9c1c849 100644
--- a/apps/schools/domains/user/components/auth/registerForm/index.tsx
+++ b/apps/schools/domains/user/components/auth/registerForm/index.tsx
@@ -1,5 +1,5 @@
import { Col, Form, Row } from 'antd'
-import React, { PropsWithChildren, useCallback, useContext, useState } from 'react'
+import React, {PropsWithChildren, useCallback, useContext, useEffect, useState} from 'react'
import styles from '../styles/formStyles.module.scss'
import { ResponsiveCol } from '../containers/ResponsiveCol'
@@ -10,7 +10,9 @@ import { IRegisterFormProps } from './interfaces'
import { BUTTON_FORM_GUTTER_20 } from '../constants/styles'
import { FirebaseReCaptchaContext } from '@domains/user/providers/firebaseReCaptchaProvider'
import { registrationHandler } from '@domains/user/handlers/auth/register'
-import { useUsersMutation } from '@domains/user/redux/userApi'
+import {useUsersMutation} from '@domains/user/redux/userApi'
+import {useUpdateEmployeeProfileByIdMutation} from "@domains/employee/redux/employeeApi";
+import {useLazyGetUserQuery} from "@domains/user/redux/authenticationApi";
const RequiredFlagWrapper: React.FC
> = (props) => {
return {props.children}
@@ -28,12 +30,36 @@ export const RegisterForm: React.FC = ({ onFinish, onError }
signInByPhone: () => {},
}
- const registerComplete = useCallback(async () => {
- const { password } = form.getFieldsValue(['password'])
- registrationHandler(phone, password, userRegistration, onFinish, onError, form)
- }, [form, signInByPhone])
+ const [updateProfile] = useUpdateEmployeeProfileByIdMutation();
+ const [getLazyUser, {data}] = useLazyGetUserQuery();
- const initialValues = { phone }
+ const registerComplete = useCallback(() => {
+ const { password } = form.getFieldsValue(['password']);
+
+ registrationHandler(phone, password, userRegistration, onError, form)
+ .then(async () => {
+ await getLazyUser({});
+ });
+ }, [form, signInByPhone, getLazyUser]);
+
+ useEffect(() => {
+ const { email } = form.getFieldsValue(['email']);
+ const { name } = form.getFieldsValue(['name']);
+
+ if (data && data.user.employee_profile?.id) {
+ const updateEmail = {
+ employee_profile_id: data.user.employee_profile.id,
+ name: name,
+ email: email
+ };
+ updateProfile(updateEmail);
+ onFinish();
+ }
+ }, [data, updateProfile]);
+
+ const initialValues = {
+ phone
+ }
return (