From 43ddbf65198905b1d64568b59d6d5be6c55652b4 Mon Sep 17 00:00:00 2001 From: hamid zarghami Date: Sun, 23 Nov 2025 12:01:15 +0330 Subject: [PATCH] update payment method --- src/pages/paymentMethods/Update.tsx | 2 +- .../components/PaymentMethodTableColumns.tsx | 3 ++ src/pages/paymentMethods/types/Types.ts | 44 +++++++++++++++++-- 3 files changed, 45 insertions(+), 4 deletions(-) diff --git a/src/pages/paymentMethods/Update.tsx b/src/pages/paymentMethods/Update.tsx index 424d073..e46ab4e 100644 --- a/src/pages/paymentMethods/Update.tsx +++ b/src/pages/paymentMethods/Update.tsx @@ -60,7 +60,7 @@ const UpdatePaymentMethod: FC = () => { useEffect(() => { if (restaurantPaymentMethod) { formik.setValues({ - paymentMethodId: restaurantPaymentMethod.paymentMethodId || '', + paymentMethodId: restaurantPaymentMethod.paymentMethod?.id || '', merchantId: restaurantPaymentMethod.merchantId || '', isActive: restaurantPaymentMethod.isActive ?? true, }) diff --git a/src/pages/paymentMethods/components/PaymentMethodTableColumns.tsx b/src/pages/paymentMethods/components/PaymentMethodTableColumns.tsx index 507de97..db67eb3 100644 --- a/src/pages/paymentMethods/components/PaymentMethodTableColumns.tsx +++ b/src/pages/paymentMethods/components/PaymentMethodTableColumns.tsx @@ -49,6 +49,9 @@ export const getPaymentMethodTableColumns = ({ onDelete, isDeleting }: GetPaymen { key: 'merchantId', title: 'شناسه مرچنت', + render: (item: RestaurantPaymentMethod) => { + return item.merchantId || '-' + } }, { key: 'actions', diff --git a/src/pages/paymentMethods/types/Types.ts b/src/pages/paymentMethods/types/Types.ts index 600f759..6376189 100644 --- a/src/pages/paymentMethods/types/Types.ts +++ b/src/pages/paymentMethods/types/Types.ts @@ -15,16 +15,54 @@ export type PaymentMethod = { export type PaymentMethodsResponse = IResponse; +export type GeoJSONPoint = [number, number]; + +export type GeoJSONPolygon = { + type: "Polygon"; + coordinates: GeoJSONPoint[][]; +}; + +export type Restaurant = { + id: string; + createdAt: string; + updatedAt: string; + deletedAt: string | null; + name: string; + slug: string; + logo: string | null; + address: string | null; + menuColor: string | null; + latitude: number | null; + longitude: number | null; + serviceArea: GeoJSONPolygon; + isActive: boolean; + establishedYear: number | null; + phoneNumber: string | null; + phone: string; + instagram: string | null; + telegram: string | null; + whatsapp: string | null; + description: string | null; + seoTitle: string | null; + seoDescription: string | null; + tagNames: unknown | null; + images: unknown | null; + vat: number; +}; + export type RestaurantPaymentMethodsResponse = IResponse< RestaurantPaymentMethod[] >; export type RestaurantPaymentMethod = { id: string; - paymentMethodId: string; - merchantId: string; + createdAt: string; + updatedAt: string; + deletedAt: string | null; + restaurant: Restaurant; + paymentMethod: PaymentMethod; + merchantId: string | null; isActive: boolean; - paymentMethod?: PaymentMethod; }; export type RestaurantPaymentMethodResponse = IResponse<