aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm/Utils
diff options
context:
space:
mode:
authorJoris2016-06-26 12:31:24 +0200
committerJoris2016-06-26 12:31:24 +0200
commit9ec84e3a20c767f6525639f58cd22715e302b88d (patch)
treea080552859180707472c1a289080857c0a54fc06 /src/client/elm/Utils
parent5cb36652ccf07c9e0995ebc421a837ad7d258469 (diff)
Add an editable date field for punctual payment creation
Diffstat (limited to 'src/client/elm/Utils')
-rw-r--r--src/client/elm/Utils/Form.elm10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/client/elm/Utils/Form.elm b/src/client/elm/Utils/Form.elm
index 6793222..482db5f 100644
--- a/src/client/elm/Utils/Form.elm
+++ b/src/client/elm/Utils/Form.elm
@@ -1,11 +1,21 @@
module Utils.Form exposing
( fieldAsText
+ , frequency
)
import Form exposing (Form)
+import Model.Payment exposing (Frequency(..))
+
fieldAsText : Form a b -> String -> String
fieldAsText form field =
Form.getFieldAsString field form
|> .value
|> Maybe.withDefault ""
+
+frequency : Form a b -> Frequency
+frequency form =
+ let field = Form.getFieldAsString "frequency" form
+ in if field.value == Just (toString Monthly)
+ then Monthly
+ else Punctual