diff --git a/src/app/[name]/(Dialogs)/order/checkout/[id]/components/PaymentSection.tsx b/src/app/[name]/(Dialogs)/order/checkout/[id]/components/PaymentSection.tsx index 7b5b8d9..8e903e7 100644 --- a/src/app/[name]/(Dialogs)/order/checkout/[id]/components/PaymentSection.tsx +++ b/src/app/[name]/(Dialogs)/order/checkout/[id]/components/PaymentSection.tsx @@ -74,6 +74,7 @@ export const PaymentSection = ({ paymentType, onPaymentTypeChange }: PaymentSect icon: getIconByMethod(item.method), method: item.method, cardNumber: item.cardNumber, + cardOwner: item.cardOwner, description: item.description, isWallet: item.method === PaymentMethodEnum.Wallet, })); @@ -159,6 +160,16 @@ export const PaymentSection = ({ paymentType, onPaymentTypeChange }: PaymentSect {selectedCreditCard && (
+ {selectedCreditCard.cardOwner && ( +
+ + {tOrderDetail('SectionPayment.CreditCard.CardOwnerLabel')} + +

+ {selectedCreditCard.cardOwner} +

+
+ )} {selectedCreditCard.cardNumber && (
diff --git a/src/app/[name]/(Dialogs)/order/checkout/types/Types.ts b/src/app/[name]/(Dialogs)/order/checkout/types/Types.ts index 177dfc0..b1bfac8 100644 --- a/src/app/[name]/(Dialogs)/order/checkout/types/Types.ts +++ b/src/app/[name]/(Dialogs)/order/checkout/types/Types.ts @@ -112,6 +112,7 @@ export interface PaymentMethodResponse { gateway: string | null; description: string; cardNumber: string | null; + cardOwner: string | null; enabled: boolean; order: number; merchantId: string | null; @@ -362,6 +363,7 @@ export interface OrderDetailPaymentMethod { gateway: string | null; description: string; cardNumber: string | null; + cardOwner: string | null; enabled: boolean; order: number; merchantId: string | null; @@ -426,6 +428,7 @@ export interface OrderDetailPayment { paidAt: string | null; failedAt: string | null; description: string | null; + attachments: string[]; } export interface OrderDetailCarAddress { @@ -435,6 +438,17 @@ export interface OrderDetailCarAddress { plateNumber: string; } +export interface OrderDetailUserAddress { + city: string; + phone: string; + address: string; + fullName: string; + latitude: number; + province: string; + longitude: number; + postalCode: string; +} + export interface OrderDetail { id: string; createdAt: string; @@ -443,7 +457,7 @@ export interface OrderDetail { user: OrderDetailUser; restaurant: OrderDetailRestaurant; deliveryMethod: OrderDetailDeliveryMethod; - userAddress: OrderAddress | null; + userAddress: OrderDetailUserAddress | null; carAddress: OrderDetailCarAddress | null; paymentMethod: OrderDetailPaymentMethod; orderNumber: number; @@ -461,9 +475,12 @@ export interface OrderDetail { status: | "pendingPayment" | "new" + | "paid" + | "confirmed" | "preparing" | "ready" | "delivering" + | "completed" | "delivered" | "cancelled"; history: OrderDetailHistory[]; diff --git a/src/app/[name]/(Dialogs)/order/track/[id]/page.tsx b/src/app/[name]/(Dialogs)/order/track/[id]/page.tsx index ae5cdf2..b81d5f9 100644 --- a/src/app/[name]/(Dialogs)/order/track/[id]/page.tsx +++ b/src/app/[name]/(Dialogs)/order/track/[id]/page.tsx @@ -1,6 +1,7 @@ 'use client'; import { useParams, useRouter } from 'next/navigation'; +import Image from 'next/image'; import React from 'react'; import Button from '@/components/button/PrimaryButton'; import { Skeleton } from '@/components/ui/skeleton'; @@ -29,6 +30,11 @@ const getDeliveryMethodTitle = (method: string) => { } }; +const getPaymentMethodTitle = (method: string, fallback?: string) => { + const methodKey = method as keyof typeof ordersTranslations.paymentMethod; + return ordersTranslations.paymentMethod[methodKey] || fallback || 'نامشخص'; +}; + // const getStatusPercentage = (status: string) => { // switch (status) { // case 'new': @@ -164,6 +170,46 @@ function OrderTrackingPage() {
)} + {orderDetail.data.paymentMethod && ( +
+ نوع پرداخت + + {getPaymentMethodTitle( + orderDetail.data.paymentMethod.method, + orderDetail.data.paymentMethod.description + )} + +
+ )} + + {orderDetail.data.payments?.[0]?.description?.trim() && ( +
+
توضیحات پرداخت
+
{orderDetail.data.payments[0].description}
+
+ )} + + {orderDetail.data.payments?.[0]?.attachments?.length ? ( +
+
پیوست پرداخت
+
+ {orderDetail.data.payments[0].attachments.map((attachment, index) => ( +
+ {`پیوست +
+ ))} +
+
+ ) : null} +
مجموع سفارش diff --git a/src/locales/fa/parallels.json b/src/locales/fa/parallels.json index 1a49061..003e1be 100644 --- a/src/locales/fa/parallels.json +++ b/src/locales/fa/parallels.json @@ -68,6 +68,7 @@ "SectionPayment": { "Title": "انتخاب شیوه پرداخت", "CreditCard": { + "CardOwnerLabel": "نام صاحب کارت", "CardNumberLabel": "شماره کارت", "PaymentDescLabel": "توضیحات پرداخت", "PaymentDescPlaceholder": "مثال: واریز از حساب با شماره ۱۲۳۴",