blob: 250509149df697d122c4640eea91d9087fa7255b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
module Update.LoggedIn.Monthly
( updateMonthly
) where
import Model.Action.MonthlyAction exposing (..)
import Model.View.LoggedIn.Monthly exposing (..)
updateMonthly : MonthlyAction -> Monthly -> Monthly
updateMonthly action monthly =
case action of
ToggleDetail ->
{ monthly | visibleDetail = not monthly.visibleDetail }
AddPayment payment ->
{ monthly
| payments = payment :: monthly.payments
, visibleDetail = True
}
DeletePayment id ->
{ monthly
| payments = List.filter (\payment -> payment.id /= id) monthly.payments
}
|