aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm/LoggedIn/Home/View.elm
blob: 0def64e5f6c2fdfda57e23fcc6f5f65d205a2c8e (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
module LoggedIn.Home.View exposing
  ( view
  )

import Html exposing (..)
import Html.Attributes exposing (..)
import Date

import Form
import Utils.Form as Form

import Msg exposing (Msg)

import LoggedData exposing (LoggedData)
import Model.Payment as Payment exposing (Frequency(..))

import LoggedIn.Home.Model as Home
import LoggedIn.Home.Header.View as Header

import LoggedIn.Home.View.Table as Table
import LoggedIn.Home.View.Paging as Paging

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
  in  div
        [ class "home" ]
        [ Header.view loggedData home payments frequency
        , Table.view loggedData home payments frequency
        , Paging.view home payments
        ]