Skip to content

Commit

Permalink
finance: Replace "Konto anzeigen" button with regular action button
Browse files Browse the repository at this point in the history
  • Loading branch information
FestplattenSchnitzel committed Sep 27, 2024
1 parent 84d670e commit 1846e57
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
16 changes: 11 additions & 5 deletions web/blueprints/finance/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,24 +166,30 @@ def bank_accounts_list() -> ResponseReturnValue:

@bp.route('/bank-accounts/list/json')
def bank_accounts_list_json() -> ResponseReturnValue:
def actions(bank_account: BankAccount) -> list[BtnColResponse]:
return [
BtnColResponse(
href=url_for('.accounts_show', account_id=bank_account.account_id),
title="",
btn_class="btn-primary",
icon="fa-eye",
)
]

return TableResponse[BankAccountRow](
items=[
BankAccountRow(
name=bank_account.name,
bank=bank_account.bank,
iban=bank_account.iban,
bic=bank_account.bic,
kto=BtnColResponse(
href=url_for(".accounts_show", account_id=bank_account.account_id),
title="Konto anzeigen",
btn_class="btn-primary",
),
balance=money_filter(bank_account.balance),
last_imported_at=(
str(datetime.date(i))
if (i := bank_account.last_imported_at) is not None
else "-"
),
actions=actions(bank_account),
)
for bank_account in get_all_bank_accounts(session)
]
Expand Down
4 changes: 2 additions & 2 deletions web/blueprints/finance/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ class BankAccountTable(BootstrapTable):
bic = Column("SWIFT-BIC")
balance = Column("Saldo")
last_imported_at = Column("Zuletzt importiert")
kto = BtnColumn("Konto")
actions = MultiBtnColumn("Aktionen")

def __init__(self, *, create_account: bool = False, **kw: t.Any) -> None:
self.create_account = create_account
Expand All @@ -220,9 +220,9 @@ class BankAccountRow(BaseModel):
bank: str
iban: str
bic: str
kto: BtnColResponse
balance: str
last_imported_at: str # TODO perhaps date
actions: list[BtnColResponse]


class BankAccountActivityTable(BootstrapTable):
Expand Down

0 comments on commit 1846e57

Please sign in to comment.