diff --git a/src/components/helper/pdf/table/PdfTable.tsx b/src/components/helper/pdf/table/PdfTable.tsx index 46724ef6..d1dc1df8 100644 --- a/src/components/helper/pdf/table/PdfTable.tsx +++ b/src/components/helper/pdf/table/PdfTable.tsx @@ -1,7 +1,9 @@ 'use client'; import { View, StyleSheet } from '@react-pdf/renderer'; -import { PdfColumn } from './PdfThead'; +import { PdfThead, PdfColumn } from './PdfThead'; +import { PdfTbody, PdfTbodyCell } from './PdfTbody'; +import { PdfTfoot, PdfTfootCell } from './PdfTfoot'; const styles = StyleSheet.create({ table: { @@ -13,9 +15,35 @@ const styles = StyleSheet.create({ interface PdfTableProps { columns: PdfColumn[]; - children: React.ReactNode; + data: PdfTbodyCell[][]; + footer?: PdfTfootCell[]; + footerLabel?: string; + initialBalanceRow?: { + valueKey: string; + value: number; + align?: 'right'; + color?: string; + }; } -export const PdfTable = ({ columns, children }: PdfTableProps) => { - return {children}; +export const PdfTable = ({ + columns, + data, + footer, + footerLabel = 'Total', + initialBalanceRow, +}: PdfTableProps) => { + return ( + + + + {footer && footer.length > 0 && ( + + )} + + ); }; diff --git a/src/components/helper/pdf/table/PdfTbody.tsx b/src/components/helper/pdf/table/PdfTbody.tsx index 9a23ab4b..819c4dec 100644 --- a/src/components/helper/pdf/table/PdfTbody.tsx +++ b/src/components/helper/pdf/table/PdfTbody.tsx @@ -69,16 +69,6 @@ const styles = StyleSheet.create({ fontSize: 7, textAlign: 'center', }, - badge: { - paddingVertical: 2, - paddingHorizontal: 4, - borderRadius: 12, - fontSize: 5, - fontWeight: 'bold', - borderWidth: 1, - textAlign: 'center', - whiteSpace: 'nowrap', - }, }); interface PdfTbodyProps { @@ -218,7 +208,7 @@ export const PdfTbody = ({ cell?.value !== null && cell?.value !== '' ? ( typeof cell.value === 'object' ? ( - cell.value // For custom React element (badge, etc) + cell.value ) : ( {String(cell.value)} )