aboutsummaryrefslogtreecommitdiff
path: root/packages/exchange-backoffice-ui/src/forms/simplest.ts
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2023-05-25 18:23:38 -0300
committerSebastian <sebasjm@gmail.com>2023-05-26 09:26:12 -0300
commit562067a28788084832af4a2862d06f99a71476d3 (patch)
treede210a059ce718487a3dbd411ad25d7ff7345fc4 /packages/exchange-backoffice-ui/src/forms/simplest.ts
parent64e3705669e7c12b8013704654f17cf8eaf659d4 (diff)
resolution field for all forms
Diffstat (limited to 'packages/exchange-backoffice-ui/src/forms/simplest.ts')
-rw-r--r--packages/exchange-backoffice-ui/src/forms/simplest.ts103
1 files changed, 55 insertions, 48 deletions
diff --git a/packages/exchange-backoffice-ui/src/forms/simplest.ts b/packages/exchange-backoffice-ui/src/forms/simplest.ts
index a395410c3..5da01961b 100644
--- a/packages/exchange-backoffice-ui/src/forms/simplest.ts
+++ b/packages/exchange-backoffice-ui/src/forms/simplest.ts
@@ -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,
+ },
+ },
+ ],
+ };
+}