"use client"; import { processWalletPayment } from "@/actions/payment"; import { Table, TableBody, TableCaption, TableCell, TableFooter, TableRow, } from "@/components/ui/table"; import type { Payment } from "@/lib/backend-types"; import type { User } from "@/lib/types/user"; import { BadgeDollarSign, Clipboard, ClipboardCheck, Loader2, Wallet, } from "lucide-react"; import { useState } from "react"; import { toast } from "sonner"; import { Button } from "./ui/button"; export default function DevicesToPay({ payment, user, }: { payment?: Payment; user?: User }) { console.log(user); const [verifying, setVerifying] = useState(false); const devices = payment?.devices; if (devices?.length === 0) { return null; } // 100+(n−1)×75 const walletBalance = user?.wallet_balance ?? 0; const isWalletPayVisible = walletBalance > (payment?.amount ?? 0); 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 ? ( ) : (
{isWalletPayVisible && ( )}
)}
Total Devices {devices?.length} Duration {payment?.number_of_months} Months Total Due {payment?.amount?.toFixed(2)}
); } function AccountInfomation({ accountNo, accName, }: { accountNo: string; accName: string; }) { const [accNo, setAccNo] = useState(false); return (
Account Information
Account Name
{accName}

Account No

{accountNo}
); }