aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm/Dialog/AddPayment
diff options
context:
space:
mode:
authorJoris2016-06-26 12:31:24 +0200
committerJoris2016-06-26 12:31:24 +0200
commit9ec84e3a20c767f6525639f58cd22715e302b88d (patch)
treea080552859180707472c1a289080857c0a54fc06 /src/client/elm/Dialog/AddPayment
parent5cb36652ccf07c9e0995ebc421a837ad7d258469 (diff)
Add an editable date field for punctual payment creation
Diffstat (limited to 'src/client/elm/Dialog/AddPayment')
-rw-r--r--src/client/elm/Dialog/AddPayment/View.elm10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/client/elm/Dialog/AddPayment/View.elm b/src/client/elm/Dialog/AddPayment/View.elm
index 79381dd..96686b8 100644
--- a/src/client/elm/Dialog/AddPayment/View.elm
+++ b/src/client/elm/Dialog/AddPayment/View.elm
@@ -7,8 +7,10 @@ import Html.Attributes exposing (..)
import Html.Events exposing (..)
import Html.App as Html
import Task
+import Date
import Form exposing (Form)
+import Utils.Form as Form
import Dialog
@@ -39,15 +41,16 @@ view loggedData frequency =
, confirmMsg = \model -> (
case Form.getOutput model.addPayment of
Just data ->
- Ok (Msg.UpdateLoggedIn <| LoggedInMsg.AddPayment data.name data.cost data.frequency)
+ Ok (Msg.UpdateLoggedIn <| LoggedInMsg.AddPayment data.name data.cost data.date data.frequency)
Nothing ->
Err (Msg.Dialog <| Dialog.UpdateModel <| DialogMsg.AddPaymentMsg <| Form.Submit)
)
, undo = getMessage "Undo" loggedData.translations
}
+ currentDate = Date.fromTime loggedData.currentTime
in button
[ class "addPayment"
- , onClick (Msg.Dialog <| Dialog.OpenWithUpdate dialogConfig (DialogMsg.AddPaymentMsg <| Form.Reset (DialogModel.addPaymentInitial frequency)))
+ , onClick (Msg.Dialog <| Dialog.OpenWithUpdate dialogConfig (DialogMsg.AddPaymentMsg <| Form.Reset (DialogModel.addPaymentInitial loggedData.translations currentDate frequency)))
]
[ text (getMessage "AddPayment" loggedData.translations) ]
@@ -60,5 +63,8 @@ addPaymentForm loggedData addPayment =
]
[ Form.textInput loggedData.translations addPayment "payment" "name"
, Form.textInput loggedData.translations addPayment "payment" "cost"
+ , if Form.frequency addPayment == Punctual
+ then Form.textInput loggedData.translations addPayment "payment" "date"
+ else text ""
, Form.radioInputs loggedData.translations addPayment "payment" "frequency" [ toString Punctual, toString Monthly ]
]