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