aboutsummaryrefslogtreecommitdiff
path: root/src/client/View
diff options
context:
space:
mode:
authorJoris2015-08-29 13:30:09 +0200
committerJoris2015-08-29 13:30:09 +0200
commit6b466f616035c2fc03359d182c074f096d6b7f17 (patch)
tree47708f2e96614d71059f98c757d6a3fe88c8b923 /src/client/View
parentaa7f70d172be9ef322f9a0d19d1d9d9489f9fa75 (diff)
Showing exceeding payers
Diffstat (limited to 'src/client/View')
-rw-r--r--src/client/View/Payments.elm4
-rw-r--r--src/client/View/Payments/ExceedingPayer.elm24
2 files changed, 27 insertions, 1 deletions
diff --git a/src/client/View/Payments.elm b/src/client/View/Payments.elm
index 29ab481..03886f8 100644
--- a/src/client/View/Payments.elm
+++ b/src/client/View/Payments.elm
@@ -9,6 +9,7 @@ import Model exposing (Model)
import Model.Payment exposing (Payments)
import Model.View.PaymentView exposing (PaymentView)
+import View.Payments.ExceedingPayer exposing (exceedingPayers)
import View.Payments.Add exposing (addPayment)
import View.Payments.Table exposing (paymentsTable)
@@ -16,6 +17,7 @@ renderPayments : Model -> PaymentView -> Html
renderPayments model paymentView =
div
[ class "payments" ]
- [ addPayment model paymentView.add
+ [ exceedingPayers paymentView
+ , addPayment model paymentView.add
, paymentsTable model paymentView
]
diff --git a/src/client/View/Payments/ExceedingPayer.elm b/src/client/View/Payments/ExceedingPayer.elm
new file mode 100644
index 0000000..cea8d66
--- /dev/null
+++ b/src/client/View/Payments/ExceedingPayer.elm
@@ -0,0 +1,24 @@
+module View.Payments.ExceedingPayer
+ ( exceedingPayers
+ ) where
+
+import Html exposing (..)
+import Html.Attributes exposing (..)
+import List
+
+import Model.Payers exposing (..)
+import Model.View.PaymentView exposing (PaymentView)
+
+exceedingPayers : PaymentView -> Html
+exceedingPayers paymentView =
+ div
+ [ class "exceedingPayers" ]
+ (List.map exceedingPayer (getOrderedExceedingPayers paymentView.payers))
+
+exceedingPayer : ExceedingPayer -> Html
+exceedingPayer payer =
+ div
+ [ class "exceedingPayer" ]
+ [ span [ class "userName" ] [ text payer.userName ]
+ , span [ class "amount" ] [ text ("+ " ++ (toString payer.amount)) ]
+ ]