aboutsummaryrefslogtreecommitdiff
path: root/packages/aml-backoffice-ui/src/pages/ShowConsolidated.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'packages/aml-backoffice-ui/src/pages/ShowConsolidated.tsx')
-rw-r--r--packages/aml-backoffice-ui/src/pages/ShowConsolidated.tsx89
1 files changed, 58 insertions, 31 deletions
diff --git a/packages/aml-backoffice-ui/src/pages/ShowConsolidated.tsx b/packages/aml-backoffice-ui/src/pages/ShowConsolidated.tsx
index ad350c0e6..15b109bee 100644
--- a/packages/aml-backoffice-ui/src/pages/ShowConsolidated.tsx
+++ b/packages/aml-backoffice-ui/src/pages/ShowConsolidated.tsx
@@ -1,10 +1,34 @@
-import { AbsoluteTime, AmountJson, TranslatedString } from "@gnu-taler/taler-util";
+/*
+ This file is part of GNU Taler
+ (C) 2022 Taler Systems S.A.
+
+ GNU Taler is free software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the Free Software
+ Foundation; either version 3, or (at your option) any later version.
+
+ GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with
+ GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+ */
+import {
+ AbsoluteTime,
+ AmountJson,
+ TranslatedString,
+} from "@gnu-taler/taler-util";
+import {
+ DefaultForm,
+ FlexibleForm,
+ UIFormField,
+ useTranslationContext,
+} from "@gnu-taler/web-util/browser";
import { format } from "date-fns";
import { Fragment, VNode, h } from "preact";
-import { AmlEvent } from "./CaseDetails.js";
-import { DefaultForm, FlexibleForm, UIFormField, useTranslationContext } from "@gnu-taler/web-util/browser";
import { amlStateConverter } from "../utils/converter.js";
import { AmlExchangeBackend } from "../utils/types.js";
+import { AmlEvent } from "./CaseDetails.js";
export function ShowConsolidated({
history,
@@ -22,15 +46,15 @@ export function ShowConsolidated({
return {
aml: {
threshold: {
- hidden: !form.aml
+ hidden: !form.aml,
},
since: {
- hidden: !form.aml
+ hidden: !form.aml,
},
state: {
- hidden: !form.aml
- }
- }
+ hidden: !form.aml,
+ },
+ },
};
},
design: [
@@ -70,29 +94,31 @@ export function ShowConsolidated({
},
Object.entries(cons.kyc).length > 0
? {
- title: i18n.str`KYC`,
- fields: Object.entries(cons.kyc).map(([key, field]) => {
- const result: UIFormField = {
- type: "text",
- props: {
- label: key as TranslatedString,
- name: `kyc.${key}.value`,
- help: `${field.provider} since ${field.since.t_ms === "never"
- ? "never"
- : format(field.since.t_ms, "dd/MM/yyyy")
+ title: i18n.str`KYC`,
+ fields: Object.entries(cons.kyc).map(([key, field]) => {
+ const result: UIFormField = {
+ type: "text",
+ props: {
+ label: key as TranslatedString,
+ name: `kyc.${key}.value`,
+ help: `${field.provider} since ${
+ field.since.t_ms === "never"
+ ? "never"
+ : format(field.since.t_ms, "dd/MM/yyyy")
}` as TranslatedString,
- },
- };
- return result;
- }),
- }
+ },
+ };
+ return result;
+ }),
+ }
: undefined,
],
};
return (
<Fragment>
<h1 class="text-base font-semibold leading-7 text-black">
- Consolidated information {until.t_ms === "never"
+ Consolidated information{" "}
+ {until.t_ms === "never"
? ""
: `after ${format(until.t_ms, "dd MMMM yyyy")}`}
</h1>
@@ -101,7 +127,7 @@ export function ShowConsolidated({
form={form}
initial={cons}
readOnly
- onUpdate={() => { }}
+ onUpdate={() => {}}
/>
</Fragment>
);
@@ -115,7 +141,7 @@ interface Consolidated {
};
kyc: {
[field: string]: {
- value: any;
+ value: unknown;
provider: string;
since: AbsoluteTime;
};
@@ -134,7 +160,7 @@ function getConsolidated(
value: 1000,
fraction: 0,
},
- since: AbsoluteTime.never()
+ since: AbsoluteTime.never(),
},
kyc: {},
};
@@ -153,14 +179,15 @@ function getConsolidated(
prev.aml = {
since: cur.when,
state: cur.state,
- threshold: cur.threshold
- }
+ threshold: cur.threshold,
+ };
break;
}
case "kyc-collection": {
Object.keys(cur.values).forEach((field) => {
+ const value = (cur.values as Record<string, unknown>)[field];
prev.kyc[field] = {
- value: (cur.values as any)[field],
+ value,
provider: cur.provider,
since: cur.when,
};
@@ -170,4 +197,4 @@ function getConsolidated(
}
return prev;
}, initial);
-} \ No newline at end of file
+}