From c680f5aa71b08e978444df07f93c381f9d47ab82 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 5 Jun 2023 10:04:09 -0300 Subject: rename aml --- packages/aml-backoffice-ui/src/pages/Cases.tsx | 288 +++++++++++++++++++++++++ 1 file changed, 288 insertions(+) create mode 100644 packages/aml-backoffice-ui/src/pages/Cases.tsx (limited to 'packages/aml-backoffice-ui/src/pages/Cases.tsx') diff --git a/packages/aml-backoffice-ui/src/pages/Cases.tsx b/packages/aml-backoffice-ui/src/pages/Cases.tsx new file mode 100644 index 000000000..28b9d2a88 --- /dev/null +++ b/packages/aml-backoffice-ui/src/pages/Cases.tsx @@ -0,0 +1,288 @@ +import { VNode, h } from "preact"; +import { Pages } from "../pages.js"; +import { AmlRecords, AmlState } from "../types.js"; +import { InputChoiceHorizontal } from "../handlers/InputChoiceHorizontal.js"; +import { createNewForm } from "../handlers/forms.js"; +import { TranslatedString } from "@gnu-taler/taler-util"; +import { amlStateConverter as amlStateConverter } from "./CaseDetails.js"; +import { useState } from "preact/hooks"; +import { HandleAccountNotReady } from "./HandleAccountNotReady.js"; +import { useOfficer } from "../hooks/useOfficer.js"; + +const response: AmlRecords = { + records: [ + { + current_state: 0, + h_payto: "QWEQWEQWEQWEWQE", + rowid: 1, + threshold: "USD 100", + }, + { + current_state: 1, + h_payto: "ASDASDASD", + rowid: 1, + threshold: "USD 100", + }, + { + current_state: 2, + h_payto: "ZXCZXCZXCXZC", + rowid: 1, + threshold: "USD 1000", + }, + { + current_state: 0, + h_payto: "QWEQWEQWEQWEWQE", + rowid: 1, + threshold: "USD 100", + }, + { + current_state: 1, + h_payto: "ASDASDASD", + rowid: 1, + threshold: "USD 100", + }, + { + current_state: 2, + h_payto: "ZXCZXCZXCXZC", + rowid: 1, + threshold: "USD 1000", + }, + ].map((e, idx) => { + e.rowid = idx; + e.threshold = `${e.threshold}${idx}`; + return e; + }), +}; + +function doFilter( + list: typeof response.records, + filter: AmlState | undefined, +): typeof response.records { + if (filter === undefined) return list; + return list.filter((r) => r.current_state === filter); +} + +export function Cases() { + const officer = useOfficer(); + if (officer.state !== "ready") { + return ; + } + const form = createNewForm<{ + state: AmlState; + }>(); + const initial = { state: AmlState.pending }; + const [list, setList] = useState(doFilter(response.records, initial.state)); + return ( +
+
+
+
+

+ Cases +

+

+ A list of all the account with the status +

+
+ { + setList(doFilter(response.records, v.state)); + }} + onSubmit={(v) => {}} + > + + +
+
+
+
+ + + + + + + + + + + {list.map((r) => { + return ( + + + + + + ); + })} + +
+ Account Id + + Status + + Threshold +
+ + + {((state: AmlState): VNode => { + switch (state) { + case AmlState.normal: { + return ( + + Normal + + ); + } + case AmlState.pending: { + return ( + + Pending + + ); + } + case AmlState.frozen: { + return ( + + Frozen + + ); + } + } + })(r.current_state)} + + {r.threshold} +
+ +
+
+
+
+
+ ); +} + +function Pagination() { + return ( + + ); +} -- cgit v1.2.3