blob: fba3f7c393f1eed8149b4b21ec93bc0f70660ccd (
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.View exposing
( view
)
import Date
import Html exposing (..)
import Html.Attributes exposing (..)
import Form
import Utils.Form as Form
import LoggedData exposing (LoggedData)
import LoggedIn.Home.Header.View as Header
import LoggedIn.Home.Model as Home
import LoggedIn.Home.Msg as HomeMsg
import LoggedIn.Home.View.Paging as Paging
import LoggedIn.Home.View.Table as Table
import LoggedIn.Msg as LoggedInMsg
import Model.Payment as Payment
import Model.Frequency exposing (Frequency(..))
import Msg exposing (Msg)
view : LoggedData -> Home.Model -> Html Msg
view loggedData home =
let (name, frequency) =
case Form.getOutput home.search of
Just data -> (Maybe.withDefault "" data.name, data.frequency)
Nothing -> ("", Punctual)
payments = Payment.search name frequency loggedData.payments
page =
case frequency of
Punctual -> home.punctualPage
Monthly -> home.monthlyPage
in div
[ class "home" ]
[ Header.view loggedData home payments frequency
, Table.view loggedData home payments frequency page
, Paging.view
page
(List.length payments)
Msg.NoOp
(Msg.UpdateLoggedIn << LoggedInMsg.HomeMsg << HomeMsg.UpdatePage)
]
|