Skip to content

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

feat(transactions): add a post-today quick action to pending rows (#1253)

Tássio Noronha62530e4d354c
diff --git a/backend/app/api/transactions.py b/backend/app/api/transactions.py
index 0fe9492c..c0e1dece 100644
--- a/backend/app/api/transactions.py
+++ b/backend/app/api/transactions.py
@@ -542,6 +542,26 @@ async def toggle_ignore_transaction(
return _tag_fx_fallback(TransactionRead.model_validate(transaction, from_attributes=True), primary_currency)
[email protected]("/{transaction_id}/post-today", response_model=TransactionRead)
+async def post_transaction_today(
+ transaction_id: uuid.UUID,
+ ctx: WorkspaceContext = Depends(current_writable_workspace),
+ session: AsyncSession = Depends(get_async_session),
+):
+ """One-click "it cleared today" for a pending transaction.
+
+ Marks the transaction as posted and stamps today's calendar date, resolved
+ in the workspace's timezone, the same as saving the edit dialog by hand.
+ """
+ transaction = await transaction_service.post_transaction_today(
+ session, transaction_id, ctx.workspace.id
+ )
+ if not transaction:
+ raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="Transaction not found")
+ primary_currency = ctx.user.primary_currency
+ return _tag_fx_fallback(TransactionRead.model_validate(transaction, from_attributes=True), primary_currency)
+
+
@router.patch("/{transaction_id}/unlink-recurring", response_model=TransactionRead)
async def unlink_recurring_transaction(
transaction_id: uuid.UUID,
diff --git a/backend/app/services/transaction_service.py b/backend/app/services/transaction_service.py
index 7245c0e3..e33c1e4a 100644
--- a/backend/app/services/transaction_service.py
+++ b/backend/app/services/transaction_service.py
@@ -8,6 +8,7 @@ from sqlalchemy import CursorResult, case, delete, select, func, or_, not_, upda
from sqlalchemy.ext.asyncio import AsyncSession
from sqlalchemy.orm import selectinload
+from app.core.app_clock import app_today
from app.models.transaction import Transaction
from app.models.transaction_attachment import TransactionAttachment
from app.models.account import Account
@@ -1903,6 +1904,54 @@ async def bulk_add_to_group(
return {"updated": updated, "skipped": skipped}
+async def post_transaction_today(
+ session: AsyncSession,
+ transaction_id: uuid.UUID,
+ workspace_id: uuid.UUID,
+) -> Optional[Transaction]:
+ """Mark a transaction as posted and stamp it with today's calendar date.
+
+ The one-click "it cleared today" action for a pending entry: confirms the
+ status and moves the purchase date to the workspace's current day, the same
+ as saving the edit dialog with status "posted" and date "today". The
+ effective date and the FX restamp follow the date change, and a transfer
+ pair leg carries the same change to its partner, so the row ends up exactly
+ where the manual edit would have left it. No other field is touched, and the
+ transaction must belong to the given workspace.
+ """
+ transaction = await get_transaction(session, transaction_id, workspace_id)
+ if not transaction:
+ return None
+
+ today = app_today()
+ transaction.status = "posted"
+ transaction.date = today
+
+ account = await session.get(Account, transaction.account_id)
+ apply_effective_date(transaction, account)
+ await stamp_primary_amount(session, transaction.user_id, transaction)
+
+ if transaction.transfer_pair_id:
+ paired_result = await session.execute(
+ select(Transaction).where(
+ Transaction.workspace_id == workspace_id,
+ Transaction.transfer_pair_id == transaction.transfer_pair_id,
+ Transaction.id != transaction.id,
+ )
+ )
+ paired = paired_result.scalar_one_or_none()
+ if paired:
+ paired.status = "posted"
+ paired.date = today
+ paired_account = await session.get(Account, paired.account_id)
+ apply_effective_date(paired, paired_account)
+ await stamp_primary_amount(session, paired.user_id, paired)
+
+ await session.commit()
+ await session.refresh(transaction)
+ return transaction
+
+
async def toggle_ignore_transaction(
session: AsyncSession,
transaction_id: uuid.UUID,
diff --git a/backend/tests/api_contract/baseline.json b/backend/tests/api_contract/baseline.json
index 3abbb522..197a2edb 100644
--- a/backend/tests/api_contract/baseline.json
+++ b/backend/tests/api_contract/baseline.json
@@ -312,6 +312,7 @@
"POST /api/transactions/transfer": 401,
"POST /api/transactions/{transaction_id}/attachments": 401,
"POST /api/transactions/{transaction_id}/create-counterpart": 401,
+ "POST /api/transactions/{transaction_id}/post-today": 401,
"POST /api/workspaces": 401,
"POST /api/workspaces/{workspace_id}/archive": 401,
"POST /api/workspaces/{workspace_id}/members": 401,
@@ -697,6 +698,7 @@
"POST /api/transactions/transfer": 201,
"POST /api/transactions/{transaction_id}/attachments": 201,
"POST /api/transactions/{transaction_id}/create-counterpart": 201,
+ "POST /api/transactions/{transaction_id}/post-today": 200,
"POST /api/workspaces": 201,
"POST /api/workspaces/{workspace_id}/archive": 400,
"POST /api/workspaces/{workspace_id}/members": 400,
@@ -859,6 +861,7 @@
"POST /api/reconciliation/suggestions/{suggestion_id}/decline": 404,
"POST /api/transactions/{transaction_id}/attachments": 404,
"POST /api/transactions/{transaction_id}/create-counterpart": 422,
+ "POST /api/transactions/{transaction_id}/post-today": 404,
"POST /api/workspaces/{workspace_id}/archive": 404,
"POST /api/workspaces/{workspace_id}/members": 404,
"PUT /api/agents/{agent_id}/tools": 404
@@ -1040,6 +1043,7 @@
"POST /api/transactions/transfer": 403,
"POST /api/transactions/{transaction_id}/attachments": 403,
"POST /api/transactions/{transaction_id}/create-counterpart": 403,
+ "POST /api/transactions/{transaction_id}/post-today": 403,
"POST /api/workspaces": 201,
"POST /api/workspaces/{workspace_id}/archive": 403,
"POST /api/workspaces/{workspace_id}/members": 403,
diff --git a/backend/tests/test_post_today.py b/backend/tests/test_post_today.py
new file mode 100644
index 00000000..a9473aed
--- /dev/null
+++ b/backend/tests/test_post_today.py
@@ -0,0 +1,139 @@
+"""The one-click "post today" quick action (issue #1144).
+
+A pending entry is confirmed as posted and dated with the workspace's current
+calendar day from a single request, the same result as saving the edit dialog
+by hand. Proved over HTTP so the route, the write gate, and the not-found path
+are exercised together, not just the service.
+"""
+from datetime import timedelta
+from decimal import Decimal
+from uuid import uuid4
+
+import pytest_asyncio
+from httpx import AsyncClient
+
+from app.core.app_clock import app_today
+from app.models.account import Account
+from app.models.transaction import Transaction
+from app.models.user import User
+from app.services.workspace_service import create_personal_workspace_for_user
+
+
+@pytest_asyncio.fixture
+async def pending_transaction(session, test_user, test_account) -> Transaction:
+ """A manual pending charge dated a few days back, in the test workspace."""
+ tx = Transaction(
+ id=uuid4(),
+ user_id=test_user.id,
+ account_id=test_account.id,
+ description="PENDING CHARGE",
+ amount=Decimal("42.00"),
+ date=app_today() - timedelta(days=3),
+ type="debit",
+ source="manual",
+ status="pending",
+ )
+ session.add(tx)
+ await session.commit()
+ await session.refresh(tx)
+ return tx
+
+
+async def test_post_today_marks_pending_posted_and_dates_it_today(
+ client: AsyncClient, auth_headers, session, pending_transaction: Transaction
+):
+ tx = pending_transaction
+ assert tx.status == "pending"
+ assert tx.date != app_today(), "fixture must start on a different day than today"
+
+ resp = await client.post(f"/api/transactions/{tx.id}/post-today", headers=auth_headers)
+ assert resp.status_code == 200, resp.text
+ body = resp.json()
+ assert body["status"] == "posted"
+ assert body["date"] == app_today().isoformat()
+
+ await session.refresh(tx)
+ assert tx.status == "posted"
+ assert tx.date == app_today()
+
+
+async def test_post_today_does_not_touch_other_fields(
+ client: AsyncClient, auth_headers, session, pending_transaction: Transaction
+):
+ """Only status and date move; amount, description and type are left alone."""
+ tx = pending_transaction
+ resp = await client.post(f"/api/transactions/{tx.id}/post-today", headers=auth_headers)
+ assert resp.status_code == 200, resp.text
+ body = resp.json()
+ assert Decimal(body["amount"]) == tx.amount
+ assert body["description"] == "PENDING CHARGE"
+ assert body["type"] == "debit"
+ assert body["source"] == "manual"
+
+
+async def test_a_viewer_cannot_post_today(
+ client: AsyncClient, viewer_auth_headers, pending_transaction: Transaction
+):
+ tx = pending_transaction
+ resp = await client.post(f"/api/transactions/{tx.id}/post-today", headers=viewer_auth_headers)
+ assert resp.status_code == 403, resp.text
+
+
+async def test_post_today_on_an_unknown_id_says_not_found(
+ client: AsyncClient, auth_headers
+):
+ resp = await client.post(f"/api/transactions/{uuid4()}/post-today", headers=auth_headers)
+ # A missing route also answers 404, so pin the detail the endpoint sets.
+ assert resp.status_code == 404
+ assert resp.json()["detail"] == "Transaction not found"
+
+
+async def test_post_today_cannot_reach_another_workspace(
+ client: AsyncClient, auth_headers, session
+):
+ """A pending row in someone else's workspace answers 404 and stays as it was."""
+ other = User(
+ id=uuid4(),
+ hashed_password="x",
+ is_active=True,
+ is_superuser=False,
+ is_verified=True,
+ )
+ session.add(other)
+ await session.flush()
+ other_ws = await create_personal_workspace_for_user(session, other)
+ account = Account(
+ id=uuid4(),
+ user_id=other.id,
+ workspace_id=other_ws.id,
+ name="Other Checking",
+ type="checking",
+ balance=Decimal("0"),
+ currency="BRL",
+ )
+ session.add(account)
+ await session.flush()
+ past = app_today() - timedelta(days=3)
+ foreign = Transaction(
+ id=uuid4(),
+ user_id=other.id,
+ workspace_id=other_ws.id,
+ account_id=account.id,
+ description="OTHER PENDING CHARGE",
+ amount=Decimal("10.00"),
+ date=past,
+ type="debit",
+ source="manual",
+ status="pending",
+ )
+ session.add(foreign)
+ await session.commit()
+
+ resp = await client.post(f"/api/transactions/{foreign.id}/post-today", headers=auth_headers)
+ assert resp.status_code == 404
+ assert resp.json()["detail"] == "Transaction not found"
+
+ await session.refresh(foreign)
+ assert foreign.status == "pending"
+ assert foreign.date == past
diff --git a/frontend/src/components/post-today-button.test.tsx b/frontend/src/components/post-today-button.test.tsx
new file mode 100644
index 00000000..94e8a007
--- /dev/null
+++ b/frontend/src/components/post-today-button.test.tsx
@@ -0,0 +1,53 @@
+import { describe, expect, it, vi } from 'vitest'
+import { screen } from '@testing-library/react'
+
+import { PostTodayButton } from '@/components/post-today-button'
+import { renderWithProviders, t } from '@/test/utils'
+
+const pending = { id: 'tx-1', status: 'pending', source: 'manual' }
+const posted = { id: 'tx-2', status: 'posted', source: 'manual' }
+const syncPending = { id: 'tx-3', status: 'pending', source: 'sync' }
+
+describe('PostTodayButton', () => {
+ it('offers the action on a pending row the user can edit', () => {
+ const onPostToday = vi.fn()
+ renderWithProviders(<PostTodayButton {...pending} canWrite onPostToday={onPostToday} />)
+
+ const button = screen.getByRole('button', { name: t('transactions.postToday') })
+ expect(button).toBeInTheDocument()
+
+ button.click()
+ expect(onPostToday).toHaveBeenCalledTimes(1)
+ expect(onPostToday).toHaveBeenCalledWith('tx-1')
+ })
+
+ it('is hidden once the transaction is posted', () => {
+ renderWithProviders(<PostTodayButton {...posted} canWrite onPostToday={vi.fn()} />)
+
+ expect(
+ screen.queryByRole('button', { name: t('transactions.postToday') }),
+ ).not.toBeInTheDocument()
+ })
+
+ it('is hidden for a pending row that came from a bank sync', () => {
+ renderWithProviders(<PostTodayButton {...syncPending} canWrite onPostToday={vi.fn()} />)
+
+ expect(
+ screen.queryByRole('button', { name: t('transactions.postToday') }),
+ ).not.toBeInTheDocument()
+ })
+
+ it('is hidden for a read-only user', () => {
+ renderWithProviders(<PostTodayButton {...pending} canWrite={false} onPostToday={vi.fn()} />)
+
+ expect(
+ screen.queryByRole('button', { name: t('transactions.postToday') }),
+ ).not.toBeInTheDocument()
+ })
+
+ it('renders translated copy, not the raw key', () => {
+ renderWithProviders(<PostTodayButton {...pending} canWrite onPostToday={vi.fn()} />)
+
+ expect(screen.queryByText('transactions.postToday')).not.toBeInTheDocument()
+ })
+})
diff --git a/frontend/src/components/post-today-button.tsx b/frontend/src/components/post-today-button.tsx
new file mode 100644
index 00000000..bd3dd7a3
--- /dev/null
+++ b/frontend/src/components/post-today-button.tsx
@@ -0,0 +1,39 @@
+import { Check } from 'lucide-react'
+import { useTranslation } from 'react-i18next'
+
+import { shouldShowPendingBadge } from '@/lib/transaction-status'
+
+export type PostTodayButtonProps = {
+ id: string
+ status: string | null
+ source: string | null
+ canWrite: boolean
+ onPostToday: (id: string) => void
+}
+
+/**
+ * One-click "it cleared today" action for a pending row. Sits next to the
+ * pending badge and posts the transaction with today's date from a single
+ * click, instead of opening the edit dialog. Shown only for rows the pending
+ * badge applies to, and only to users who can write the workspace.
+ */
+export function PostTodayButton({ id, status, source, canWrite, onPostToday }: PostTodayButtonProps) {
+ const { t } = useTranslation()
+ if (!canWrite || !shouldShowPendingBadge({ status, source })) return null
+
+ const label = t('transactions.postToday')
+ return (
+ <button
+ type="button"
+ title={label}
+ aria-label={label}
+ onClick={(event) => {
+ event.stopPropagation()
+ onPostToday(id)
+ }}
+ className="shrink-0 inline-flex items-center justify-center rounded-full border border-amber-300 bg-amber-50 p-0.5 text-amber-500 transition-colors hover:bg-amber-100 dark:border-amber-500/40 dark:bg-amber-500/10 dark:hover:bg-amber-500/20"
+ >
+ <Check size={12} />
+ </button>
+ )
+}
diff --git a/frontend/src/lib/api.ts b/frontend/src/lib/api.ts
index 7e00286d..af9b8d6c 100644
--- a/frontend/src/lib/api.ts
+++ b/frontend/src/lib/api.ts
@@ -621,6 +621,10 @@ export const transactions = {
const { data } = await api.patch(`/transactions/${id}/unlink-recurring`)
return data
},
+ postToday: async (id: string): Promise<Transaction> => {
+ const { data } = await api.post(`/transactions/${id}/post-today`)
+ return data
+ },
createTransfer: async (transfer: {
from_account_id: string
to_account_id: string
diff --git a/frontend/src/locales/cs.json b/frontend/src/locales/cs.json
index d4388eae..20081749 100644
--- a/frontend/src/locales/cs.json
+++ b/frontend/src/locales/cs.json
@@ -967,6 +967,7 @@
"recurringUnlinkSuccess": "Transakce odpojena od opakované platby",
"transfer": "Převod",
"pending": "Čekající",
+ "postToday": "Označit jako provedené dnes",
"recurringInfo": "Opakovaná transakce ({{frequency}}). Další: {{next}}",
"from": "Od",
"to": "Do",
diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json
index 42b16e7a..16bf261b 100644
--- a/frontend/src/locales/de.json
+++ b/frontend/src/locales/de.json
@@ -935,6 +935,7 @@
"recurringUnlinkSuccess": "Transaktion von der wiederkehrenden Rechnung getrennt",
"transfer": "Umbuchung",
"pending": "Ausstehend",
+ "postToday": "Als heute verbucht markieren",
"recurringInfo": "Wiederkehrende Transaktion ({{frequency}}). Nächste: {{next}}",
"from": "Von",
"to": "Nach",
diff --git a/frontend/src/locales/el.json b/frontend/src/locales/el.json
index 0bee0629..494774b1 100644
--- a/frontend/src/locales/el.json
+++ b/frontend/src/locales/el.json
@@ -1128,6 +1128,7 @@
"recurringUnlinkSuccess": "Η συναλλαγή αποσυνδέθηκε από τον επαναλαμβανόμενο λογαριασμό",
"transfer": "Μεταφορά",
"pending": "Εκκρεμεί",
+ "postToday": "Σημείωση ως καταχωρημένη σήμερα",
"recurringInfo": "Επαναλαμβανόμενη συναλλαγή ({{frequency}}). Επόμενη: {{next}}",
"from": "Από",
"to": "Προς",
diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json
index ccd76e38..0b70743d 100644
--- a/frontend/src/locales/en.json
+++ b/frontend/src/locales/en.json
@@ -935,6 +935,7 @@
"recurringUnlinkSuccess": "Transaction unlinked from the recurring bill",
"transfer": "Transfer",
"pending": "Pending",
+ "postToday": "Mark as posted today",
"recurringInfo": "Recurring transaction ({{frequency}}). Next: {{next}}",
"from": "From",
"to": "To",
diff --git a/frontend/src/locales/es.json b/frontend/src/locales/es.json
index a85f897a..47902022 100644
--- a/frontend/src/locales/es.json
+++ b/frontend/src/locales/es.json
@@ -937,6 +937,7 @@
"recurringUnlinkSuccess": "Transacción desvinculada de la factura recurrente",
"transfer": "Transferencia",
"pending": "Pendiente",
+ "postToday": "Marcar como contabilizada hoy",
"recurringInfo": "Transacción recurrente ({{frequency}}). Próxima: {{next}}",
"from": "Desde",
"to": "Hasta",
diff --git a/frontend/src/locales/fr.json b/frontend/src/locales/fr.json
index 641c5364..8fe4ed25 100644
--- a/frontend/src/locales/fr.json
+++ b/frontend/src/locales/fr.json
@@ -937,6 +937,7 @@
"recurringUnlinkSuccess": "Transaction dissociée de la facture récurrente",
"transfer": "Virement",
"pending": "En attente",
+ "postToday": "Marquer comme postée aujourd'hui",
"recurringInfo": "Transaction récurrente ({{frequency}}). Prochaine : {{next}}",
"from": "De",
"to": "À",
diff --git a/frontend/src/locales/hi.json b/frontend/src/locales/hi.json
index 137c174c..977bd063 100644
--- a/frontend/src/locales/hi.json
+++ b/frontend/src/locales/hi.json
@@ -935,6 +935,7 @@
"recurringUnlinkSuccess": "लेन-देन आवर्ती बिल से हटाया गया",
"transfer": "ट्रांसफ़र",
"pending": "लंबित",
+ "postToday": "आज पोस्ट की गई के रूप में चिह्नित करें",
"recurringInfo": "आवर्ती लेन-देन ({{frequency}})। अगला: {{next}}",
"from": "से",
"to": "को",
diff --git a/frontend/src/locales/hu.json b/frontend/src/locales/hu.json
index cb51e269..e8e67ebe 100644
--- a/frontend/src/locales/hu.json
+++ b/frontend/src/locales/hu.json
@@ -935,6 +935,7 @@
"recurringUnlinkSuccess": "Tranzakció leválasztva az ismétlődő tételről",
"transfer": "Átvezetés",
"pending": "Függőben",
+ "postToday": "Jelölés ma elkönyveltként",
"recurringInfo": "Ismétlődő tranzakció ({{frequency}}). Következő: {{next}}",
"from": "Innen",
"to": "Ide",
diff --git a/frontend/src/locales/it.json b/frontend/src/locales/it.json
index 0f0a4da7..f525752b 100644
--- a/frontend/src/locales/it.json
+++ b/frontend/src/locales/it.json
@@ -937,6 +937,7 @@
"recurringUnlinkSuccess": "Transazione scollegata dalla spesa ricorrente",
"transfer": "Trasferimento",
"pending": "In sospeso",
+ "postToday": "Segna come registrata oggi",
"recurringInfo": "Transazione ricorrente ({{frequency}}). Prossima: {{next}}",
"from": "Da",
"to": "A",
diff --git a/frontend/src/locales/ja.json b/frontend/src/locales/ja.json
index 202eedde..9c7615ce 100644
--- a/frontend/src/locales/ja.json
+++ b/frontend/src/locales/ja.json
@@ -935,6 +935,7 @@
"recurringUnlinkSuccess": "取引を定期支払いから紐付け解除しました",
"transfer": "振替",
"pending": "保留中",
+ "postToday": "本日確定済みとしてマーク",
"recurringInfo": "定期取引({{frequency}})。次回: {{next}}",
"from": "from",
"to": "to",
diff --git a/frontend/src/locales/nl.json b/frontend/src/locales/nl.json
index ae9ee17e..16a7262c 100644
--- a/frontend/src/locales/nl.json
+++ b/frontend/src/locales/nl.json
@@ -935,6 +935,7 @@
"recurringUnlinkSuccess": "Transactie ontkoppeld van de terugkerende factuur",
"transfer": "Overdracht",
"pending": "In behandeling",
+ "postToday": "Markeer als vandaag geboekt",
"recurringInfo": "Terugkerende transactie ({{frequency}}). Volgende: {{next}}",
"from": "Van",
"to": "Aan",
diff --git a/frontend/src/locales/pl.json b/frontend/src/locales/pl.json
index 7cb04e99..e01233da 100644
--- a/frontend/src/locales/pl.json
+++ b/frontend/src/locales/pl.json
@@ -949,6 +949,7 @@
"recurringUnlinkSuccess": "Transakcja odłączona od cyklicznego rachunku",
"transfer": "Transfer",
"pending": "Oczekująca",
+ "postToday": "Oznacz jako rozliczoną dzisiaj",
"recurringInfo": "Transakcja cykliczna ({{frequency}}). Następna: {{next}}",
"from": "Z",
"to": "Do",
diff --git a/frontend/src/locales/pt-BR.json b/frontend/src/locales/pt-BR.json
index e5b8611c..04e4dead 100644
--- a/frontend/src/locales/pt-BR.json
+++ b/frontend/src/locales/pt-BR.json
@@ -937,6 +937,7 @@
"recurringUnlinkSuccess": "Transação desvinculada da conta recorrente",
"transfer": "Transferência",
"pending": "Pendente",
+ "postToday": "Marcar como lançada hoje",
"recurringInfo": "Transação recorrente ({{frequency}}). Próxima: {{next}}",
"from": "De",
"to": "Até",
diff --git a/frontend/src/locales/pt-PT.json b/frontend/src/locales/pt-PT.json
index 38a64c94..a916ea6f 100644
--- a/frontend/src/locales/pt-PT.json
+++ b/frontend/src/locales/pt-PT.json
@@ -937,6 +937,7 @@
"recurringUnlinkSuccess": "Transação desvinculada da conta recorrente",
"transfer": "Transferência",
"pending": "Pendente",
+ "postToday": "Marcar como registada hoje",
"recurringInfo": "Transação recorrente ({{frequency}}). Próxima: {{next}}",
"from": "De",
"to": "Até",
diff --git a/frontend/src/locales/ru.json b/frontend/src/locales/ru.json
index 73e3772d..e9f856d6 100644
--- a/frontend/src/locales/ru.json
+++ b/frontend/src/locales/ru.json
@@ -943,6 +943,7 @@
"recurringUnlinkSuccess": "Транзакция отвязана от регулярного платежа",
"transfer": "Перевод",
"pending": "Ожидание",
+ "postToday": "Отметить как проведённую сегодня",
"recurringInfo": "Регулярная транзакция ({{frequency}}). Следующая: {{next}}",
"from": "Откуда",
"to": "Куда",
diff --git a/frontend/src/locales/sk.json b/frontend/src/locales/sk.json
index b329d9cf..738ee3b0 100644
--- a/frontend/src/locales/sk.json
+++ b/frontend/src/locales/sk.json
@@ -951,6 +951,7 @@
"recurringUnlinkSuccess": "Transakcia odpojená od opakovanej platby",
"transfer": "Prevod",
"pending": "Čakajúca",
+ "postToday": "Označiť ako evidované dnes",
"recurringInfo": "Opakovaná transakcia ({{frequency}}). Ďalšia: {{next}}",
"from": "Od",
"to": "Do",
diff --git a/frontend/src/locales/uk.json b/frontend/src/locales/uk.json
index daa19cd2..b6b44dba 100644
--- a/frontend/src/locales/uk.json
+++ b/frontend/src/locales/uk.json
@@ -943,6 +943,7 @@
"recurringUnlinkSuccess": "Транзакцію відв'язано від регулярного платежу",
"transfer": "Переказ",
"pending": "Очікування",
+ "postToday": "Позначити як оброблену сьогодні",
"recurringInfo": "Регулярна транзакція ({{frequency}}). Наступна: {{next}}",
"from": "Звідки",
"to": "Куди",
diff --git a/frontend/src/pages/transactions.tsx b/frontend/src/pages/transactions.tsx
index fc35559b..aaacb7c3 100644
--- a/frontend/src/pages/transactions.tsx
+++ b/frontend/src/pages/transactions.tsx
@@ -57,6 +57,7 @@ import { CategoryIcon } from '@/components/category-icon'
import { CategorySelect } from '@/components/category-select'
import { CategoryPicker } from '@/components/category-picker'
import { TransactionDialog, type SaveAction, type TransactionSavePayload } from '@/components/transaction-dialog'
+import { PostTodayButton } from '@/components/post-today-button'
import { extractApiError } from '@/lib/api-errors'
import { refreshTransactionsView } from '@/lib/transactions-refresh'
import { TransactionsColumnPicker } from '@/components/transactions-column-picker'
@@ -580,6 +581,17 @@ export default function TransactionsPage() {
},
})
+ const postTodayMutation = useMutation({
+ mutationFn: (id: string) => transactions.postToday(id),
+ onSuccess: () => {
+ invalidateAfterTxMutation()
+ toast.success(t('transactions.updated'))
+ },
+ onError: (error) => {
+ toast.error(extractApiError(error))
+ },
+ })
+
const bulkCategorizeMutation = useMutation({
mutationFn: ({ ids, categoryId }: { ids: string[]; categoryId: string | null }) =>
transactions.bulkCategorize(ids, categoryId),
@@ -1213,6 +1225,13 @@ export default function TransactionsPage() {
<Clock size={12} className="text-amber-500" role="img" aria-label={t('transactions.pending')} />
</span>
)}
+ <PostTodayButton
+ id={tx.id}
+ status={tx.status}
+ source={tx.source}
+ canWrite={canWrite}
+ onPostToday={(id) => postTodayMutation.mutate(id)}
+ />
{(tx.attachment_count ?? 0) > 0 && (
<Paperclip size={12} className="text-muted-foreground shrink-0" />
)}