- Billing
- Guthaben, Statistiken und Transaktionen
+
+
+
Billing
+
Guthaben, Statistiken und Transaktionen
+
+ {activeTab !== 'transactions' && (
+
+
+
+
+ )}
+
@@ -411,36 +478,73 @@ export const BillingDataView: React.FC = () => {
{/* ================================================================ */}
{/* Tab: Übersicht (My Overview) */}
{/* ================================================================ */}
- {activeTab === 'overview' && (
- <>
- {/* Balance Cards */}
-
- Mein Guthaben
- {dashboardLoading ? (
- Lade Guthaben...
- ) : balances.length === 0 ? (
- Keine Abrechnungskonten vorhanden
- ) : (
-
- {balances.map((balance) => (
-
- ))}
-
- )}
-
+ {activeTab === 'overview' && (() => {
+ // Filter balances and user accounts by scope
+ const filteredBalances = selectedScope === 'personal' || selectedScope === 'all'
+ ? balances
+ : balances.filter(b => b.mandateId === selectedScope);
+
+ const filteredUserBalances = selectedScope === 'personal'
+ ? [] // personal view: only own balance cards, no other users
+ : selectedScope === 'all'
+ ? allUserBalances
+ : allUserBalances.filter(ub => ub.mandateId === selectedScope);
- {/* Usage Statistics via FormGeneratorReport (no period selector - always full year) */}
-
- >
- )}
+ return (
+ <>
+ {/* Balance Cards - own balances */}
+
+ Mein Guthaben
+ {dashboardLoading ? (
+ Lade Guthaben...
+ ) : filteredBalances.length === 0 ? (
+ Keine Abrechnungskonten vorhanden
+ ) : (
+
+ {filteredBalances.map((balance) => (
+
+ ))}
+
+ )}
+
+
+ {/* All User Balance Cards (mandate/all scope) */}
+ {filteredUserBalances.length > 0 && (
+
+ Benutzer-Guthaben
+ {allUserBalancesLoading ? (
+ Lade Benutzer-Guthaben...
+ ) : (
+
+ {filteredUserBalances.map((ub, idx) => (
+
+
+
{ub.userName || ub.userId?.slice(0, 8)}
+ {ub.mandateName}
+
+
+ {_formatCurrency(ub.balance || 0)}
+
+
+ ))}
+
+ )}
+
+ )}
+
+ {/* Usage Statistics via FormGeneratorReport */}
+
+ >
+ );
+ })()}
{/* ================================================================ */}
{/* Tab: Statistik (Dashboard) */}
@@ -474,7 +578,7 @@ export const BillingDataView: React.FC = () => {