Version : 2025.11.22

This commit is contained in:
2025-11-23 16:34:11 +01:00
commit b399e803b3
31 changed files with 5810 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
import React from 'react';
import { PDFDownloadLink } from '@react-pdf/renderer';
import PDFDocument from './PDFDocument';
import { Operation, Balance } from '../types';
import { format } from 'date-fns';
interface ExportButtonProps {
operations: Operation[];
balances: Balance[];
dateRange: { start: Date; end: Date };
associationName: string;
}
const ExportButton: React.FC<ExportButtonProps> = ({ operations, balances, dateRange, associationName }) => {
return (
<PDFDownloadLink
document={
<PDFDocument
operations={operations}
balances={balances}
dateRange={dateRange}
associationName={associationName}
/>
}
fileName={`abacus_export_${format(dateRange.start, 'yyyy-MM-dd')}_${format(dateRange.end, 'yyyy-MM-dd')}.pdf`}
className="text-sm font-medium text-gray-600 hover:text-gray-900 transition flex items-center space-x-1"
>
{({ blob, url, loading, error }) => (
<>
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor" className="w-5 h-5">
<path strokeLinecap="round" strokeLinejoin="round" d="M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5M16.5 12 12 16.5m0 0L7.5 12m4.5 4.5V3" />
</svg>
<span>{loading ? 'Loading...' : 'Export PDF'}</span>
</>
)}
</PDFDownloadLink>
);
};
export default ExportButton;