diff options
author | Joris | 2015-09-06 16:46:59 +0200 |
---|---|---|
committer | Joris | 2015-09-06 16:46:59 +0200 |
commit | 3853811450d4fe801da996eb48825049c3541030 (patch) | |
tree | b483c6152f55b6fe87d23108d2d0346a593e51ac /src/client/Update/LoggedIn/Add.elm | |
parent | 0b6f0fa29075178b45cb17d2932003ab4b342280 (diff) |
Renaming PaymentView to LoggedInView
Diffstat (limited to 'src/client/Update/LoggedIn/Add.elm')
-rw-r--r-- | src/client/Update/LoggedIn/Add.elm | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/client/Update/LoggedIn/Add.elm b/src/client/Update/LoggedIn/Add.elm new file mode 100644 index 0000000..1f28997 --- /dev/null +++ b/src/client/Update/LoggedIn/Add.elm @@ -0,0 +1,29 @@ +module Update.LoggedIn.Add + ( AddPaymentAction(..) + , updateAddPayment + ) where + +import Model.View.LoggedIn.Add exposing (..) + +type AddPaymentAction = + UpdateName String + | UpdateCost String + | AddError (Maybe String) (Maybe String) + | ToggleFrequency + +updateAddPayment : AddPaymentAction -> AddPayment -> AddPayment +updateAddPayment action addPayment = + case action of + UpdateName name -> + { addPayment | name <- name } + UpdateCost cost -> + { addPayment | cost <- cost } + AddError nameError costError -> + { addPayment + | nameError <- nameError + , costError <- costError + } + ToggleFrequency -> + { addPayment + | frequency <- if addPayment.frequency == Punctual then Monthly else Punctual + } |