aboutsummaryrefslogtreecommitdiff
path: root/src/client/Update
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/Update')
-rw-r--r--src/client/Update/Payment.elm8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/client/Update/Payment.elm b/src/client/Update/Payment.elm
index 817a3f0..67331d6 100644
--- a/src/client/Update/Payment.elm
+++ b/src/client/Update/Payment.elm
@@ -17,6 +17,7 @@ type PaymentAction =
| UpdatePayments Payments
| AddPayment PaymentId String Int
| ToggleEdit PaymentId
+ | Remove PaymentId
updatePayment : Model -> PaymentAction -> PaymentView -> PaymentView
updatePayment model action paymentView =
@@ -27,15 +28,16 @@ updatePayment model action paymentView =
{ paymentView | payments <- payments }
AddPayment id name cost ->
let payment =
- { id = id
- , creation = Date.fromTime model.currentTime
+ { creation = Date.fromTime model.currentTime
, name = name
, cost = cost
, userName = paymentView.userName
}
in { paymentView
- | payments <- payment :: paymentView.payments
+ | payments <- addPayment paymentView.payments (id, payment)
, add <- initAddPayment
}
ToggleEdit id ->
{ paymentView | edition <- if paymentView.edition == Just id then Nothing else Just id }
+ Remove id ->
+ { paymentView | payments <- removePayment paymentView.payments id }