From 7f96669bc794263112867dc255f57b8cbf877b11 Mon Sep 17 00:00:00 2001 From: hamid zarghami Date: Wed, 5 Nov 2025 10:44:53 +0330 Subject: [PATCH] customers list --- src/pages/customers/List.tsx | 207 +++++++++++++++++++++++++++++++++++ src/router/Main.tsx | 2 + 2 files changed, 209 insertions(+) create mode 100644 src/pages/customers/List.tsx diff --git a/src/pages/customers/List.tsx b/src/pages/customers/List.tsx new file mode 100644 index 0000000..8257940 --- /dev/null +++ b/src/pages/customers/List.tsx @@ -0,0 +1,207 @@ +import Button from '@/components/Button' +import Table from '@/components/Table' +import Filters from '@/components/Filters' +import { Add, Eye } from 'iconsax-react' +import { type FC, useState } from 'react' +import type { RowDataType, ActionType } from '@/components/types/TableTypes' +import type { FilterValues } from '@/components/Filters' + +interface CustomerData extends RowDataType { + id: number + name: string + phone: string + email: string + customerCode: string + ordersCount: number + ticketsCount: number +} + +const CustomersList: FC = () => { + const [currentPage, setCurrentPage] = useState(1) + const totalPages = 10 + + const handlePageChange = (page: number) => { + setCurrentPage(page) + } + + const handleFiltersChange = (newFilters: FilterValues) => { + // اینجا می‌توانید API call جدید برای فیلتر کردن داده‌ها بزنید + console.log('فیلترها:', newFilters) + } + + const handleRowActions = (item: CustomerData): ActionType[] => { + return [ + { + label: 'ویرایش', + onClick: () => { + console.log('ویرایش مشتری:', item.id) + }, + }, + { + label: 'حذف', + onClick: () => { + console.log('حذف مشتری:', item.id) + }, + }, + ] + } + + const columns = [ + { + key: 'name', + title: 'نام', + }, + { + key: 'phone', + title: 'شماره تماس', + }, + { + key: 'email', + title: 'ایمیل', + }, + { + key: 'customerCode', + title: 'کد مشتری', + }, + { + key: 'ordersCount', + title: 'سفارشات', + render: (item: CustomerData) => { + return ( + + ) + }, + }, + { + key: 'ticketsCount', + title: 'تیکت‌ها', + render: (item: CustomerData) => { + return ( + + ) + }, + }, + { + key: 'details', + title: 'جزییات', + render: () => { + return + }, + }, + ] + + const data: CustomerData[] = [ + { + id: 1, + name: 'مهرداد مظفری', + phone: '۰۹۱۲۹۲۸۳۳۹۵', + email: 'info@example.com', + customerCode: '۱۲۲', + ordersCount: 4, + ticketsCount: 4, + }, + { + id: 2, + name: 'مهرداد مظفری', + phone: '۰۹۱۲۹۲۸۳۳۹۵', + email: 'info@example.com', + customerCode: '۱۲۲', + ordersCount: 4, + ticketsCount: 4, + }, + { + id: 3, + name: 'مهرداد مظفری', + phone: '۰۹۱۲۹۲۸۳۳۹۵', + email: 'info@example.com', + customerCode: '۱۲۲', + ordersCount: 4, + ticketsCount: 4, + }, + { + id: 4, + name: 'مهرداد مظفری', + phone: '۰۹۱۲۹۲۸۳۳۹۵', + email: 'info@example.com', + customerCode: '۱۲۲', + ordersCount: 4, + ticketsCount: 4, + }, + { + id: 5, + name: 'مهرداد مظفری', + phone: '۰۹۱۲۹۲۸۳۳۹۵', + email: 'info@example.com', + customerCode: '۱۲۲', + ordersCount: 4, + ticketsCount: 4, + }, + { + id: 6, + name: 'مهرداد مظفری', + phone: '۰۹۱۲۹۲۸۳۳۹۵', + email: 'info@example.com', + customerCode: '۱۲۲', + ordersCount: 4, + ticketsCount: 4, + }, + ] + + return ( +
+
+

لیست مشتریان

+ +
+ +
+ +
+ + + + ) +} + +export default CustomersList \ No newline at end of file diff --git a/src/router/Main.tsx b/src/router/Main.tsx index 1bc525c..c1d3e36 100644 --- a/src/router/Main.tsx +++ b/src/router/Main.tsx @@ -9,6 +9,7 @@ import FoodsList from '@/pages/food/List' import { Pages } from '@/config/Pages' import CreateFood from '@/pages/food/Create' import CategoryFood from '@/pages/food/Category' +import CustomersList from '@/pages/customers/List' const MainRouter: FC = () => { @@ -30,6 +31,7 @@ const MainRouter: FC = () => { } /> } /> } /> + } />