aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm/Utils
diff options
context:
space:
mode:
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