blob: 70b2f9c838aec762bfe03a11c3e9c3946684cdcf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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
}
|