refactor(FE-208): enhance PurchaseOrderInvoice layout with improved cell styling and add inner table header

This commit is contained in:
rstubryan
2025-11-15 10:54:59 +07:00
parent 4bd6ac3cac
commit e421c7d422
@@ -172,17 +172,42 @@ const pdfStyles = StyleSheet.create({
}, },
innerTable: { innerTable: {
marginTop: 5, marginTop: 5,
borderWidth: 1,
borderColor: '#000000',
}, },
innerRow: { innerRow: {
flexDirection: 'row', flexDirection: 'row',
borderBottomWidth: 0.5, borderBottomWidth: 1,
borderBottomColor: '#ccc', borderBottomColor: '#000000',
borderBottomStyle: 'solid', borderBottomStyle: 'solid',
}, },
innerCell: { innerCell: {
flex: 1, flex: 1,
padding: 4, borderRightWidth: 1,
fontSize: 8, borderRightColor: '#000000',
borderRightStyle: 'solid',
padding: 8,
fontSize: 9,
},
innerCellLast: {
flex: 1,
padding: 8,
fontSize: 9,
},
innerCellRight: {
flex: 1,
borderRightWidth: 1,
borderRightColor: '#000000',
borderRightStyle: 'solid',
padding: 8,
fontSize: 9,
textAlign: 'right',
},
innerCellRightLast: {
flex: 1,
padding: 8,
fontSize: 9,
textAlign: 'right',
}, },
footer: { footer: {
marginTop: 30, marginTop: 30,
@@ -398,17 +423,25 @@ const PurchaseOrderInvoice = ({ data }: PurchaseOrderInvoiceProps) => {
<View style={pdfStyles.tableCellLast}> <View style={pdfStyles.tableCellLast}>
{/* Inner table for product allocation */} {/* Inner table for product allocation */}
<View style={pdfStyles.innerTable}> <View style={pdfStyles.innerTable}>
{/* Header for inner table */}
<View
style={[
pdfStyles.innerRow,
{ backgroundColor: '#F5F5F5' },
]}
>
<Text style={pdfStyles.innerCell}>Item</Text>
<Text style={pdfStyles.innerCellRightLast}>
Quantity
</Text>
</View>
{/* Data rows */}
{purchaseData?.items?.map((item, index) => ( {purchaseData?.items?.map((item, index) => (
<View key={index} style={pdfStyles.innerRow}> <View key={index} style={pdfStyles.innerRow}>
<Text style={pdfStyles.innerCell}> <Text style={pdfStyles.innerCell}>
{item.product?.name || '-'} {item.product?.name || '-'}
</Text> </Text>
<Text <Text style={pdfStyles.innerCellRightLast}>
style={[
pdfStyles.innerCell,
{ textAlign: 'right' },
]}
>
{formatNumber(item.total_qty || 0)} {formatNumber(item.total_qty || 0)}
</Text> </Text>
</View> </View>
@@ -424,7 +457,7 @@ const PurchaseOrderInvoice = ({ data }: PurchaseOrderInvoiceProps) => {
<View style={pdfStyles.specialInstructionTable}> <View style={pdfStyles.specialInstructionTable}>
<View style={[pdfStyles.tableRow, pdfStyles.tableHeader]}> <View style={[pdfStyles.tableRow, pdfStyles.tableHeader]}>
<View style={pdfStyles.tableCellHeaderLast}> <View style={pdfStyles.tableCellHeaderLast}>
<Text>Special Instruction</Text> <Text>Notes</Text>
</View> </View>
</View> </View>
<View style={pdfStyles.tableRow}> <View style={pdfStyles.tableRow}>