diff options
author | Joris | 2016-03-27 21:24:11 +0200 |
---|---|---|
committer | Joris | 2016-03-27 21:24:11 +0200 |
commit | 617d30c96792795ab8561a6262c4c5f4e023b6cf (patch) | |
tree | 3174d82e3839e942a4be17a065415b497405fd0b /src/client/elm/LoggedIn/Monthly/Update.elm | |
parent | 0c9d2b91e73f045067f7bcce6e4235fc9008f309 (diff) |
Regroup monthly modules
Diffstat (limited to 'src/client/elm/LoggedIn/Monthly/Update.elm')
-rw-r--r-- | src/client/elm/LoggedIn/Monthly/Update.elm | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/client/elm/LoggedIn/Monthly/Update.elm b/src/client/elm/LoggedIn/Monthly/Update.elm new file mode 100644 index 0000000..62b40e6 --- /dev/null +++ b/src/client/elm/LoggedIn/Monthly/Update.elm @@ -0,0 +1,21 @@ +module LoggedIn.Monthly.Update + ( update + ) where + +import LoggedIn.Monthly.Action as MonthlyAction +import LoggedIn.Monthly.Model as MonthlyModel + +update : MonthlyAction.Action -> MonthlyModel.Model -> MonthlyModel.Model +update action monthly = + case action of + MonthlyAction.ToggleDetail -> + { monthly | visibleDetail = not monthly.visibleDetail } + MonthlyAction.AddPayment payment -> + { monthly + | payments = payment :: monthly.payments + , visibleDetail = True + } + MonthlyAction.DeletePayment payment -> + { monthly + | payments = List.filter (((/=) payment.id) << .id) monthly.payments + } |