refactor(FE): Rename initialBalanceRow to firstRow

This commit is contained in:
rstubryan
2026-01-28 10:00:01 +07:00
parent 3d8d0d9e4d
commit ca0d379c2c
3 changed files with 197 additions and 436 deletions
+8 -15
View File
@@ -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>
);
})}