aboutsummaryrefslogtreecommitdiff
path: root/packages/aml-backoffice-ui/src/forms/simplest.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/aml-backoffice-ui/src/forms/simplest.ts')
-rw-r--r--packages/aml-backoffice-ui/src/forms/simplest.ts70
1 files changed, 33 insertions, 37 deletions
diff --git a/packages/aml-backoffice-ui/src/forms/simplest.ts b/packages/aml-backoffice-ui/src/forms/simplest.ts
index 6455b6f41..d32c759cb 100644
--- a/packages/aml-backoffice-ui/src/forms/simplest.ts
+++ b/packages/aml-backoffice-ui/src/forms/simplest.ts
@@ -13,74 +13,68 @@
You should have received a copy of the GNU General Public License along with
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-import {
- TalerExchangeApi,
- type TranslatedString
-} from "@gnu-taler/taler-util";
-import type { DoubleColumnFormSection, FlexibleForm, FormState, InternationalizationAPI } from "@gnu-taler/web-util/browser";
-import { amlStateConverter } from "../utils/converter.js";
-import { BaseForm } from "./declaration.js";
+import type {
+ InternationalizationAPI
+} from "@gnu-taler/web-util/browser";
+import { BaseForm, DoubleColumnForm, DoubleColumnFormSection, UIHandlerId } from "../context/ui-forms.js";
-export const v1 = (i18n: InternationalizationAPI) => (current: BaseForm): FlexibleForm<Simplest.Form> => ({
+export const v1 = (i18n: InternationalizationAPI): DoubleColumnForm => ({
+ type: "double-column" as const,
design: [
{
title: i18n.str`Simple form`,
fields: [
{
type: "textArea",
- props: {
+ properties: {
+ id: ".comment" as UIHandlerId,
name: "comment",
label: i18n.str`Comments`,
},
},
],
},
- resolutionSection(current, i18n),
+ resolutionSection(i18n),
],
- behavior: function formBehavior(
- v: Partial<Simplest.Form>,
- ): FormState<Simplest.Form> {
- return {
- comment: {
- help: ((v.comment?.length ?? 0) > 100 ? "keep it short" : "") as TranslatedString,
- },
- threshold: {
- disabled: v.state === TalerExchangeApi.AmlState.frozen,
- },
- };
- },
+ // behavior: function formBehavior(
+ // v: Partial<Simplest.Form>,
+ // ): FormState<Simplest.Form> {
+ // return {
+ // comment: {
+ // help: ((v.comment?.length ?? 0) > 100 ? "keep it short" : "") as TranslatedString,
+ // },
+ // threshold: {
+ // disabled: v.state === TalerExchangeApi.AmlState.frozen,
+ // },
+ // };
+ // },
});
-export namespace Simplest {
- export interface Form extends BaseForm {
- comment: string;
- }
-}
-
-export function resolutionSection(current: BaseForm, i18n: InternationalizationAPI): DoubleColumnFormSection {
+export function resolutionSection(
+ i18n: InternationalizationAPI,
+): DoubleColumnFormSection {
return {
title: i18n.str`Resolution`,
- description: `Current state is ${amlStateConverter.toStringUI(
- current.state,
- )} and threshold at ` as TranslatedString,
fields: [
{
type: "choiceHorizontal",
- props: {
+ properties: {
+ id: ".state" as UIHandlerId,
name: "state",
label: i18n.str`New state`,
+ converterId: "TalerExchangeApi.AmlState",
choices: [
{
- value: TalerExchangeApi.AmlState.frozen,
+ value: "frozen",
label: i18n.str`Frozen`,
},
{
- value: TalerExchangeApi.AmlState.pending,
+ value: "pending",
label: i18n.str`Pending`,
},
{
- value: TalerExchangeApi.AmlState.normal,
+ value: "normal",
label: i18n.str`Normal`,
},
],
@@ -88,7 +82,9 @@ export function resolutionSection(current: BaseForm, i18n: InternationalizationA
},
{
type: "amount",
- props: {
+ properties: {
+ id: ".threshold" as UIHandlerId,
+ currency: "USD",
name: "threshold",
label: i18n.str`New threshold`,
},