import { VNode, h } from "preact";
import { allForms } from "./AntiMoneyLaunderingForm.js";
import { Pages } from "../pages.js";
import { NiceForm } from "../NiceForm.js";
import { AmlState } from "../types.js";
import { Amounts } from "@gnu-taler/taler-util";
export function NewFormEntry({
account,
type,
}: {
account?: string;
type?: string;
}): VNode {
if (!account) {
return
no account
;
}
if (!type) {
return ;
}
const selectedForm = Number.parseInt(type ?? "0", 10);
if (Number.isNaN(selectedForm)) {
return WHAT! {type}
;
}
const showingFrom = allForms[selectedForm].impl;
const initial = {
fullName: "loggedIn_user_fullname",
when: {
t_ms: new Date().getTime(),
},
state: AmlState.pending,
threshold: Amounts.parseOrThrow("USD:10"),
};
return (
{
alert(JSON.stringify(v));
}}
>
);
}
function SelectForm({ account }: { account: string }) {
return (
New form for account: {account}
{allForms.map((form, idx) => {
return (
{form.name}
);
})}
);
}