refactor(FE-364): update PDF export layout and parameter badges

This commit is contained in:
rstubryan
2025-12-16 13:26:16 +07:00
parent 615d4d5ffe
commit 0d8e642b4e
@@ -24,32 +24,6 @@ const pdfStyles = StyleSheet.create({
padding: 20, padding: 20,
backgroundColor: '#FFFFFF', backgroundColor: '#FFFFFF',
}, },
header: {
marginBottom: 20,
},
logo: {
width: 120,
height: 30,
marginBottom: 8,
},
companyInfo: {
fontSize: 12,
fontWeight: 'bold',
marginBottom: 4,
color: '#1f74bf',
},
address: {
fontSize: 8,
color: '#666666',
maxWidth: 400,
marginBottom: 10,
},
divider: {
borderBottomWidth: 1,
borderBottomColor: '#000000',
borderBottomStyle: 'solid',
marginBottom: 15,
},
titleSection: { titleSection: {
marginBottom: 10, marginBottom: 10,
}, },
@@ -59,11 +33,6 @@ const pdfStyles = StyleSheet.create({
marginBottom: 5, marginBottom: 5,
color: '#1f74bf', color: '#1f74bf',
}, },
parameterSection: {
fontSize: 9,
color: '#666666',
marginBottom: 15,
},
supplierTitle: { supplierTitle: {
fontSize: 12, fontSize: 12,
fontWeight: 'bold', fontWeight: 'bold',
@@ -223,10 +192,10 @@ const pdfStyles = StyleSheet.create({
fontWeight: 'bold', fontWeight: 'bold',
}, },
supplierSection: { supplierSection: {
marginBottom: 20, marginBottom: 10,
}, },
supplierSectionBreak: { supplierSectionBreak: {
marginBottom: 25, marginBottom: 15,
}, },
badge: { badge: {
backgroundColor: '#1f74bf', backgroundColor: '#1f74bf',
@@ -236,6 +205,21 @@ const pdfStyles = StyleSheet.create({
fontSize: 7, fontSize: 7,
fontWeight: 'bold', fontWeight: 'bold',
alignSelf: 'flex-start', alignSelf: 'flex-start',
marginRight: 4,
},
parameterBadge: {
backgroundColor: '#F5F5F5',
color: '#333333',
padding: 4,
borderRadius: 4,
fontSize: 8,
marginRight: 8,
marginBottom: 4,
},
parameterContainer: {
flexDirection: 'row',
flexWrap: 'wrap',
marginBottom: 8,
}, },
}); });
@@ -290,12 +274,6 @@ const getParameterText = (
) => { ) => {
const paramsText = []; const paramsText = [];
if (params.filter_by === 'received_date') {
paramsText.push('Tanggal Terima');
} else if (params.filter_by === 'po_date') {
paramsText.push('Tanggal PO');
}
if (params.supplier_name) { if (params.supplier_name) {
paramsText.push(`Supplier: ${params.supplier_name}`); paramsText.push(`Supplier: ${params.supplier_name}`);
} else { } else {
@@ -314,7 +292,7 @@ const getParameterText = (
const currentDate = formatDate(new Date(), 'DD MMM YYYY HH:mm'); const currentDate = formatDate(new Date(), 'DD MMM YYYY HH:mm');
paramsText.push(`Dicetak: ${currentDate}`); paramsText.push(`Dicetak: ${currentDate}`);
return paramsText.join(' | '); return paramsText;
}; };
const createPDFDocument = ( const createPDFDocument = (
@@ -328,13 +306,21 @@ const createPDFDocument = (
<Text style={pdfStyles.mainTitle}> <Text style={pdfStyles.mainTitle}>
Laporan &gt; Rekapitulasi Pembelian Per Supplier Laporan &gt; Rekapitulasi Pembelian Per Supplier
</Text> </Text>
<Text style={pdfStyles.parameterSection}> <View style={pdfStyles.parameterContainer}>
Jenis Tanggal:{' '} <View style={pdfStyles.parameterBadge}>
{params.filter_by === 'received_date' <Text>
? 'Tanggal Terima' Jenis Tanggal:{' '}
: 'Tanggal PO'}{' '} {params.filter_by === 'received_date'
| {getParameterText(params)} ? 'Tanggal Terima'
</Text> : 'Tanggal PO'}
</Text>
</View>
{getParameterText(params).map((param, index) => (
<View key={index} style={pdfStyles.parameterBadge}>
<Text>{param}</Text>
</View>
))}
</View>
</View> </View>
{/* Supplier Sections */} {/* Supplier Sections */}