many updates :-)
This commit is contained in:
@@ -111,6 +111,26 @@ const styles = StyleSheet.create({
|
||||
colQty: { width: "16%", textAlign: "right" },
|
||||
colUnit: { width: "16%", textAlign: "right" },
|
||||
colTotal: { width: "16%", textAlign: "right" },
|
||||
descriptionCell: {
|
||||
flexDirection: "row",
|
||||
alignItems: "flex-start",
|
||||
gap: 6,
|
||||
},
|
||||
productIcon: {
|
||||
width: 28,
|
||||
height: 28,
|
||||
objectFit: "contain",
|
||||
borderWidth: 0.5,
|
||||
borderColor: TABLE_BORDER,
|
||||
borderRadius: 2,
|
||||
},
|
||||
productIconPlaceholder: {
|
||||
width: 28,
|
||||
height: 28,
|
||||
},
|
||||
descriptionText: {
|
||||
flex: 1,
|
||||
},
|
||||
itemTitle: {
|
||||
fontFamily: "Helvetica-Bold",
|
||||
},
|
||||
@@ -123,6 +143,9 @@ const styles = StyleSheet.create({
|
||||
marginTop: 10,
|
||||
alignSelf: "flex-end",
|
||||
width: "50%",
|
||||
// Match the table rows' horizontal padding so the right-aligned amounts
|
||||
// line up perfectly with the "Total" column above.
|
||||
paddingHorizontal: 4,
|
||||
},
|
||||
totalRow: {
|
||||
flexDirection: "row",
|
||||
@@ -346,9 +369,6 @@ export function InvoiceDocument({ invoice }: DocProps) {
|
||||
|
||||
<View style={styles.closing}>
|
||||
<Text>{t.closing}</Text>
|
||||
<Text style={{ fontFamily: "Helvetica-Bold", marginTop: 4 }}>
|
||||
{invoice.issuer.ownerName || invoice.issuer.companyName}
|
||||
</Text>
|
||||
</View>
|
||||
|
||||
<Footer issuer={invoice.issuer} language={invoice.language} />
|
||||
@@ -416,9 +436,16 @@ function LineRow({
|
||||
return (
|
||||
<View style={styles.tableRow}>
|
||||
<Text style={styles.colPos}>{line.position}</Text>
|
||||
<View style={styles.colDescription}>
|
||||
<Text style={styles.itemTitle}>{line.title}</Text>
|
||||
{line.sku ? <Text style={styles.itemSku}>SKU: {line.sku}</Text> : null}
|
||||
<View style={[styles.colDescription, styles.descriptionCell]}>
|
||||
{line.imageDataUrl ? (
|
||||
<Image src={line.imageDataUrl} style={styles.productIcon} />
|
||||
) : (
|
||||
<View style={styles.productIconPlaceholder} />
|
||||
)}
|
||||
<View style={styles.descriptionText}>
|
||||
<Text style={styles.itemTitle}>{line.title}</Text>
|
||||
{line.sku ? <Text style={styles.itemSku}>SKU: {line.sku}</Text> : null}
|
||||
</View>
|
||||
</View>
|
||||
<Text style={styles.colQty}>{formatQuantity(line.quantity, t.pieceUnit, language)}</Text>
|
||||
<Text style={styles.colUnit}>{formatMoney(line.unitPriceNet, currency, language)}</Text>
|
||||
@@ -460,8 +487,20 @@ function Footer({ issuer, language }: { issuer: IssuerData; language: InvoiceLan
|
||||
{issuer.bankName ? <Text>{t.bankLabel}: {issuer.bankName}</Text> : null}
|
||||
{issuer.iban ? <Text>{t.ibanLabel}: {issuer.iban}</Text> : null}
|
||||
{issuer.bic ? <Text>{t.bicLabel}: {issuer.bic}</Text> : null}
|
||||
{issuer.footerNote ? <Text>{issuer.footerNote}</Text> : null}
|
||||
{pickFooterNote(issuer, language) ? <Text>{pickFooterNote(issuer, language)}</Text> : null}
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Picks the footer note for the rendered language. English falls back to the
|
||||
* German `footerNote` when `footerNoteEn` is empty (so existing single-language
|
||||
* setups keep working). German always uses `footerNote`.
|
||||
*/
|
||||
function pickFooterNote(issuer: { footerNote: string; footerNoteEn: string }, language: InvoiceLanguage): string {
|
||||
if (language === "en") {
|
||||
return issuer.footerNoteEn?.trim() || issuer.footerNote || "";
|
||||
}
|
||||
return issuer.footerNote || "";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user