commit 0c6e221d6103fe1cceaf58c98907315aa29745c3
parent 9ac49df6e00acf972f5cfdce306fc9a0a75e1d76
Author: Florian Dold <florian@dold.me>
Date: Wed, 4 Feb 2026 14:05:25 +0100
always show export PDF button on accounts page
Diffstat:
1 file changed, 43 insertions(+), 38 deletions(-)
diff --git a/packages/aml-backoffice-ui/src/pages/AccountDetails.tsx b/packages/aml-backoffice-ui/src/pages/AccountDetails.tsx
@@ -36,7 +36,9 @@ import {
} from "@gnu-taler/web-util/browser";
import { format } from "date-fns";
import { h, VNode } from "preact";
+import { useState } from "preact/hooks";
import { Fragment } from "preact/jsx-runtime";
+import pdfIcon from "../assets/pdf-icon.png";
import { ShowDecisionLimitInfo } from "../components/ShowDecisionLimitInfo.js";
import { ShowDefaultRules } from "../components/ShowDefaultRules.js";
import { ShowLegistimizationInfo } from "../components/ShowLegitimizationInfo.js";
@@ -44,11 +46,9 @@ import { useAccountInformation } from "../hooks/account.js";
import { DecisionRequest } from "../hooks/decision-request.js";
import { useAccountDecisions } from "../hooks/decisions.js";
import { useCurrentLegitimizations } from "../hooks/legitimizations.js";
+import { useOfficer } from "../hooks/officer.js";
import { useServerMeasures } from "../hooks/server-info.js";
import { BANK_RULES, WALLET_RULES } from "./decision/Rules.js";
-import { useState } from "preact/hooks";
-import pdfIcon from "../assets/pdf-icon.png";
-import { useOfficer } from "../hooks/officer.js";
const utfDecoder = new TextDecoder("Latin1");
@@ -190,14 +190,17 @@ export function AccountDetails({
const filteredRulesByType = !activeDecision
? defaultRules
: defaultRules.filter((r) => {
- return activeDecision.is_wallet
- ? WALLET_RULES.includes(r.operation_type)
- : BANK_RULES.includes(r.operation_type);
- });
+ return activeDecision.is_wallet
+ ? WALLET_RULES.includes(r.operation_type)
+ : BANK_RULES.includes(r.operation_type);
+ });
const time = format(new Date(), "yyyyMMdd_HHmmss");
- const downloadPdf = safeFunctionHandler(lib.exchange.getAmlAttributesForAccountAsPdf.bind(lib.exchange), session ? [session, account] : undefined);
+ const downloadPdf = safeFunctionHandler(
+ lib.exchange.getAmlAttributesForAccountAsPdf.bind(lib.exchange),
+ session ? [session, account] : undefined,
+ );
downloadPdf.onSuccess = (result) => {
setExported({
content: new Uint8Array(result).reduce(
@@ -208,7 +211,6 @@ export function AccountDetails({
});
};
-
return (
<div class="min-w-60">
<LocalNotificationBanner notification={notification} />
@@ -234,6 +236,33 @@ export function AccountDetails({
/>
</p>
</div>
+
+ <div class="flex space-x-2 mb-4">
+ <i18n.Translate>Export as PDF</i18n.Translate>
+ <ButtonBetter type="button" onClick={downloadPdf}>
+ <img class="size-6 w-6" src={pdfIcon} />
+ </ButtonBetter>
+ </div>
+ {!exported ? (
+ <div />
+ ) : (
+ <a
+ href={
+ "data:application/pdf;base64," + window.btoa(exported.content)
+ }
+ name="save file"
+ download={exported.file}
+ >
+ <Attention
+ title={i18n.str`Export completed`}
+ onClose={() => setExported(undefined)}
+ >
+ <i18n.Translate>
+ Click here to save the file in your computer.
+ </i18n.Translate>
+ </Attention>
+ </a>
+ )}
</header>
{!activeDecision || !activeDecision.to_investigate ? undefined : (
@@ -257,38 +286,14 @@ export function AccountDetails({
</i18n.Translate>
</p>
</div>
+
{collectionEvents.length === 0 ? (
- <Attention title={i18n.str`The event list is empty`} type="warning" />
+ <Attention
+ title={i18n.str`No collected attributes for this account.`}
+ type="warning"
+ />
) : (
<Fragment>
- <div class="flex space-x-2 mb-4">
- <i18n.Translate>Export as PDF</i18n.Translate>
- <ButtonBetter type="button" onClick={downloadPdf}>
- <img class="size-6 w-6" src={pdfIcon} />
- </ButtonBetter>
- </div>
- {!exported ? (
- <div />
- ) : (
- <a
- href={
- "data:application/pdf;base64," +
- window.btoa(exported.content)
- }
- name="save file"
- download={exported.file}
- >
- <Attention
- title={i18n.str`Export completed`}
- onClose={() => setExported(undefined)}
- >
- <i18n.Translate>
- Click here to save the file in your computer.
- </i18n.Translate>
- </Attention>
- </a>
- )}
-
<ShowTimeline
account={account}
history={collectionEvents}