blob: cebdc70e9246d61cd7f4d4080aeaa547e5dc43f2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
module LoggedIn.Home.Update
( update
) where
import Effects exposing (Effects)
import LoggedData exposing (LoggedData)
import LoggedIn.Home.Action as HomeAction
import LoggedIn.Home.Model as HomeModel
import LoggedIn.Home.AddPayment.Update as AddPaymentUpdate
update : LoggedData -> HomeAction.Action -> HomeModel.Model -> (HomeModel.Model, Effects HomeAction.Action)
update loggedData action homeModel =
case action of
HomeAction.NoOp -> (homeModel, Effects.none)
HomeAction.UpdateAdd addPaymentAction ->
( { homeModel | add = AddPaymentUpdate.update addPaymentAction homeModel.add }
, Effects.none
)
HomeAction.ToggleEdit id ->
( { homeModel | paymentEdition = if homeModel.paymentEdition == Just id then Nothing else Just id }
, Effects.none
)
HomeAction.UpdatePage page ->
( { homeModel | currentPage = page }
, Effects.none
)
HomeAction.ShowMonthlyDetail ->
( { homeModel | monthlyDetail = True }
, Effects.none
)
HomeAction.ToggleMonthlyDetail ->
( { homeModel | monthlyDetail = not homeModel.monthlyDetail }
, Effects.none
)
|