diff options
Diffstat (limited to 'src/client/Update')
-rw-r--r-- | src/client/Update/Payment.elm | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/client/Update/Payment.elm b/src/client/Update/Payment.elm index b9b60dd..1b43f6f 100644 --- a/src/client/Update/Payment.elm +++ b/src/client/Update/Payment.elm @@ -7,6 +7,7 @@ import Date import Dict import Model exposing (Model) +import Model.User exposing (UserId) import Model.Payment exposing (..) import Model.Payers exposing (..) import Model.View.PaymentView exposing (..) @@ -17,9 +18,9 @@ import Update.Payment.Add exposing (..) type PaymentAction = UpdateAdd AddPaymentAction | UpdatePayments Payments - | AddPayment String Int Payments + | AddPayment UserId Int Payments | ToggleEdit PaymentId - | Remove String Int Payments + | Remove UserId Int Payments | UpdatePage Int Payments updatePayment : Model -> PaymentAction -> PaymentView -> PaymentView @@ -29,20 +30,20 @@ updatePayment model action paymentView = { paymentView | add <- updateAddPayment addPaymentAction paymentView.add } UpdatePayments payments -> { paymentView | payments <- payments } - AddPayment userName cost payments -> + AddPayment userId cost payments -> { paymentView | payments <- payments , currentPage <- 1 , add <- initAddPayment - , payers <- updatePayers paymentView.payers userName cost + , payers <- updatePayers paymentView.payers userId cost , paymentsCount <- paymentView.paymentsCount + 1 } ToggleEdit id -> { paymentView | edition <- if paymentView.edition == Just id then Nothing else Just id } - Remove userName cost payments -> + Remove userId cost payments -> { paymentView | payments <- payments - , payers <- updatePayers paymentView.payers userName -cost + , payers <- updatePayers paymentView.payers userId -cost , paymentsCount <- paymentView.paymentsCount - 1 } UpdatePage page payments -> |