import React, { useState } from 'react'; import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter, } from "@/components/ui/dialog"; import { Button } from '@/components/ui/button'; import { FileDown, Loader2 } from 'lucide-react'; export default function CollectionReportDialog({ open, onOpenChange, collections, clientName, statusFilter }) { const [isGenerating, setIsGenerating] = useState(false); const formatDate = (date) => { return new Date(date).toLocaleDateString('en-US', { timeZone: 'America/New_York' }); }; const handleExport = async () => { setIsGenerating(true); try { await new Promise(resolve => setTimeout(resolve, 100)); // Placeholder: In production, use generateCollectionReport console.log('Generating report for', collections.length, 'collections'); onOpenChange(false); } catch (error) { console.error("Export failed", error); } finally { setIsGenerating(false); } }; const getStatusLabel = () => { if (statusFilter === 'active') return 'Active'; if (statusFilter === 'resolved') return 'Resolved'; return 'All'; }; const todayEST = formatDate(new Date()); return ( Export {getStatusLabel()} Financial Report Generate a detailed financial breakdown PDF for your {getStatusLabel().toLowerCase()} collections.

This report includes financial details for {collections?.length || 0} visible records.

Included Columns:
  • Owner Name
  • Total Amount Owed
  • Last Notice Date
  • Status

Report Date: {todayEST} (EST)

); }