'use client'; import { Dialog, DialogContent, DialogHeader, DialogTitle, } from '@/components/ui/dialog'; import { Button } from '@/components/ui/button'; import { Separator } from '@/components/ui/separator'; import { Badge } from '@/components/ui/badge'; import { Download, Printer, Copy, CreditCard } from 'lucide-react'; import { ScrollArea } from '@/components/ui/scroll-area'; import { formatCurrency } from '@/data/mockData'; import { toast } from 'sonner'; interface ReceiptViewerProps { open: boolean; onOpenChange: (open: boolean) => void; booking: any; // Using any for now, ideally UserBooking } export function ReceiptViewer({ open, onOpenChange, booking }: ReceiptViewerProps) { if (!booking) return null; const copyToClipboard = (text: string) => { navigator.clipboard.writeText(text); toast.success("Copied to clipboard"); }; // Mock calculations for the receipt const basePrice = booking.amount * 0.9; const tax = booking.amount * 0.1; const fee = 2.50; // Mock processing fee return (

Receipt from Eventify

Thank you for your business.

{/* Meta Data */}

Order ID

copyToClipboard(booking.id)}> {booking.id.substring(0, 12)}...

Date

{new Date(booking.createdAt).toLocaleDateString()}

{/* Customer Info */}

Billed To

User ID: {booking.userId}

Payment Method: Visa •••• 4242

{/* Line Items */}
Description Amount

{booking.eventName}

{booking.ticketType} x {booking.quantity}

{formatCurrency(basePrice)}
Processing Fees {formatCurrency(fee)}
Tax (10%) {formatCurrency(tax)}
Total {formatCurrency(booking.amount + fee)}
{/* Status */}
Status: {booking.status}
); }