From c2efc802b2789cb47a6b0a54fc1672b98ee37db2 Mon Sep 17 00:00:00 2001
From: Sebastian <sebasjm@gmail.com>
Date: Fri, 6 Sep 2024 13:54:33 -0300
Subject: search account in aml form and remove name from dynamic forms

---
 .../aml-backoffice-ui/src/pages/ShowConsolidated.tsx     | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 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 21c14fee3..7374125b0 100644
--- a/packages/aml-backoffice-ui/src/pages/ShowConsolidated.tsx
+++ b/packages/aml-backoffice-ui/src/pages/ShowConsolidated.tsx
@@ -20,7 +20,6 @@ import {
   TranslatedString,
 } from "@gnu-taler/taler-util";
 import {
-  DefaultForm,
   FormConfiguration,
   RenderAllFieldsByUiConfig,
   UIFormElementConfig,
@@ -31,8 +30,8 @@ import {
 } 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";
+import { AmlEvent } from "./CaseDetails.js";
 
 /**
  * the exchange doesn't hava a consistent api
@@ -78,7 +77,6 @@ export function ShowConsolidated({
                 type: "text",
                 label: key as TranslatedString,
                 id: `${key}.value` as UIHandlerId,
-                name: `${key}.value`,
                 disabled: true,
                 help: `At ${
                   field.since.t_ms === "never"
@@ -92,13 +90,11 @@ export function ShowConsolidated({
         : undefined!,
     ],
   };
-  const shape: Array<UIHandlerId> = [];
-
-  formConfig.design.forEach((section) => {
-    Array.prototype.push.apply(shape, getShapeFromFields(section.fields));
-  });
+  const shape: Array<UIHandlerId> = formConfig.design.flatMap((field) =>
+    getShapeFromFields(field.fields),
+  );
 
-  const [form, state] = useFormState<{}>(shape, fixed, (result) => {
+  const { handler } = useFormState<{}>(shape, fixed, (result) => {
     return { status: "ok", errors: undefined, result };
   });
 
@@ -130,7 +126,7 @@ export function ShowConsolidated({
                       fields={convertUiField(
                         i18n,
                         section.fields,
-                        form,
+                        handler,
                         getConverterById,
                       )}
                     />
-- 
cgit v1.2.3

