forked from fahrPool/fahrPool
77 lines
2.7 KiB
TypeScript
77 lines
2.7 KiB
TypeScript
import { Document, Page, Text, View, Image, StyleSheet } from "@react-pdf/renderer";
|
|
import type { ProtokollProps } from "./protokoll";
|
|
|
|
const styles = StyleSheet.create({
|
|
page: { padding: 32, fontSize: 11 },
|
|
h1: { fontSize: 16, marginBottom: 12, fontWeight: 700 },
|
|
row: { flexDirection: "row", justifyContent: "space-between", marginBottom: 4 },
|
|
fotoGrid: { flexDirection: "row", flexWrap: "wrap", gap: 8, marginTop: 12 },
|
|
foto: { width: 120, marginBottom: 8 },
|
|
fotoImg: { width: 120, height: 90, objectFit: "cover" },
|
|
fotoLabel: { fontSize: 9, marginTop: 2 },
|
|
unterschrift: { width: 200, height: 80, marginTop: 8, borderWidth: 1, borderColor: "#ccc" },
|
|
});
|
|
|
|
export function ProtokollDocument({ props }: { props: ProtokollProps }) {
|
|
return (
|
|
<Document>
|
|
<Page size="A4" style={styles.page}>
|
|
<Text style={styles.h1}>Übergabeprotokoll {props.auftragsnummer}</Text>
|
|
<View style={styles.row}>
|
|
<Text>Fahrzeug</Text>
|
|
<Text>{props.fahrzeugKennzeichen}</Text>
|
|
</View>
|
|
<View style={styles.row}>
|
|
<Text>Abholort</Text>
|
|
<Text>
|
|
{props.abholort.adresse} ({props.abholort.ansprechpartner})
|
|
</Text>
|
|
</View>
|
|
<View style={styles.row}>
|
|
<Text>Zielort</Text>
|
|
<Text>
|
|
{props.zielort.adresse} ({props.zielort.ansprechpartner})
|
|
</Text>
|
|
</View>
|
|
<View style={styles.row}>
|
|
<Text>Start-KM</Text>
|
|
<Text>{props.startKm ?? "-"}</Text>
|
|
</View>
|
|
<View style={styles.row}>
|
|
<Text>End-KM</Text>
|
|
<Text>{props.endKm ?? "-"}</Text>
|
|
</View>
|
|
<View style={styles.row}>
|
|
<Text>Übergabe bestätigt</Text>
|
|
<Text>{props.uebergabeBestaetigtAt ?? "-"}</Text>
|
|
</View>
|
|
<View style={styles.row}>
|
|
<Text>Empfänger</Text>
|
|
<Text>{props.empfaengerName ?? "-"}</Text>
|
|
</View>
|
|
|
|
{props.fotos.length > 0 && (
|
|
<View style={styles.fotoGrid}>
|
|
{props.fotos.map((foto, index) => (
|
|
<View key={index} style={styles.foto}>
|
|
<Image src={{ data: foto.buffer, format: "jpg" }} style={styles.fotoImg} />
|
|
<Text style={styles.fotoLabel}>
|
|
{foto.label}
|
|
{foto.beschreibung ? `: ${foto.beschreibung}` : ""}
|
|
</Text>
|
|
</View>
|
|
))}
|
|
</View>
|
|
)}
|
|
|
|
{props.unterschriftBuffer && (
|
|
<>
|
|
<Text style={{ marginTop: 12 }}>Unterschrift</Text>
|
|
<Image src={{ data: props.unterschriftBuffer, format: "png" }} style={styles.unterschrift} />
|
|
</>
|
|
)}
|
|
</Page>
|
|
</Document>
|
|
);
|
|
}
|