From 6b466f616035c2fc03359d182c074f096d6b7f17 Mon Sep 17 00:00:00 2001 From: Joris Date: Sat, 29 Aug 2015 13:30:09 +0200 Subject: Showing exceeding payers --- src/client/View/Payments.elm | 4 +++- src/client/View/Payments/ExceedingPayer.elm | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 src/client/View/Payments/ExceedingPayer.elm (limited to 'src/client/View') 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)) ] + ] -- cgit v1.2.3