Skip to content

Open-source personal finance manager. Self-hosted, privacy-first.

feat(accounts): link loan accounts to a property and show its equity (#1055)

eilandnle3d386581f6a
diff --git a/backend/alembic/versions/098_loan_property_link.py b/backend/alembic/versions/098_loan_property_link.py
new file mode 100644
index 00000000..e9ab4ca5
--- /dev/null
+++ b/backend/alembic/versions/098_loan_property_link.py
@@ -0,0 +1,37 @@
+"""link loan accounts to the real-estate asset they are secured against
+
+Revision ID: 098
+Revises: 097
+"""
+
+import sqlalchemy as sa
+from sqlalchemy.dialects import postgresql
+
+from alembic import op
+
+revision = "098"
+down_revision = "097"
+branch_labels = None
+depends_on = None
+
+
+def upgrade() -> None:
+ op.add_column(
+ "accounts",
+ sa.Column("secured_asset_id", postgresql.UUID(as_uuid=True), nullable=True),
+ )
+ op.create_index("ix_accounts_secured_asset_id", "accounts", ["secured_asset_id"])
+ op.create_foreign_key(
+ "fk_accounts_secured_asset_id_assets",
+ "accounts",
+ "assets",
+ ["secured_asset_id"],
+ ["id"],
+ ondelete="SET NULL",
+ )
+
+
+def downgrade() -> None:
+ op.drop_constraint("fk_accounts_secured_asset_id_assets", "accounts", type_="foreignkey")
+ op.drop_index("ix_accounts_secured_asset_id", table_name="accounts")
+ op.drop_column("accounts", "secured_asset_id")
diff --git a/backend/app/api/accounts.py b/backend/app/api/accounts.py
index e5981d6a..d82c1e2b 100644
--- a/backend/app/api/accounts.py
+++ b/backend/app/api/accounts.py
@@ -200,7 +200,10 @@ async def create_account(
ctx: WorkspaceContext = Depends(current_writable_workspace),
session: AsyncSession = Depends(get_async_session),
):
- account = await account_service.create_account(session, ctx.workspace.id, ctx.user_id, data)
+ try:
+ account = await account_service.create_account(session, ctx.workspace.id, ctx.user_id, data)
+ except ValueError as e:
+ raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST, detail=str(e))
return account_service.serialize_account(account, None, None)
diff --git a/backend/app/models/account.py b/backend/app/models/account.py
index d930f0fc..c0ca46e4 100644
--- a/backend/app/models/account.py
+++ b/backend/app/models/account.py
@@ -41,7 +41,11 @@ class Account(Base):
# duplicating the account after a reconnect. Refreshed alongside `name`,
# never blanked by a missing value.
stable_external_id: Mapped[Optional[str]] = mapped_column(String(255), nullable=True)
- type: Mapped[str] = mapped_column(String(50)) # checking, savings, credit_card
+ type: Mapped[str] = mapped_column(String(50)) # checking, savings, credit_card, loan
+ # Loan accounts only: the property or vehicle this loan is secured against.
+ secured_asset_id: Mapped[Optional[uuid.UUID]] = mapped_column(
+ UUID(as_uuid=True), ForeignKey("assets.id", ondelete="SET NULL"), nullable=True, index=True
+ )
balance: Mapped[Decimal] = mapped_column(Numeric(precision=15, scale=2), default=Decimal("0.00"))
currency: Mapped[str] = mapped_column(String(3), default="USD")
balance_primary: Mapped[Optional[Decimal]] = mapped_column(Numeric(precision=15, scale=2), nullable=True)
diff --git a/backend/app/models/asset.py b/backend/app/models/asset.py
index bc5d79d1..3f2f203d 100644
--- a/backend/app/models/asset.py
+++ b/backend/app/models/asset.py
@@ -15,6 +15,10 @@ if TYPE_CHECKING:
from app.models.asset_value import AssetValue
+
+# Asset types a loan can be secured against (a mortgage, a car financing).
+LOAN_COLLATERAL_TYPES = frozenset({"real_estate", "vehicle"})
+
class Asset(Base):
__tablename__ = "assets"
__table_args__ = (
diff --git a/backend/app/schemas/account.py b/backend/app/schemas/account.py
index 05f74268..5ea2d0d0 100644
--- a/backend/app/schemas/account.py
+++ b/backend/app/schemas/account.py
@@ -11,6 +11,8 @@ class AccountBase(BaseModel):
type: str
balance: Decimal
currency: str = "USD"
+ # Loan accounts only: the property or vehicle the loan is secured against.
+ secured_asset_id: Optional[uuid.UUID] = None
class AccountCreate(BaseModel):
@@ -19,6 +21,7 @@ class AccountCreate(BaseModel):
balance: Decimal = Decimal("0.00")
balance_date: Optional[date] = None
currency: str = "USD"
+ secured_asset_id: Optional[uuid.UUID] = None
credit_limit: Optional[Decimal] = None
statement_close_day: Optional[int] = None
payment_due_day: Optional[int] = None
@@ -31,6 +34,7 @@ class AccountUpdate(BaseModel):
name: Optional[str] = None
display_name: Optional[str] = None
type: Optional[str] = None
+ secured_asset_id: Optional[uuid.UUID] = None
balance: Optional[Decimal] = None
balance_date: Optional[date] = None
credit_limit: Optional[Decimal] = None
diff --git a/backend/app/services/account_service.py b/backend/app/services/account_service.py
index 7f768483..5a94779c 100644
--- a/backend/app/services/account_service.py
+++ b/backend/app/services/account_service.py
@@ -9,6 +9,7 @@ from sqlalchemy.orm import contains_eager
from app.core.app_clock import app_today
from app.models.account import Account
+from app.models.asset import LOAN_COLLATERAL_TYPES, Asset
from app.models.bank_connection import BankConnection
from app.models.credit_card_bill import CreditCardBill
from app.models.transaction import Transaction
@@ -49,7 +50,8 @@ def _simplefin_to_internal_balance(provider: str, account_type: str, balance: De
def _opening_balance_values(account_type: str, balance: Decimal) -> tuple[Decimal, str]:
amount = abs(balance)
- is_credit = (balance > 0) == (account_type != "credit_card")
+ # A loan is entered as the amount owed, like a card, and is debt in the ledger.
+ is_credit = (balance > 0) == (account_type not in {"credit_card", "loan"})
return amount, "credit" if is_credit else "debit"
@@ -243,6 +245,7 @@ def serialize_account(
"display_name": acc.display_name,
"masked_number": acc.masked_number,
"type": acc.type,
+ "secured_asset_id": acc.secured_asset_id,
"balance": acc.balance,
"currency": acc.currency,
"current_balance": resolved_balance,
@@ -329,6 +332,7 @@ async def create_account(
user_id: uuid.UUID,
data: AccountCreate,
) -> Account:
+ await _validate_secured_asset(session, workspace_id, data.type, data.secured_asset_id)
is_cc = data.type == "credit_card"
account = Account(
user_id=user_id,
@@ -337,6 +341,7 @@ async def create_account(
type=data.type,
balance=data.balance,
currency=data.currency,
+ secured_asset_id=data.secured_asset_id,
credit_limit=data.credit_limit if is_cc else None,
statement_close_day=data.statement_close_day if is_cc else None,
payment_due_day=data.payment_due_day if is_cc else None,
@@ -377,6 +382,33 @@ async def update_account(
update_data = data.model_dump(exclude_unset=True)
balance_date = update_data.pop("balance_date", None)
+ new_type = update_data.get("type", account.type)
+ if account.connection_id is not None and new_type == "loan":
+ raise ValueError("Bank-connected accounts cannot be loans yet")
+ # Switching between a loan and any other type flips what the balance means
+ # (money held vs. money owed). That is safe for an account that only has
+ # its opening balance; with real history it would silently reinterpret it.
+ if new_type != account.type and "loan" in {account.type, new_type}:
+ has_history = await session.scalar(
+ select(Transaction.id)
+ .where(
+ Transaction.account_id == account.id,
+ Transaction.source != "opening_balance",
+ )
+ .limit(1)
+ )
+ if has_history is not None:
+ raise ValueError("An account with transactions cannot switch to or from a loan")
+ # The property link is dropped when the account stops being a loan, so only
+ # a link sent with this edit is checked.
+ await _validate_secured_asset(
+ session,
+ workspace_id,
+ new_type,
+ update_data.get(
+ "secured_asset_id", account.secured_asset_id if new_type == "loan" else None
+ ),
+ )
# Track whether we need to recompute effective_date for all transactions.
# Changes to the CC cycle days shift which bill each historical purchase
@@ -384,6 +416,7 @@ async def update_account(
cycle_fields_changed = any(
k in update_data for k in ("statement_close_day", "payment_due_day")
)
+ old_type = account.type
# Bank-connected accounts are managed by the sync pipeline. Beyond display
# name and credit card metadata (limit + cycle days, which providers often
@@ -455,7 +488,10 @@ async def update_account(
account.minimum_payment = None
account.card_brand = None
account.card_level = None
+ if account.type != "loan":
+ account.secured_asset_id = None
+ opening_balance_type_changed = old_type != account.type and "loan" in {old_type, account.type}
# When balance changes, sync the opening_balance transaction
if "balance" in update_data:
new_balance = update_data["balance"]
@@ -491,7 +527,7 @@ async def update_account(
session.add(opening_tx)
elif opening_tx:
await session.delete(opening_tx)
- elif balance_date:
+ elif opening_balance_type_changed or balance_date:
existing_opening = await session.execute(
select(Transaction).where(
Transaction.account_id == account_id,
@@ -500,7 +536,10 @@ async def update_account(
)
opening_tx = existing_opening.scalar_one_or_none()
if opening_tx:
- opening_tx.date = balance_date
+ if opening_balance_type_changed and account.balance != Decimal("0.00"):
+ _, opening_tx.type = _opening_balance_values(account.type, account.balance)
+ if balance_date:
+ opening_tx.date = balance_date
apply_effective_date(opening_tx, account)
if cycle_fields_changed:
@@ -511,6 +550,23 @@ async def update_account(
return account
+async def _validate_secured_asset(
+ session: AsyncSession,
+ workspace_id: uuid.UUID,
+ account_type: str,
+ asset_id: Optional[uuid.UUID],
+) -> None:
+ if asset_id is None:
+ return
+ if account_type != "loan":
+ raise ValueError("Only loan accounts can be linked to a property")
+ asset = await session.scalar(
+ select(Asset).where(Asset.id == asset_id, Asset.workspace_id == workspace_id)
+ )
+ if asset is None or asset.type not in LOAN_COLLATERAL_TYPES:
+ raise ValueError("Linked asset must be a property or vehicle in the same workspace")
+
+
async def _recompute_effective_dates(session: AsyncSession, account: Account) -> None:
"""Recompute effective_date on every transaction in this account.
diff --git a/backend/app/services/asset_service.py b/backend/app/services/asset_service.py
index 3aa8adf6..e7e5664d 100644
--- a/backend/app/services/asset_service.py
+++ b/backend/app/services/asset_service.py
@@ -5,12 +5,13 @@ from decimal import Decimal
from typing import Any, Optional, cast
from fastapi import HTTPException, status
-from sqlalchemy import select, func, desc
+from sqlalchemy import select, func, desc, update as sa_update
from sqlalchemy.exc import IntegrityError
from sqlalchemy.ext.asyncio import AsyncSession
from app.core.app_clock import app_today
-from app.models.asset import Asset
+from app.models.account import Account
+from app.models.asset import LOAN_COLLATERAL_TYPES, Asset
from app.models.asset_transaction import AssetTransaction
from app.models.asset_value import AssetValue
from app.models.user import User
@@ -670,6 +671,15 @@ async def update_asset(
for key, value in update_data.items():
setattr(asset, key, value)
+ # Only a property or a vehicle can secure a loan, so an asset that changes
+ # to another type releases its loans instead of leaving them linked to it.
+ if asset.type not in LOAN_COLLATERAL_TYPES:
+ await session.execute(
+ sa_update(Account)
+ .where(Account.secured_asset_id == asset.id)
+ .values(secured_asset_id=None)
+ )
+
# Regenerate growth-rule values if requested
if regenerate_growth and asset.valuation_method == "growth_rule":
# Delete all rule-generated values
diff --git a/backend/app/services/dashboard_service.py b/backend/app/services/dashboard_service.py
index 0f07d7e7..369d6502 100644
--- a/backend/app/services/dashboard_service.py
+++ b/backend/app/services/dashboard_service.py
@@ -141,6 +141,7 @@ async def _get_recurring_projections(
if (rec.id, occ_date) in materialized_occurrences:
continue
projections.append({
+ "account_id": rec.account_id,
"category_id": rec.category_id,
"amount": float(rec.amount),
"type": rec.type,
@@ -1579,24 +1580,38 @@ async def get_balance_history(
user = await session.get(User, user_id)
primary_currency = user.primary_currency if user else get_settings().default_currency
+ # Loans are long-term debt: they count in net worth, not in the money this
+ # curve tracks, so it leaves them out (like the sidebar accounts total).
+ loan_ids = set((await session.execute(
+ select(Account.id).where(Account.workspace_id == workspace_id, Account.type == "loan")
+ )).scalars())
+ balance_account_ids = account_ids
+ if loan_ids:
+ if account_ids is None:
+ balance_account_ids = list((await session.execute(
+ select(Account.id).where(Account.workspace_id == workspace_id, Account.type != "loan")
+ )).scalars())
+ else:
+ balance_account_ids = [i for i in account_ids if i not in loan_ids]
+
# Starting balances
current_start = await _balance_at(
session, workspace_id, month_start - timedelta(days=1),
- primary_currency_hint=primary_currency, account_ids=account_ids,
+ primary_currency_hint=primary_currency, account_ids=balance_account_ids,
)
prev_start = await _balance_at(
session, workspace_id, prev_month_start - timedelta(days=1),
- primary_currency_hint=primary_currency, account_ids=account_ids,
+ primary_currency_hint=primary_currency, account_ids=balance_account_ids,
)
# Daily deltas from real transactions
current_deltas = await _daily_deltas(
session, workspace_id, month_start, month_end,
- primary_currency_hint=primary_currency, account_ids=account_ids,
+ primary_currency_hint=primary_currency, account_ids=balance_account_ids,
)
prev_deltas = await _daily_deltas(
session, workspace_id, prev_month_start, prev_month_end,
- primary_currency_hint=primary_currency, account_ids=account_ids,
+ primary_currency_hint=primary_currency, account_ids=balance_account_ids,
)
# Recurring projections for future days of current month (converted to primary currency)
@@ -1609,7 +1624,7 @@ async def get_balance_history(
# rows dated today or earlier.
if month_start > today:
carried_forecasts = await _get_forecast_transactions(
- session, workspace_id, date.min, month_start, account_ids
+ session, workspace_id, date.min, month_start, balance_account_ids
)
for tx in carried_forecasts:
if tx.is_ignored or (tx.category and tx.category.is_ignored):
@@ -1626,7 +1641,7 @@ async def get_balance_history(
workspace_id,
proj_start,
month_end,
- account_ids,
+ balance_account_ids,
)
for tx in forecast_transactions:
if tx.is_ignored or (tx.category and tx.category.is_ignored):
@@ -1646,6 +1661,8 @@ async def get_balance_history(
session, workspace_id, proj_start, month_end, account_ids
)
for proj in projections:
+ if proj["account_id"] in loan_ids:
+ continue
day = proj["date"].day
proj_converted, _ = await convert(
session, Decimal(str(proj["amount"])), proj["currency"], primary_currency,
diff --git a/backend/tests/test_loan_accounts.py b/backend/tests/test_loan_accounts.py
new file mode 100644
index 00000000..7276538a
--- /dev/null
+++ b/backend/tests/test_loan_accounts.py
@@ -0,0 +1,381 @@
+import uuid
+from datetime import date, timedelta
+
+import pytest
+from httpx import AsyncClient
+from sqlalchemy import select
+from sqlalchemy.ext.asyncio import AsyncSession
+
+from app.models.asset import Asset
+from app.core.app_clock import app_today
+from app.models.transaction import Transaction
+from app.models.user import User
+from app.models.workspace import Workspace, WorkspaceMember
+
+
+async def _asset(session: AsyncSession, user: User, workspace: Workspace, asset_type: str) -> Asset:
+ asset = Asset(
+ id=uuid.uuid4(),
+ user_id=user.id,
+ workspace_id=workspace.id,
+ name="Home" if asset_type == "real_estate" else "Coins",
+ type=asset_type,
+ currency="EUR",
+ valuation_method="manual",
+ )
+ session.add(asset)
+ await session.commit()
+ return asset
+
+
+async def test_loan_can_be_linked_to_a_property_and_shows_as_debt(
+ client: AsyncClient,
+ auth_headers,
+ session: AsyncSession,
+ test_user: User,
+ test_workspace: Workspace,
+):
+ home = await _asset(session, test_user, test_workspace, "real_estate")
+
+ created = await client.post(
+ "/api/accounts",
+ headers=auth_headers,
+ json={
+ "name": "Mortgage",
+ "type": "loan",
+ "balance": 200000,
+ "currency": "EUR",
+ "secured_asset_id": str(home.id),
+ },
+ )
+
+ assert created.status_code == 201, created.text
+ assert created.json()["secured_asset_id"] == str(home.id)
+ listed = (await client.get("/api/accounts", headers=auth_headers)).json()
+ loan = next(row for row in listed if row["id"] == created.json()["id"])
+ assert loan["current_balance"] == -200000
+
+
+async def test_only_a_loan_can_be_linked_to_a_property_or_vehicle(
+ client: AsyncClient,
+ auth_headers,
+ session: AsyncSession,
+ test_user: User,
+ test_workspace: Workspace,
+):
+ home = await _asset(session, test_user, test_workspace, "real_estate")
+ coins = await _asset(session, test_user, test_workspace, "crypto")
+
+ not_a_loan = await client.post(
+ "/api/accounts",
+ headers=auth_headers,
+ json={"name": "Checking", "type": "checking", "secured_asset_id": str(home.id)},
+ )
+ not_a_property = await client.post(
+ "/api/accounts",
+ headers=auth_headers,
+ json={"name": "Loan", "type": "loan", "secured_asset_id": str(coins.id)},
+ )
+ unknown = await client.post(
+ "/api/accounts",
+ headers=auth_headers,
+ json={"name": "Loan", "type": "loan", "secured_asset_id": str(uuid.uuid4())},
+ )
+
+ assert not_a_loan.status_code == 400
+ assert not_a_property.status_code == 400
+ assert unknown.status_code == 400
+
+
+async def test_a_loan_cannot_link_to_a_property_in_another_workspace(
+ client: AsyncClient,
+ auth_headers,
+ session: AsyncSession,
+ test_user: User,
+):
+ other_workspace = Workspace(
+ id=uuid.uuid4(),
+ name="Other household",
+ kind="personal",
+ created_by_user_id=test_user.id,
+ )
+ session.add(other_workspace)
+ await session.flush()
+ session.add(
+ WorkspaceMember(
+ id=uuid.uuid4(),
+ workspace_id=other_workspace.id,
+ user_id=test_user.id,
+ role="owner",
+ )
+ )
+ home = await _asset(session, test_user, other_workspace, "real_estate")
+
+ response = await client.post(
+ "/api/accounts",
+ headers=auth_headers,
+ json={"name": "Loan", "type": "loan", "secured_asset_id": str(home.id)},
+ )
+
+ assert response.status_code == 400
+ assert "same workspace" in response.json()["detail"]
+
+
+async def test_a_loan_can_be_linked_unlinked_and_retyped(
+ client: AsyncClient,
+ auth_headers,
+ session: AsyncSession,
+ test_user: User,
+ test_workspace: Workspace,
+):
+ home = await _asset(session, test_user, test_workspace, "real_estate")
+ loan = (
+ await client.post(
+ "/api/accounts",
+ headers=auth_headers,
+ json={"name": "Loan", "type": "loan", "balance": 1000},
+ )
+ ).json()
+
+ linked = await client.patch(
+ f"/api/accounts/{loan['id']}",
+ headers=auth_headers,
+ json={"secured_asset_id": str(home.id)},
+ )
+ unlinked = await client.patch(
+ f"/api/accounts/{loan['id']}", headers=auth_headers, json={"secured_asset_id": None}
+ )
+ relinked = await client.patch(
+ f"/api/accounts/{loan['id']}",
+ headers=auth_headers,
+ json={"secured_asset_id": str(home.id)},
+ )
+ retyped = await client.patch(
+ f"/api/accounts/{loan['id']}", headers=auth_headers, json={"type": "checking"}
+ )
+
+ assert linked.json()["secured_asset_id"] == str(home.id)
+ assert unlinked.json()["secured_asset_id"] is None
+ assert relinked.status_code == 200
+ assert retyped.status_code == 200
+ assert retyped.json()["secured_asset_id"] is None
+ listed = (await client.get("/api/accounts", headers=auth_headers)).json()
+ checking = next(row for row in listed if row["id"] == loan["id"])
+ assert checking["current_balance"] == 1000
+
+
+async def test_retyping_account_to_loan_resigns_opening_balance_without_balance_update(
+ client: AsyncClient,
+ auth_headers,
+):
+ created = await client.post(
+ "/api/accounts",
+ headers=auth_headers,
+ json={"name": "Mortgage", "type": "checking", "balance": 200000, "currency": "EUR"},
+ )
+ assert created.status_code == 201, created.text
+
+ updated = await client.patch(
+ f"/api/accounts/{created.json()['id']}",
+ headers=auth_headers,
+ json={"type": "loan"},
+ )
+
+ assert updated.status_code == 200, updated.text
+ accounts = (await client.get("/api/accounts", headers=auth_headers)).json()
+ mortgage = next(row for row in accounts if row["id"] == created.json()["id"])
+ assert mortgage["current_balance"] == -200000
+
+
+async def test_a_bank_connected_account_cannot_become_a_loan(
+ client: AsyncClient,
+ auth_headers,
+ session: AsyncSession,
+ test_user: User,
+ test_workspace: Workspace,
+):
+ from datetime import datetime, timezone
+
+ from app.models.account import Account
+ from app.models.bank_connection import BankConnection
+
+ connection = BankConnection(
+ id=uuid.uuid4(),
+ user_id=test_user.id,
+ workspace_id=test_workspace.id,
+ provider="enable_banking",
+ external_id=f"ext-{uuid.uuid4().hex[:8]}",
+ institution_name="Lender",
+ credentials={"token": "fake"},
+ status="active",
+ last_sync_at=datetime.now(timezone.utc),
+ created_at=datetime.now(timezone.utc),
+ )
+ session.add(connection)
+ await session.flush()
+ account = Account(
+ id=uuid.uuid4(),
+ user_id=test_user.id,
+ workspace_id=test_workspace.id,
+ connection_id=connection.id,
+ external_id="acc-1",
+ name="Lender account",
+ type="checking",
+ balance=-1000,
+ currency="EUR",
+ )
+ session.add(account)
+ await session.commit()
+
+ response = await client.patch(
+ f"/api/accounts/{account.id}", headers=auth_headers, json={"type": "loan"}
+ )
+
+ assert response.status_code == 400
+ assert "cannot be loans" in response.json()["detail"]
+
+
+async def test_retyping_the_linked_property_drops_the_link_and_keeps_the_loan_editable(
+ client: AsyncClient,
+ auth_headers,
+ session: AsyncSession,
+ test_user: User,
+ test_workspace: Workspace,
+):
+ home = await _asset(session, test_user, test_workspace, "real_estate")
+ loan = (
+ await client.post(
+ "/api/accounts",
+ headers=auth_headers,
+ json={"name": "Mortgage", "type": "loan", "balance": 1000, "secured_asset_id": str(home.id)},
+ )
+ ).json()
+
+ retyped_asset = await client.patch(
+ f"/api/assets/{home.id}", headers=auth_headers, json={"type": "other"}
+ )
+ listed = (await client.get("/api/accounts", headers=auth_headers)).json()
+ renamed = await client.patch(
+ f"/api/accounts/{loan['id']}", headers=auth_headers, json={"name": "Old mortgage"}
+ )
+
+ assert retyped_asset.status_code == 200, retyped_asset.text
+ assert next(row for row in listed if row["id"] == loan["id"])["secured_asset_id"] is None
+ assert renamed.status_code == 200, renamed.text
+
+
+async def test_retyping_a_loan_also_moves_the_opening_balance_date(
+ client: AsyncClient,
+ auth_headers,
+ session: AsyncSession,
+):
+ loan = (
+ await client.post(
+ "/api/accounts",
+ headers=auth_headers,
+ json={"name": "Loan", "type": "loan", "balance": 1000, "balance_date": "2026-01-10"},
+ )
+ ).json()
+
+ retyped = await client.patch(
+ f"/api/accounts/{loan['id']}",
+ headers=auth_headers,
+ json={"type": "checking", "balance_date": "2026-02-20"},
+ )
+
+ assert retyped.status_code == 200, retyped.text
+ opening = await session.scalar(
+ select(Transaction).where(
+ Transaction.account_id == uuid.UUID(loan["id"]),
+ Transaction.source == "opening_balance",
+ )
+ )
+ assert opening is not None
+ assert opening.type == "credit"
+ assert opening.date == date(2026, 2, 20)
+
+
+async def test_a_car_loan_can_be_linked_to_a_vehicle(
+ client: AsyncClient,
+ auth_headers,
+ session: AsyncSession,
+ test_user: User,
+ test_workspace: Workspace,
+):
+ car = await _asset(session, test_user, test_workspace, "vehicle")
+
+ created = await client.post(
+ "/api/accounts",
+ headers=auth_headers,
+ json={"name": "Car financing", "type": "loan", "balance": 30000, "secured_asset_id": str(car.id)},
+ )
+
+ assert created.status_code == 201, created.text
+ assert created.json()["secured_asset_id"] == str(car.id)
+
+
[email protected]("from_type,to_type", [("loan", "checking"), ("checking", "loan")])
+async def test_an_account_with_transactions_cannot_switch_to_or_from_a_loan(
+ client: AsyncClient,
+ auth_headers,
+ from_type: str,
+ to_type: str,
+):
+ account = (
+ await client.post(
+ "/api/accounts",
+ headers=auth_headers,
+ json={"name": "Account", "type": from_type, "balance": 1000},
+ )
+ ).json()
+ posted = await client.post(
+ "/api/transactions",
+ headers=auth_headers,
+ json={
+ "account_id": account["id"],
+ "description": "Payment",
+ "amount": 100,
+ "type": "credit",
+ "date": app_today().isoformat(),
+ },
+ )
+ assert posted.status_code == 201, posted.text
+
+ retyped = await client.patch(
+ f"/api/accounts/{account['id']}", headers=auth_headers, json={"type": to_type}
+ )
+
+ assert retyped.status_code == 400
+ assert "cannot switch" in retyped.json()["detail"]
+
+
+async def test_balance_history_leaves_loans_out(client: AsyncClient, auth_headers):
+ month_start = app_today().replace(day=1)
+ opened = (month_start - timedelta(days=1)).replace(day=1)
+ for body in (
+ {"name": "Checking", "type": "checking", "balance": 1000},
+ {"name": "Mortgage", "type": "loan", "balance": 200000},
+ ):
+ created = await client.post(
+ "/api/accounts",
+ headers=auth_headers,
+ json={**body, "balance_date": opened.isoformat()},
+ )
+ assert created.status_code == 201, created.text
+
+ history = await client.get("/api/dashboard/balance-history", headers=auth_headers)
+
+ assert history.status_code == 200, history.text
+ first_day = next(point for point in history.json()["current"] if point["day"] == 1)
+ assert first_day["balance"] == 1000
diff --git a/frontend/src/components/app-layout.tsx b/frontend/src/components/app-layout.tsx
index 95edb0d9..0e157293 100644
--- a/frontend/src/components/app-layout.tsx
+++ b/frontend/src/components/app-layout.tsx
@@ -1,5 +1,5 @@
import { useState, useCallback, useEffect, useMemo, lazy, Suspense } from 'react'
-import { getAccountName, sortAccountsByAbsoluteBalance, sumAccountBalances } from '@/lib/account-utils'
+import { getAccountName, sortAccountsByAbsoluteBalance, sumAccountsTotal } from '@/lib/account-utils'
import { Link, Outlet, useLocation, useNavigate } from 'react-router-dom'
import { useTranslation } from 'react-i18next'
import { useDisplayLocale } from '@/hooks/use-display-locale'
@@ -196,7 +196,7 @@ export function AppLayout() {
const visibleAccounts = activeAccountIds
? allAccounts.filter((a) => activeAccountIds.includes(a.id))
: allAccounts
- const totalBalance = sumAccountBalances(visibleAccounts)
+ const totalBalance = sumAccountsTotal(visibleAccounts)
const versionA11yLabel = t('app.versionAriaLabel', { version: APP_VERSION })
return (
diff --git a/frontend/src/components/property-equity-summary.test.tsx b/frontend/src/components/property-equity-summary.test.tsx
new file mode 100644
index 00000000..4ff13775
--- /dev/null
+++ b/frontend/src/components/property-equity-summary.test.tsx
@@ -0,0 +1,47 @@
+import { screen } from '@testing-library/react'
+import { describe, expect, it } from 'vitest'
+
+import { PropertyEquitySummary } from '@/components/property-equity-summary'
+import { formatCurrency } from '@/lib/format'
+import { renderWithProviders, t } from '@/test/utils'
+import type { Account, Asset } from '@/types'
+
+const home = { id: 'home', type: 'real_estate', current_value: 500000, current_value_primary: null } as Asset
+
+function loan(id: string, name: string, balance: number, securedTo: string | null = 'home') {
+ return {
+ id, name, display_name: null, type: 'loan', secured_asset_id: securedTo,
+ current_balance: balance, balance_primary: null, currency: 'EUR',
+ } as unknown as Account
+}
+
+const props = { currency: 'EUR', locale: 'en-US', mask: (value: string) => value }
+
+describe('PropertyEquitySummary', () => {
+ it('lists the linked loans with the debt and the equity left', () => {
+ renderWithProviders(
+ <PropertyEquitySummary
+ asset={home}
+ loans={[loan('a', 'Part A', -200000), loan('b', 'Part B', -50000), loan('c', 'Elsewhere', -9000, 'other')]}
+ {...props}
+ />,
+ )
+
+ expect(screen.getByText('Part A')).toBeInTheDocument()
+ expect(screen.getByText('Part B')).toBeInTheDocument()
+ expect(screen.queryByText('Elsewhere')).not.toBeInTheDocument()
+ expect(screen.getByText(t('assets.propertyEquity', {
+ value: formatCurrency(500000, 'EUR', 'en-US'),
+ debt: formatCurrency(250000, 'EUR', 'en-US'),
+ equity: formatCurrency(250000, 'EUR', 'en-US'),
+ }))).toBeInTheDocument()
+ })
+
+ it('shows nothing for a property without a linked loan', () => {
+ const { container } = renderWithProviders(
+ <PropertyEquitySummary asset={home} loans={[loan('c', 'Elsewhere', -9000, 'other')]} {...props} />,
+ )
+
+ expect(container).toBeEmptyDOMElement()
+ })
+})
diff --git a/frontend/src/components/property-equity-summary.tsx b/frontend/src/components/property-equity-summary.tsx
new file mode 100644
index 00000000..c15aa0c3
--- /dev/null
+++ b/frontend/src/components/property-equity-summary.tsx
@@ -0,0 +1,54 @@
+import { Link } from 'react-router-dom'
+import { useTranslation } from 'react-i18next'
+
+import { formatCurrency } from '@/lib/format'
+import { getLoanDebtPrimary, getPropertyEquity } from '@/lib/property-equity'
+import type { Account, Asset } from '@/types'
+
+/**
+ * The loans secured against a property, with its value, debt and equity.
+ * Renders nothing for a property without a linked loan.
+ */
+export function PropertyEquitySummary({
+ asset,
+ loans,
+ currency,
+ locale,
+ mask,
+}: {
+ asset: Asset
+ loans: Account[]
+ currency: string
+ locale: string
+ mask: (value: string) => string
+}) {
+ const { t } = useTranslation()
+ const linked = loans.filter(loan => loan.type === 'loan' && loan.secured_asset_id === asset.id)
+ const equity = getPropertyEquity(asset, linked)
+ if (linked.length === 0 || !equity) return null
+
+ return (
+ <div className="px-4 py-3 border-t border-border bg-muted/20 space-y-2">
+ <h3 className="text-xs font-semibold">{t('assets.linkedLoans')}</h3>
+ <div className="space-y-1">
+ {linked.map(loan => (
+ <div key={loan.id} className="flex items-center justify-between gap-3 text-xs">
+ <Link to={`/accounts/${loan.id}`} className="text-muted-foreground hover:underline truncate">
+ {loan.display_name || loan.name}
+ </Link>
+ <span className="tabular-nums shrink-0">
+ {mask(formatCurrency(getLoanDebtPrimary(loan), currency, locale))}
+ </span>
+ </div>
+ ))}
+ </div>
+ <p className="pt-2 border-t border-border text-xs font-medium">
+ {t('assets.propertyEquity', {
+ value: mask(formatCurrency(equity.value, currency, locale)),
+ debt: mask(formatCurrency(equity.debt, currency, locale)),
+ equity: mask(formatCurrency(equity.equity, currency, locale)),
+ })}
+ </p>
+ </div>
+ )
+}
diff --git a/frontend/src/lib/account-type-config.ts b/frontend/src/lib/account-type-config.ts
index 0ae1f1f3..a93d754f 100644
--- a/frontend/src/lib/account-type-config.ts
+++ b/frontend/src/lib/account-type-config.ts
@@ -1,5 +1,5 @@
import type { ElementType } from 'react'
-import { Building2, PiggyBank, CreditCard, TrendingUp, Wallet } from 'lucide-react'
+import { Building2, PiggyBank, CreditCard, TrendingUp, Wallet, Landmark } from 'lucide-react'
// Account-type → icon/color, the fallback shown when an account has no bank
// logo (manual accounts, and connected accounts whose provider exposes none).
@@ -10,6 +10,7 @@ export const ACCOUNT_TYPE_CONFIG: Record<
checking: { icon: Building2, color: 'text-indigo-600', bg: 'bg-indigo-100', label: 'accounts.typeChecking' },
savings: { icon: PiggyBank, color: 'text-emerald-600', bg: 'bg-emerald-100', label: 'accounts.typeSavings' },
credit_card: { icon: CreditCard, color: 'text-violet-600', bg: 'bg-violet-100', label: 'accounts.typeCreditCard' },
+ loan: { icon: Landmark, color: 'text-rose-600', bg: 'bg-rose-100', label: 'accounts.typeLoan' },
investment: { icon: TrendingUp, color: 'text-amber-600', bg: 'bg-amber-100', label: 'accounts.typeInvestment' },
wallet: { icon: Wallet, color: 'text-rose-600', bg: 'bg-rose-100', label: 'accounts.typeWallet' },
}
diff --git a/frontend/src/lib/account-utils.test.ts b/frontend/src/lib/account-utils.test.ts
index e6aeda9e..5f829e1b 100644
--- a/frontend/src/lib/account-utils.test.ts
+++ b/frontend/src/lib/account-utils.test.ts
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest'
-import { sortAccountsByAbsoluteBalance, sortAccountsByDisplayName } from './account-utils'
+import { sortAccountsByAbsoluteBalance, sortAccountsByDisplayName, sumAccountsTotal } from './account-utils'
describe('sortAccountsByDisplayName', () => {
it('orders accounts by display name when present and falls back to name', () => {
@@ -78,3 +78,15 @@ describe('sortAccountsByAbsoluteBalance', () => {
expect(accounts.map((account) => account.id)).toEqual(['small', 'large'])
})
})
+
+describe('sumAccountsTotal', () => {
+ it('leaves loans out of the accounts total', () => {
+ const accounts = [
+ { type: 'checking', current_balance: 4000, balance_primary: null, shared_balance_group: null },
+ { type: 'credit_card', current_balance: -500, balance_primary: null, shared_balance_group: null },
+ { type: 'loan', current_balance: -200000, balance_primary: null, shared_balance_group: null },
+ ]
+
+ expect(sumAccountsTotal(accounts)).toBe(3500)
+ })
+})
diff --git a/frontend/src/lib/account-utils.ts b/frontend/src/lib/account-utils.ts
index b3ba59b5..560d935b 100644
--- a/frontend/src/lib/account-utils.ts
+++ b/frontend/src/lib/account-utils.ts
@@ -22,6 +22,16 @@ export function sumAccountBalances(
}, 0)
}
+/**
+ * The accounts total the sidebar shows. Loans are long-term debt that the
+ * net worth already counts, so they stay out of this money-on-hand total.
+ */
+export function sumAccountsTotal(
+ accounts: readonly Pick<Account, 'type' | 'balance_primary' | 'current_balance' | 'shared_balance_group'>[],
+): number {
+ return sumAccountBalances(accounts.filter((account) => account.type !== 'loan'))
+}
+
/**
* Return a presentation-only copy ordered by the name users see.
* The input is never mutated, which keeps React Query's cached account list intact.
diff --git a/frontend/src/lib/api.ts b/frontend/src/lib/api.ts
index 452eacf5..7e00286d 100644
--- a/frontend/src/lib/api.ts
+++ b/frontend/src/lib/api.ts
@@ -496,6 +496,7 @@ export const accounts = {
balance?: number
balance_date?: string
currency?: string
+ secured_asset_id?: string | null
credit_limit?: number | null
statement_close_day?: number | null
payment_due_day?: number | null
diff --git a/frontend/src/lib/property-equity.test.ts b/frontend/src/lib/property-equity.test.ts
new file mode 100644
index 00000000..3e346dc6
--- /dev/null
+++ b/frontend/src/lib/property-equity.test.ts
@@ -0,0 +1,34 @@
+import { describe, expect, it } from 'vitest'
+
+import { getLoanDebtPrimary, getPropertyEquity } from '@/lib/property-equity'
+
+describe('property equity', () => {
+ const property = { id: 'home', current_value: 593000, current_value_primary: null }
+ const loans = [
+ { type: 'loan', secured_asset_id: 'home', current_balance: -194723.17, balance_primary: null },
+ { type: 'loan', secured_asset_id: 'home', current_balance: -23556.84, balance_primary: null },
+ { type: 'loan', secured_asset_id: 'other', current_balance: -48802.47, balance_primary: null },
+ ]
+
+ it('deducts every loan linked to the property once', () => {
+ const result = getPropertyEquity(property, loans)
+ expect(result?.debt).toBeCloseTo(218280.01, 2)
+ expect(result?.equity).toBeCloseTo(374719.99, 2)
+ })
+
+ it('uses converted balances when a loan is in another currency', () => {
+ const result = getPropertyEquity(
+ { ...property, current_value_primary: 600000 },
+ [{ ...loans[0], balance_primary: -200000 }],
+ )
+ expect(result).toEqual({ value: 600000, debt: 200000, equity: 400000 })
+ })
+
+ it('does not count an overpaid loan as debt', () => {
+ expect(getLoanDebtPrimary({ current_balance: 25, balance_primary: null })).toBe(0)
+ })
+
+ it('has no equity to show for a property without a value', () => {
+ expect(getPropertyEquity({ ...property, current_value: null }, loans)).toBeNull()
+ })
+})
diff --git a/frontend/src/lib/property-equity.ts b/frontend/src/lib/property-equity.ts
new file mode 100644
index 00000000..63a41a05
--- /dev/null
+++ b/frontend/src/lib/property-equity.ts
@@ -0,0 +1,26 @@
+import type { Account, Asset } from '@/types'
+import { getAssetValuePrimary } from '@/lib/asset-portfolio-share'
+
+/** Asset types a loan can be secured against (a mortgage, a car financing). */
+export const LOAN_COLLATERAL_TYPES: readonly string[] = ['real_estate', 'vehicle']
+
+type ValuedProperty = Pick<Asset, 'id' | 'current_value' | 'current_value_primary'>
+type SecuredLoan = Pick<Account, 'type' | 'secured_asset_id' | 'current_balance' | 'balance_primary'>
+
+/** Loan debt in the user's primary currency. An overpaid loan owes nothing. */
+export function getLoanDebtPrimary(loan: Pick<Account, 'current_balance' | 'balance_primary'>): number {
+ return Math.max(0, -Number(loan.balance_primary ?? loan.current_balance))
+}
+
+/** Value, linked debt and equity of a property, in the user's primary currency. */
+export function getPropertyEquity(
+ property: ValuedProperty,
+ accounts: SecuredLoan[],
+): { value: number; debt: number; equity: number } | null {
+ const value = getAssetValuePrimary(property)
+ if (value == null) return null
+ const debt = accounts
+ .filter(account => account.type === 'loan' && account.secured_asset_id === property.id)
+ .reduce((total, loan) => total + getLoanDebtPrimary(loan), 0)
+ return { value, debt, equity: value - debt }
+}
diff --git a/frontend/src/locales/cs.json b/frontend/src/locales/cs.json
index c8a0f587..d4388eae 100644
--- a/frontend/src/locales/cs.json
+++ b/frontend/src/locales/cs.json
@@ -845,6 +845,7 @@
"netWorth": "Čisté jmění",
"netWorthTooltip": "Účty + investice, po odečtení otevřených výpisů kreditní karty.",
"creditCardBalance": "Otevřené výpisy kreditní karty",
+ "loanBalance": "Úvěry a financování",
"pendingSharesOwe": "Netto {{net}} po skupinových dluzích ({{owed}} čeká na vyrovnání)",
"pendingSharesOwed": "Netto {{net}} včetně {{owed}}, které vám dluží",
"pendingSharesTooltip": "Zohledňuje, co dlužíte / co vám dluží ve vašich skupinách, před vyrovnáním.",
@@ -1259,6 +1260,12 @@
"typeCreditCard": "Kreditní karta",
"typeInvestment": "Investiční účet",
"typeWallet": "Peněženka",
+ "typeLoan": "Úvěr / financování",
+ "securedProperty": "Propojený majetek",
+ "noSecuredProperty": "Žádný propojený majetek",
+ "loanRetypeHint": "Pouze účet bez transakcí může přejít na typ Úvěr nebo z něj.",
+ "loanRetypeBlocked": "Tento účet má transakce, takže nemůže přejít na typ Úvěr ani z něj. Vytvořte místo toho nový úvěrový účet.",
+ "balanceLoan": "Nesplacený dluh",
"creditLimit": "Úvěrový limit",
"statementCloseDay": "Den uzávěrky výpisu",
"paymentDueDay": "Den splatnosti",
@@ -1918,6 +1925,8 @@
},
"assets": {
"title": "Aktiva",
+ "linkedLoans": "Propojené úvěry",
+ "propertyEquity": "Hodnota {{value}} · Dluh {{debt}} · Vlastní kapitál {{equity}}",
"addAsset": "Přidat aktivum",
"oversellWarning": "Máte jen {{available}} ks — krátké pozice nejsou podporovány.",
"noPriceBadge": "bez ceny",
diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json
index d1b3eb7e..42b16e7a 100644
--- a/frontend/src/locales/de.json
+++ b/frontend/src/locales/de.json
@@ -821,6 +821,7 @@
"netWorth": "Nettovermögen",
"netWorthTooltip": "Konten + Investitionen, abzüglich offener Kreditkartenrechnungen.",
"creditCardBalance": "Offene Kreditkartenrechnungen",
+ "loanBalance": "Kredite und Finanzierungen",
"pendingSharesOwe": "Netto {{net}} nach Gruppenschulden ({{owed}} ausstehend)",
"pendingSharesOwed": "Netto {{net}} einschließlich {{owed}}, die dir geschuldet werden",
"pendingSharesTooltip": "Spiegelt wider, was du in deinen Gruppen schuldest / dir geschuldet wird, vor einer Abrechnung.",
@@ -1188,6 +1189,12 @@
"typeCreditCard": "Kreditkarte",
"typeInvestment": "Depot",
"typeWallet": "Bargeld",
+ "typeLoan": "Kredit / Finanzierung",
+ "securedProperty": "Verknüpfter Vermögenswert",
+ "noSecuredProperty": "Kein verknüpfter Vermögenswert",
+ "loanRetypeHint": "Nur ein Konto ohne Buchungen kann zu Kredit oder von Kredit wechseln.",
+ "loanRetypeBlocked": "Dieses Konto hat Buchungen und kann daher nicht zu Kredit oder von Kredit wechseln. Lege stattdessen ein neues Kreditkonto an.",
+ "balanceLoan": "Offene Schuld",
"creditLimit": "Kreditlimit",
"statementCloseDay": "Abrechnungsstichtag",
"paymentDueDay": "Zahlungstermin",
@@ -1919,7 +1926,9 @@
"total": "Gesamt",
"confirmRegenerateTitle": "Werte neu generieren?",
"confirmRegenerate": "Wachstumsparameter wurden geändert. Alle automatisch generierten Werte werden gelöscht und neu berechnet. Manuell eingegebene Werte bleiben erhalten.",
- "regenerate": "Neu generieren"
+ "regenerate": "Neu generieren",
+ "linkedLoans": "Verknüpfte Kredite",
+ "propertyEquity": "Wert {{value}} · Schuld {{debt}} · Eigenkapital {{equity}}"
},
"reports": {
"section": "Analysen",
diff --git a/frontend/src/locales/el.json b/frontend/src/locales/el.json
index 97cf248d..0bee0629 100644
--- a/frontend/src/locales/el.json
+++ b/frontend/src/locales/el.json
@@ -821,6 +821,7 @@
"netWorth": "Καθαρή θέση",
"netWorthTooltip": "Λογαριασμοί + επενδύσεις, μείον τις ανεξόφλητες οφειλές πιστωτικών καρτών.",
"creditCardBalance": "Ανεξόφλητες οφειλές πιστωτικών καρτών",
+ "loanBalance": "Δάνεια και χρηματοδοτήσεις",
"pendingSharesOwe": "Καθαρό {{net}} μετά από ομαδικά χρέη ({{owed}} σε εκκρεμότητα)",
"pendingSharesOwed": "Καθαρό {{net}} συμπεριλαμβανομένων {{owed}} που σας οφείλονται",
"pendingSharesTooltip": "Αντικατοπτρίζει όσα οφείλετε / σας οφείλονται στις ομάδες σας, πριν από οποιονδήποτε διακανονισμό.",
@@ -916,6 +917,12 @@
"typeCreditCard": "Πιστωτική κάρτα",
"typeInvestment": "Επενδυτικός",
"typeWallet": "Πορτοφόλι",
+ "typeLoan": "Δάνειο / χρηματοδότηση",
+ "securedProperty": "Συνδεδεμένο περιουσιακό στοιχείο",
+ "noSecuredProperty": "Κανένα συνδεδεμένο περιουσιακό στοιχείο",
+ "loanRetypeHint": "Μόνο ένας λογαριασμός χωρίς συναλλαγές μπορεί να αλλάξει σε ή από Δάνειο.",
+ "loanRetypeBlocked": "Αυτός ο λογαριασμός έχει συναλλαγές, οπότε δεν μπορεί να αλλάξει σε ή από Δάνειο. Δημιουργήστε έναν νέο λογαριασμό δανείου.",
+ "balanceLoan": "Ανεξόφλητο χρέος",
"creditLimit": "Πιστωτικό όριο",
"statementCloseDay": "Ημέρα κλεισίματος λογαριασμού",
"paymentDueDay": "Ημέρα λήξης πληρωμής",
@@ -1918,7 +1925,9 @@
"total": "Σύνολο",
"confirmRegenerateTitle": "Επανυπολογισμός αξιών;",
"confirmRegenerate": "Οι παράμετροι ανάπτυξης άλλαξαν. Όλες οι αυτόματα παραγόμενες τιμές θα διαγραφούν και θα επανυπολογιστούν. Οι χειροκίνητες τιμές θα διατηρηθούν.",
- "regenerate": "Επανυπολογισμός"
+ "regenerate": "Επανυπολογισμός",
+ "linkedLoans": "Συνδεδεμένα δάνεια",
+ "propertyEquity": "Αξία {{value}} · Χρέος {{debt}} · Καθαρή αξία {{equity}}"
},
"payees": {
"noPayeeFound": "Δεν βρέθηκε δικαιούχος.",
diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json
index 1a937314..ccd76e38 100644
--- a/frontend/src/locales/en.json
+++ b/frontend/src/locales/en.json
@@ -821,6 +821,7 @@
"netWorth": "Net Worth",
"netWorthTooltip": "Accounts + investments, minus open credit card bills.",
"creditCardBalance": "Open credit card bills",
+ "loanBalance": "Loans",
"pendingSharesOwe": "Net {{net}} after group debts ({{owed}} pending)",
"pendingSharesOwed": "Net {{net}} including {{owed}} owed to you",
"pendingSharesTooltip": "Reflects what you owe / are owed across your groups, before any settlement.",
@@ -1187,6 +1188,12 @@
"typeCreditCard": "Credit Card",
"typeInvestment": "Investment",
"typeWallet": "Wallet",
+ "typeLoan": "Loan",
+ "securedProperty": "Linked asset",
+ "noSecuredProperty": "No linked asset",
+ "loanRetypeHint": "Only an account without transactions can switch to or from Loan.",
+ "loanRetypeBlocked": "This account has transactions, so it can't switch to or from Loan. Create a new loan account instead.",
+ "balanceLoan": "Outstanding debt",
"creditLimit": "Credit limit",
"statementCloseDay": "Statement close day",
"paymentDueDay": "Payment due day",
@@ -1918,7 +1925,9 @@
"total": "Total",
"confirmRegenerateTitle": "Regenerate values?",
"confirmRegenerate": "Growth parameters changed. All automatically generated values will be deleted and recalculated. Manual values will be kept.",
- "regenerate": "Regenerate"
+ "regenerate": "Regenerate",
+ "linkedLoans": "Linked loans",
+ "propertyEquity": "Value {{value}} · Debt {{debt}} · Equity {{equity}}"
},
"reports": {
"section": "Analytics",
diff --git a/frontend/src/locales/es.json b/frontend/src/locales/es.json
index 669cf25b..a85f897a 100644
--- a/frontend/src/locales/es.json
+++ b/frontend/src/locales/es.json
@@ -823,6 +823,7 @@
"netWorth": "Patrimonio neto",
"netWorthTooltip": "Cuentas + inversiones, descontando las facturas de tarjeta abiertas.",
"creditCardBalance": "Facturas de tarjeta abiertas",
+ "loanBalance": "Préstamos y financiaciones",
"pendingSharesOwe": "Neto {{net}} después de deudas del grupo ({{owed}} pendientes)",
"pendingSharesOwed": "Neto {{net}} incluyendo {{owed}} que te deben",
"pendingSharesTooltip": "Refleja lo que debes / te deben en tus grupos, antes de cualquier liquidación.",
@@ -1191,6 +1192,12 @@
"typeCreditCard": "Tarjeta de crédito",
"typeInvestment": "Inversión",
"typeWallet": "Cartera",
+ "typeLoan": "Préstamo / financiación",
+ "securedProperty": "Bien vinculado",
+ "noSecuredProperty": "Ningún bien vinculado",
+ "loanRetypeHint": "Solo una cuenta sin transacciones puede cambiar a Préstamo o desde Préstamo.",
+ "loanRetypeBlocked": "Esta cuenta tiene transacciones, así que no puede cambiar a Préstamo o desde Préstamo. Crea una nueva cuenta de préstamo.",
+ "balanceLoan": "Deuda pendiente",
"creditLimit": "Límite de crédito",
"statementCloseDay": "Día de cierre de estado",
"paymentDueDay": "Día de vencimiento",
@@ -1922,7 +1929,9 @@
"total": "Total",
"confirmRegenerateTitle": "¿Regenerar valores?",
"confirmRegenerate": "Los parámetros de crecimiento cambiaron. Todos los valores generados automáticamente se eliminarán y recalcularán. Se conservarán los valores manuales.",
- "regenerate": "Regenerar"
+ "regenerate": "Regenerar",
+ "linkedLoans": "Préstamos vinculados",
+ "propertyEquity": "Valor {{value}} · Deuda {{debt}} · Patrimonio {{equity}}"
},
"reports": {
"section": "Analítica",
diff --git a/frontend/src/locales/fr.json b/frontend/src/locales/fr.json
index a6ee22a1..641c5364 100644
--- a/frontend/src/locales/fr.json
+++ b/frontend/src/locales/fr.json
@@ -823,6 +823,7 @@
"netWorth": "Valeur nette",
"netWorthTooltip": "Comptes + investissements, moins les factures de carte ouvertes.",
"creditCardBalance": "Factures de carte ouvertes",
+ "loanBalance": "Prêts et financements",
"pendingSharesOwe": "Net {{net}} après dettes de groupe ({{owed}} en attente)",
"pendingSharesOwed": "Net {{net}} incluant {{owed}} qui vous sont dus",
"pendingSharesTooltip": "Reflète ce que vous devez / ce qu'on vous doit dans vos groupes, avant tout règlement.",
@@ -1191,6 +1192,12 @@
"typeCreditCard": "Carte de crédit",
"typeInvestment": "Investissement",
"typeWallet": "Portefeuille",
+ "typeLoan": "Prêt / financement",
+ "securedProperty": "Bien lié",
+ "noSecuredProperty": "Aucun bien lié",
+ "loanRetypeHint": "Seul un compte sans transactions peut passer au type Prêt ou le quitter.",
+ "loanRetypeBlocked": "Ce compte a des transactions : il ne peut ni passer au type Prêt ni le quitter. Créez plutôt un nouveau compte de prêt.",
+ "balanceLoan": "Dette restante",
"creditLimit": "Limite de crédit",
"statementCloseDay": "Jour de clôture du relevé",
"paymentDueDay": "Jour d'échéance du paiement",
@@ -1922,7 +1929,9 @@
"total": "Total",
"confirmRegenerateTitle": "Régénérer les valeurs ?",
"confirmRegenerate": "Les paramètres de croissance ont changé. Toutes les valeurs générées automatiquement seront supprimées et recalculées. Les valeurs manuelles seront conservées.",
- "regenerate": "Régénérer"
+ "regenerate": "Régénérer",
+ "linkedLoans": "Prêts liés",
+ "propertyEquity": "Valeur {{value}} · Dette {{debt}} · Valeur nette {{equity}}"
},
"reports": {
"section": "Analyses",
diff --git a/frontend/src/locales/hi.json b/frontend/src/locales/hi.json
index c2e425b8..137c174c 100644
--- a/frontend/src/locales/hi.json
+++ b/frontend/src/locales/hi.json
@@ -821,6 +821,7 @@
"netWorth": "कुल संपत्ति",
"netWorthTooltip": "खाते + निवेश, घटा बकाया क्रेडिट कार्ड बिल।",
"creditCardBalance": "बकाया क्रेडिट कार्ड बिल",
+ "loanBalance": "ऋण और वित्तपोषण",
"pendingSharesOwe": "समूह क़र्ज़ों के बाद निवल {{net}} ({{owed}} लंबित)",
"pendingSharesOwed": "आपको मिलने वाले {{owed}} सहित निवल {{net}}",
"pendingSharesTooltip": "किसी भी निपटान से पहले, आपके समूहों में आप पर क्या बकाया है / आपको क्या मिलना है, यह दर्शाता है।",
@@ -1187,6 +1188,12 @@
"typeCreditCard": "क्रेडिट कार्ड",
"typeInvestment": "निवेश",
"typeWallet": "वॉलेट",
+ "typeLoan": "ऋण / वित्तपोषण",
+ "securedProperty": "जुड़ी हुई संपत्ति",
+ "noSecuredProperty": "कोई जुड़ी हुई संपत्ति नहीं",
+ "loanRetypeHint": "केवल बिना लेन-देन वाला खाता ऋण प्रकार में या उससे बदला जा सकता है।",
+ "loanRetypeBlocked": "इस खाते में लेन-देन हैं, इसलिए इसे ऋण प्रकार में या उससे नहीं बदला जा सकता। इसके बजाय एक नया ऋण खाता बनाएँ।",
+ "balanceLoan": "बकाया ऋण",
"creditLimit": "क्रेडिट सीमा",
"statementCloseDay": "स्टेटमेंट बंद होने का दिन",
"paymentDueDay": "भुगतान देय दिन",
@@ -1918,7 +1925,9 @@
"total": "कुल",
"confirmRegenerateTitle": "मूल्य दोबारा बनाएँ?",
"confirmRegenerate": "वृद्धि पैरामीटर बदले। अपने आप बने सभी मूल्य हटा दिए जाएँगे और दोबारा गणना किए जाएँगे। मैन्युअल मूल्य रखे जाएँगे।",
- "regenerate": "दोबारा बनाएँ"
+ "regenerate": "दोबारा बनाएँ",
+ "linkedLoans": "जुड़े हुए ऋण",
+ "propertyEquity": "मूल्य {{value}} · ऋण {{debt}} · इक्विटी {{equity}}"
},
"reports": {
"section": "एनालिटिक्स",
diff --git a/frontend/src/locales/hu.json b/frontend/src/locales/hu.json
index ef0cc8a5..cb51e269 100644
--- a/frontend/src/locales/hu.json
+++ b/frontend/src/locales/hu.json
@@ -821,6 +821,7 @@
"netWorth": "Nettó vagyon",
"netWorthTooltip": "Számlák + befektetések, mínusz a nyitott hitelkártya-számlák.",
"creditCardBalance": "Nyitott hitelkártya-számlák",
+ "loanBalance": "Hitelek és finanszírozások",
"pendingSharesOwe": "Nettó {{net}} a csoportos tartozások után ({{owed}} függőben)",
"pendingSharesOwed": "Nettó {{net}}, benne {{owed}}, amivel neked tartoznak",
"pendingSharesTooltip": "Azt mutatja, mennyivel tartozol, illetve mennyivel tartoznak neked a csoportjaidban, bármilyen kiegyenlítés előtt.",
@@ -1187,6 +1188,12 @@
"typeCreditCard": "Hitelkártya",
"typeInvestment": "Befektetés",
"typeWallet": "Pénztárca",
+ "typeLoan": "Hitel / finanszírozás",
+ "securedProperty": "Kapcsolt vagyontárgy",
+ "noSecuredProperty": "Nincs kapcsolt vagyontárgy",
+ "loanRetypeHint": "Csak tranzakciók nélküli számla váltható Hitel típusra vagy arról.",
+ "loanRetypeBlocked": "Ennek a számlának vannak tranzakciói, ezért nem váltható Hitel típusra vagy arról. Hozz létre helyette egy új hitelszámlát.",
+ "balanceLoan": "Fennálló tartozás",
"creditLimit": "Hitelkeret",
"statementCloseDay": "Kivonat zárónapja",
"paymentDueDay": "Fizetési határidő napja",
@@ -1786,6 +1793,8 @@
},
"assets": {
"title": "Eszközök",
+ "linkedLoans": "Kapcsolt hitelek",
+ "propertyEquity": "Érték {{value}} · Tartozás {{debt}} · Saját tőke {{equity}}",
"addAsset": "Eszköz hozzáadása",
"oversellWarning": "Csak {{available}} egységed van — short pozíció nem támogatott.",
"noPriceBadge": "nincs bekerülési ár",
diff --git a/frontend/src/locales/it.json b/frontend/src/locales/it.json
index 56ad7955..0f0a4da7 100644
--- a/frontend/src/locales/it.json
+++ b/frontend/src/locales/it.json
@@ -823,6 +823,7 @@
"netWorth": "Patrimonio netto",
"netWorthTooltip": "Conti + investimenti, meno le fatture della carta di credito aperte.",
"creditCardBalance": "Fatture della carta aperte",
+ "loanBalance": "Prestiti e finanziamenti",
"pendingSharesOwe": "Netto {{net}} dopo i debiti di gruppo ({{owed}} in sospeso)",
"pendingSharesOwed": "Netto {{net}} incluso {{owed}} che ti è dovuto",
"pendingSharesTooltip": "Riflette ciò che devi / ti è dovuto nei tuoi gruppi, prima di qualsiasi saldo.",
@@ -1191,6 +1192,12 @@
"typeCreditCard": "Carta di credito",
"typeInvestment": "Investimento",
"typeWallet": "Portafoglio",
+ "typeLoan": "Prestito / finanziamento",
+ "securedProperty": "Bene collegato",
+ "noSecuredProperty": "Nessun bene collegato",
+ "loanRetypeHint": "Solo un conto senza transazioni può passare a Prestito o da Prestito.",
+ "loanRetypeBlocked": "Questo conto ha delle transazioni, quindi non può passare a Prestito o da Prestito. Crea invece un nuovo conto prestito.",
+ "balanceLoan": "Debito residuo",
"creditLimit": "Limite di credito",
"statementCloseDay": "Giorno di chiusura estratto",
"paymentDueDay": "Giorno di scadenza pagamento",
@@ -1922,7 +1929,9 @@
"total": "Totale",
"confirmRegenerateTitle": "Rigenerare i valori?",
"confirmRegenerate": "I parametri di crescita sono cambiati. Tutti i valori generati automaticamente saranno eliminati e ricalcolati. I valori manuali saranno mantenuti.",
- "regenerate": "Rigenera"
+ "regenerate": "Rigenera",
+ "linkedLoans": "Prestiti collegati",
+ "propertyEquity": "Valore {{value}} · Debito {{debt}} · Patrimonio netto {{equity}}"
},
"reports": {
"section": "Analisi",
diff --git a/frontend/src/locales/ja.json b/frontend/src/locales/ja.json
index 98f83e2c..202eedde 100644
--- a/frontend/src/locales/ja.json
+++ b/frontend/src/locales/ja.json
@@ -821,6 +821,7 @@
"netWorth": "純資産",
"netWorthTooltip": "口座+投資から、未払いのクレジットカード請求を差し引いた額。",
"creditCardBalance": "未払いのクレジットカード請求",
+ "loanBalance": "ローン",
"pendingSharesOwe": "グループの貸し借りを反映した純額 {{net}}({{owed}}件未精算)",
"pendingSharesOwed": "あなたへの未回収{{owed}}を含む純額 {{net}}",
"pendingSharesTooltip": "精算前の、グループ間の貸し借りを反映しています。",
@@ -1187,6 +1188,12 @@
"typeCreditCard": "クレジットカード",
"typeInvestment": "投資",
"typeWallet": "ウォレット",
+ "typeLoan": "ローン",
+ "securedProperty": "紐付けた資産",
+ "noSecuredProperty": "紐付けた資産なし",
+ "loanRetypeHint": "取引のない口座だけがローンとの間で種類を変更できます。",
+ "loanRetypeBlocked": "この口座には取引があるため、ローンとの間で種類を変更できません。新しいローン口座を作成してください。",
+ "balanceLoan": "残債",
"creditLimit": "利用枠",
"statementCloseDay": "締め日",
"paymentDueDay": "支払日",
@@ -1918,7 +1925,9 @@
"total": "合計",
"confirmRegenerateTitle": "価値を再生成しますか?",
"confirmRegenerate": "増加パラメータが変更されました。自動生成されたすべての価値が削除され再計算されます。手動入力の価値は保持されます。",
- "regenerate": "再生成"
+ "regenerate": "再生成",
+ "linkedLoans": "紐付けたローン",
+ "propertyEquity": "評価額 {{value}} · 負債 {{debt}} · 純資産 {{equity}}"
},
"reports": {
"section": "分析",
diff --git a/frontend/src/locales/nl.json b/frontend/src/locales/nl.json
index 2bd73469..ae9ee17e 100644
--- a/frontend/src/locales/nl.json
+++ b/frontend/src/locales/nl.json
@@ -821,6 +821,7 @@
"netWorth": "Nettovermogen",
"netWorthTooltip": "Rekeningen + beleggingen, min openstaande creditcardafschriften.",
"creditCardBalance": "Openstaande creditcardafschriften",
+ "loanBalance": "Leningen en financieringen",
"pendingSharesOwe": "Netto {{net}} na groepsschulden ({{owed}} in behandeling)",
"pendingSharesOwed": "Netto {{net}} inclusief {{owed}} aan u verschuldigd",
"pendingSharesTooltip": "Geeft weer wat u verschuldigd bent/is aan al uw groepen, vóór enige schikking.",
@@ -1188,6 +1189,12 @@
"typeCreditCard": "Creditcard",
"typeInvestment": "Investering",
"typeWallet": "Portemonnee",
+ "typeLoan": "Lening / financiering",
+ "securedProperty": "Gekoppelde bezitting",
+ "noSecuredProperty": "Geen gekoppelde bezitting",
+ "loanRetypeHint": "Alleen een rekening zonder transacties kan naar of van Lening wisselen.",
+ "loanRetypeBlocked": "Deze rekening heeft transacties en kan daarom niet naar of van Lening wisselen. Maak in plaats daarvan een nieuwe leningrekening aan.",
+ "balanceLoan": "Openstaande schuld",
"creditLimit": "Kredietlimiet",
"statementCloseDay": "Verklaring sluitingsdag",
"paymentDueDay": "Betalingsdatum",
@@ -1920,7 +1927,9 @@
"total": "Totaal",
"confirmRegenerateTitle": "Waarden opnieuw genereren?",
"confirmRegenerate": "Groeiparameters veranderd. Alle automatisch gegenereerde waarden worden verwijderd en opnieuw berekend. Handmatige waarden blijven behouden.",
- "regenerate": "Regenereer"
+ "regenerate": "Regenereer",
+ "linkedLoans": "Gekoppelde leningen",
+ "propertyEquity": "Waarde {{value}} · Schuld {{debt}} · Eigen vermogen {{equity}}"
},
"reports": {
"section": "Analyses",
diff --git a/frontend/src/locales/pl.json b/frontend/src/locales/pl.json
index cf5426d8..7cb04e99 100644
--- a/frontend/src/locales/pl.json
+++ b/frontend/src/locales/pl.json
@@ -829,6 +829,7 @@
"netWorth": "Majątek netto",
"netWorthTooltip": "Konta + inwestycje, pomniejszone o otwarte rachunki karty kredytowej.",
"creditCardBalance": "Otwarte rachunki karty kredytowej",
+ "loanBalance": "Kredyty i finansowania",
"pendingSharesOwe": "Netto {{net}} po długach grupowych ({{owed}} oczekuje)",
"pendingSharesOwed": "Netto {{net}}, w tym {{owed}} należne Tobie",
"pendingSharesTooltip": "Odzwierciedla to, co jesteś winien / co jest Ci winne w grupach, przed rozliczeniem.",
@@ -1231,6 +1232,12 @@
"typeCreditCard": "Karta kredytowa",
"typeInvestment": "Inwestycyjne",
"typeWallet": "Portfel",
+ "typeLoan": "Kredyt / finansowanie",
+ "securedProperty": "Powiązany składnik majątku",
+ "noSecuredProperty": "Brak powiązanego składnika majątku",
+ "loanRetypeHint": "Tylko konto bez transakcji może zmienić typ na Kredyt lub z Kredytu.",
+ "loanRetypeBlocked": "To konto ma transakcje, więc nie może zmienić typu na Kredyt ani z Kredytu. Utwórz zamiast tego nowe konto kredytowe.",
+ "balanceLoan": "Pozostałe zadłużenie",
"creditLimit": "Limit kredytowy",
"statementCloseDay": "Dzień zamknięcia okresu rozliczeniowego",
"paymentDueDay": "Dzień płatności",
@@ -2007,7 +2014,9 @@
"total": "Łącznie",
"confirmRegenerateTitle": "Przeliczyć wartości ponownie?",
"confirmRegenerate": "Zmieniono parametry wzrostu. Wszystkie automatycznie wygenerowane wartości zostaną usunięte i przeliczone ponownie. Wartości ręczne zostaną zachowane.",
- "regenerate": "Przelicz ponownie"
+ "regenerate": "Przelicz ponownie",
+ "linkedLoans": "Powiązane kredyty",
+ "propertyEquity": "Wartość {{value}} · Dług {{debt}} · Kapitał własny {{equity}}"
},
"reports": {
"section": "Analityka",
diff --git a/frontend/src/locales/pt-BR.json b/frontend/src/locales/pt-BR.json
index d10fa658..e5b8611c 100644
--- a/frontend/src/locales/pt-BR.json
+++ b/frontend/src/locales/pt-BR.json
@@ -823,6 +823,7 @@
"netWorth": "Patrimônio líquido",
"netWorthTooltip": "Contas + investimentos, descontando faturas de cartão em aberto.",
"creditCardBalance": "Faturas de cartão em aberto",
+ "loanBalance": "Empréstimos e financiamentos",
"pendingSharesOwe": "Líquido {{net}} após dívidas de grupo ({{owed}} pendente)",
"pendingSharesOwed": "Líquido {{net}} incluindo {{owed}} a receber",
"pendingSharesTooltip": "Reflete o que você deve ou vai receber em grupos, antes de qualquer acerto.",
@@ -1191,6 +1192,12 @@
"typeCreditCard": "Cartão de Crédito",
"typeInvestment": "Investimento",
"typeWallet": "Carteira",
+ "typeLoan": "Empréstimo / financiamento",
+ "securedProperty": "Bem vinculado",
+ "noSecuredProperty": "Nenhum bem vinculado",
+ "loanRetypeHint": "Só uma conta sem transações pode mudar de ou para Empréstimo.",
+ "loanRetypeBlocked": "Esta conta tem transações, então não pode mudar de ou para Empréstimo. Crie uma nova conta de empréstimo.",
+ "balanceLoan": "Dívida em aberto",
"creditLimit": "Limite do cartão",
"statementCloseDay": "Dia de fechamento",
"paymentDueDay": "Dia de vencimento",
@@ -1922,7 +1929,9 @@
"total": "Total",
"confirmRegenerateTitle": "Regenerar valores?",
"confirmRegenerate": "Os parâmetros de crescimento foram alterados. Todos os valores gerados automaticamente serão excluídos e recalculados. Valores manuais serão mantidos.",
- "regenerate": "Regenerar"
+ "regenerate": "Regenerar",
+ "linkedLoans": "Empréstimos vinculados",
+ "propertyEquity": "Valor {{value}} · Dívida {{debt}} · Patrimônio {{equity}}"
},
"reports": {
"section": "Análises",
diff --git a/frontend/src/locales/pt-PT.json b/frontend/src/locales/pt-PT.json
index 6c6e2667..38a64c94 100644
--- a/frontend/src/locales/pt-PT.json
+++ b/frontend/src/locales/pt-PT.json
@@ -823,6 +823,7 @@
"netWorth": "Património líquido",
"netWorthTooltip": "Contas + investimentos, descontando faturas de cartão em aberto.",
"creditCardBalance": "Faturas de cartão em aberto",
+ "loanBalance": "Empréstimos e financiamentos",
"pendingSharesOwe": "Líquido {{net}} após dívidas de grupo ({{owed}} pendente)",
"pendingSharesOwed": "Líquido {{net}} incluindo {{owed}} a receber",
"pendingSharesTooltip": "Reflete o que deves ou vais receber em grupos, antes de qualquer acerto.",
@@ -1191,6 +1192,12 @@
"typeCreditCard": "Cartão de Crédito",
"typeInvestment": "Investimento",
"typeWallet": "Carteira",
+ "typeLoan": "Empréstimo / financiamento",
+ "securedProperty": "Bem associado",
+ "noSecuredProperty": "Nenhum bem associado",
+ "loanRetypeHint": "Só uma conta sem transações pode mudar de ou para Empréstimo.",
+ "loanRetypeBlocked": "Esta conta tem transações, por isso não pode mudar de ou para Empréstimo. Crie uma nova conta de empréstimo.",
+ "balanceLoan": "Montante em dívida",
"creditLimit": "Limite do cartão",
"statementCloseDay": "Dia de fecho",
"paymentDueDay": "Dia de vencimento",
@@ -1922,7 +1929,9 @@
"total": "Total",
"confirmRegenerateTitle": "Regenerar valores?",
"confirmRegenerate": "Os parâmetros de crescimento foram alterados. Todos os valores gerados automaticamente serão eliminados e recalculados. Valores manuais serão mantidos.",
- "regenerate": "Regenerar"
+ "regenerate": "Regenerar",
+ "linkedLoans": "Empréstimos associados",
+ "propertyEquity": "Valor {{value}} · Dívida {{debt}} · Capital próprio {{equity}}"
},
"reports": {
"section": "Análises",
diff --git a/frontend/src/locales/ru.json b/frontend/src/locales/ru.json
index b77a69d0..73e3772d 100644
--- a/frontend/src/locales/ru.json
+++ b/frontend/src/locales/ru.json
@@ -829,6 +829,7 @@
"netWorth": "Собственный капитал",
"netWorthTooltip": "Счета + инвестиции, за вычетом открытых счетов по кредитной карте.",
"creditCardBalance": "Открытые счета по кредитной карте",
+ "loanBalance": "Кредиты и финансирование",
"pendingSharesOwe": "Чистый {{net}} после групповых долгов ({{owed}} ожидает)",
"pendingSharesOwed": "Чистый {{net}} включая {{owed}} задолженность вам",
"pendingSharesTooltip": "Отражает, что вы должны / вам должны по вашим группам, до урегулирования.",
@@ -1204,6 +1205,12 @@
"typeCreditCard": "Кредитная карта",
"typeInvestment": "Инвестиционный",
"typeWallet": "Кошелёк",
+ "typeLoan": "Кредит / финансирование",
+ "securedProperty": "Связанное имущество",
+ "noSecuredProperty": "Нет связанного имущества",
+ "loanRetypeHint": "Только счёт без транзакций можно перевести в тип «Кредит» или из него.",
+ "loanRetypeBlocked": "У этого счёта есть транзакции, поэтому его нельзя перевести в тип «Кредит» или из него. Создайте новый кредитный счёт.",
+ "balanceLoan": "Остаток долга",
"creditLimit": "Кредитный лимит",
"statementCloseDay": "Дата закрытия выписки",
"paymentDueDay": "Дата платежа",
@@ -1935,7 +1942,9 @@
"total": "Итого",
"confirmRegenerateTitle": "Перегенерировать значения?",
"confirmRegenerate": "Параметры роста изменены. Все автоматически сгенерированные значения будут удалены и пересчитаны. Ручные значения сохранятся.",
- "regenerate": "Перегенерировать"
+ "regenerate": "Перегенерировать",
+ "linkedLoans": "Связанные кредиты",
+ "propertyEquity": "Стоимость {{value}} · Долг {{debt}} · Собственный капитал {{equity}}"
},
"reports": {
"section": "Аналитика",
diff --git a/frontend/src/locales/sk.json b/frontend/src/locales/sk.json
index 0eb74585..b329d9cf 100644
--- a/frontend/src/locales/sk.json
+++ b/frontend/src/locales/sk.json
@@ -829,6 +829,7 @@
"netWorth": "Čisté imanie",
"netWorthTooltip": "Účty + investície, po odpočítaní otvorených faktúr kreditnej karty.",
"creditCardBalance": "Otvorené faktúry kreditnej karty",
+ "loanBalance": "Úvery a financovanie",
"pendingSharesOwe": "Netto {{net}} po skupinových dlhoch ({{owed}} čaká na vyrovnanie)",
"pendingSharesOwed": "Netto {{net}} vrátane {{owed}}, ktoré ti dlhujú",
"pendingSharesTooltip": "Zohľadňuje, čo dlhuješ / čo ti dlhujú v tvojich skupinách, pred vyrovnaním.",
@@ -1243,6 +1244,12 @@
"typeCreditCard": "Kreditná karta",
"typeInvestment": "Investičný účet",
"typeWallet": "Peňaženka",
+ "typeLoan": "Úver / financovanie",
+ "securedProperty": "Prepojený majetok",
+ "noSecuredProperty": "Žiadny prepojený majetok",
+ "loanRetypeHint": "Iba účet bez transakcií môže prejsť na typ Úver alebo z neho.",
+ "loanRetypeBlocked": "Tento účet má transakcie, preto nemôže prejsť na typ Úver ani z neho. Vytvorte namiesto toho nový úverový účet.",
+ "balanceLoan": "Zostatok dlhu",
"creditLimit": "Kreditný limit",
"statementCloseDay": "Deň uzávierky výpisu",
"paymentDueDay": "Deň splatnosti",
@@ -2034,7 +2041,9 @@
"total": "Spolu",
"confirmRegenerateTitle": "Prepočítať hodnoty?",
"confirmRegenerate": "Parametre rastu sa zmenili. Všetky automaticky vygenerované hodnoty sa vymažú a prepočítajú. Manuálne hodnoty zostanú zachované.",
- "regenerate": "Prepočítať"
+ "regenerate": "Prepočítať",
+ "linkedLoans": "Prepojené úvery",
+ "propertyEquity": "Hodnota {{value}} · Dlh {{debt}} · Vlastný kapitál {{equity}}"
},
"reports": {
"section": "Analytika",
diff --git a/frontend/src/locales/uk.json b/frontend/src/locales/uk.json
index a6bf30fa..daa19cd2 100644
--- a/frontend/src/locales/uk.json
+++ b/frontend/src/locales/uk.json
@@ -829,6 +829,7 @@
"netWorth": "Власний капітал",
"netWorthTooltip": "Рахунки + інвестиції, за вирахуванням відкритих рахунків за кредитною карткою.",
"creditCardBalance": "Відкриті рахунки за кредитною карткою",
+ "loanBalance": "Кредити та фінансування",
"pendingSharesOwe": "Чистий {{net}} після групових боргів ({{owed}} очікує)",
"pendingSharesOwed": "Чистий {{net}} включно з {{owed}} заборгованості вам",
"pendingSharesTooltip": "Відображає, що ви винні / вам винні за вашими групами, до врегулювання.",
@@ -1204,6 +1205,12 @@
"typeCreditCard": "Кредитна картка",
"typeInvestment": "Інвестиційний",
"typeWallet": "Гаманець",
+ "typeLoan": "Кредит / фінансування",
+ "securedProperty": "Пов’язане майно",
+ "noSecuredProperty": "Немає пов’язаного майна",
+ "loanRetypeHint": "Лише рахунок без транзакцій можна перевести в тип «Кредит» або з нього.",
+ "loanRetypeBlocked": "Цей рахунок має транзакції, тому його не можна перевести в тип «Кредит» або з нього. Створіть новий кредитний рахунок.",
+ "balanceLoan": "Залишок боргу",
"creditLimit": "Кредитний ліміт",
"statementCloseDay": "Дата закриття виписки",
"paymentDueDay": "Дата платежу",
@@ -1935,7 +1942,9 @@
"total": "Усього",
"confirmRegenerateTitle": "Перегенерувати значення?",
"confirmRegenerate": "Параметри зростання змінено. Усі автоматично згенеровані значення буде видалено та перераховано. Ручні значення збережуться.",
- "regenerate": "Перегенерувати"
+ "regenerate": "Перегенерувати",
+ "linkedLoans": "Пов’язані кредити",
+ "propertyEquity": "Вартість {{value}} · Борг {{debt}} · Власний капітал {{equity}}"
},
"reports": {
"section": "Аналітика",
diff --git a/frontend/src/pages/accounts.tsx b/frontend/src/pages/accounts.tsx
index d8ce58f2..09a38fda 100644
--- a/frontend/src/pages/accounts.tsx
+++ b/frontend/src/pages/accounts.tsx
@@ -6,7 +6,7 @@ import { useTranslation } from 'react-i18next'
import { useDisplayLocale, useDateLocale } from '@/hooks/use-display-locale'
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
import axios from 'axios'
-import { accounts, connections, currencies } from '@/lib/api'
+import { accounts, assets, connections, currencies } from '@/lib/api'
import { localDateString } from '@/lib/date-utils'
import { invalidateFinancialQueries } from '@/lib/invalidate-queries'
import { toast } from 'sonner'
@@ -40,6 +40,7 @@ import { useAuth } from '@/contexts/auth-context'
import { useCollectionFilter } from '@/contexts/collection-filter-context'
import { useWorkspace } from '@/contexts/workspace-context'
import { formatCurrency } from '@/lib/format'
+import { LOAN_COLLATERAL_TYPES } from '@/lib/property-equity'
// Account types offered in the create/edit dialog. Shared between the manual
// type selector and the connected-account override selector so the list stays
@@ -48,6 +49,7 @@ const ACCOUNT_TYPE_OPTIONS = [
{ value: 'checking', labelKey: 'accounts.typeChecking' },
{ value: 'savings', labelKey: 'accounts.typeSavings' },
{ value: 'credit_card', labelKey: 'accounts.typeCreditCard' },
+ { value: 'loan', labelKey: 'accounts.typeLoan' },
{ value: 'investment', labelKey: 'accounts.typeInvestment' },
{ value: 'wallet', labelKey: 'accounts.typeWallet' },
] as const
@@ -196,7 +198,12 @@ export default function AccountsPage() {
setEditingAccount(null)
toast.success(t('accounts.updated'))
},
- onError: () => toast.error(t('common.error')),
+ onError: (_err, variables) => {
+ const original = editingAccount?.type
+ const crossesLoan = !!original && !!variables.type && variables.type !== original
+ && (variables.type === 'loan' || original === 'loan')
+ toast.error(crossesLoan ? t('accounts.loanRetypeBlocked') : t('common.error'))
+ },
})
const deleteMutation = useMutation({
@@ -705,6 +712,7 @@ function AccountDialog({
balance?: number
balance_date?: string
currency?: string
+ secured_asset_id?: string | null
credit_limit?: number | null
statement_close_day?: number | null
payment_due_day?: number | null
@@ -719,6 +727,11 @@ function AccountDialog({
queryFn: currencies.list,
staleTime: Infinity,
})
+ const { data: assetsList } = useQuery({
+ queryKey: ['assets'],
+ queryFn: () => assets.list(),
+ enabled: open,
+ })
const [name, setName] = useState(account?.name ?? '')
const [displayName, setDisplayName] = useState(account?.display_name ?? '')
const [type, setType] = useState(account?.type ?? 'checking')
@@ -728,7 +741,12 @@ function AccountDialog({
const [creditLimit, setCreditLimit] = useState(account?.credit_limit?.toString() ?? '')
const [statementCloseDay, setStatementCloseDay] = useState(account?.statement_close_day?.toString() ?? '')
const [paymentDueDay, setPaymentDueDay] = useState(account?.payment_due_day?.toString() ?? '')
+ const [securedAssetId, setSecuredAssetId] = useState(account?.secured_asset_id ?? '')
+ const properties = (assetsList ?? []).filter((asset) => LOAN_COLLATERAL_TYPES.includes(asset.type))
+ // Send the link the select shows: a saved id that is no longer a listed
+ // property (it changed type) would otherwise be resent and rejected.
+ const securedAssetIsListed = !!securedAssetId && (!assetsList || properties.some((asset) => asset.id === securedAssetId))
const [formSource, setFormSource] = useState<{ account: typeof account } | null>(null)
if (!formSource || formSource.account !== account) {
setFormSource({ account })
@@ -741,6 +759,7 @@ function AccountDialog({
setCreditLimit(account?.credit_limit?.toString() ?? '')
setStatementCloseDay(account?.statement_close_day?.toString() ?? '')
setPaymentDueDay(account?.payment_due_day?.toString() ?? '')
+ setSecuredAssetId(account?.secured_asset_id ?? '')
}
return (
@@ -764,6 +783,7 @@ function AccountDialog({
onSave({
...(!isConnected && { name, balance: parseFloat(balance), balance_date: balanceDate, currency }),
type,
+ ...(type === 'loan' && { secured_asset_id: securedAssetIsListed ? securedAssetId : null }),
display_name: displayName.trim() || null,
...(isCC && {
credit_limit: creditLimit !== '' ? parseFloat(creditLimit) : null,
@@ -797,7 +817,8 @@ function AccountDialog({
value={type}
onChange={(e) => setType(e.target.value)}
>
- {ACCOUNT_TYPE_OPTIONS.map((o) => (
+ {/* A bank-connected account cannot be a loan yet. */}
+ {ACCOUNT_TYPE_OPTIONS.filter((o) => o.value !== 'loan').map((o) => (
<option key={o.value} value={o.value}>{t(o.labelKey)}</option>
))}
</select>
@@ -818,6 +839,9 @@ function AccountDialog({
<option key={o.value} value={o.value}>{t(o.labelKey)}</option>
))}
</select>
+ {account && type !== account.type && (type === 'loan' || account.type === 'loan') && (
+ <p className="text-xs text-muted-foreground">{t('accounts.loanRetypeHint')}</p>
+ )}
</div>
<div className="space-y-2">
<Label>{t('accounts.currency')}</Label>
@@ -837,12 +861,14 @@ function AccountDialog({
<Label>
{type === 'credit_card'
? t('accounts.balanceCreditCard')
- : t('accounts.balance')}
+ : type === 'loan'
+ ? t('accounts.balanceLoan')
+ : t('accounts.balance')}
</Label>
<Input
type="number"
step="0.01"
- min={type === 'credit_card' ? '0' : undefined}
+ min={type === 'credit_card' || type === 'loan' ? '0' : undefined}
value={balance}
onChange={(e) => setBalance(e.target.value)}
/>
@@ -863,6 +889,21 @@ function AccountDialog({
)}
</>
)}
+ {type === 'loan' && (
+ <div className="space-y-2">
+ <Label>{t('accounts.securedProperty')}</Label>
+ <select
+ className="w-full border border-border rounded-lg px-3 py-2 text-sm bg-card text-foreground focus:outline-none focus:ring-2 focus:ring-primary"
+ value={securedAssetId}
+ onChange={(e) => setSecuredAssetId(e.target.value)}
+ >
+ <option value="">{t('accounts.noSecuredProperty')}</option>
+ {properties.map((asset) => (
+ <option key={asset.id} value={asset.id}>{asset.name}</option>
+ ))}
+ </select>
+ </div>
+ )}
{type === 'credit_card' && (
<div className="space-y-4 rounded-lg border border-border bg-muted/30 p-4">
<div className="space-y-2">
diff --git a/frontend/src/pages/assets.tsx b/frontend/src/pages/assets.tsx
index db09df6b..4d5c5de6 100644
--- a/frontend/src/pages/assets.tsx
+++ b/frontend/src/pages/assets.tsx
@@ -3,7 +3,7 @@ import { useTranslation } from 'react-i18next'
import { useDisplayLocale, useDateLocale } from '@/hooks/use-display-locale'
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
import { useRegisterPageChatContext } from '@/lib/page-chat-context'
-import { assets, assetGroups, currencies as currenciesApi } from '@/lib/api'
+import { accounts as accountsApi, assets, assetGroups, currencies as currenciesApi } from '@/lib/api'
import { localDateString } from '@/lib/date-utils'
import { toast } from 'sonner'
import { Button } from '@/components/ui/button'
@@ -53,6 +53,8 @@ import {
} from 'recharts'
import { useNavigate } from 'react-router-dom'
import { PageHeader } from '@/components/page-header'
+import { PropertyEquitySummary } from '@/components/property-equity-summary'
+import { LOAN_COLLATERAL_TYPES } from '@/lib/property-equity'
import { usePrivacyMode } from '@/hooks/use-privacy-mode'
import { useAuth } from '@/contexts/auth-context'
import { useWorkspace } from '@/contexts/workspace-context'
@@ -275,6 +277,11 @@ export default function AssetsPage() {
queryKey: ['portfolio-trend'],
queryFn: () => assets.portfolioTrend(),
})
+ // Loans secured against a property show up in that property's detail.
+ const { data: accountsList } = useQuery({
+ queryKey: ['accounts'],
+ queryFn: () => accountsApi.list(),
+ })
// Scope the portfolio chart + total to the active collection's wallets too.
// Trend rows are keyed by asset id, so we keep only the in-collection asset
// columns and recompute each row's `_total`.
@@ -845,7 +852,17 @@ export default function AssetsPage() {
</div>
{isExpanded && (
- isMarketPriced ? (
+ <>
+ {LOAN_COLLATERAL_TYPES.includes(asset.type) && (
+ <PropertyEquitySummary
+ asset={asset}
+ loans={accountsList ?? []}
+ currency={userCurrency}
+ locale={locale}
+ mask={mask}
+ />
+ )}
+ {isMarketPriced ? (
<>
{/* Value-evolution chart on top, then the buy/sell ledger. */}
<AssetDetail assetId={asset.id} currency={asset.currency} locale={locale} dateLocale={dateLocale} purchasePrice={asset.purchase_price} purchaseDate={asset.purchase_date} valuationMethod={asset.valuation_method} canWrite={canWrite} chartOnly />
@@ -861,7 +878,8 @@ export default function AssetsPage() {
</>
) : (
<AssetDetail assetId={asset.id} currency={asset.currency} locale={locale} dateLocale={dateLocale} purchasePrice={asset.purchase_price} purchaseDate={asset.purchase_date} valuationMethod={asset.valuation_method} canWrite={canWrite} />
- )
+ )}
+ </>
)}
</div>
)
diff --git a/frontend/src/pages/dashboard.test.tsx b/frontend/src/pages/dashboard.test.tsx
index 5d25d607..c2238a20 100644
--- a/frontend/src/pages/dashboard.test.tsx
+++ b/frontend/src/pages/dashboard.test.tsx
@@ -135,6 +135,27 @@ describe('Dashboard net worth breakdown', () => {
const cardRow = within(tooltip).getByText(t('dashboard.creditCardBalance')).parentElement!
expect(cardRow).toHaveTextContent(formatCurrency(-500, 'USD', 'en-US'))
})
+
+ it('lists mortgage debt as its own row instead of available balance', async () => {
+ api.accounts.list.mockResolvedValue([
+ ...accounts,
+ account({ id: 'mortgage', name: 'Mortgage', type: 'loan', current_balance: -40000 }),
+ ])
+ const { user } = renderWithProviders(
+ <TooltipProvider delayDuration={0}>
+ <DashboardPage />
+ </TooltipProvider>,
+ )
+
+ await screen.findByText(formatCurrency(500, 'USD', 'en-US'))
+ await user.hover(screen.getByRole('button', { name: 'i' }))
+
+ const tooltip = await screen.findByRole('tooltip')
+ const availableRow = within(tooltip).getByText(t('dashboard.availableBalance')).parentElement!
+ expect(availableRow).toHaveTextContent(formatCurrency(1000, 'USD', 'en-US'))
+ const loanRow = within(tooltip).getByText(t('dashboard.loanBalance')).parentElement!
+ expect(loanRow).toHaveTextContent(formatCurrency(-40000, 'USD', 'en-US'))
+ })
})
describe('Dashboard available balance without an FX rate', () => {
diff --git a/frontend/src/pages/dashboard.tsx b/frontend/src/pages/dashboard.tsx
index 18e359f2..4e8c67e0 100644
--- a/frontend/src/pages/dashboard.tsx
+++ b/frontend/src/pages/dashboard.tsx
@@ -417,11 +417,15 @@ export default function DashboardPage() {
const accountsUnavailable = accountsLoading || accountsError
const creditCardBalance = sumAccountBalances((accountsList ?? [])
.filter((a) => (activeAccountIds ? activeAccountIds.includes(a.id) : true) && a.type === 'credit_card'))
- // Net worth's "Available balance" breakdown row: every non-card account
- // (unlike the headline `availableBalance`, which is checking/savings only),
- // so it reconciles with `totalBalance` — which sums all account types.
+ const loanBalance = (accountsList ?? [])
+ .filter((a) => (activeAccountIds ? activeAccountIds.includes(a.id) : true) && a.type === 'loan')
+ .reduce((sum, a) => sum + Number(a.balance_primary ?? a.current_balance), 0)
+ // Net worth's "Available balance" breakdown row: every account that is not
+ // a card or loan (unlike the headline `availableBalance`, which is
+ // checking/savings only), so with the card and loan rows it reconciles with
+ // `totalBalance` — which sums all account types.
const nonCardAccountsBalance = (accountsList ?? [])
- .filter((a) => (activeAccountIds ? activeAccountIds.includes(a.id) : true) && a.type !== 'credit_card')
+ .filter((a) => (activeAccountIds ? activeAccountIds.includes(a.id) : true) && a.type !== 'credit_card' && a.type !== 'loan')
.reduce((sum, a) => sum + Number(a.balance_primary ?? a.current_balance), 0)
// Savings rate & projection
@@ -829,6 +833,12 @@ export default function DashboardPage() {
<span>{mask(formatCurrency(creditCardBalance, primaryCurrency, locale))}</span>
</div>
)}
+ {loanBalance !== 0 && (
+ <div className="flex justify-between gap-3">
+ <span>{t('dashboard.loanBalance')}</span>
+ <span>{mask(formatCurrency(loanBalance, primaryCurrency, locale))}</span>
+ </div>
+ )}
{hasProjectedBalance && (
<div className="flex justify-between gap-3">
<span>{t('dashboard.projectedBalance')}</span>
diff --git a/frontend/src/types/index.ts b/frontend/src/types/index.ts
index 01bbfecd..3f9628a8 100644
--- a/frontend/src/types/index.ts
+++ b/frontend/src/types/index.ts
@@ -178,6 +178,7 @@ export interface Account {
institution_name: string | null
institution_logo_url: string | null
type: string
+ secured_asset_id?: string | null
balance: number
current_balance: number
previous_balance: number | null