Implement banking system features and enhancements

- Added banking mode with checking, savings, and charity accounts, including auto-split options for income.
- Introduced banking transaction management, including transfers and charity outflows.
- Updated family settings to allow configuration of banking features and interest rates.
- Enhanced data export functionality to include bank transactions.
- Improved user interface to display banking information and donation goals.
- Updated documentation to reflect new banking features and settings.
This commit is contained in:
2026-03-31 11:03:53 -05:00
parent f14de0b7e1
commit 6d10cb4726
21 changed files with 1337 additions and 41 deletions
+24
View File
@@ -30,6 +30,12 @@ function familySettingsDefaultsRaw(): array {
'currency_symbol' => '★',
'currency_name' => 'Stars',
'currency_permanence' => 'permanent',
'banking_enabled' => false,
'banking_auto_split_enabled' => false,
'banking_auto_split_savings_pct' => 0,
'banking_auto_split_charity_pct' => 0,
'banking_savings_monthly_interest_rate' => 0,
'banking_roundup_destination' => 'off',
'timezone' => 'America/New_York',
'week_starts_on' => 0,
'calendar_two_way_google' => false,
@@ -80,6 +86,24 @@ function normalizeTimezoneToUs(string $tz, array $allowed): string {
function normalizeLoadedFamilySettings(array $s): array {
$allowed = familyHubUsTimezoneIdentifiers();
$s['timezone'] = normalizeTimezoneToUs((string) ($s['timezone'] ?? ''), $allowed);
$bankingEnabled = $s['banking_enabled'] ?? false;
$s['banking_enabled'] = $bankingEnabled === true || $bankingEnabled === 1 || $bankingEnabled === '1' || $bankingEnabled === 'true';
$autoSplitEnabled = $s['banking_auto_split_enabled'] ?? false;
$s['banking_auto_split_enabled'] = $autoSplitEnabled === true || $autoSplitEnabled === 1 || $autoSplitEnabled === '1' || $autoSplitEnabled === 'true';
$savingsPct = (float) ($s['banking_auto_split_savings_pct'] ?? 0);
$charityPct = (float) ($s['banking_auto_split_charity_pct'] ?? 0);
$s['banking_auto_split_savings_pct'] = max(0, min(100, round($savingsPct, 2)));
$s['banking_auto_split_charity_pct'] = max(0, min(100, round($charityPct, 2)));
if (($s['banking_auto_split_savings_pct'] + $s['banking_auto_split_charity_pct']) > 100) {
$s['banking_auto_split_charity_pct'] = max(0, round(100 - $s['banking_auto_split_savings_pct'], 2));
}
$monthlyRate = (float) ($s['banking_savings_monthly_interest_rate'] ?? 0);
$s['banking_savings_monthly_interest_rate'] = max(0, round($monthlyRate, 6));
$roundupDestination = trim((string) ($s['banking_roundup_destination'] ?? 'off'));
if (!in_array($roundupDestination, ['off', 'savings', 'charity'], true)) {
$roundupDestination = 'off';
}
$s['banking_roundup_destination'] = $roundupDestination;
$v = $s['calendar_two_way_google'] ?? false;
$s['calendar_two_way_google'] = $v === true || $v === 1 || $v === '1' || $v === 'true';
$s['calendar_bill_days'] = normalizeCalendarBillDaysRaw($s['calendar_bill_days'] ?? []);