From 30b55a9e2e3b9435579ce68823c45355a0a4ae8d Mon Sep 17 00:00:00 2001 From: Aryankpoor Date: Sun, 10 Nov 2024 18:14:10 +0530 Subject: [PATCH] restored buttons styles --- src/app/invoices/[id]/page.tsx | 48 ++++++++++++++++++++++++++-------- 1 file changed, 37 insertions(+), 11 deletions(-) diff --git a/src/app/invoices/[id]/page.tsx b/src/app/invoices/[id]/page.tsx index 45b66ee..dd5ce33 100644 --- a/src/app/invoices/[id]/page.tsx +++ b/src/app/invoices/[id]/page.tsx @@ -9,6 +9,26 @@ import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" import { Button } from "@/components/ui/button" import { Download, Send } from "lucide-react" +interface Customer { + name: string + address: string + email: string +} + +interface BankInfo { + account_name: string + account_number: string + currency: string +} + +interface Invoice { + id: string + title: string + total_amount: number + items: string + created_at: string +} + const formatDateString = (dateString: string): string => { const date = new Date(dateString) const day = date.getDate() @@ -67,7 +87,7 @@ export default function Invoices() { }, body: JSON.stringify({ invoiceID: id, - items: invoice?.items, // Send items as is, don't stringify here + items: invoice?.items, title: invoice?.title, amount: invoice?.total_amount, customerEmail: customer?.email, @@ -101,18 +121,24 @@ export default function Invoices() {

Invoice #{id}

- - +
@@ -121,7 +147,7 @@ export default function Invoices() {

From:

{bankInfo?.account_name}

-

Date: {formatDateString(invoice?.created_at!)}

+

Date: {invoice?.created_at ? formatDateString(invoice.created_at) : ''}

To:

@@ -135,7 +161,7 @@ export default function Invoices() {

Subject: {invoice?.title}

Total: {bankInfo?.currency} - {Number(invoice?.total_amount).toLocaleString()} + {invoice?.total_amount ? Number(invoice.total_amount).toLocaleString() : ''}

{invoice?.items && }