Add Transactions view with detailed tx log

This commit is contained in:
2026-09-27 13:12:44 +02:00
parent 7c1b67c000
commit 9f87fd66ac
11 changed files with 526 additions and 5 deletions
@@ -11,7 +11,13 @@ import { i18n } from "discourse-i18n";
import { amountText } from "../lib/hledger-report";
import HledgerAccountCell from "./hledger-account-cell";
const REPORT_IDS = ["accounts", "balance_sheet", "income_statement", "equity"];
const REPORT_IDS = [
"accounts",
"balance_sheet",
"income_statement",
"equity",
"transactions",
];
export default class HledgerDashboard extends Component {
@tracked selectedReport = "accounts";
@@ -35,6 +41,7 @@ export default class HledgerDashboard extends Component {
balance_sheet: "scale-balanced",
income_statement: "chart-line",
equity: "users",
transactions: "receipt",
}[id],
}));
}
@@ -47,6 +54,10 @@ export default class HledgerDashboard extends Component {
return this.selectedReport === "equity";
}
get isTransactions() {
return this.selectedReport === "transactions";
}
get labels() {
return {
total: i18n("hledger.total"),
@@ -191,6 +202,37 @@ export default class HledgerDashboard extends Component {
</div>
{{/each}}
<p class="hledger-dashboard__note">{{this.labels.note}}</p>
{{else if this.isTransactions}}
{{#if this.report.transactions.length}}
{{#each this.report.transactions as |transaction|}}
<div class="hledger-dashboard__transaction">
<div class="hledger-dashboard__transaction-header">
<span
class="hledger-dashboard__transaction-date"
>{{transaction.date}}</span>
<span
class="hledger-dashboard__transaction-description"
>{{transaction.description}}</span>
</div>
<table class="hledger-dashboard__table">
<tbody>
{{#each transaction.postings as |posting|}}
<tr>
<td
class="hledger-dashboard__account"
>{{posting.account}}</td>
<td class="hledger-dashboard__amount">{{amountText
posting.amounts
}}</td>
</tr>
{{/each}}
</tbody>
</table>
</div>
{{/each}}
{{else}}
<p class="hledger-dashboard__empty">{{this.labels.noData}}</p>
{{/if}}
{{else}}
{{#each this.report.sections as |section|}}
<div class="hledger-dashboard__section">