import { Table, TableBody, TableCaption, TableCell, TableFooter, TableRow, } from "@/components/ui/table" import type { BillFormula, Prisma } from "@prisma/client" import React from 'react' type PaymentWithDevices = Prisma.PaymentGetPayload<{ include: { devices: true } }> export default function DevicesToPay({ billFormula, payment }: { billFormula?: BillFormula, payment?: PaymentWithDevices }) { 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 Total Devices {devices?.length} Total {total.toFixed(2)}
) }