Files
negareh-admin/src/pages/print/List.tsx
T
hamid zarghami 41acb02611 delete section
2026-02-02 10:19:39 +03:30

82 lines
3.0 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { type FC } from 'react'
import { useDeleteSection, useGetSections } from './hooks/usePrintData'
import { Link } from 'react-router-dom'
import { Paths } from '@/config/Paths'
import Button from '@/components/Button'
import { AddSquare, Edit, More2 } from 'iconsax-react'
import Table from '@/components/Table'
import TrashWithConfrim from '@/components/TrashWithConfrim'
const SectionList: FC = () => {
const { data } = useGetSections()
const { mutate, isPending } = useDeleteSection()
return (
<div className='mt-5'>
<div className='flex justify-between items-center'>
<h1 className='text-lg font-light'>بخش</h1>
<Link
to={Paths.print.create}
>
<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>
<Table
data={data?.data}
columns={[
{
key: 'title',
title: 'عنوان'
},
{
key: 'order',
title: 'ترتیب'
},
{
key: 'attribute',
title: 'ویژگی ها',
render: (item) => {
return (
<Link to={Paths.formBuilder.list + item.id + `/print`} className='flex text-[#0037FF] gap-2 items-center'>
<More2 size={18} color='#0037FF' />
<div className='text-[13px]'>ویژگی ها</div>
</Link>
)
}
},
{
key: 'actions',
title: '',
render: (item) => {
return (
<div className='flex gap-2 items-center'>
<Link to={Paths.print.update + item.id}>
<Edit size={20} color='#0037FF' />
</Link>
<TrashWithConfrim
onDelete={() => mutate(item.id)}
isloading={isPending}
colorIcon='red'
/>
</div>
)
}
},
]}
/>
</div>
)
}
export default SectionList