'use client' import { verifyPayment } from "@/actions/payment"; import { Table, TableBody, TableCaption, TableCell, TableFooter, TableRow, } from "@/components/ui/table"; import { formatDate } from "@/lib/utils"; import type { BillFormula, Prisma, User } from "@prisma/client"; import { Clipboard, ClipboardCheck, Loader2, Wallet } from "lucide-react"; import { useState } from "react"; import { toast } from "sonner"; import { Button } from "./ui/button"; type PaymentWithDevices = Prisma.PaymentGetPayload<{ include: { devices: true; }; }>; export default function DevicesToPay({ billFormula, payment, user }: { billFormula?: BillFormula; payment?: PaymentWithDevices, user?: User }) { const [verifying, setVerifying] = useState(false) const devices = payment?.devices; if (devices?.length === 0) { return null; } const baseAmount = billFormula?.baseAmount ?? 100; const discountPercentage = billFormula?.discountPercentage ?? 75; // 100+(n−1)×75 const total = baseAmount + (devices?.length ?? 1 - 1) * discountPercentage; return (

{!payment?.paid ? "Devices to pay" : "Devices Paid"}

{devices?.map((device) => (
{device.name}
{device.mac}
))}

Please send the following amount to the payment address

{payment?.paid ? ( ) : ( )}
Total Devices {devices?.length} Total Due {total.toFixed(2)}
); } function AccountInfomation({ accountNo, accName, }: { accountNo: string; accName: string; }) { const [accNo, setAccNo] = useState(false) return (
Account Information
Account Name
{accName}

Account No

{accountNo}
); }