mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-23 14:55:44 +00:00
refactor(FE): Rename initialBalanceRow to firstRow
This commit is contained in:
@@ -18,7 +18,7 @@ interface PdfTableProps {
|
||||
data: PdfTbodyCell[][];
|
||||
footer?: PdfTfootCell[];
|
||||
footerLabel?: string;
|
||||
initialBalanceRow?: {
|
||||
firstRow?: {
|
||||
valueKey: string;
|
||||
value: number;
|
||||
align?: 'right';
|
||||
@@ -31,16 +31,12 @@ export const PdfTable = ({
|
||||
data,
|
||||
footer,
|
||||
footerLabel = 'Total',
|
||||
initialBalanceRow,
|
||||
firstRow,
|
||||
}: PdfTableProps) => {
|
||||
return (
|
||||
<View style={styles.table}>
|
||||
<PdfThead columns={columns} />
|
||||
<PdfTbody
|
||||
columns={columns}
|
||||
rows={data}
|
||||
initialBalanceRow={initialBalanceRow}
|
||||
/>
|
||||
<PdfTbody columns={columns} rows={data} firstRow={firstRow} />
|
||||
{footer && footer.length > 0 && (
|
||||
<PdfTfoot columns={columns} cells={footer} label={footerLabel} />
|
||||
)}
|
||||
|
||||
@@ -74,7 +74,7 @@ const styles = StyleSheet.create({
|
||||
interface PdfTbodyProps {
|
||||
columns: PdfColumn[];
|
||||
rows: PdfTbodyCell[][];
|
||||
initialBalanceRow?: {
|
||||
firstRow?: {
|
||||
valueKey: string;
|
||||
value: number;
|
||||
align?: 'right';
|
||||
@@ -85,31 +85,26 @@ interface PdfTbodyProps {
|
||||
formatCurrency?: (num: number) => string;
|
||||
}
|
||||
|
||||
export const PdfTbody = ({
|
||||
columns,
|
||||
rows,
|
||||
initialBalanceRow,
|
||||
}: PdfTbodyProps) => {
|
||||
export const PdfTbody = ({ columns, rows, firstRow }: PdfTbodyProps) => {
|
||||
return (
|
||||
<>
|
||||
{/* Initial Balance Row */}
|
||||
{initialBalanceRow && (
|
||||
{/* First Row */}
|
||||
{firstRow && (
|
||||
<View style={[styles.tableRow, styles.tableBorderBottom]}>
|
||||
{columns.map((column, index) => {
|
||||
const isLastColumn = index === columns.length - 1;
|
||||
const isInitialBalanceColumn =
|
||||
column.key === initialBalanceRow.valueKey;
|
||||
const isfirstRowColumn = column.key === firstRow.valueKey;
|
||||
const align = column.align || 'center';
|
||||
|
||||
const cellStyle =
|
||||
column.key === 'no'
|
||||
? [styles.tableCellNo, { flex: column.flex }]
|
||||
: isInitialBalanceColumn
|
||||
: isfirstRowColumn
|
||||
? [
|
||||
styles.tableCellRight,
|
||||
{
|
||||
flex: column.flex,
|
||||
color: initialBalanceRow.color || 'black',
|
||||
color: firstRow.color || 'black',
|
||||
borderRightWidth: isLastColumn ? 0 : 1,
|
||||
},
|
||||
]
|
||||
@@ -141,9 +136,7 @@ export const PdfTbody = ({
|
||||
|
||||
return (
|
||||
<View key={column.key} style={cellStyle}>
|
||||
<Text>
|
||||
{isInitialBalanceColumn ? initialBalanceRow.value : ''}
|
||||
</Text>
|
||||
<Text>{isfirstRowColumn ? firstRow.value : ''}</Text>
|
||||
</View>
|
||||
);
|
||||
})}
|
||||
|
||||
Reference in New Issue
Block a user