diff --git a/components/dashboard/userAccount/sidebars/transactions/Card.js b/components/dashboard/userAccount/sidebars/transactions/Card.js index 77b78a2..3b7a3bc 100644 --- a/components/dashboard/userAccount/sidebars/transactions/Card.js +++ b/components/dashboard/userAccount/sidebars/transactions/Card.js @@ -1,39 +1,36 @@ -import CircularLoading from "@/app/component/loading/Circular"; import TextLoading from "@/app/component/loading/Text"; -import Image from "next/image"; -import { convertTimestampToJalali, convertTimestampToTime } from "@/helper"; +import { convertTimestampToJalali } from "@/helper"; import Link from "next/link"; +const PAYMENT_STATUS = { + success: { label: "پرداخت شده", cls: "bg-[#E8FADD] text-[#75E22E]" }, + pending: { label: "در انتظار", cls: "bg-[#FFF3DD] text-[#FDBA35]" }, + failed: { label: "ناموفق", cls: "bg-[#FFE3E2] text-[#FF5450]" }, + cancelled: { label: "لغو شده", cls: "bg-[#FFE3E2] text-[#FF5450]" }, + refunded: { label: "بازگشت وجه", cls: "bg-[#EFEFEF] text-[#616161]" }, +}; + +const TYPE_LABELS = { + appointment: "نوبت", + subscription: "اشتراک", + sms_wallet: "کیف پول پیامک", +}; + function Card({ data, loading }) { + const status = PAYMENT_STATUS[data.status] || { label: data.status, cls: "bg-[#FFE3E2] text-[#FF5450]" }; + return (
- {data.appointment_details?.doctor_name || "--"} -
-+ {TYPE_LABELS[data.type] || data.type || "--"} +
+شناسه:
{data.id}
+{data.order_id || "--"}
- تاریخ نوبت: -
+تاریخ:
- {convertTimestampToJalali(data.appointment_details?.start_time)} -
-ساعت نوبت:
-- {convertTimestampToTime(data.appointment_details?.start_time)} + {convertTimestampToJalali(data.created_at)}
- مبلغ: -
+مبلغ:
- {data.amount ? data.amount.toLocaleString('fa-IR') : "--"} تومان + {data.amount_rials ? Math.round(data.amount_rials / 10).toLocaleString("fa-IR") : "--"} تومان
+ تراکنشی ثبت نشده است. +
+ ); + } + return (