list of category
This commit is contained in:
@@ -1,3 +1,3 @@
|
|||||||
VITE_API_BASE_URL = 'http://172.27.64.88:4000'
|
VITE_API_BASE_URL = 'http://10.241.118.88:4000'
|
||||||
VITE_TOKEN_NAME = 'negareh_t'
|
VITE_TOKEN_NAME = 'negareh_t'
|
||||||
VITE_REFRESH_TOKEN_NAME = 'negareh_rt'
|
VITE_REFRESH_TOKEN_NAME = 'negareh_rt'
|
||||||
@@ -1,23 +1,55 @@
|
|||||||
import { type FC } from 'react'
|
import { type FC } from 'react'
|
||||||
import { useGetCategory } from '../hooks/useProductData'
|
import { useGetCategory } from '../hooks/useProductData'
|
||||||
import Table from '@/components/Table'
|
import Table from '@/components/Table'
|
||||||
import type { RowDataType } from '@/components/types/TableTypes'
|
import type { ColumnType, RowDataType } from '@/components/types/TableTypes'
|
||||||
import type { CategoryType } from '../types/Types'
|
import type { CategoryType } from '../types/Types'
|
||||||
|
import { Edit } from 'iconsax-react'
|
||||||
|
|
||||||
const CategoryList: FC = () => {
|
const CategoryList: FC = () => {
|
||||||
|
|
||||||
const { data } = useGetCategory()
|
const { data } = useGetCategory()
|
||||||
|
|
||||||
const column = [{
|
const column: ColumnType<CategoryType>[] = [
|
||||||
|
{
|
||||||
title: 'عنوان',
|
title: 'عنوان',
|
||||||
key: 'title',
|
key: 'title',
|
||||||
}]
|
},
|
||||||
|
{
|
||||||
|
title: 'تعداد زیر درسته',
|
||||||
|
key: 'children',
|
||||||
|
render: (item) => {
|
||||||
|
return (
|
||||||
|
<div>{item.children?.length}</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'اولویت',
|
||||||
|
key: 'order'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '',
|
||||||
|
key: 'action',
|
||||||
|
render: () => {
|
||||||
|
return (
|
||||||
|
<div className='flex items-center gap-2'>
|
||||||
|
<Edit
|
||||||
|
size={20}
|
||||||
|
color='#8C90A3'
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='mt-5'>
|
<div className='mt-5'>
|
||||||
<h1 className='text-lg font-light'>دسته بندی محصولات</h1>
|
<h1 className='text-lg font-light'>دسته بندی محصولات</h1>
|
||||||
|
|
||||||
<Table
|
<Table<CategoryType & RowDataType>
|
||||||
columns={column}
|
columns={column}
|
||||||
data={data?.data || [] as (CategoryType & RowDataType)[]}
|
data={data?.data || [] as (CategoryType & RowDataType)[]}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user