From 9b138cfc855d8d2bfa570f185467e4df0d1d8565 Mon Sep 17 00:00:00 2001 From: Joris Date: Tue, 5 Apr 2016 15:58:50 +0200 Subject: Add total payments stats --- src/client/elm/LoggedIn/Stat/View.elm | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'src/client') 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 + ] + ] -- cgit v1.2.3