blob: 302509fa0c3d7f7434502c6440651eee9c59db71 (
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
50
51
|
module LoggedIn.Home.Update exposing
( update
)
import Form exposing (Form)
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.SearchMsg formMsg ->
( { homeModel
| search = Form.update formMsg homeModel.search
, currentPage = 1
}
, Cmd.none
)
|