diff options
Diffstat (limited to 'src/client/elm/LoggedIn/Home/Monthly/Update.elm')
-rw-r--r-- | src/client/elm/LoggedIn/Home/Monthly/Update.elm | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/client/elm/LoggedIn/Home/Monthly/Update.elm b/src/client/elm/LoggedIn/Home/Monthly/Update.elm new file mode 100644 index 0000000..70b2f9c --- /dev/null +++ b/src/client/elm/LoggedIn/Home/Monthly/Update.elm @@ -0,0 +1,21 @@ +module LoggedIn.Home.Monthly.Update + ( update + ) where + +import LoggedIn.Home.Monthly.Action as MonthlyAction +import LoggedIn.Home.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 + } |