diff --git a/frontend/src/views/accounts/AccountsView.vue b/frontend/src/views/accounts/AccountsView.vue index 6e6cd3c..9980263 100644 --- a/frontend/src/views/accounts/AccountsView.vue +++ b/frontend/src/views/accounts/AccountsView.vue @@ -6,34 +6,43 @@ Add Account - - - - - {{ accountTypeIcon(account.type) }} - {{ account.name }} - - {{ account.institution }} - {{ accountTypeLabel(account.type) }} - -
- {{ formatCurrency(account.balance) }} -
-
- Credit Limit: {{ formatCurrency(account.creditLimit) }} - ({{ ((Math.abs(account.balance) / account.creditLimit) * 100).toFixed(0) }}% used) -
-
APR: {{ account.interestRate }}%
-
+ @@ -93,8 +102,19 @@ const accountTypes = [ const form = ref({ name: '', type: 'Checking', institution: '', accountNumber: '', balance: 0, creditLimit: null as number | null, interestRate: null as number | null, notes: '' }) +const liabilityTypes = ['CreditCard', 'AutoLoan', 'PersonalLoan', 'Mortgage', 'LineOfCredit'] + +const accountGroups = computed(() => { + const assets = accountsStore.accounts.filter(a => !liabilityTypes.includes(a.type)) + const liabilities = accountsStore.accounts.filter(a => liabilityTypes.includes(a.type)) + return [ + { label: 'Assets', accounts: assets, total: assets.reduce((sum, a) => sum + a.balance, 0) }, + { label: 'Liabilities', accounts: liabilities, total: liabilities.reduce((sum, a) => sum + a.balance, 0) }, + ] +}) + const showCreditLimit = computed(() => ['CreditCard', 'LineOfCredit'].includes(form.value.type)) -const showInterestRate = computed(() => ['CreditCard', 'AutoLoan', 'PersonalLoan', 'Mortgage', 'LineOfCredit'].includes(form.value.type)) +const showInterestRate = computed(() => liabilityTypes.includes(form.value.type)) onMounted(() => accountsStore.fetchAccounts())