Add potential fix to transactionpdf page build error

This commit is contained in:
Keannu Bernasol 2024-01-11 08:31:16 +08:00
parent 06d019323c
commit 01e74a79de

View file

@ -8,10 +8,30 @@ import {
import ustplogo from "../../assets/ustp-logo.png"; import ustplogo from "../../assets/ustp-logo.png";
type props = { type props = {
transaction: TransactionType; transaction: TransactionType | null;
}; };
export default function TransactionPDF(props: props) { export default function TransactionPDF(props: props) {
if (!props.transaction) {
return (
<Document>
<Page size={{ width: 8.5 * 72, height: 10 * 90 }}>
<View>
<Text
style={{
color: colors.form_dark,
fontSize: 10,
textAlign: "center",
padding: "5 0 5 0",
}}
>
Invalid transaction PDF specified
</Text>
</View>
</Page>
</Document>
);
}
return ( return (
<Document> <Document>
<Page size={{ width: 8.5 * 72, height: 10 * 90 }}> <Page size={{ width: 8.5 * 72, height: 10 * 90 }}>
@ -52,7 +72,6 @@ export default function TransactionPDF(props: props) {
/> />
<View style={{ alignItems: "center" }}> <View style={{ alignItems: "center" }}>
<Text <Text
style={{ style={{
color: colors.form_dark, color: colors.form_dark,
@ -66,7 +85,7 @@ export default function TransactionPDF(props: props) {
Lapasan, Cagayan de Oro City {"\n"} Lapasan, Cagayan de Oro City {"\n"}
College of Science and Mathematics College of Science and Mathematics
</Text> </Text>
<Text <Text
style={{ style={{
color: colors.form_dark, color: colors.form_dark,
@ -74,7 +93,10 @@ export default function TransactionPDF(props: props) {
padding: "5 0 5 0", padding: "5 0 5 0",
}} }}
> >
<Text style={{ fontFamily: 'Helvetica-Bold' }}> BORROWER'S SLIP </Text> <Text style={{ fontFamily: "Helvetica-Bold" }}>
{" "}
BORROWER'S SLIP{" "}
</Text>
</Text> </Text>
</View> </View>
</View> </View>
@ -186,7 +208,10 @@ export default function TransactionPDF(props: props) {
style={{ textDecoration: "underline" }} style={{ textDecoration: "underline" }}
>{`${props.transaction.borrower.course}`}</Text>{" "} >{`${props.transaction.borrower.course}`}</Text>{" "}
{"\n"} {"\n"}
Section: <Text style={{ textDecoration: "underline" }}>{props.transaction.section}</Text> Section:{" "}
<Text style={{ textDecoration: "underline" }}>
{props.transaction.section}
</Text>
</Text> </Text>
</View> </View>
</View> </View>
@ -230,7 +255,7 @@ export default function TransactionPDF(props: props) {
display: "flex", display: "flex",
gap: 5, gap: 5,
alignSelf: "stretch", alignSelf: "stretch",
marginTop: "10" marginTop: "10",
}} }}
> >
<Text <Text
@ -271,7 +296,7 @@ export default function TransactionPDF(props: props) {
</Text> </Text>
</View> </View>
{/* Consumables Area */} {/* Consumables Area */}
<View style={{ marginTop: "5" , marginBottom: 10}}> <View style={{ marginTop: "5", marginBottom: 10 }}>
<Text <Text
style={{ style={{
color: colors.form_title, color: colors.form_title,
@ -295,10 +320,13 @@ export default function TransactionPDF(props: props) {
</View> </View>
{/* Members here */} {/* Members here */}
<View style={{ <View
display: "flex", style={{
gap: 5, display: "flex",
alignSelf: "stretch",}}> gap: 5,
alignSelf: "stretch",
}}
>
<Text <Text
style={{ style={{
color: colors.form_title, color: colors.form_title,
@ -318,31 +346,37 @@ export default function TransactionPDF(props: props) {
</Text> </Text>
{/* Remarks */} {/* Remarks */}
</View> </View>
<View style={{ display: "flex", flexDirection: "column", alignSelf: "stretch" }}> <View
<View style={{ padding: "10 0" }}> style={{
<Text display: "flex",
style={{ flexDirection: "column",
color: colors.form_title, alignSelf: "stretch",
marginTop: 10, }}
borderBottom: "1px solid #A2A2A2", >
padding: "5 0", <View style={{ padding: "10 0" }}>
}}
>
Remarks
</Text>
</View>
<Text <Text
style={{ style={{
color: colors.form_dark, color: colors.form_title,
fontSize: 14, marginTop: 10,
margin: 0, borderBottom: "1px solid #A2A2A2",
marginTop: 8, padding: "5 0",
}} }}
> >
{props.transaction.remarks} Remarks
</Text> </Text>
</View> </View>
<Text
style={{
color: colors.form_dark,
fontSize: 14,
margin: 0,
marginTop: 8,
}}
>
{props.transaction.remarks}
</Text>
</View>
</View> </View>
</Page> </Page>
</Document> </Document>