Skip to content

Commit

Permalink
fix conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
nenichv committed Jul 17, 2024
1 parent 3657815 commit 77cdc8b
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions apps/schools/domains/student/components/studentList/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useCallback, useEffect, useState } from 'react'
import React, { useCallback, useState } from 'react'
import { Typography } from 'antd'
import router from 'next/router'
import styles from './styles/styles.module.scss'
Expand All @@ -17,6 +17,7 @@ import { scrollToTop } from '@domains/common/utils/scrollInDirection'
import { handlePaginationChange } from '@domains/common/handlers/paginationChange'
import { calculateResults } from '@domains/student/handlers/resultsCalculate'
import { getTotalPages } from '@domains/common/utils/getTotalPages'
import { useQueryState } from "next-usequerystate"

export function StudentList() {
const [queryPaginationParams, setQueryPaginationParams] = useState({
Expand All @@ -30,20 +31,20 @@ export function StudentList() {
},
})

const [searchRequestText, setSearchRequestText] = useState('')
const [searchRequestText, setSearchRequestText] = useQueryState('search')
const { organizationId } = useOrganization()

const { data: invites, isLoading: isLoadingInvites } = useGetAllStudentInvitationsQuery({
circle__organization__id: organizationId,
status: StatusesEnum.SENT,
or_search: createSearchTextForRequest(searchRequestText, searchInvitesColumns),
or_search: createSearchTextForRequest(searchRequestText || '', searchInvitesColumns),
page: queryPaginationParams.invites.page,
page_size: queryPaginationParams.invites.pageSize,
})

const { data: students, isFetching: isFetchingStudents } = useGetAllStudentsQuery({
circle__organization: organizationId,
or_search: createSearchTextForRequest(searchRequestText, searchStudentsColumns),
or_search: createSearchTextForRequest(searchRequestText || '', searchStudentsColumns),
page: queryPaginationParams.students.page,
page_size: queryPaginationParams.students.pageSize,
})
Expand Down Expand Up @@ -90,7 +91,7 @@ export function StudentList() {
data={data}
isLoading={isFetchingStudents || isLoadingInvites}
handleRunTask={() => router.push(RoutePath[AppRoutes.STUDENT_CREATE])}
searchTrigger={searchRequestText}
searchTrigger={searchRequestText || ''}
>
<div className={styles.header}>
<Typography.Title level={1}>Обучающиеся</Typography.Title>
Expand Down Expand Up @@ -127,9 +128,9 @@ export function StudentList() {
isLoading={isLoadingInvites || isFetchingStudents}
mainRoute={RoutePath[AppRoutes.STUDENT_LIST]}
searchFields={['student_name', 'student_phone', 'parent_phone', 'circle_name']}
searchRequestText={searchRequestText}
setSearchRequestText={setSearchRequestText}
searchRequestText={searchRequestText || ''}
setSearchRequestText={(text) => setSearchRequestText(text)}
/>
</EmptyWrapper>
)
}
}

0 comments on commit 77cdc8b

Please sign in to comment.