Skip to content

Commit

Permalink
del new statuses, rename QueryStatuses to StatusesEnum.
Browse files Browse the repository at this point in the history
  • Loading branch information
levil664 committed Apr 26, 2024
1 parent 72754f6 commit 8833089
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 43 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useEffect, useState } from 'react'
import router, { useRouter } from 'next/router'
import { useRouter } from 'next/router'
import { Col, Row, Typography } from 'antd'
import Image from 'next/image'
import Link from 'next/link'
Expand All @@ -23,7 +23,7 @@ import { searchColumns } from './constants'
import { CurrentCircleRowType } from './interfaces'
import styles from './styles/styles.module.scss'
import { getVarsForAddressColumn } from '@domains/common/utils/geo'
import { QueryStatuses } from '@domains/common/constants/Enums'
import { StatusesEnum } from '@domains/common/constants/Enums'
import { ErrorType } from '@store/commonApi'
import { AppRoutes, RoutePath } from '@domains/common/constants/routerEnums'

Expand Down Expand Up @@ -98,7 +98,7 @@ const CurrentCircle = () => {
<div>Принято</div>
<span></span>
<Link
href={`/query?statuses=${QueryStatuses.ACCEPTED}&circles=${circle?.circle.name}${backQuery}`}
href={`/query?statuses=${StatusesEnum.ACCEPTED}&circles=${circle?.circle.name}${backQuery}`}
className={styles.colorCountAcceptedQueries}
>
{queriesCount.ACCEPTED}
Expand All @@ -108,7 +108,7 @@ const CurrentCircle = () => {
<div>На рассмотрении</div>
<span></span>
<Link
href={`/query?statuses=${QueryStatuses.IN_PROGRESS}&circles=${circle?.circle.name}${backQuery}`}
href={`/query?statuses=${StatusesEnum.IN_PROGRESS}&circles=${circle?.circle.name}${backQuery}`}
className={styles.colorCountInProgressQueries}
>
{queriesCount.IN_PROGRESS}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { IBaseLayoutProps } from './interfaces'
import { OrganizationSelect } from '../OrganizationSelect'
import { useLayoutContext } from '@domains/user/providers/baseLayoutProvider'
import { COLLAPSED_DIVIDER_WIDTH, COLLAPSED_LAYOUT_WIDTH, DIVIDER_WIDTH, LAYOUT_WIDTH } from './styles/styles'
import { QueryStatuses } from '@domains/common/constants/Enums'
import { StatusesEnum } from '@domains/common/constants/Enums'
import Image from 'next/image'
import ExclamationCircleOutlined from '@public/icons/ExclamationCircleOutlined.svg'
import { Button } from '@domains/common/components/button'
Expand All @@ -36,7 +36,7 @@ export const BaseLayout: React.FC<IBaseLayoutProps> = (props) => {
<Layout className={styles.placement}>
<div className={styles.invitationsContainer}>
{invitations?.results.map((invite) => {
if (invite.status === QueryStatuses.SENT || invite.status === QueryStatuses.IN_PROGRESS) {
if (invite.status === StatusesEnum.SENT || invite.status === StatusesEnum.IN_PROGRESS) {
return (
<div className={styles.inviteContainer} key={invite.id}>
<div className={styles.leftContainer}>
Expand All @@ -50,7 +50,7 @@ export const BaseLayout: React.FC<IBaseLayoutProps> = (props) => {
handleChangeStatusInvitation(
mutation,
invite.id,
QueryStatuses.ACCEPTED,
StatusesEnum.ACCEPTED,
).then(() => {
refetch()
emit(EventKey.RefetchOrganizationsQuery)
Expand All @@ -65,7 +65,7 @@ export const BaseLayout: React.FC<IBaseLayoutProps> = (props) => {
handleChangeStatusInvitation(
mutation,
invite.id,
QueryStatuses.DECLINED,
StatusesEnum.DECLINED,
).then(refetch)
}
>
Expand Down
8 changes: 1 addition & 7 deletions apps/schools/domains/common/constants/Enums.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
export enum QueryStatuses {
export enum StatusesEnum {
SENT = 'SENT',
ACCEPTED = 'ACCEPTED',
IN_PROGRESS = 'IN_PROGRESS',
DECLINED = 'DECLINED',
CANCELED = 'CANCELED',
}

export enum TicketStatuses {
NEW = 'NEW',
OPENED = 'OPENED',
CLOSED = 'CLOSED',
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { withLoadingMessage } from '@domains/common/utils/loading'
import { LoadingMsg } from '@domains/user/components/auth/constants/message'
import { message } from 'antd'
import { QueriesTypes } from '@domains/common/redux/interfaces'
import { QueryStatuses } from '@domains/common/constants/Enums'
import { StatusesEnum } from '@domains/common/constants/Enums'

export async function handleChangeStatusInvitation(mutation: any, id: string | undefined, status: QueriesTypes) {
if (id === undefined) {
Expand All @@ -16,7 +16,7 @@ export async function handleChangeStatusInvitation(mutation: any, id: string | u
})

if ('data' in response)
status === QueryStatuses.ACCEPTED
status === StatusesEnum.ACCEPTED
? message.success(`Вы успешно приняли заявку`)
: message.success(`Вы успешно отклонили заявку`)
}
12 changes: 6 additions & 6 deletions apps/schools/domains/query/components/queryList/constants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { QueryStatuses } from '@domains/common/constants/Enums'
import { StatusesEnum } from '@domains/common/constants/Enums'
import {
ACCEPTED_FILTER_COLOR,
CANCELED_FILTER_COLOR,
Expand All @@ -23,9 +23,9 @@ interface TagType {
}

export const StatusDictionary: { [key: string]: TagType } = {
[QueryStatuses.SENT]: { text: 'Отправлено', color: SENT_FILTER_COLOR, antdColor: 'gold' },
[QueryStatuses.IN_PROGRESS]: { text: 'На рассмотрении', color: IN_PROGRESS_FILTER_COLOR, antdColor: 'blue' },
[QueryStatuses.ACCEPTED]: { text: 'Принято', color: ACCEPTED_FILTER_COLOR, antdColor: 'green' },
[QueryStatuses.CANCELED]: { text: 'Отменено', color: CANCELED_FILTER_COLOR, antdColor: 'volcano' },
[QueryStatuses.DECLINED]: { text: 'Отклонено', color: DECLINED_FILTER_COLOR, antdColor: 'red' },
[StatusesEnum.SENT]: { text: 'Отправлено', color: SENT_FILTER_COLOR, antdColor: 'gold' },
[StatusesEnum.IN_PROGRESS]: { text: 'На рассмотрении', color: IN_PROGRESS_FILTER_COLOR, antdColor: 'blue' },
[StatusesEnum.ACCEPTED]: { text: 'Принято', color: ACCEPTED_FILTER_COLOR, antdColor: 'green' },
[StatusesEnum.CANCELED]: { text: 'Отменено', color: CANCELED_FILTER_COLOR, antdColor: 'volcano' },
[StatusesEnum.DECLINED]: { text: 'Отклонено', color: DECLINED_FILTER_COLOR, antdColor: 'red' },
}
4 changes: 2 additions & 2 deletions apps/schools/domains/student/components/studentList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { createSearchTextForRequest } from '@domains/common/utils/searchText'
import { RowType, TableType } from './interfaces'
import { searchInvitesColumns, searchStudentsColumns } from './constants'
import { useGetAllStudentInvitationsQuery, useGetAllStudentsQuery } from '@domains/organization/redux/organizationApi'
import { QueryStatuses } from '@domains/common/constants/Enums'
import { StatusesEnum } from '@domains/common/constants/Enums'
import EmptyWrapper from '@domains/common/components/containers/EmptyWrapper'
import { AppRoutes, RoutePath } from '@domains/common/constants/routerEnums'

Expand All @@ -19,7 +19,7 @@ export function StudentList() {

const { data: invites, isLoading: isLoadingInvites } = useGetAllStudentInvitationsQuery({
circle__organization__id: organizationId,
status: QueryStatuses.SENT,
status: StatusesEnum.SENT,
or_search: createSearchTextForRequest(searchRequestText, searchInvitesColumns),
})

Expand Down
22 changes: 7 additions & 15 deletions apps/schools/domains/ticket/components/ticketList/constants.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { QueryStatuses, TicketStatuses } from '@domains/common/constants/Enums'
import { CLOSED_FILTER_COLOR, OPENED_FILTER_COLOR, NEW_FILTER_COLOR } from './styles/styles'
import { StatusesEnum } from '@domains/common/constants/Enums'
import type { LiteralUnion } from 'antd/lib/_util/type'
import type { PresetColorType, PresetStatusColorType } from 'antd/lib/_util/colors'
import {
Expand All @@ -8,7 +7,7 @@ import {
DECLINED_FILTER_COLOR,
IN_PROGRESS_FILTER_COLOR,
SENT_FILTER_COLOR,
} from '@domains/query/components/queryList/styles/styles'
} from './styles/styles'

export const searchTicketsColumns = ['family__name']

Expand All @@ -18,17 +17,10 @@ interface TagType {
antdColor: LiteralUnion<PresetColorType | PresetStatusColorType, string>
}

//
// export const StatusDictionary: { [key: string]: TagType } = {
// [TicketStatuses.NEW]: { text: 'Отправлено', color: NEW_FILTER_COLOR, antdColor: 'red' },
// [TicketStatuses.OPENED]: { text: 'На рассмотрении', color: OPENED_FILTER_COLOR, antdColor: 'blue' },
// [TicketStatuses.CLOSED]: { text: 'Принято', color: CLOSED_FILTER_COLOR, antdColor: 'green' },
// }

export const StatusDictionary: { [key: string]: TagType } = {
[QueryStatuses.SENT]: { text: 'Отправлено', color: SENT_FILTER_COLOR, antdColor: 'gold' },
[QueryStatuses.IN_PROGRESS]: { text: 'На рассмотрении', color: IN_PROGRESS_FILTER_COLOR, antdColor: 'blue' },
[QueryStatuses.ACCEPTED]: { text: 'Принято', color: ACCEPTED_FILTER_COLOR, antdColor: 'green' },
[QueryStatuses.CANCELED]: { text: 'Отменено', color: CANCELED_FILTER_COLOR, antdColor: 'volcano' },
[QueryStatuses.DECLINED]: { text: 'Отклонено', color: DECLINED_FILTER_COLOR, antdColor: 'red' },
[StatusesEnum.SENT]: { text: 'Отправлено', color: SENT_FILTER_COLOR, antdColor: 'gold' },
[StatusesEnum.IN_PROGRESS]: { text: 'На рассмотрении', color: IN_PROGRESS_FILTER_COLOR, antdColor: 'blue' },
[StatusesEnum.ACCEPTED]: { text: 'Принято', color: ACCEPTED_FILTER_COLOR, antdColor: 'green' },
[StatusesEnum.CANCELED]: { text: 'Отменено', color: CANCELED_FILTER_COLOR, antdColor: 'volcano' },
[StatusesEnum.DECLINED]: { text: 'Отклонено', color: DECLINED_FILTER_COLOR, antdColor: 'red' },
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export const NEW_FILTER_COLOR = '#EB3468'
export const OPENED_FILTER_COLOR = '#2F54EB'
export const CLOSED_FILTER_COLOR = '#52C41A'
export const ACCEPTED_FILTER_COLOR = '#B7EB8F'
export const IN_PROGRESS_FILTER_COLOR = '#2F54EB'
export const SENT_FILTER_COLOR = '#FF9500'
export const CANCELED_FILTER_COLOR = '#EB3468'
export const DECLINED_FILTER_COLOR = '#FFA39E'

0 comments on commit 8833089

Please sign in to comment.