diff --git a/src/components/Table.tsx b/src/components/Table.tsx index 6f51a77..7e6b8ca 100644 --- a/src/components/Table.tsx +++ b/src/components/Table.tsx @@ -339,8 +339,8 @@ const MyComponent = () => { ]; const data = [ - { id: 1, name: 'علی', email: 'ali@example.com' }, - { id: 2, name: 'فاطمه', email: 'fateme@example.com' }, + { id: '1', name: 'علی', email: 'ali@example.com' }, + { id: '2', name: 'فاطمه', email: 'fateme@example.com' }, ]; const handlePageChange = (page: number) => { diff --git a/src/components/types/TableTypes.ts b/src/components/types/TableTypes.ts index 5d87e0c..9c067af 100644 --- a/src/components/types/TableTypes.ts +++ b/src/components/types/TableTypes.ts @@ -1,5 +1,5 @@ export interface RowDataType { - id: string | number; + id: string; [key: string]: unknown; } @@ -30,7 +30,7 @@ export interface TableProps { columns: ColumnType[]; data?: T[]; isLoading?: boolean; - onRowClick?: (id: string | number, item: T) => void; + onRowClick?: (id: string, item: T) => void; className?: string; rowClassName?: string | ((item: T, index: number) => string); noDataMessage?: string; diff --git a/src/pages/home/components/data/ordersData.ts b/src/pages/home/components/data/ordersData.ts index d605614..b314c42 100644 --- a/src/pages/home/components/data/ordersData.ts +++ b/src/pages/home/components/data/ordersData.ts @@ -2,7 +2,7 @@ import { type Order } from '../types/OrderTypes'; export const ordersData: Order[] = [ { - id: 1, + id: '1', number: '123455', title: 'کارت ویزیت', creationDate: { @@ -13,7 +13,7 @@ export const ordersData: Order[] = [ unreadMessages: 2 }, { - id: 2, + id: '2', number: '123455', title: 'شاپینگ بگ', creationDate: { @@ -24,7 +24,7 @@ export const ordersData: Order[] = [ unreadMessages: 0 }, { - id: 3, + id: '3', number: '123455', title: 'کارت ویزیت', creationDate: { diff --git a/src/pages/home/components/types/OrderTypes.ts b/src/pages/home/components/types/OrderTypes.ts index 7f25d48..1d05565 100644 --- a/src/pages/home/components/types/OrderTypes.ts +++ b/src/pages/home/components/types/OrderTypes.ts @@ -1,7 +1,7 @@ import { type RowDataType } from '@/components/types/TableTypes'; export interface Order extends RowDataType { - id: string | number; + id: string; number: string; title: string; creationDate: { diff --git a/src/pages/invoice/Detail.tsx b/src/pages/invoice/Detail.tsx index 0dc631e..fc6c995 100644 --- a/src/pages/invoice/Detail.tsx +++ b/src/pages/invoice/Detail.tsx @@ -6,7 +6,7 @@ import Table from '@/components/Table' import type { RowDataType } from '@/components/types/TableTypes' interface InvoiceItem extends RowDataType { - id: number + id: string image: string | null title: string quantity: string @@ -30,7 +30,7 @@ const InvoiceDetail: FC = () => { const items: InvoiceItem[] = [ { - id: 1, + id: '1', image: null, title: 'شاپینگ بک : پوشش UV برای و پوشش سلفون مات و UV برای و پرجسته', quantity: '۲۰۰۰', @@ -40,7 +40,7 @@ const InvoiceDetail: FC = () => { confirmed: true }, { - id: 2, + id: '2', image: null, title: 'شاپینگ بک : پوشش UV برای و پوشش سلفون مات و UV برای و پرجسته', quantity: '۱۰۰۰', diff --git a/src/pages/invoice/ProformaInvoice.tsx b/src/pages/invoice/ProformaInvoice.tsx index 8c8fff5..851c83d 100644 --- a/src/pages/invoice/ProformaInvoice.tsx +++ b/src/pages/invoice/ProformaInvoice.tsx @@ -77,7 +77,7 @@ const ProformaInvoice: FC = () => { ]} data={[ { - id: 1, + id: '1', service: 'خدمت 1', issueDate: '2021-01-01', lastConfirmDate: '2021-01-01', @@ -86,7 +86,7 @@ const ProformaInvoice: FC = () => { paymentStatus: 'پرداخت شده', }, { - id: 2, + id: '2', service: 'خدمت 2', issueDate: '2021-01-01', lastConfirmDate: '2021-01-01', diff --git a/src/pages/order/components/ManageAttribute.tsx b/src/pages/order/components/ManageAttribute.tsx index a3f595f..fc49e61 100644 --- a/src/pages/order/components/ManageAttribute.tsx +++ b/src/pages/order/components/ManageAttribute.tsx @@ -19,7 +19,7 @@ const ManageAttribute: FC = (props) => { const { attributes, formik } = props - const handleChange = (attributeId: number, value: string) => { + const handleChange = (attributeId: string, value: string) => { const attribute = formik.values.attributes const index: number = attribute.findIndex(o => o.attributeId === attributeId) if (index > -1) { diff --git a/src/pages/order/components/Order.tsx b/src/pages/order/components/Order.tsx index 0afc17e..104915b 100644 --- a/src/pages/order/components/Order.tsx +++ b/src/pages/order/components/Order.tsx @@ -42,7 +42,7 @@ const Order: FC = ({ addNewItem }) => { attributes: [] }, validationSchema: Yup.object({ - productId: Yup.number().required('این فیلد اجباری می باشد'), + productId: Yup.string().required('این فیلد اجباری می باشد'), quantity: Yup.number().required('این فیلد اجباری می باشد'), }), onSubmit: async (values) => { diff --git a/src/pages/order/type/Types.ts b/src/pages/order/type/Types.ts index caabbf1..75f53d7 100644 --- a/src/pages/order/type/Types.ts +++ b/src/pages/order/type/Types.ts @@ -5,7 +5,7 @@ import type { RowDataType } from "@/components/types/TableTypes"; export type CategoryType = { avatarUrl?: string; createdAt: string; - id: number; + id: string; isActive: boolean; order: number; parent?: CategoryType; @@ -18,10 +18,10 @@ export type AttachmentsType = { }; export type OrderType = { - productId?: number; + productId?: string; quantity?: number; attributes: { - attributeId: number; + attributeId: string; value: string | number; }[]; attachments: AttachmentsType[]; @@ -29,20 +29,20 @@ export type OrderType = { }; export type AttributeValueType = { - attribute: number; + attribute: string; createdAt: string; - id: number; + id: string; order: number; value: string; }; export type AttributeType = { createdAt: string; - id: number; + id: string; isRequired: boolean; name: string; order: number; - product: number; + product: string; type: FieldTypeEnum; options: AttributeValueType[]; }; @@ -115,7 +115,7 @@ export type TicketType = { attachments: AttachmentsType[]; content: string; createdAt: string; - id: number; + id: string; user?: string; };