From 0c9f61c6f478bea4dbb97e5fec24e78e2ee55607 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 29 Aug 2024 00:50:05 -0300 Subject: fix difference between kyc form and aml form, mostly prettier --- .../src/pages/ShowConsolidated.tsx | 71 +++++++++++++++++----- 1 file changed, 55 insertions(+), 16 deletions(-) (limited to 'packages/aml-backoffice-ui/src/pages/ShowConsolidated.tsx') diff --git a/packages/aml-backoffice-ui/src/pages/ShowConsolidated.tsx b/packages/aml-backoffice-ui/src/pages/ShowConsolidated.tsx index e53c74aa5..21c14fee3 100644 --- a/packages/aml-backoffice-ui/src/pages/ShowConsolidated.tsx +++ b/packages/aml-backoffice-ui/src/pages/ShowConsolidated.tsx @@ -22,13 +22,17 @@ import { import { DefaultForm, FormConfiguration, + RenderAllFieldsByUiConfig, UIFormElementConfig, UIHandlerId, + convertUiField, + getConverterById, useTranslationContext, } from "@gnu-taler/web-util/browser"; import { format } from "date-fns"; import { Fragment, VNode, h } from "preact"; import { AmlEvent } from "./CaseDetails.js"; +import { getShapeFromFields, useFormState } from "../hooks/form.js"; /** * the exchange doesn't hava a consistent api @@ -63,7 +67,7 @@ export function ShowConsolidated({ const fixed = fixProvidedInfo(cons.kyc); - const form: FormConfiguration = { + const formConfig: FormConfiguration = { type: "double-column", design: [ Object.entries(fixed).length > 0 @@ -73,8 +77,9 @@ export function ShowConsolidated({ const result: UIFormElementConfig = { type: "text", label: key as TranslatedString, - id: `kyc.${key}.value` as UIHandlerId, - name: `kyc.${key}.value`, + id: `${key}.value` as UIHandlerId, + name: `${key}.value`, + disabled: true, help: `At ${ field.since.t_ms === "never" ? "never" @@ -87,21 +92,55 @@ export function ShowConsolidated({ : undefined!, ], }; + const shape: Array = []; + + formConfig.design.forEach((section) => { + Array.prototype.push.apply(shape, getShapeFromFields(section.fields)); + }); + + const [form, state] = useFormState<{}>(shape, fixed, (result) => { + return { status: "ok", errors: undefined, result }; + }); + return ( - {/*

- Consolidated information{" "} - {until.t_ms === "never" - ? "" - : `after ${format(until.t_ms, "dd MMMM yyyy")}`} -

*/} - {}} - /> +
+ {formConfig.design.map((section, i) => { + if (!section) return ; + return ( +
+
+

+ {section.title} +

+ {section.description && ( +

+ {section.description} +

+ )} +
+
+
+
+ +
+
+
+
+ ); + })} +
); } -- cgit v1.2.3