aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoris2016-04-05 15:58:50 +0200
committerJoris2016-04-05 15:58:50 +0200
commit9b138cfc855d8d2bfa570f185467e4df0d1d8565 (patch)
treeaa7c90cd247f84121b7f2d6c65f5c6075bd555ad /src
parentaa64d6bdaa9fd23d205c18974dac8f29d29fd4f3 (diff)
downloadbudget-9b138cfc855d8d2bfa570f185467e4df0d1d8565.tar.gz
budget-9b138cfc855d8d2bfa570f185467e4df0d1d8565.tar.bz2
budget-9b138cfc855d8d2bfa570f185467e4df0d1d8565.zip
Add total payments stats
Diffstat (limited to 'src')
-rw-r--r--src/client/elm/LoggedIn/Stat/View.elm34
1 files changed, 33 insertions, 1 deletions
diff --git a/src/client/elm/LoggedIn/Stat/View.elm b/src/client/elm/LoggedIn/Stat/View.elm
index e5d1c08..76acd8f 100644
--- a/src/client/elm/LoggedIn/Stat/View.elm
+++ b/src/client/elm/LoggedIn/Stat/View.elm
@@ -6,5 +6,37 @@ 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 = text "Stats"
+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
+ ]
+ ]