'use client' import { Badge } from '@/components/ui/badge' import { Separator } from '@/components/ui/separator' import { getVatTreatmentLabel } from '@/lib/invoices/vat-rules' import { formatCurrency } from '@/lib/utils' import type { Customer, Currency, VatTreatment } from '@/types' interface ReviewItem { description: string quantity: number unit: string unit_price: number } interface InvoiceReviewContentProps { customer: Customer invoiceDate: string dueDate: string currency: Currency items: ReviewItem[] subtotal: number vatRate: number vatAmount: number total: number vatTreatment: VatTreatment yourReference?: string ourReference?: string notes?: string } export function InvoiceReviewContent({ customer, invoiceDate, dueDate, currency, items, subtotal, vatRate, vatAmount, total, vatTreatment, yourReference, ourReference, notes, }: InvoiceReviewContentProps) { const customerTypeLabel: Record = { individual: 'Privatperson', swedish_business: 'Svenskt företag', eu_business: 'EU-företag', non_eu_business: 'Utanför EU', } return (
{/* Customer info */}

{customer.name}

{customer.email}

{customerTypeLabel[customer.customer_type] || customer.customer_type}
{/* VAT treatment */} {getVatTreatmentLabel(vatTreatment)} {/* Dates */}
Fakturadatum

{invoiceDate}

Förfallodatum

{dueDate}

{/* Line items table */} {items.map((item, index) => ( ))}
Beskrivning Antal Enhet À-pris Belopp
{item.description} {item.quantity} {item.unit} {formatCurrency(item.unit_price, currency)} {formatCurrency(item.quantity * item.unit_price, currency)}
{/* Totals */}
Delsumma {formatCurrency(subtotal, currency)}
Moms ({vatRate}%) {formatCurrency(vatAmount, currency)}
Totalt {formatCurrency(total, currency)}
{/* References/notes */} {(yourReference || ourReference || notes) && (
{yourReference &&

Er referens: {yourReference}

} {ourReference &&

Vår referens: {ourReference}

} {notes &&

Anteckning: {notes}

}
)}
) }