priority
This commit is contained in:
@@ -650,6 +650,7 @@
|
|||||||
"upload_image": "آپلود تصویر",
|
"upload_image": "آپلود تصویر",
|
||||||
"new_password": "رمز عبور جدید"
|
"new_password": "رمز عبور جدید"
|
||||||
},
|
},
|
||||||
|
"priority": "الویت",
|
||||||
"messages": {
|
"messages": {
|
||||||
"messages_list": "لیست پیام ها",
|
"messages_list": "لیست پیام ها",
|
||||||
"submit_date": "تاریخ ثبت",
|
"submit_date": "تاریخ ثبت",
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ const Category: FC = () => {
|
|||||||
<tr>
|
<tr>
|
||||||
<Td text='' />
|
<Td text='' />
|
||||||
<Td text={t('service.title')} />
|
<Td text={t('service.title')} />
|
||||||
|
<Td text={t('priority')} />
|
||||||
<Td text={t('service.parent_category')} />
|
<Td text={t('service.parent_category')} />
|
||||||
<Td text={t('service.count_sub_category')} />
|
<Td text={t('service.count_sub_category')} />
|
||||||
<Td text={t('service.count_service')} />
|
<Td text={t('service.count_service')} />
|
||||||
@@ -86,9 +87,10 @@ const Category: FC = () => {
|
|||||||
return (
|
return (
|
||||||
<tr key={item.id} className='tr'>
|
<tr key={item.id} className='tr'>
|
||||||
<Td text=''>
|
<Td text=''>
|
||||||
<img src={item.icon} className='size-10 rounded-lg' />
|
<img src={item.icon} className='size-10 min-w-10 rounded-lg' />
|
||||||
</Td>
|
</Td>
|
||||||
<Td text={item.title} />
|
<Td text={item.title} />
|
||||||
|
<Td text={item.order} />
|
||||||
<Td text={item.parent ? item.parent.title : '-'} />
|
<Td text={item.parent ? item.parent.title : '-'} />
|
||||||
<Td text={item.childrenCount + ''} />
|
<Td text={item.childrenCount + ''} />
|
||||||
<Td text={item.servicesCount + ''} />
|
<Td text={item.servicesCount + ''} />
|
||||||
|
|||||||
@@ -25,7 +25,8 @@ const CreateCategory: FC = () => {
|
|||||||
initialValues: {
|
initialValues: {
|
||||||
title: '',
|
title: '',
|
||||||
isActive: true,
|
isActive: true,
|
||||||
parentId: ''
|
parentId: '',
|
||||||
|
order: '',
|
||||||
},
|
},
|
||||||
validationSchema: Yup.object({
|
validationSchema: Yup.object({
|
||||||
title: Yup.string().required(t('errors.required')),
|
title: Yup.string().required(t('errors.required')),
|
||||||
@@ -49,7 +50,8 @@ const CreateCategory: FC = () => {
|
|||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
...values,
|
...values,
|
||||||
parentId: values.parentId ? values.parentId : undefined
|
parentId: values.parentId ? values.parentId : undefined,
|
||||||
|
order: +values.order
|
||||||
}
|
}
|
||||||
createCategory.mutate(params, {
|
createCategory.mutate(params, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
@@ -91,6 +93,16 @@ const CreateCategory: FC = () => {
|
|||||||
error_text={formik.touched.title && formik.errors.title ? formik.errors.title : ''}
|
error_text={formik.touched.title && formik.errors.title ? formik.errors.title : ''}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<div className='mt-6'>
|
||||||
|
<Input
|
||||||
|
type='number'
|
||||||
|
label={t('priority')}
|
||||||
|
value={formik.values.order}
|
||||||
|
name='order'
|
||||||
|
onChange={formik.handleChange}
|
||||||
|
error_text={formik.touched.order && formik.errors.order ? formik.errors.order : ''}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
{
|
{
|
||||||
getCategory.data &&
|
getCategory.data &&
|
||||||
<div className='mt-6'>
|
<div className='mt-6'>
|
||||||
@@ -122,7 +134,7 @@ const CreateCategory: FC = () => {
|
|||||||
<Button
|
<Button
|
||||||
className='w-fit px-5'
|
className='w-fit px-5'
|
||||||
onClick={() => formik.handleSubmit()}
|
onClick={() => formik.handleSubmit()}
|
||||||
isLoading={createCategory.isPending}
|
isLoading={createCategory.isPending || singleUpload.isPending}
|
||||||
>
|
>
|
||||||
<div className='flex items-center gap-2'>
|
<div className='flex items-center gap-2'>
|
||||||
<TickCircle
|
<TickCircle
|
||||||
|
|||||||
@@ -32,7 +32,8 @@ const UpdateCategory: FC<Props> = (props) => {
|
|||||||
initialValues: {
|
initialValues: {
|
||||||
title: '',
|
title: '',
|
||||||
isActive: true,
|
isActive: true,
|
||||||
parentId: ''
|
parentId: '',
|
||||||
|
order: '',
|
||||||
},
|
},
|
||||||
validationSchema: Yup.object({
|
validationSchema: Yup.object({
|
||||||
title: Yup.string().required(t('errors.required')),
|
title: Yup.string().required(t('errors.required')),
|
||||||
@@ -55,7 +56,8 @@ const UpdateCategory: FC<Props> = (props) => {
|
|||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
...values,
|
...values,
|
||||||
parentId: values.parentId ? values.parentId : undefined
|
parentId: values.parentId ? values.parentId : undefined,
|
||||||
|
order: +values.order
|
||||||
}
|
}
|
||||||
updateCategory.mutate(params, {
|
updateCategory.mutate(params, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
@@ -79,7 +81,8 @@ const UpdateCategory: FC<Props> = (props) => {
|
|||||||
formik.setValues({
|
formik.setValues({
|
||||||
title: data?.title,
|
title: data?.title,
|
||||||
parentId: data?.parentId,
|
parentId: data?.parentId,
|
||||||
isActive: data?.isActive
|
isActive: data?.isActive,
|
||||||
|
order: data?.order
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,6 +111,17 @@ const UpdateCategory: FC<Props> = (props) => {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div className='mt-5'>
|
||||||
|
<Input
|
||||||
|
label={t('priority')}
|
||||||
|
value={formik.values.order}
|
||||||
|
name='order'
|
||||||
|
onChange={formik.handleChange}
|
||||||
|
error_text={formik.touched.order && formik.errors.order ? formik.errors.order : ''}
|
||||||
|
className='bg-white bg-opacity-40'
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
{
|
{
|
||||||
getCategory.data &&
|
getCategory.data &&
|
||||||
<div className='mt-5'>
|
<div className='mt-5'>
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ export type ServiceCategoryType = {
|
|||||||
parentId: string;
|
parentId: string;
|
||||||
childrenCount: number;
|
childrenCount: number;
|
||||||
servicesCount: number;
|
servicesCount: number;
|
||||||
|
order: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type CreateServiceCategoryType = {
|
export type CreateServiceCategoryType = {
|
||||||
@@ -20,6 +21,7 @@ export type CreateServiceCategoryType = {
|
|||||||
icon?: string;
|
icon?: string;
|
||||||
isActive: boolean;
|
isActive: boolean;
|
||||||
parentId?: string;
|
parentId?: string;
|
||||||
|
order: string | number;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type ToggleStatusCategoryType = {
|
export type ToggleStatusCategoryType = {
|
||||||
|
|||||||
Reference in New Issue
Block a user