diff options
Diffstat (limited to 'packages/aml-backoffice-ui/src/forms/simplest.ts')
-rw-r--r-- | packages/aml-backoffice-ui/src/forms/simplest.ts | 41 |
1 files changed, 18 insertions, 23 deletions
diff --git a/packages/aml-backoffice-ui/src/forms/simplest.ts b/packages/aml-backoffice-ui/src/forms/simplest.ts index 99d109da9..1561076df 100644 --- a/packages/aml-backoffice-ui/src/forms/simplest.ts +++ b/packages/aml-backoffice-ui/src/forms/simplest.ts @@ -1,30 +1,27 @@ -import { - AbsoluteTime, - AmountJson, - Amounts, - TranslatedString, +import type { + TranslatedString } from "@gnu-taler/taler-util"; -import { BaseForm } from "../pages/AntiMoneyLaunderingForm.js"; -import { AmlExchangeBackend } from "../types.js"; -import { amlStateConverter } from "../pages/ShowConsolidated.js"; -import { DoubleColumnFormSection, FlexibleForm, FormState } from "@gnu-taler/web-util/browser"; +import type { DoubleColumnFormSection, FlexibleForm, FormState, InternationalizationAPI } from "@gnu-taler/web-util/browser"; +import { BaseForm } from "./index.js"; +import { amlStateConverter } from "../utils/converter.js"; +import { AmlExchangeBackend } from "../utils/types.js"; -export const v1 = (current: BaseForm): FlexibleForm<Simplest.Form> => ({ +export const v1 = (i18n: InternationalizationAPI) => (current: BaseForm): FlexibleForm<Simplest.Form> => ({ design: [ { - title: "Simple form" as TranslatedString, + title: i18n.str`Simple form`, fields: [ { type: "textArea", props: { name: "comment", - label: "Comments" as TranslatedString, + label: i18n.str`Comments`, }, }, ], }, - resolutionSection(current), + resolutionSection(current, i18n), ], behavior: function formBehavior( v: Partial<Simplest.Form>, @@ -47,33 +44,31 @@ export namespace Simplest { } } -export function resolutionSection(current: BaseForm): DoubleColumnFormSection { +export function resolutionSection(current: BaseForm, i18n: InternationalizationAPI): DoubleColumnFormSection { return { - title: "Resolution" as TranslatedString, + title: i18n.str`Resolution`, description: `Current state is ${amlStateConverter.toStringUI( current.state, - )} and threshold at ${Amounts.stringifyValue( - current.threshold, - )}` as TranslatedString, + )} and threshold at ` as TranslatedString, fields: [ { type: "choiceHorizontal", props: { name: "state", - label: "New state" as TranslatedString, + label: i18n.str`New state`, converter: amlStateConverter, choices: [ { value: AmlExchangeBackend.AmlState.frozen, - label: "Frozen" as TranslatedString, + label: i18n.str`Frozen`, }, { value: AmlExchangeBackend.AmlState.pending, - label: "Pending" as TranslatedString, + label: i18n.str`Pending`, }, { value: AmlExchangeBackend.AmlState.normal, - label: "Normal" as TranslatedString, + label: i18n.str`Normal`, }, ], }, @@ -82,7 +77,7 @@ export function resolutionSection(current: BaseForm): DoubleColumnFormSection { type: "amount", props: { name: "threshold", - label: "New threshold" as TranslatedString, + label: i18n.str`New threshold`, }, }, ], |