aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm/LoggedIn/Stat
diff options
context:
space:
mode:
authorJoris2016-04-05 23:52:13 +0200
committerJoris2016-04-05 23:52:13 +0200
commitfe50c4042848681833d15fab27466d1d2d4bda45 (patch)
tree9a1eda4adb22c0d84815e20e8e021968815d7c50 /src/client/elm/LoggedIn/Stat
parent466f77394885cb74d01451c4733cafc9b61f4bba (diff)
Ameliore design in income page and stat page
Diffstat (limited to 'src/client/elm/LoggedIn/Stat')
-rw-r--r--src/client/elm/LoggedIn/Stat/View.elm45
1 files changed, 32 insertions, 13 deletions
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)
+ ]