diff --git a/src/pages/criticisms/Add.tsx b/src/pages/criticisms/Add.tsx index 1d4057d..e176499 100644 --- a/src/pages/criticisms/Add.tsx +++ b/src/pages/criticisms/Add.tsx @@ -1,4 +1,4 @@ -import { FC } from 'react' +import { type FC } from 'react' import { useTranslation } from 'react-i18next' import Input from '../../components/Input' import Textarea from '../../components/Textarea' diff --git a/src/pages/ticket/Category.tsx b/src/pages/ticket/Category.tsx deleted file mode 100644 index c325f28..0000000 --- a/src/pages/ticket/Category.tsx +++ /dev/null @@ -1,196 +0,0 @@ -import { type FC } from 'react' -import Select from '@/components/Select' -import Input from '@/components/Input' -import Td from '@/components/Td' -import SwitchComponent from '@/components/Switch' -import { useFormik } from 'formik' -import type { CategoriesItemType, CreateCategoryType } from './types/TicketTypes' -import * as Yup from 'yup' -import Button from '@/components/Button' -import { useCreateCategory, useGetCategories } from './hooks/useTicketData' -import Textarea from '@/components/Textarea' -import type { ErrorType } from '@/helpers/types' -import { toast } from 'react-toastify' - -const TicketCategory: FC = () => { - - // TODO: این hook باید بعداً وصل شود - مربوط به users است - // const getGroups = useGetGroups() - const createCategory = useCreateCategory() - const getCategories = useGetCategories() - - const formik = useFormik({ - initialValues: { - title: '', - description: '', - userGroupId: '', - isActive: true - }, - validationSchema: Yup.object({ - title: Yup.string().required('این فیلد الزامی است'), - userGroupId: Yup.string().required('این فیلد الزامی است'), - description: Yup.string().required('این فیلد الزامی است'), - }), - onSubmit: (values: CreateCategoryType) => { - createCategory.mutate(values, { - onSuccess: () => { - formik.resetForm() - }, - onError: (error: ErrorType) => { - toast.error(error.response?.data?.error.message[0]) - } - }) - } - }) - - return ( -
-
- دسته‌بندی تیکت‌ها -
- -
-
-
-
- -
-
-
-
- - - - - - - { - getCategories.data?.data?.ticketCategories?.map((item: CategoriesItemType) => ( - - - )) - } - -
- -
- -
-
-
-
- -
-
- افزودن دسته‌بندی -
- -
-
- وضعیت دسته‌بندی -
- - formik.setFieldValue('isActive', value)} - /> -
- -
- -
- -
-