diff options
Diffstat (limited to 'src/client/Update/LoggedView')
-rw-r--r-- | src/client/Update/LoggedView/Monthly.elm | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/client/Update/LoggedView/Monthly.elm b/src/client/Update/LoggedView/Monthly.elm index 8d02c5e..567025f 100644 --- a/src/client/Update/LoggedView/Monthly.elm +++ b/src/client/Update/LoggedView/Monthly.elm @@ -3,17 +3,25 @@ module Update.LoggedView.Monthly , updateMonthly ) where -import Model.Payment exposing (Payment) +import Model.Payment exposing (Payment, PaymentId) import Model.View.Payment.Monthly exposing (..) type MonthlyAction = ToggleDetail - | AddMonthlyPayment Payment + | AddPayment Payment + | DeletePayment PaymentId updateMonthly : MonthlyAction -> Monthly -> Monthly updateMonthly action monthly = case action of ToggleDetail -> { monthly | visibleDetail <- not monthly.visibleDetail } - AddMonthlyPayment payment -> - { monthly | payments <- payment :: monthly.payments } + AddPayment payment -> + { monthly + | payments <- payment :: monthly.payments + , visibleDetail <- True + } + DeletePayment id -> + { monthly + | payments <- List.filter (\payment -> payment.id /= id) monthly.payments + } |