list of sections

This commit is contained in:
hamid zarghami
2026-02-02 09:44:05 +03:30
parent c3cb697fae
commit a25ab81d08
3 changed files with 41 additions and 3 deletions
+28 -1
View File
@@ -3,7 +3,8 @@ import { useGetSections } from './hooks/usePrintData'
import { Link } from 'react-router-dom' import { Link } from 'react-router-dom'
import { Paths } from '@/config/Paths' import { Paths } from '@/config/Paths'
import Button from '@/components/Button' import Button from '@/components/Button'
import { AddSquare } from 'iconsax-react' import { AddSquare, More2 } from 'iconsax-react'
import Table from '@/components/Table'
const SectionList: FC = () => { const SectionList: FC = () => {
@@ -28,6 +29,32 @@ const SectionList: FC = () => {
</Link> </Link>
</div> </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> </div>
) )
} }
+2 -2
View File
@@ -1,8 +1,8 @@
import axios from "@/config/axios"; import axios from "@/config/axios";
import type { CreateSectionType } from "../types/Types"; import type { CreateSectionType, SectionsResponseType } from "../types/Types";
export const getSections = async () => { export const getSections = async () => {
const { data } = await axios.get(`/admin/section`); const { data } = await axios.get<SectionsResponseType>(`/admin/section`);
return data; return data;
}; };
+11
View File
@@ -1,4 +1,15 @@
import type { BaseResponse } from "@/shared/types/Types";
export type CreateSectionType = { export type CreateSectionType = {
title: string; title: string;
order: number; order: number;
}; };
export type SectionItemType = {
createdAt: string;
id: number;
order: number;
title: string;
};
export type SectionsResponseType = BaseResponse<SectionItemType[]>;