aboutsummaryrefslogtreecommitdiff
path: root/src/client/View/Payments/ExceedingPayer.elm
blob: 88b3a7218ffe0a50b3fa5926af9cd62f949ebb37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
module View.Payments.ExceedingPayer
  ( exceedingPayers
  ) where

import Html exposing (..)
import Html.Attributes exposing (..)
import List

import Model exposing (Model)
import Model.User exposing (getUserName)
import Model.Payers exposing (..)
import Model.View.LoggedView exposing (LoggedView)
import Model.Translations exposing (getMessage)

exceedingPayers : Model -> LoggedView -> Html
exceedingPayers model loggedView =
  div
    [ class "exceedingPayers" ]
    (List.map (exceedingPayer model loggedView) (getOrderedExceedingPayers loggedView.payers))

exceedingPayer : Model -> LoggedView -> ExceedingPayer -> Html
exceedingPayer model loggedView payer =
  div
    [ class "exceedingPayer" ]
    [ span
        [ class "userName" ]
        [ payer.userId
            |> getUserName loggedView.users
            |> Maybe.withDefault "−"
            |> text
        ]
    , span
        [ class "amount" ]
        [ text ("+ " ++ (toString payer.amount) ++ " " ++ (getMessage "MoneySymbol" model.translations)) ]
    ]