aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm/Dialog/AddPayment
diff options
context:
space:
mode:
authorJoris2016-06-26 17:30:03 +0200
committerJoris2016-06-26 17:30:03 +0200
commit885dfd7708e338a3220c85b7f22a3ac267aad3f7 (patch)
treeff259354eb9fd97fc0bab2775296830dcced5693 /src/client/elm/Dialog/AddPayment
parentcfade71c343eb29c8873011f5878a39aed8257b2 (diff)
Add the clone functionality on payments
Diffstat (limited to 'src/client/elm/Dialog/AddPayment')
-rw-r--r--src/client/elm/Dialog/AddPayment/View.elm73
1 files changed, 0 insertions, 73 deletions
diff --git a/src/client/elm/Dialog/AddPayment/View.elm b/src/client/elm/Dialog/AddPayment/View.elm
deleted file mode 100644
index 30df617..0000000
--- a/src/client/elm/Dialog/AddPayment/View.elm
+++ /dev/null
@@ -1,73 +0,0 @@
-module Dialog.AddPayment.View exposing
- ( view
- )
-
-import Html exposing (..)
-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
-
-import View.Form as Form
-import View.Events exposing (onSubmitPrevDefault)
-
-import Msg exposing (Msg)
-import LoggedIn.Msg as LoggedInMsg
-import LoggedIn.Home.Msg as HomeMsg
-
-import Model.Translations exposing (getMessage)
-import Model.Payment as Payment exposing (Frequency(..))
-import Model.View exposing (View(LoggedInView))
-
-import Dialog.Model as DialogModel
-import Dialog.Msg as DialogMsg
-
-import LoggedData exposing (LoggedData)
-import LoggedIn.Home.Model as HomeModel
-
-view : LoggedData -> Frequency -> Html Msg
-view loggedData frequency =
- let dialogConfig =
- { className = "paymentDialog"
- , title = getMessage "AddPayment" loggedData.translations
- , body = \model -> addPaymentForm loggedData model.addPayment
- , confirm = getMessage "Confirm" loggedData.translations
- , confirmMsg = submitForm << .addPayment
- , 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 loggedData.translations currentDate frequency)))
- ]
- [ text (getMessage "AddPayment" loggedData.translations) ]
-
-addPaymentForm : LoggedData -> Form String DialogModel.AddPayment -> Html Msg
-addPaymentForm loggedData addPayment =
- let htmlMap = Html.map (Msg.Dialog << Dialog.Update << DialogMsg.AddPaymentMsg)
- in Html.form
- [ class "addPayment"
- , onSubmitPrevDefault Msg.NoOp
- ]
- [ htmlMap <| Form.textInput loggedData.translations addPayment "payment" "name"
- , htmlMap <| Form.textInput loggedData.translations addPayment "payment" "cost"
- , if Form.frequency addPayment == Punctual
- then htmlMap <| Form.textInput loggedData.translations addPayment "payment" "date"
- else text ""
- , htmlMap <| Form.radioInputs loggedData.translations addPayment "payment" "frequency" [ toString Punctual, toString Monthly ]
- , Form.hiddenSubmit (submitForm addPayment)
- ]
-
-submitForm : Form String DialogModel.AddPayment -> Msg
-submitForm addPayment =
- case Form.getOutput addPayment of
- Just data ->
- Msg.Dialog <| Dialog.UpdateAndClose <| Msg.UpdateLoggedIn <| LoggedInMsg.AddPayment data.name data.cost data.date data.frequency
- Nothing ->
- Msg.Dialog <| Dialog.Update <| DialogMsg.AddPaymentMsg <| Form.Submit