aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm/LoggedIn/Home/View
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/elm/LoggedIn/Home/View')
-rw-r--r--src/client/elm/LoggedIn/Home/View/Table.elm39
1 files changed, 22 insertions, 17 deletions
diff --git a/src/client/elm/LoggedIn/Home/View/Table.elm b/src/client/elm/LoggedIn/Home/View/Table.elm
index fa0a93d..b86976c 100644
--- a/src/client/elm/LoggedIn/Home/View/Table.elm
+++ b/src/client/elm/LoggedIn/Home/View/Table.elm
@@ -28,6 +28,8 @@ import Model.User exposing (getUserName)
import Model.Payment as Payment exposing (..)
import Model.Translations exposing (getMessage)
+import Dialog
+
view : LoggedData -> HomeModel.Model -> Payments -> Frequency -> Html Msg
view loggedData homeModel payments frequency =
let visiblePayments =
@@ -63,13 +65,8 @@ headerLine loggedData frequency =
paymentLine : LoggedData -> HomeModel.Model -> Frequency -> Payment -> Html Msg
paymentLine loggedData homeModel frequency payment =
- a
- [ classList
- [ ("row", True)
- , ("edition", homeModel.paymentEdition == Just payment.id)
- ]
- , onClick (Msg.UpdateLoggedIn << LoggedInMsg.HomeMsg << HomeMsg.ToggleEdit <| payment.id)
- ]
+ div
+ [ class "row" ]
[ div [ class "cell category" ] [ text payment.name ]
, div
[ classList
@@ -98,14 +95,22 @@ paymentLine loggedData homeModel frequency payment =
]
Monthly ->
text ""
- , if loggedData.me == payment.userId
- then
- div
- [ class "cell delete" ]
- [ button
- [ onClick (Msg.UpdateLoggedIn <| LoggedInMsg.DeletePayment payment.id)]
- [ FontAwesome.times Color.white 20 ]
- ]
- else
- div [ class "cell" ] []
+ , div
+ [ class "cell delete" ]
+ [ if loggedData.me /= payment.userId
+ then
+ text ""
+ else
+ let dialogConfig =
+ { className = "paymentDialog"
+ , title = getMessage "ConfirmPaymentDelete" loggedData.translations
+ , body = always <| text ""
+ , confirm = getMessage "Confirm" loggedData.translations
+ , confirmMsg = always <| Ok <| Msg.UpdateLoggedIn <| LoggedInMsg.DeletePayment payment.id
+ , undo = getMessage "Undo" loggedData.translations
+ }
+ in button
+ [ onClick (Msg.Dialog <| Dialog.Open dialogConfig) ]
+ [ FontAwesome.trash Color.chestnutRose 18 ]
+ ]
]