Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 1.1.1 #146

Merged
merged 43 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
7fba951
fix field name
nenichv Jun 13, 2024
fa070ce
fix field name
nenichv Jun 13, 2024
41188d8
add function send email after success (not work)
nenichv Jun 13, 2024
7c983e2
moved the reformattedData to transformResponse
levil664 Jun 13, 2024
e7d30dd
prettier
levil664 Jun 13, 2024
c540842
fix middleware bug
levil664 Jun 13, 2024
d5cfb37
fix CurrentCircleTableType and search bug in ticketList
levil664 Jun 13, 2024
fbc88b0
rename TableTypeCurrentCircle
levil664 Jun 13, 2024
b06e435
del parseInt
levil664 Jun 13, 2024
930d3e0
Merge pull request #140 from open-schools/feature/SCHOOL-837/rtk-quer…
levil664 Jun 13, 2024
071585b
family name fix in ticket list
zavarin-michael Jun 14, 2024
a0e39c7
Merge pull request #141 from open-schools/bugfix/ticket-list-family-name
levil664 Jun 14, 2024
094379f
fix name of column
zavarin-michael Jun 14, 2024
0794c25
Merge pull request #142 from open-schools/bugfix/ticket-list-family-name
levil664 Jun 14, 2024
6792aea
add expires value for all set cookie methods in project
zavarin-michael Jun 14, 2024
faf30c4
Merge pull request #143 from open-schools/bugfix/SCHOOL-731/cookie-ex…
zavarin-michael Jun 14, 2024
db43ff6
add mutation for send email
nenichv Jun 14, 2024
15a4c1e
delete unnecessary code
nenichv Jun 20, 2024
fa55eea
delete unnecessary code
nenichv Jun 20, 2024
e6f8b6d
delete unnecessary code
nenichv Jun 20, 2024
61cacaa
add pagination
levil664 Jun 20, 2024
bd3adc5
add scroll to top when change page
levil664 Jun 20, 2024
3c66cba
prettier
levil664 Jun 20, 2024
db2b798
add email profile
nenichv Jun 20, 2024
781cb18
refactoring
nenichv Jun 20, 2024
45030a1
refactoring
nenichv Jun 20, 2024
ccb49e9
fix page and pageSize combined in state var
levil664 Jun 20, 2024
380b866
fix
nenichv Jun 20, 2024
d7223ae
delete log
nenichv Jun 21, 2024
0b931de
page params transfer in constants, use isFetching instead of isLoading
levil664 Jun 21, 2024
9584312
Add scrollTo function in common domain utils
levil664 Jun 21, 2024
e5409eb
fix
levil664 Jun 21, 2024
ea3142e
fix
levil664 Jun 21, 2024
b331773
fix and add lazy get user query instead of useUserProfile
nenichv Jun 21, 2024
a763d4c
refactoring
nenichv Jun 21, 2024
18336b9
refactoring
nenichv Jun 21, 2024
3b7fcec
refactoring
nenichv Jun 21, 2024
78ec43a
Merge pull request #145 from open-schools/feature/SCHOOL-838/add-tabl…
zavarin-michael Jun 21, 2024
cd9534b
upgrade version of node in dev.Dockerfile and prod.Dockerfile from 16…
zavarin-michael Jun 24, 2024
8464557
trying to fix problem with props.text
zavarin-michael Jun 24, 2024
8dc562d
changed from es5 to es6
zavarin-michael Jun 24, 2024
aaa53ba
changed from es6 to es2018
zavarin-michael Jun 24, 2024
5f99fef
Merge pull request #144 from open-schools/feature/SCHOOL-788/add-emai…
zavarin-michael Jun 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/schools/dev.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:16-alpine AS runner
FROM node:18-alpine AS runner

RUN node -v

Expand Down
29 changes: 22 additions & 7 deletions apps/schools/domains/circle/components/circleList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,23 @@ import { mapReturnedData } from '@domains/common/redux/utils'
import { HighlightText } from '@domains/common/components/table/forming'
import { getVarsForAddressColumn } from '@domains/common/utils/geo'
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 CircleList() {
const [searchRequestText, setSearchRequestText] = useState('')
const { organizationId } = useOrganization()

const [paginationParams, setPaginationParams] = useState({
page: defaultPaginationTablePage,
pageSize: defaultPaginationTablePageSize,
})

const { data: circles, isFetching: isFetching } = useGetAllCirclesQuery({
organization_id: organizationId,
or_search: createSearchTextForRequest(searchRequestText, searchStudentsColumns),
})

const reformattedData = mapReturnedData(circles, (circle) => {
const transformedCircle = structuredClone(circle) as unknown as TableType
transformedCircle.accepted_count = circle.student_profile_queries.ACCEPTED
return transformedCircle
page: paginationParams.page,
page_size: paginationParams.pageSize,
})

return (
Expand Down Expand Up @@ -58,7 +61,19 @@ export function CircleList() {
['Адрес', 'address'],
['Кол-во принятых заявок', 'accepted_count'],
]}
data={reformattedData}
pagination={{
current: paginationParams.page,
pageSize: paginationParams.pageSize,
total: circles?.count,
onChange: (page, pageSize) => {
setPaginationParams({
page,
pageSize,
})
scrollToTop()
},
}}
data={circles}
isLoading={isFetching}
mainRoute={RoutePath[AppRoutes.CIRCLE_LIST]}
searchFields={['name', 'address']}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export interface RowType {
}

export interface TableType {
id?: string
id: string
name: string
address: string
accepted_count: number
Expand Down
17 changes: 3 additions & 14 deletions apps/schools/domains/circle/components/currentCircle/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,13 @@ import { useOrganization } from '@domains/organization/providers/organizationPro
import { CARD_HEAD_STYLE } from '@domains/circle/components/currentCircle/styles/styles'
import { Table } from '@domains/common/components/table'
import { createSearchTextForRequest } from '@domains/common/utils/searchText'
import { mapReturnedData } from '@domains/common/redux/utils'
import { ActionBar } from '@domains/common/components/stickyBlock/actionBar'
import { sumObjectValues } from '@domains/common/utils/sumObjectValues'

import android from '@public/image/Android.svg'

import { searchColumns } from './constants'
import { CurrentCircleRowType } from './interfaces'
import { RowType, TableType } from './interfaces'
import styles from './styles/styles.module.scss'
import { getVarsForAddressColumn } from '@domains/common/utils/geo'
import { StatusesEnum } from '@domains/common/constants/Enums'
Expand Down Expand Up @@ -53,16 +52,6 @@ const CurrentCircle = () => {
CANCELED: 0,
}

const reformattedData = mapReturnedData(students, (student) => {
const transformedCircle = structuredClone(student) as unknown as CurrentCircleRowType
transformedCircle.id = student.id
transformedCircle.student_name = student.name
transformedCircle.student_phone = student.student_profile.phone
transformedCircle.parent_names = student.student_profile.parent_names?.replaceAll(',', ',\n')
transformedCircle.parent_phones = student.student_profile.parent_phones?.replaceAll(',', '\n')
return transformedCircle
})

const countAllQueries = sumObjectValues(queriesCount)
const addressVars = getVarsForAddressColumn(circle?.circle.address ?? '')

Expand Down Expand Up @@ -134,14 +123,14 @@ const CurrentCircle = () => {
</Col>
</Row>
<div className={styles.tableContainer}>
<Table<CurrentCircleRowType, CurrentCircleRowType>
<Table<RowType, TableType>
columnsTitlesAndKeys={[
['Ф. И. О обучающегося', 'student_name'],
['Телефон обучающегося', 'student_phone'],
['Ф. И. О родителя', 'parent_names'],
['Телефон родителя', 'parent_phones'],
]}
data={reformattedData}
data={students}
mainRoute={RoutePath[AppRoutes.STUDENT_LIST]}
isLoading={isLoading}
needNumbering={true}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
export interface CurrentCircleRowType {
export interface RowType {
id?: string
student_name: string
student_phone?: string
parent_names?: string
parent_phones?: string
}

export interface TableType {
id?: string
student_name: string
student_phone?: string
Expand Down
18 changes: 17 additions & 1 deletion apps/schools/domains/circle/redux/circleApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import {
ChangeCircleData,
} from './interfaces'
import { GetCircle, GetQueryStatus, GetStudent } from '@domains/common/redux/serializers'
import { mapReturnedData } from '@domains/common/redux/utils'
import { TableType as TableTypeCurrentCircle } from '@domains/circle/components/currentCircle/interfaces'

const circleApi = commonApi.injectEndpoints({
endpoints: (build) => ({
Expand Down Expand Up @@ -43,12 +45,26 @@ const circleApi = commonApi.injectEndpoints({
}),
providesTags: (result, error, arg) => [{ type: 'Circle', id: arg.circle_id }],
}),
getCircleStudents: build.query<ReturnedData<GetStudent[]>, CircleStudentsData>({
getCircleStudents: build.query<ReturnedData<TableTypeCurrentCircle[]>, CircleStudentsData>({
query: (params) => ({
url: `/organization-management/circles/${params.circle_id}/students`,
method: 'GET',
params: params,
}),
transformResponse: (response: ReturnedData<GetStudent[]>) => {
return mapReturnedData(response, (student: GetStudent) => {
return {
...student,
student_name: student.name,
student_profile: {
...student.student_profile,
phone: student.student_profile.phone,
parent_names: student.student_profile.parent_names,
parent_phones: student.student_profile.parent_phones,
},
}
})!
},
providesTags: (result, error, arg) => [{ type: 'Circle', id: arg.circle_id }],
}),
deleteCircle: build.mutation<{ circle: GetCircle }, CircleData>({
Expand Down
4 changes: 2 additions & 2 deletions apps/schools/domains/common/components/table/forming.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ColumnType } from 'antd/lib/table/interface'
import React from 'react'
import React, { ReactElement } from 'react'
import styles from './styles/styles.module.scss'
import { getSearchText } from '@domains/common/utils/searchText'
import {
Expand Down Expand Up @@ -53,7 +53,7 @@ export function useGenerateFullColumns<RowType>(
const obj = (record as any)[column.dataIndex]

if (!isReactElement(obj)) return obj === value
return obj.props.text === value
return (obj as ReactElement).props.text === value
},
}
}
Expand Down
1 change: 1 addition & 0 deletions apps/schools/domains/common/constants/Cookies.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const oneYearExpiresDate = new Date(Date.now() + 60 * 60 * 24 * 365 * 1000)
2 changes: 2 additions & 0 deletions apps/schools/domains/common/constants/Table.ts
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
export const typeTable = ['tableWithoutSearch']
export const defaultPaginationTablePage = 1
export const defaultPaginationTablePageSize = 10
7 changes: 7 additions & 0 deletions apps/schools/domains/common/utils/scrollInDirection.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export function scrollToTop() {
window.scrollTo({ top: 0, left: 0 })
}

export function scrollToBottom() {
window.scrollTo({ top: document.body.scrollHeight, left: 0 })
}
25 changes: 23 additions & 2 deletions apps/schools/domains/employee/components/employeeList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,23 @@ import { GetListEmployee } from '@domains/employee/redux/interfaces'
import { RowType } from '@domains/employee/components/employeeList/interfaces'
import { searchColumns } from '@domains/employee/components/employeeList/constants'
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 EmployeeList() {
const [searchRequestText, setSearchRequestText] = useState('')
const { organizationId } = useOrganization()

const { data, isLoading } = useGetAllEmployeesQuery({
const [paginationParams, setPaginationParams] = useState({
page: defaultPaginationTablePage,
pageSize: defaultPaginationTablePageSize,
})

const { data, isFetching } = useGetAllEmployeesQuery({
organization: organizationId,
or_search: createSearchTextForRequest(searchRequestText, searchColumns),
page: paginationParams.page,
page_size: paginationParams.pageSize,
})

return (
Expand All @@ -41,8 +50,20 @@ export function EmployeeList() {
['Должность', 'position'],
['Телефон', 'phone'],
]}
pagination={{
current: paginationParams.page,
pageSize: paginationParams.pageSize,
total: data?.count,
onChange: (page, pageSize) => {
setPaginationParams({
page,
pageSize,
})
scrollToTop()
},
}}
data={data}
isLoading={isLoading}
isLoading={isFetching}
mainRoute={RoutePath[AppRoutes.EMPLOYEE_LIST]}
searchFields={searchColumns}
searchRequestText={searchRequestText}
Expand Down
38 changes: 36 additions & 2 deletions apps/schools/domains/organization/redux/organizationApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ import {
UpdateOrganizationInviteEmployee,
} from '@domains/common/redux/serializers'
import { GetTicket, GetTicketData, GetTicketsData } from '@domains/ticket/redux/serializers'
import { mapReturnedData } from '@domains/common/redux/utils'
import { TableType as TableTypeCircle } from '@domains/circle/components/circleList/interfaces'
import { TableType as TableTypeTickets } from '@domains/ticket/components/ticketList/interfaces'
import { TableType as TableTypeQuery } from '@domains/query/components/queryList/interfaces'

const organizationApi = commonApi.injectEndpoints({
endpoints: (build) => ({
Expand Down Expand Up @@ -68,12 +72,19 @@ const organizationApi = commonApi.injectEndpoints({
}),
providesTags: (result) => providesList(result?.results, 'Student'),
}),
getAllCircles: build.query<ReturnedData<GetOrganizationCircleList[]>, GetOrganizationCircleListData>({
getAllCircles: build.query<ReturnedData<TableTypeCircle[]>, GetOrganizationCircleListData>({
query: (params) => ({
url: `/organization-management/organizations/${params.organization_id}/circles`,
method: 'GET',
params: params,
}),
transformResponse: (response: ReturnedData<GetOrganizationCircleList[]>) => {
return mapReturnedData(response, (circle) => {
const transformedCircle = structuredClone(circle) as unknown as TableTypeCircle
transformedCircle.accepted_count = circle.student_profile_queries.ACCEPTED
return transformedCircle
})!
},
providesTags: (result) => providesList(result?.results, 'Circle'),
}),
getCurrentCircle: build.query<{ circle: GetOrganizationCircleList }, GetCurrentCircleData>({
Expand Down Expand Up @@ -165,6 +176,16 @@ const organizationApi = commonApi.injectEndpoints({
method: 'GET',
params: params,
}),
transformResponse: (response: ReturnedData<GetStudentJoinCircle[]>) => {
return mapReturnedData(response, (query) => {
const transformedQuery = structuredClone(query) as unknown as TableTypeQuery
transformedQuery.parent_name = query.additional.parent_name
transformedQuery.parent_phone = query.additional.parent_phone
transformedQuery.circle_name = query.recipient.name
transformedQuery.student_name = query.body.name
return transformedQuery
})!
},
providesTags: (result) => providesList(result?.results, 'StudentJoinCircleQuery'),
}),
getOrganizationAnalytics: build.query<{ analytics: GetAnalytics }, GetAnalyticsData>({
Expand All @@ -183,12 +204,25 @@ const organizationApi = commonApi.injectEndpoints({
}),
providesTags: ['Ticket'],
}),
getAllTickets: build.query<ReturnedData<GetTicket[]>, GetTicketsData>({
getAllTickets: build.query<ReturnedData<TableTypeTickets[]>, GetTicketsData>({
query: (params) => ({
url: `/organization-management/organizations/${params.organization_id}/family-tickets`,
method: 'GET',
params: params,
}),
transformResponse: (response: ReturnedData<GetTicket[]>) => {
return mapReturnedData(response, (query) => {
return {
...query,
content: query.last_comment.value,
sender: query.sender?.name,
contentTrimmed:
query.last_comment.value.length > 200
? query.last_comment.value.slice(0, 200) + '…'
: query.last_comment.value,
} as TableTypeTickets
})!
},
providesTags: ['Ticket'],
}),
getTicket: build.query<{ ticket: GetTicket }, GetTicketData>({
Expand Down
Loading
Loading