diff options
author | Joris | 2015-08-23 10:54:45 +0200 |
---|---|---|
committer | Joris | 2015-08-23 10:54:45 +0200 |
commit | a2527c34e6b0e719a948cfd36bfee5ffad095a30 (patch) | |
tree | 6431510e87db2bd972952d266ba087793ad263c0 /src/client/Update | |
parent | a4c90e0f66f0db16a0c50c55a4b5cd93d4e8a7fe (diff) |
UI payment delete, not done on server side yet
Diffstat (limited to 'src/client/Update')
-rw-r--r-- | src/client/Update/Payment.elm | 8 |
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 } |