This commit is contained in:
@@ -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() {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{orderDetail.data.paymentMethod && (
|
||||
<div className='flex justify-between items-center h-16 border-b border-border'>
|
||||
<span className='text-sm text-muted-foreground'>نوع پرداخت</span>
|
||||
<span className='text-sm font-semibold'>
|
||||
{getPaymentMethodTitle(
|
||||
orderDetail.data.paymentMethod.method,
|
||||
orderDetail.data.paymentMethod.description
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{orderDetail.data.payments?.[0]?.description?.trim() && (
|
||||
<div className='py-3 border-b border-border'>
|
||||
<div className='text-sm text-muted-foreground mb-1'>توضیحات پرداخت</div>
|
||||
<div className='text-sm'>{orderDetail.data.payments[0].description}</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{orderDetail.data.payments?.[0]?.attachments?.length ? (
|
||||
<div className='py-3 border-b border-border'>
|
||||
<div className='text-sm text-muted-foreground mb-2'>پیوست پرداخت</div>
|
||||
<div className='flex flex-col gap-2'>
|
||||
{orderDetail.data.payments[0].attachments.map((attachment, index) => (
|
||||
<div
|
||||
key={attachment}
|
||||
className='relative w-full h-40 rounded-normal overflow-hidden border border-border'
|
||||
>
|
||||
<Image
|
||||
src={attachment}
|
||||
alt={`پیوست پرداخت ${index + 1}`}
|
||||
fill
|
||||
className='object-contain'
|
||||
/>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
<div className='flex justify-between items-center py-4 border-t border-border'>
|
||||
<span className='text-sm font-medium'>مجموع سفارش</span>
|
||||
<span className='text-sm font-bold '>
|
||||
|
||||
Reference in New Issue
Block a user