This commit is contained in:
hamid zarghami
2025-03-09 17:08:49 +03:30
parent b870700056
commit 9df7404684
5 changed files with 38 additions and 7 deletions
@@ -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