blob: 482db5f0e43a1a06b5275dc67b8c514671e70b3a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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
|