list of category

This commit is contained in:
hamid zarghami
2026-01-24 09:40:41 +03:30
parent 2995bb86b4
commit 6948af8b05
2 changed files with 39 additions and 7 deletions
+1 -1
View File
@@ -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'
+38 -6
View File
@@ -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: 'عنوان', {
key: 'title', 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)[]}
/> />