diff --git a/apps/schools/domains/common/constants/Enums.ts b/apps/schools/domains/common/constants/Enums.ts index 41623b3f..eab16db4 100644 --- a/apps/schools/domains/common/constants/Enums.ts +++ b/apps/schools/domains/common/constants/Enums.ts @@ -4,4 +4,5 @@ export enum StatusesEnum { IN_PROGRESS = 'IN_PROGRESS', DECLINED = 'DECLINED', CANCELED = 'CANCELED', + CLOSED = 'CLOSED', } diff --git a/apps/schools/domains/ticket/components/currentTicket/index.tsx b/apps/schools/domains/ticket/components/currentTicket/index.tsx index 3a8aa4ea..45f9b65d 100644 --- a/apps/schools/domains/ticket/components/currentTicket/index.tsx +++ b/apps/schools/domains/ticket/components/currentTicket/index.tsx @@ -4,7 +4,7 @@ import router from 'next/router' import { AppRoutes, RoutePath } from '@domains/common/constants/routerEnums' import { useOrganization } from '@domains/organization/providers/organizationProvider' import { - ACCEPTED_FILTER_COLOR, + CLOSED_FILTER_COLOR, IN_PROGRESS_FILTER_COLOR, SENT_FILTER_COLOR, } from '@domains/ticket/components/ticketList/styles/styles' @@ -98,11 +98,13 @@ const CurrentTicket = () => { const SendComment = () => { setIsButtonDisabled(true) - handleCreateComment(uuid[0], mutationCreateComment, text, data?.results[0].id, isInternal).then(() => { + handleCreateComment(uuid[0], mutationCreateComment, text, data?.results[0].id, isInternal).then((success) => { + if (success) { + setIsInternal(false) + setText('') + handleChange + } setIsButtonDisabled(false) - setIsInternal(false) - setText('') - handleChange }) } @@ -128,9 +130,9 @@ const CurrentTicket = () => { translate: 'Открыто', color: IN_PROGRESS_FILTER_COLOR, }, - ACCEPTED: { + CLOSED: { translate: 'Закрыто', - color: ACCEPTED_FILTER_COLOR, + color: CLOSED_FILTER_COLOR, }, } diff --git a/apps/schools/domains/ticket/components/ticketList/constants.ts b/apps/schools/domains/ticket/components/ticketList/constants.ts index bb63666a..1df43f71 100644 --- a/apps/schools/domains/ticket/components/ticketList/constants.ts +++ b/apps/schools/domains/ticket/components/ticketList/constants.ts @@ -1,7 +1,7 @@ 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 { ACCEPTED_FILTER_COLOR, IN_PROGRESS_FILTER_COLOR, SENT_FILTER_COLOR } from './styles/styles' +import { CLOSED_FILTER_COLOR, IN_PROGRESS_FILTER_COLOR, SENT_FILTER_COLOR } from './styles/styles' export const searchTicketsColumns = ['family__name', 'ticket_comment__value'] @@ -14,5 +14,5 @@ interface TagType { export const StatusDictionary: { [key: string]: TagType } = { [StatusesEnum.SENT]: { text: 'Новое', color: SENT_FILTER_COLOR, antdColor: 'red' }, [StatusesEnum.IN_PROGRESS]: { text: 'Открыто', color: IN_PROGRESS_FILTER_COLOR, antdColor: 'blue' }, - [StatusesEnum.ACCEPTED]: { text: 'Закрыто', color: ACCEPTED_FILTER_COLOR, antdColor: 'green' }, + [StatusesEnum.CLOSED]: { text: 'Закрыто', color: CLOSED_FILTER_COLOR, antdColor: 'green' }, } diff --git a/apps/schools/domains/ticket/components/ticketList/styles/styles.ts b/apps/schools/domains/ticket/components/ticketList/styles/styles.ts index e1dcbaa0..e25c3656 100644 --- a/apps/schools/domains/ticket/components/ticketList/styles/styles.ts +++ b/apps/schools/domains/ticket/components/ticketList/styles/styles.ts @@ -1,3 +1,3 @@ export const IN_PROGRESS_FILTER_COLOR = '#2F54EB' export const SENT_FILTER_COLOR = '#EB3468' -export const ACCEPTED_FILTER_COLOR = '#52C41A' +export const CLOSED_FILTER_COLOR = '#52C41A' diff --git a/apps/schools/domains/ticket/handlers/createComment.ts b/apps/schools/domains/ticket/handlers/createComment.ts index 8847f01e..3df19113 100644 --- a/apps/schools/domains/ticket/handlers/createComment.ts +++ b/apps/schools/domains/ticket/handlers/createComment.ts @@ -15,7 +15,7 @@ export async function handleCreateComment( ) { if (value.length === 0) { message.error(NeedConfirmComment) - return + return false } let response = await withLoadingMessage(LoadingMsg, mutation, { @@ -29,5 +29,7 @@ export async function handleCreateComment( if ('data' in response) { message.success(SuccessCreateCommentMsg) + return true } + return false } diff --git a/apps/schools/store/middlewares.ts b/apps/schools/store/middlewares.ts index b905cfe0..26ab2c8c 100644 --- a/apps/schools/store/middlewares.ts +++ b/apps/schools/store/middlewares.ts @@ -17,6 +17,7 @@ const errorCodes: ErrorCodes = { EmailServiceUnavailable: 'Сервис отправки электронной почты недоступен', AlreadyExists: 'Объект с такими параметрами уже существует', MapServiceUnavailable: 'Сервис карт недоступен', + TicketIsClosed: 'Не удалось выполнить действие, так как тикет закрыт', }, 401: 'Вы не аутентифицированы. Пожалуйста, выполните вход для доступа к запрашиваемому ресурсу', 403: 'Недостаточно прав для выполнения операции. Обратитесь к администратору для получения необходимых разрешений',