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";
type props = {
transaction: TransactionType;
transaction: TransactionType | null;
};
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 (
<Document>
<Page size={{ width: 8.5 * 72, height: 10 * 90 }}>
@ -52,7 +72,6 @@ export default function TransactionPDF(props: props) {
/>
<View style={{ alignItems: "center" }}>
<Text
style={{
color: colors.form_dark,
@ -74,7 +93,10 @@ export default function TransactionPDF(props: props) {
padding: "5 0 5 0",
}}
>
<Text style={{ fontFamily: 'Helvetica-Bold' }}> BORROWER'S SLIP </Text>
<Text style={{ fontFamily: "Helvetica-Bold" }}>
{" "}
BORROWER'S SLIP{" "}
</Text>
</Text>
</View>
</View>
@ -186,7 +208,10 @@ export default function TransactionPDF(props: props) {
style={{ textDecoration: "underline" }}
>{`${props.transaction.borrower.course}`}</Text>{" "}
{"\n"}
Section: <Text style={{ textDecoration: "underline" }}>{props.transaction.section}</Text>
Section:{" "}
<Text style={{ textDecoration: "underline" }}>
{props.transaction.section}
</Text>
</Text>
</View>
</View>
@ -230,7 +255,7 @@ export default function TransactionPDF(props: props) {
display: "flex",
gap: 5,
alignSelf: "stretch",
marginTop: "10"
marginTop: "10",
}}
>
<Text
@ -271,7 +296,7 @@ export default function TransactionPDF(props: props) {
</Text>
</View>
{/* Consumables Area */}
<View style={{ marginTop: "5" , marginBottom: 10}}>
<View style={{ marginTop: "5", marginBottom: 10 }}>
<Text
style={{
color: colors.form_title,
@ -295,10 +320,13 @@ export default function TransactionPDF(props: props) {
</View>
{/* Members here */}
<View style={{
display: "flex",
gap: 5,
alignSelf: "stretch",}}>
<View
style={{
display: "flex",
gap: 5,
alignSelf: "stretch",
}}
>
<Text
style={{
color: colors.form_title,
@ -318,31 +346,37 @@ export default function TransactionPDF(props: props) {
</Text>
{/* Remarks */}
</View>
<View style={{ display: "flex", flexDirection: "column", alignSelf: "stretch" }}>
<View style={{ padding: "10 0" }}>
<Text
style={{
color: colors.form_title,
marginTop: 10,
borderBottom: "1px solid #A2A2A2",
padding: "5 0",
}}
>
Remarks
</Text>
</View>
<View
style={{
display: "flex",
flexDirection: "column",
alignSelf: "stretch",
}}
>
<View style={{ padding: "10 0" }}>
<Text
style={{
color: colors.form_dark,
fontSize: 14,
margin: 0,
marginTop: 8,
color: colors.form_title,
marginTop: 10,
borderBottom: "1px solid #A2A2A2",
padding: "5 0",
}}
>
{props.transaction.remarks}
Remarks
</Text>
</View>
<Text
style={{
color: colors.form_dark,
fontSize: 14,
margin: 0,
marginTop: 8,
}}
>
{props.transaction.remarks}
</Text>
</View>
</View>
</Page>
</Document>