aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm/LoggedIn/Stat/View.elm
blob: 76acd8f3abf58ce84642c33e64e9dcce25e3144c (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
module LoggedIn.Stat.View
  ( view
  ) where

import Html exposing (..)

import LoggedData exposing (LoggedData)

import Model.Payment exposing (Payments)
import Model.Conf exposing (Conf)

import LoggedIn.View.Price exposing (price)

view : LoggedData -> Html
view loggedData =
  div
    []
    [ h1 [] [ text "Total" ]
    , paymentDetail loggedData.conf loggedData.payments
    ]

paymentDetail : Conf -> Payments -> Html
paymentDetail conf payments =
  ul
    []
    [ li
        []
        [ payments
            |> List.length
            |> toString
            |> text
        , text " payments"
        ]
    , li
        []
        [ payments
            |> List.map .cost
            |> List.sum
            |> price conf
            |> text
        ]
    ]