diff options
Diffstat (limited to 'src/client/elm/Dialog/AddPayment')
-rw-r--r-- | src/client/elm/Dialog/AddPayment/View.elm | 10 |
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 ] ] |