blob: 3b62abf1b58a4aa992c0609df5376d5944f0b899 (
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
44
45
46
47
48
49
|
module LoggedIn.Home.Update exposing
( update
)
import LoggedData exposing (LoggedData)
import LoggedIn.Home.Msg as HomeMsg
import LoggedIn.Home.Model as HomeModel
import LoggedIn.Home.AddPayment.Update as AddPaymentUpdate
update : LoggedData -> HomeMsg.Msg -> HomeModel.Model -> (HomeModel.Model, Cmd HomeMsg.Msg)
update loggedData action homeModel =
case action of
HomeMsg.NoOp -> (homeModel, Cmd.none)
HomeMsg.UpdateAdd addPaymentMsg ->
( { homeModel | add = AddPaymentUpdate.update addPaymentMsg homeModel.add }
, Cmd.none
)
HomeMsg.ToggleEdit id ->
( { homeModel | paymentEdition = if homeModel.paymentEdition == Just id then Nothing else Just id }
, Cmd.none
)
HomeMsg.UpdatePage page ->
( { homeModel | currentPage = page }
, Cmd.none
)
HomeMsg.ShowMonthlyDetail ->
( { homeModel | monthlyDetail = True }
, Cmd.none
)
HomeMsg.ToggleMonthlyDetail ->
( { homeModel | monthlyDetail = not homeModel.monthlyDetail }
, Cmd.none
)
HomeMsg.UpdateSearch search ->
( { homeModel
| search = search
, currentPage = 1
}
, Cmd.none
)
|