list of attributes
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
import Button from '@/components/Button'
|
||||
import { Paths } from '@/config/Paths'
|
||||
import { AddSquare, Edit } from 'iconsax-react'
|
||||
import { type FC } from 'react'
|
||||
import { Link, useParams } from 'react-router-dom'
|
||||
import { useGetAttributes } from '../hooks/useProductData'
|
||||
import Table from '@/components/Table'
|
||||
|
||||
const AttributeList: FC = () => {
|
||||
|
||||
const { id } = useParams()
|
||||
const { data } = useGetAttributes(Number(id))
|
||||
|
||||
return (
|
||||
<div className='mt-5'>
|
||||
<div className='flex justify-between items-center'>
|
||||
<h1 className='text-lg font-light'>ویژگی ها</h1>
|
||||
|
||||
<Link
|
||||
to={Paths.product.attribute.create + id}
|
||||
>
|
||||
<Button
|
||||
className='w-fit px-6'
|
||||
>
|
||||
<div className='flex gap-1.5'>
|
||||
<AddSquare size={18} color='black' />
|
||||
<div className='text-[13px] font-light'>ویژگی جدید</div>
|
||||
</div>
|
||||
</Button>
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
<div className='mt-8'>
|
||||
<Table
|
||||
columns={[
|
||||
{
|
||||
key: 'name',
|
||||
title: 'نام'
|
||||
},
|
||||
{
|
||||
key: 'type',
|
||||
title: 'نوع'
|
||||
},
|
||||
{
|
||||
key: 'isRequired',
|
||||
title: 'احباری',
|
||||
render: (item) => {
|
||||
return (
|
||||
<div>{item.isRequired ? 'اجباری' : 'اختیاری'}</div>
|
||||
)
|
||||
}
|
||||
},
|
||||
{
|
||||
key: 'actions',
|
||||
title: '',
|
||||
render: (item) => {
|
||||
return (
|
||||
<div className='flex gap-2 items-center'>
|
||||
<Link to={Paths.product.attribute.update + item.id}>
|
||||
<Edit
|
||||
color='#0037FF'
|
||||
size={20}
|
||||
/>
|
||||
</Link>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
]}
|
||||
data={data?.data}
|
||||
/>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default AttributeList
|
||||
Reference in New Issue
Block a user