feat(admin): update B2B PDF, mail and admin table

- format PDF order number as AE- and add upgrade flags

- style status emails with sleek modern dark theme

- add badge counts to admin table status filter buttons

- implement preiskorrektur inline editing inside admin detail modal

- trigger DB and total price recalculations on snapshot changes
This commit is contained in:
DanielS
2026-08-20 17:16:40 +02:00
parent e0d9c1d20e
commit 49a7a0768d
4 changed files with 368 additions and 145 deletions

View File

@@ -105,6 +105,8 @@ export const InvoicePDF = ({
const items = orderSnapshot?.items ?? [];
const taxRate = orderSnapshot?.tax_rate ?? 19;
const isSubscription = order?.type === 'subscription' || orderSnapshot?.billing_cycle === 'monthly';
const formattedOrderNumber = (order.order_number || order.id || '').replace(/^BE-/, 'AE-');
const isUpgrade = !!orderSnapshot?.last_license_date;
let oneTimeNet = 0;
let monthlyNet = 0;
@@ -162,7 +164,7 @@ export const InvoicePDF = ({
</View>
<Text style={styles.title}>
Anfragebestätigung: {order.order_number || order.id}
{isUpgrade ? 'Erweiterungsangebot' : 'Anfragebestätigung'}: #{formattedOrderNumber}
</Text>
<View style={{ flexDirection: 'row', justifyContent: 'space-between', marginBottom: 15 }}>
@@ -177,7 +179,7 @@ export const InvoicePDF = ({
<View style={{ width: '48%' }}>
<Text style={styles.label}>Bestelldetails</Text>
<Text>Bestellnummer: {order.order_number || order.id}</Text>
<Text>Bestellnummer: #{formattedOrderNumber}</Text>
<Text>Zahlungsart: {isSubscription ? 'SEPA-Lastschrift' : 'Rechnung'}</Text>
<Text>Datum: {new Date(order.created_at || Date.now()).toLocaleDateString('de-DE')}</Text>
@@ -197,7 +199,7 @@ export const InvoicePDF = ({
<View key={groupIdx} style={{ marginBottom: 12, borderWidth: 1, borderColor: '#e2e8f0', borderRadius: 4, padding: 8, backgroundColor: '#f8fafc' }}>
<View style={{ borderBottomWidth: 1, borderBottomColor: '#cbd5e1', paddingBottom: 4, marginBottom: 6 }}>
<Text style={{ fontSize: 10, fontWeight: 'bold', color: '#1e3a8a' }}>
{deviceName === 'Zusatzleistung' ? 'Backoffice' : `Kasse: ${deviceName}`}
{deviceName === 'Zusatzleistung' ? 'Backoffice' : `${isUpgrade ? 'Erweiterung für Gerät' : 'Kasse'}: ${deviceName}`}
</Text>
</View>
{devItems.map((item: any, idx: number) => (