aboutsummaryrefslogtreecommitdiff
path: root/src/client/View/Payments
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/View/Payments')
-rw-r--r--src/client/View/Payments/Add.elm2
-rw-r--r--src/client/View/Payments/ExceedingPayer.elm19
-rw-r--r--src/client/View/Payments/Table.elm13
3 files changed, 25 insertions, 9 deletions
diff --git a/src/client/View/Payments/Add.elm b/src/client/View/Payments/Add.elm
index 115fed2..32233ed 100644
--- a/src/client/View/Payments/Add.elm
+++ b/src/client/View/Payments/Add.elm
@@ -31,7 +31,7 @@ addPayment model paymentView =
[ class "add"
, case (validateName paymentView.add.name model.translations, validateCost paymentView.add.cost model.translations) of
(Ok name, Ok cost) ->
- onSubmitPrevDefault serverCommunications.address (SC.AddPayment paymentView.userName name cost)
+ onSubmitPrevDefault serverCommunications.address (SC.AddPayment paymentView.me name cost)
(resName, resCost) ->
onSubmitPrevDefault actions.address (UpdatePayment <| UpdateAdd <| AddError (toMaybeError resName) (toMaybeError resCost))
]
diff --git a/src/client/View/Payments/ExceedingPayer.elm b/src/client/View/Payments/ExceedingPayer.elm
index 903ad5b..f249383 100644
--- a/src/client/View/Payments/ExceedingPayer.elm
+++ b/src/client/View/Payments/ExceedingPayer.elm
@@ -7,6 +7,7 @@ import Html.Attributes exposing (..)
import List
import Model exposing (Model)
+import Model.User exposing (getUserName)
import Model.Payers exposing (..)
import Model.View.PaymentView exposing (PaymentView)
import Model.Translations exposing (getMessage)
@@ -15,12 +16,20 @@ exceedingPayers : Model -> PaymentView -> Html
exceedingPayers model paymentView =
div
[ class "exceedingPayers" ]
- (List.map (exceedingPayer model) (getOrderedExceedingPayers paymentView.payers))
+ (List.map (exceedingPayer model paymentView) (getOrderedExceedingPayers paymentView.payers))
-exceedingPayer : Model -> ExceedingPayer -> Html
-exceedingPayer model payer =
+exceedingPayer : Model -> PaymentView -> ExceedingPayer -> Html
+exceedingPayer model paymentView payer =
div
[ class "exceedingPayer" ]
- [ span [ class "userName" ] [ text payer.userName ]
- , span [ class "amount" ] [ text ("+ " ++ (toString payer.amount) ++ " " ++ (getMessage "MoneySymbol" model.translations)) ]
+ [ span
+ [ class "userName" ]
+ [ payer.userId
+ |> getUserName paymentView.users
+ |> Maybe.withDefault "−"
+ |> text
+ ]
+ , span
+ [ class "amount" ]
+ [ text ("+ " ++ (toString payer.amount) ++ " " ++ (getMessage "MoneySymbol" model.translations)) ]
]
diff --git a/src/client/View/Payments/Table.elm b/src/client/View/Payments/Table.elm
index 06bec17..743a8a9 100644
--- a/src/client/View/Payments/Table.elm
+++ b/src/client/View/Payments/Table.elm
@@ -13,6 +13,7 @@ import Date exposing (Date)
import String exposing (append)
import Model exposing (Model)
+import Model.User exposing (getUserName)
import Model.Payment exposing (..)
import Model.View.PaymentView exposing (PaymentView)
import Model.Translations exposing (getMessage)
@@ -55,7 +56,13 @@ paymentLine model paymentView (id, payment) =
]
[ div [ class "cell category" ] [ text payment.name ]
, div [ class "cell cost" ] [ text ((toString payment.cost) ++ " " ++ (getMessage "MoneySymbol" model.translations)) ]
- , div [ class "cell user" ] [ text payment.userName ]
+ , div
+ [ class "cell user" ]
+ [ payment.userId
+ |> getUserName paymentView.users
+ |> Maybe.withDefault "−"
+ |> text
+ ]
, div
[ class "cell date" ]
[ span
@@ -65,11 +72,11 @@ paymentLine model paymentView (id, payment) =
[ class "longDate" ]
[ text (renderLongDate payment.creation model.translations) ]
]
- , if paymentView.userName == payment.userName
+ , if paymentView.me == payment.userId
then
div
[ class "cell remove"
- , onClick serverCommunications.address (SC.DeletePayment id payment.userName payment.cost paymentView.currentPage)
+ , onClick serverCommunications.address (SC.DeletePayment id payment.userId payment.cost paymentView.currentPage)
]
[ renderIcon "times" ]
else