diff --git a/packages/admin/src/components/pos/pos-payment-dialog.tsx b/packages/admin/src/components/pos/pos-payment-dialog.tsx
index 53cabbd..ff0c35d 100644
--- a/packages/admin/src/components/pos/pos-payment-dialog.tsx
+++ b/packages/admin/src/components/pos/pos-payment-dialog.tsx
@@ -84,6 +84,7 @@ export function POSPaymentDialog({ open, onOpenChange, paymentMethod, transactio
queryKey: ['pos', 'receipt', result?.id],
queryFn: () => api.get<{
transaction: Transaction & { lineItems: { description: string; qty: number; unitPrice: string; taxAmount: string; lineTotal: string; discountAmount: string }[] }
+ customerEmail: string | null
company: { name: string; phone: string | null; email: string | null; address: { street?: string; city?: string; state?: string; zip?: string } | null }
location: { name: string; phone: string | null; email: string | null; address: { street?: string; city?: string; state?: string; zip?: string } | null }
}>(`/v1/transactions/${result!.id}/receipt`),
@@ -91,6 +92,19 @@ export function POSPaymentDialog({ open, onOpenChange, paymentMethod, transactio
})
const [showReceipt, setShowReceipt] = useState(false)
+ const [emailMode, setEmailMode] = useState(false)
+ const [emailAddress, setEmailAddress] = useState('')
+ const [emailSent, setEmailSent] = useState(false)
+
+ const emailReceiptMutation = useMutation({
+ mutationFn: () => api.post<{ message: string }>(`/v1/transactions/${result!.id}/email-receipt`, { email: emailAddress }),
+ onSuccess: () => {
+ toast.success('Receipt emailed')
+ setEmailMode(false)
+ setEmailSent(true)
+ },
+ onError: (err) => toast.error(err.message),
+ })
if (completed && result) {
const changeGiven = parseFloat(result.changeGiven ?? '0')
@@ -140,14 +154,47 @@ export function POSPaymentDialog({ open, onOpenChange, paymentMethod, transactio
)}
-
-
-
-
+ {emailMode ? (
+
+
+
+ setEmailAddress(e.target.value)}
+ placeholder="customer@example.com"
+ className="h-9"
+ autoFocus
+ />
+
+
+
+
+ ) : (
+
+
+
+
+ )}