summaryrefslogtreecommitdiff
path: root/packages/demobank-ui/src/forms/simplest.ts
blob: 54b6b1c65b9f8bb6a6b318c0143fc349054872a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import {
  AbsoluteTime,
  AmountJson,
  TranslatedString
} from "@gnu-taler/taler-util";
import { DoubleColumnForm, FormState } from "@gnu-taler/web-util/browser";

export namespace Data {
  export interface WithResolution {
    when: AbsoluteTime;
    threshold: AmountJson;
    state: string;
  }
  export interface Form extends WithResolution {
    comment: string;
  }
}

const design: DoubleColumnForm = [
  {
    title: "Simple form" as TranslatedString,
    fields: [
      {
        type: "textArea",
        props: {
          name: "comment",
          label: "Comments" as TranslatedString,
        },
      },
    ],
  },
  {
    title: "Resolution" as TranslatedString,
    description: `Current state is and threshold at ` as TranslatedString,
    fields: [
      {
        type: "date",
        props: {
          name: "when",
          label: "Decision Time" as TranslatedString,
        },
      },
      {
        type: "amount",
        props: {
          name: "threshold",
          label: "New threshold" as TranslatedString,
        },
      },
    ],
  }
  ,
];

function formBehavior(v: Partial<Data.Form>): FormState<Data.Form> {
  return {
    when: {
      disabled: true,
    },
    threshold: {
      // disabled: v.state === AmlExchangeBackend.AmlState.frozen,
    },
  };
}