import { Head, Link } from '@inertiajs/react';
import { ArrowLeft, Printer } from 'lucide-react';
import { AppLogoIcon } from '@/components/brand';
import { Badge } from '@/components/ui/badge';
import { Button } from '@/components/ui/button';
import {
Table,
TableBody,
TableCell,
TableHead,
TableHeader,
TableRow,
} from '@/components/ui/table';
import { formatCurrency } from '@/lib/utils';
import { index as invoiceIndex } from '@/routes/admin/manage/invoices';
import { InvoiceShareButton } from './invoice-share-button';
type InvoiceItem = {
id: number;
name: string;
quantity: number;
price: number;
subtotal: number;
};
type Company = {
name: string;
address: string | null;
email: string | null;
phone: string | null;
};
type PrintInvoice = {
id: number;
invoice_number: string;
customer_name: string;
customer_phone: string | null;
customer_address: string | null;
amount: number;
formatted_amount: string;
formatted_date: string;
formatted_due_date: string | null;
status: 'unpaid' | 'paid';
status_label: string;
description: string | null;
items: InvoiceItem[];
company: Company;
};
type Props = {
invoice: PrintInvoice;
};
const STATUS_BADGE_CLASSES: Record
{company.name}
{company.address && ({company.address}
)} {(company.phone || company.email) && ({[company.phone, company.email] .filter(Boolean) .join(' ยท ')}
)}{invoice.invoice_number}
Ditagihkan Kepada
{invoice.customer_name}
{invoice.customer_phone && ({invoice.customer_phone}
)} {invoice.customer_address && ({invoice.customer_address}
)}Tanggal Invoice
{invoice.formatted_date}
{invoice.formatted_due_date && ( <>Jatuh Tempo
{invoice.formatted_due_date}
> )}Keterangan
{invoice.description}