From fe50c4042848681833d15fab27466d1d2d4bda45 Mon Sep 17 00:00:00 2001 From: Joris Date: Tue, 5 Apr 2016 23:52:13 +0200 Subject: Ameliore design in income page and stat page --- src/client/elm/LoggedIn/Stat/View.elm | 45 +++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 13 deletions(-) (limited to 'src/client/elm/LoggedIn/Stat') diff --git a/src/client/elm/LoggedIn/Stat/View.elm b/src/client/elm/LoggedIn/Stat/View.elm index 76acd8f..3fe9d1f 100644 --- a/src/client/elm/LoggedIn/Stat/View.elm +++ b/src/client/elm/LoggedIn/Stat/View.elm @@ -3,40 +3,59 @@ module LoggedIn.Stat.View ) where import Html exposing (..) +import Html.Attributes exposing (..) import LoggedData exposing (LoggedData) -import Model.Payment exposing (Payments) +import Model.Payment as Payment exposing (Payments) import Model.Conf exposing (Conf) +import Model.Translations exposing (getMessage) -import LoggedIn.View.Price exposing (price) +import LoggedIn.View.Format as Format + +import View.Plural exposing (plural) view : LoggedData -> Html view loggedData = div - [] - [ h1 [] [ text "Total" ] - , paymentDetail loggedData.conf loggedData.payments + [ class "stat" ] + [ h1 [] [ text (getMessage "Overall" loggedData.translations) ] + , paymentsDetail loggedData (Payment.punctual loggedData.payments) + , h1 [] [ text (getMessage "ByMonths" loggedData.translations) ] + , monthsDetail loggedData ] -paymentDetail : Conf -> Payments -> Html -paymentDetail conf payments = +paymentsDetail : LoggedData -> Payments -> Html +paymentsDetail loggedData payments = ul [] [ li [] - [ payments - |> List.length - |> toString - |> text - , text " payments" + [ let single = getMessage "Payment" loggedData.translations + multiple = getMessage "Payments" loggedData.translations + in text <| plural (List.length payments) single multiple ] , li [] [ payments |> List.map .cost |> List.sum - |> price conf + |> Format.price loggedData.conf |> text ] ] + +monthsDetail : LoggedData -> Html +monthsDetail loggedData = + ul + [] + [] + +monthDetail : String -> Int -> Html +monthDetail month amount = + li + [] + [ text month + , text " " + , text (toString amount) + ] -- cgit v1.2.3