resolution field for all forms

This commit is contained in:
Sebastian 2023-05-25 18:23:38 -03:00
parent 64e3705669
commit 562067a287
No known key found for this signature in database
GPG Key ID: 173909D1A5F66069
10 changed files with 127 additions and 72 deletions

View File

@ -1,7 +1,13 @@
import { AbsoluteTime, TranslatedString } from "@gnu-taler/taler-util";
import {
AbsoluteTime,
AmountJson,
TranslatedString,
} from "@gnu-taler/taler-util";
import { FormState } from "../handlers/FormProvider.js";
import { FlexibleForm } from "./index.js";
import { State } from "../pages/AntiMoneyLaunderingForm.js";
import { AmlState } from "../types.js";
import { Simplest, resolutionSection } from "./simplest.js";
export const v1 = (current: State): FlexibleForm<Form902_11.Form> => ({
versionId: "2023-05-15",
@ -114,6 +120,7 @@ export const v1 = (current: State): FlexibleForm<Form902_11.Form> => ({
},
],
},
resolutionSection(current),
],
behavior: function formBehavior(
v: Partial<Form902_11.Form>,
@ -137,12 +144,11 @@ namespace Form902_11 {
firstName: string;
address: string;
}
export interface Form {
export interface Form extends Simplest.WithResolution {
contractingPartner: string;
declares: "25-or-more" | "controlling-in-other-ways" | "managing-director";
person: Person[];
fiduciaryAssets: "no" | "yes";
when: AbsoluteTime;
signature: string;
}
}

View File

@ -1,7 +1,13 @@
import { AbsoluteTime, TranslatedString } from "@gnu-taler/taler-util";
import {
AbsoluteTime,
AmountJson,
TranslatedString,
} from "@gnu-taler/taler-util";
import { FormState } from "../handlers/FormProvider.js";
import { FlexibleForm } from "./index.js";
import { State } from "../pages/AntiMoneyLaunderingForm.js";
import { AmlState } from "../types.js";
import { Simplest, resolutionSection } from "./simplest.js";
export const v1 = (current: State): FlexibleForm<Form902_12.Form> => ({
versionId: "2023-05-15",
@ -363,6 +369,7 @@ export const v1 = (current: State): FlexibleForm<Form902_12.Form> => ({
},
],
},
resolutionSection(current),
],
behavior: function formBehavior(
v: Partial<Form902_12.Form>,
@ -419,7 +426,7 @@ namespace Form902_12 {
type Founder = WithRevoke<WithDeath<Person>>;
type Beneficiary = WithClaim<Person>;
export interface Form {
export interface Form extends Simplest.WithResolution {
contractingPartner: string;
knownAs: string;
boardMember: string;
@ -429,6 +436,5 @@ namespace Form902_12 {
beneficiaryWhenSigning: Array<Beneficiary>;
beneficiaryExtra: Array<Beneficiary>;
withRightToNominate: Array<WithRevoke<Person>>;
when: AbsoluteTime;
}
}

View File

@ -1,7 +1,13 @@
import { AbsoluteTime, TranslatedString } from "@gnu-taler/taler-util";
import {
AbsoluteTime,
AmountJson,
TranslatedString,
} from "@gnu-taler/taler-util";
import { FormState } from "../handlers/FormProvider.js";
import { FlexibleForm } from "./index.js";
import { State } from "../pages/AntiMoneyLaunderingForm.js";
import { AmlState } from "../types.js";
import { Simplest, resolutionSection } from "./simplest.js";
export const v1 = (current: State): FlexibleForm<Form902_13.Form> => ({
versionId: "2023-05-15",
@ -440,6 +446,7 @@ export const v1 = (current: State): FlexibleForm<Form902_13.Form> => ({
},
],
},
resolutionSection(current),
],
behavior: function formBehavior(
v: Partial<Form902_13.Form>,
@ -505,7 +512,7 @@ namespace Form902_13 {
type Founder = WithRevoke<WithDeath<Person>>;
type Beneficiary = WithClaim<Person>;
export interface Form {
export interface Form extends Simplest.WithResolution {
contractingPartner: string;
knownAs: string;
boardMember: string;
@ -516,6 +523,5 @@ namespace Form902_13 {
beneficiaryExtra: Array<Beneficiary>;
protectors: Array<WithRevoke<Person>>;
furtherPersons: Array<WithRevoke<Person>>;
when: AbsoluteTime;
}
}

View File

@ -1,7 +1,13 @@
import { AbsoluteTime, TranslatedString } from "@gnu-taler/taler-util";
import {
AbsoluteTime,
AmountJson,
TranslatedString,
} from "@gnu-taler/taler-util";
import { FormState } from "../handlers/FormProvider.js";
import { FlexibleForm } from "./index.js";
import { State } from "../pages/AntiMoneyLaunderingForm.js";
import { AmlState } from "../types.js";
import { Simplest, resolutionSection } from "./simplest.js";
export const v1 = (current: State): FlexibleForm<Form902_15.Form> => ({
versionId: "2023-05-15",
@ -159,6 +165,7 @@ export const v1 = (current: State): FlexibleForm<Form902_15.Form> => ({
},
],
},
resolutionSection(current),
],
behavior: function formBehavior(
v: Partial<Form902_15.Form>,
@ -179,13 +186,12 @@ namespace Form902_15 {
nationality: string;
}
export interface Form {
export interface Form extends Simplest.WithResolution {
contractingPartner: string;
contractualRelationship: string;
insurancePolicy: string;
holder: Person;
premiumsPayer: Person;
when: AbsoluteTime;
signature: string;
}
}

View File

@ -1,7 +1,15 @@
import { AbsoluteTime, TranslatedString } from "@gnu-taler/taler-util";
import {
AbsoluteTime,
AmountJson,
Amounts,
TranslatedString,
} from "@gnu-taler/taler-util";
import { FlexibleForm, languageList } from "./index.js";
import { FormState } from "../handlers/FormProvider.js";
import { State } from "../pages/AntiMoneyLaunderingForm.js";
import { AmlState } from "../types.js";
import { amlStateConverter } from "../pages/AccountDetails.js";
import { Simplest, resolutionSection } from "./simplest.js";
export const v1 = (current: State): FlexibleForm<Form902_1.Form> => ({
versionId: "2023-05-15",
@ -511,6 +519,7 @@ export const v1 = (current: State): FlexibleForm<Form902_1.Form> => ({
},
],
},
resolutionSection(current),
],
behavior: function formBehavior(
v: Partial<Form902_1.Form>,
@ -671,8 +680,7 @@ namespace Form902_1 {
purpose: string;
}
export interface Form {
when: AbsoluteTime;
export interface Form extends Simplest.WithResolution {
fullName: string;
customerType: "natural" | "legal";
naturalCustomer: NaturalCustomer;

View File

@ -1,10 +1,18 @@
import { AbsoluteTime, TranslatedString } from "@gnu-taler/taler-util";
import {
AbsoluteTime,
AmountJson,
Amounts,
TranslatedString,
} from "@gnu-taler/taler-util";
import { FormState } from "../handlers/FormProvider.js";
import { FlexibleForm } from "./index.js";
import { ArrowRightIcon } from "@heroicons/react/24/outline";
import { h as create } from "preact";
import { ChevronRightIcon } from "@heroicons/react/24/solid";
import { State } from "../pages/AntiMoneyLaunderingForm.js";
import { AmlState } from "../types.js";
import { amlStateConverter } from "../pages/AccountDetails.js";
import { Simplest, resolutionSection } from "./simplest.js";
export const v1 = (current: State): FlexibleForm<Form902_4.Form> => ({
versionId: "2023-05-15",
@ -736,6 +744,7 @@ export const v1 = (current: State): FlexibleForm<Form902_4.Form> => ({
},
],
},
resolutionSection(current),
],
behavior: function formBehavior(
v: Partial<Form902_4.Form>,
@ -749,10 +758,9 @@ export const v1 = (current: State): FlexibleForm<Form902_4.Form> => ({
});
namespace Form902_4 {
export interface Form {
export interface Form extends Simplest.WithResolution {
customer: string;
fullName: string;
when: AbsoluteTime;
pep: {
foreign: "yes" | "no";
domestic: "yes" | "no" | "yes-but-no-risk";

View File

@ -6,6 +6,8 @@ import {
import { FormState } from "../handlers/FormProvider.js";
import { FlexibleForm, currencyList } from "./index.js";
import { State } from "../pages/AntiMoneyLaunderingForm.js";
import { AmlState } from "../types.js";
import { Simplest, resolutionSection } from "./simplest.js";
export const v1 = (current: State): FlexibleForm<Form902_5.Form> => ({
versionId: "2023-05-15",
@ -229,6 +231,7 @@ export const v1 = (current: State): FlexibleForm<Form902_5.Form> => ({
},
],
},
resolutionSection(current),
],
behavior: function formBehavior(
v: Partial<Form902_5.Form>,
@ -247,10 +250,9 @@ export const v1 = (current: State): FlexibleForm<Form902_5.Form> => ({
});
namespace Form902_5 {
export interface Form {
export interface Form extends Simplest.WithResolution {
customer: string;
fullName: string;
when: AbsoluteTime;
businessActivity: string;
financial: string;
originOfAssets: {

View File

@ -1,7 +1,13 @@
import { AbsoluteTime, TranslatedString } from "@gnu-taler/taler-util";
import {
AbsoluteTime,
AmountJson,
TranslatedString,
} from "@gnu-taler/taler-util";
import { FormState } from "../handlers/FormProvider.js";
import { FlexibleForm } from "./index.js";
import { State } from "../pages/AntiMoneyLaunderingForm.js";
import { AmlState } from "../types.js";
import { Simplest, resolutionSection } from "./simplest.js";
export const v1 = (current: State): FlexibleForm<Form902_9.Form> => ({
versionId: "2023-05-15",
@ -103,6 +109,7 @@ export const v1 = (current: State): FlexibleForm<Form902_9.Form> => ({
},
],
},
resolutionSection(current),
],
behavior: function formBehavior(
v: Partial<Form902_9.Form>,
@ -123,10 +130,9 @@ namespace Form902_9 {
nationality: string;
address: string;
}
export interface Form {
export interface Form extends Simplest.WithResolution {
contractingPartner: string;
persons: Person;
when: AbsoluteTime;
signature: string;
}
}

View File

@ -9,6 +9,7 @@ import { FlexibleForm } from "./index.js";
import { AmlState } from "../types.js";
import { amlStateConverter } from "../pages/AccountDetails.js";
import { State } from "../pages/AntiMoneyLaunderingForm.js";
import { DoubleColumnFormSection, UIFormField } from "../handlers/forms.js";
export const v1 = (current: State): FlexibleForm<Simplest.Form> => ({
versionId: "2023-05-25",
@ -25,52 +26,7 @@ export const v1 = (current: State): FlexibleForm<Simplest.Form> => ({
},
],
},
{
title: "Resolution" as TranslatedString,
description: `Current state is ${amlStateConverter.toStringUI(
current.state,
)} and threshold at ${Amounts.stringifyValue(
current.threshold,
)}` as TranslatedString,
fields: [
{
type: "date",
props: {
name: "when",
label: "Decision Time" as TranslatedString,
},
},
{
type: "choiceHorizontal",
props: {
name: "state",
label: "New state" as TranslatedString,
converter: amlStateConverter,
choices: [
{
value: AmlState.frozen,
label: "Frozen" as TranslatedString,
},
{
value: AmlState.pending,
label: "Pending" as TranslatedString,
},
{
value: AmlState.normal,
label: "Normal" as TranslatedString,
},
],
},
},
{
type: "amount",
props: {
name: "threshold",
label: "New threshold" as TranslatedString,
},
},
],
},
resolutionSection(current),
],
behavior: function formBehavior(
v: Partial<Simplest.Form>,
@ -86,11 +42,62 @@ export const v1 = (current: State): FlexibleForm<Simplest.Form> => ({
},
});
namespace Simplest {
export interface Form {
export namespace Simplest {
export interface WithResolution {
when: AbsoluteTime;
threshold: AmountJson;
state: AmlState;
}
export interface Form extends WithResolution {
comment: string;
}
}
export function resolutionSection(current: State): DoubleColumnFormSection {
return {
title: "Resolution" as TranslatedString,
description: `Current state is ${amlStateConverter.toStringUI(
current.state,
)} and threshold at ${Amounts.stringifyValue(
current.threshold,
)}` as TranslatedString,
fields: [
{
type: "date",
props: {
name: "when",
label: "Decision Time" as TranslatedString,
},
},
{
type: "choiceHorizontal",
props: {
name: "state",
label: "New state" as TranslatedString,
converter: amlStateConverter,
choices: [
{
value: AmlState.frozen,
label: "Frozen" as TranslatedString,
},
{
value: AmlState.pending,
label: "Pending" as TranslatedString,
},
{
value: AmlState.normal,
label: "Normal" as TranslatedString,
},
],
},
},
{
type: "amount",
props: {
name: "threshold",
label: "New threshold" as TranslatedString,
},
},
],
};
}

View File

@ -18,7 +18,7 @@ import { InputChoiceHorizontal } from "./InputChoiceHorizontal.js";
export type DoubleColumnForm = Array<DoubleColumnFormSection | undefined>;
type DoubleColumnFormSection = {
export type DoubleColumnFormSection = {
title: TranslatedString;
description?: TranslatedString;
fields: UIFormField[];