diff options
Diffstat (limited to 'src/client/elm/LoggedIn/Income')
-rw-r--r-- | src/client/elm/LoggedIn/Income/Model.elm | 2 | ||||
-rw-r--r-- | src/client/elm/LoggedIn/Income/Msg.elm | 1 | ||||
-rw-r--r-- | src/client/elm/LoggedIn/Income/Update.elm | 9 | ||||
-rw-r--r-- | src/client/elm/LoggedIn/Income/View.elm | 15 |
4 files changed, 22 insertions, 5 deletions
diff --git a/src/client/elm/LoggedIn/Income/Model.elm b/src/client/elm/LoggedIn/Income/Model.elm index 4c82ab1..e56e290 100644 --- a/src/client/elm/LoggedIn/Income/Model.elm +++ b/src/client/elm/LoggedIn/Income/Model.elm @@ -16,6 +16,7 @@ import Form.Validate as Validate exposing (..) type alias Model = { addIncome : Form String AddIncome + , test : Bool } type alias AddIncome = @@ -26,6 +27,7 @@ type alias AddIncome = init : Model init = { addIncome = initForm + , test = False } initForm : Form String AddIncome diff --git a/src/client/elm/LoggedIn/Income/Msg.elm b/src/client/elm/LoggedIn/Income/Msg.elm index 0a09dad..b3f3633 100644 --- a/src/client/elm/LoggedIn/Income/Msg.elm +++ b/src/client/elm/LoggedIn/Income/Msg.elm @@ -7,3 +7,4 @@ import Form exposing (Form) type Msg = NoOp | AddIncomeMsg Form.Msg + | ToggleTest diff --git a/src/client/elm/LoggedIn/Income/Update.elm b/src/client/elm/LoggedIn/Income/Update.elm index 74920f3..8fa47fc 100644 --- a/src/client/elm/LoggedIn/Income/Update.elm +++ b/src/client/elm/LoggedIn/Income/Update.elm @@ -10,8 +10,8 @@ import LoggedIn.Income.Model as IncomeModel import LoggedIn.Income.Msg as IncomeMsg update : LoggedData -> IncomeMsg.Msg -> IncomeModel.Model -> (IncomeModel.Model, Cmd IncomeMsg.Msg) -update loggedData action model = - case action of +update loggedData msg model = + case msg of IncomeMsg.NoOp -> ( model @@ -22,3 +22,8 @@ update loggedData action model = ( { model | addIncome = Form.update formMsg model.addIncome } , Cmd.none ) + + IncomeMsg.ToggleTest -> + ( { model | test = not model.test } + , Cmd.none + ) diff --git a/src/client/elm/LoggedIn/Income/View.elm b/src/client/elm/LoggedIn/Income/View.elm index d5863ab..7970284 100644 --- a/src/client/elm/LoggedIn/Income/View.elm +++ b/src/client/elm/LoggedIn/Income/View.elm @@ -14,6 +14,7 @@ import Html.Events exposing (..) import Html.Attributes exposing (..) import Html.App as Html import Form exposing (Form) +import Dialog import Msg exposing (Msg) @@ -23,6 +24,7 @@ import Model.Income exposing (IncomeId, Income, userCumulativeIncomeSince) import Model.Translations exposing (getMessage, getParamMessage) import Model.Payer exposing (useIncomesFrom) import Model.User exposing (UserId, User) +import Model.View as View import LoggedIn.Income.Model as IncomeModel import LoggedIn.Msg as LoggedInMsg @@ -108,7 +110,14 @@ incomeView loggedData (incomeId, income) = [ text <| renderShortDate (Date.fromTime income.time) loggedData.translations , text " − " , text <| Format.price loggedData.conf income.amount - , button - [ onClick (Msg.UpdateLoggedIn <| LoggedInMsg.DeleteIncome incomeId) ] - [ FontAwesome.remove Color.chestnutRose 14 ] + , let dialogConfig = + { title = getMessage "ConfirmDelete" loggedData.translations + , body = always <| text "" + , confirm = getMessage "Confirm" loggedData.translations + , confirmMsg = Msg.UpdateLoggedIn <| LoggedInMsg.DeleteIncome incomeId + , undo = getMessage "Undo" loggedData.translations + } + in button + [ onClick (Msg.Dialog <| Dialog.Open dialogConfig) ] + [ FontAwesome.remove Color.chestnutRose 14 ] ] |