list of sections
This commit is contained in:
@@ -3,7 +3,8 @@ import { useGetSections } from './hooks/usePrintData'
|
||||
import { Link } from 'react-router-dom'
|
||||
import { Paths } from '@/config/Paths'
|
||||
import Button from '@/components/Button'
|
||||
import { AddSquare } from 'iconsax-react'
|
||||
import { AddSquare, More2 } from 'iconsax-react'
|
||||
import Table from '@/components/Table'
|
||||
|
||||
const SectionList: FC = () => {
|
||||
|
||||
@@ -28,6 +29,32 @@ const SectionList: FC = () => {
|
||||
</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>
|
||||
)
|
||||
}
|
||||
},
|
||||
]}
|
||||
/>
|
||||
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import axios from "@/config/axios";
|
||||
import type { CreateSectionType } from "../types/Types";
|
||||
import type { CreateSectionType, SectionsResponseType } from "../types/Types";
|
||||
|
||||
export const getSections = async () => {
|
||||
const { data } = await axios.get(`/admin/section`);
|
||||
const { data } = await axios.get<SectionsResponseType>(`/admin/section`);
|
||||
return data;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,4 +1,15 @@
|
||||
import type { BaseResponse } from "@/shared/types/Types";
|
||||
|
||||
export type CreateSectionType = {
|
||||
title: string;
|
||||
order: number;
|
||||
};
|
||||
|
||||
export type SectionItemType = {
|
||||
createdAt: string;
|
||||
id: number;
|
||||
order: number;
|
||||
title: string;
|
||||
};
|
||||
|
||||
export type SectionsResponseType = BaseResponse<SectionItemType[]>;
|
||||
|
||||
Reference in New Issue
Block a user