import CustomTable from "@/app/component/CustomTable"; import { TableCell, TableRow } from "@mui/material"; import Image from "next/image"; import Card from "./Card"; import TextLoading from "@/app/component/loading/Text"; import CustomLoading from "@/app/component/loading/Custom"; import CircularLoading from "@/app/component/loading/Circular"; import { convertTimestampToJalali } from "@/helper"; import Pagination from "@/app/component/Pagination"; 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 List({ payments, loading, page, totalPages, onPageChange }) { const rows = Array.isArray(payments) ? payments : []; const tableHead = ["ردیف", "شناسه پرداخت", "نوع", "تاریخ", "مبلغ (تومان)", "وضعیت"]; const centerTable = [0, 4, 5]; if (!loading && rows.length === 0) { return (

تراکنشی ثبت نشده است.

); } return (
{rows.map((row, idx) => ( {(page - 1) * 10 + idx + 1} {row.order_id || "--"} {TYPE_LABELS[row.type] || row.type || "--"} {convertTimestampToJalali(row.created_at)} {row.amount_rials ? Math.round(row.amount_rials / 10).toLocaleString("fa-IR") : "--"}
{(PAYMENT_STATUS[row.status] || { label: row.status }).label}
))}
{totalPages > 1 && (
)}
); } export default List;