diff options
author | Joris | 2016-04-06 14:28:16 +0200 |
---|---|---|
committer | Joris | 2016-04-06 14:28:16 +0200 |
commit | ac8a7c6210e2f430a3015e8004ff0726ef24d63b (patch) | |
tree | 0df4ccbef7fca622a0ee4e89d35b9ce7d2d6eb09 /src/client/elm/LoggedIn | |
parent | d889c728c6ef1462fdeb56891de8d4d1a3df70c6 (diff) |
Add payments by month in stat
Diffstat (limited to 'src/client/elm/LoggedIn')
-rw-r--r-- | src/client/elm/LoggedIn/Stat/View.elm | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/src/client/elm/LoggedIn/Stat/View.elm b/src/client/elm/LoggedIn/Stat/View.elm index 3fe9d1f..a289002 100644 --- a/src/client/elm/LoggedIn/Stat/View.elm +++ b/src/client/elm/LoggedIn/Stat/View.elm @@ -37,25 +37,32 @@ paymentsDetail loggedData payments = ] , li [] - [ payments - |> List.map .cost - |> List.sum - |> Format.price loggedData.conf - |> text - ] + [ text (paymentsSum loggedData.conf payments) ] ] monthsDetail : LoggedData -> Html monthsDetail loggedData = ul [] - [] + ( Payment.punctual loggedData.payments + |> Payment.groupAndSortByMonth + |> List.map (monthDetail loggedData.conf) + ) -monthDetail : String -> Int -> Html -monthDetail month amount = +monthDetail : Conf -> ((Int, Int), Payments) -> Html +monthDetail conf ((year, month), payments) = li [] - [ text month - , text " " - , text (toString amount) + [ text (toString month) + , text "/" + , text (toString year) + , text " − " + , text (paymentsSum conf payments) ] + +paymentsSum : Conf -> Payments -> String +paymentsSum conf payments = + payments + |> List.map .cost + |> List.sum + |> Format.price conf |