aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm/LoggedIn/Home/AddPayment
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/elm/LoggedIn/Home/AddPayment')
-rw-r--r--src/client/elm/LoggedIn/Home/AddPayment/View.elm68
1 files changed, 0 insertions, 68 deletions
diff --git a/src/client/elm/LoggedIn/Home/AddPayment/View.elm b/src/client/elm/LoggedIn/Home/AddPayment/View.elm
deleted file mode 100644
index 5ccdb35..0000000
--- a/src/client/elm/LoggedIn/Home/AddPayment/View.elm
+++ /dev/null
@@ -1,68 +0,0 @@
-module LoggedIn.Home.AddPayment.View exposing
- ( view
- )
-
-import Html exposing (..)
-import Html.Attributes exposing (..)
-import Html.Events exposing (..)
-import Html.App as Html
-import Task
-
-import Form exposing (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
-import Model.View exposing (View(LoggedInView))
-
-import LoggedData exposing (LoggedData)
-import LoggedIn.Home.Model as HomeModel
-
-view : LoggedData -> Html Msg
-view loggedData =
- let dialogConfig =
- { title = getMessage "AddPayment" loggedData.translations
- , body = \view -> (
- case view of
- LoggedInView loggedIn -> addPaymentForm loggedData loggedIn.home
- _ -> text ""
- )
- , confirm = getMessage "Confirm" loggedData.translations
- , confirmMsg = \view -> (
- case view of
- LoggedInView loggedIn ->
- case Form.getOutput loggedIn.home.addPayment of
- Just data ->
- Ok (Msg.UpdateLoggedIn <| LoggedInMsg.AddPayment data.name data.cost data.frequency)
- Nothing ->
- Err (Msg.UpdateLoggedIn <| LoggedInMsg.HomeMsg <| HomeMsg.AddPaymentMsg <| Form.Submit)
- _ ->
- Err (Msg.UpdateLoggedIn LoggedInMsg.NoOp)
- )
- , undo = getMessage "Undo" loggedData.translations
- }
- in button
- [ class "addPayment"
- , onClick (Msg.Dialog <| Dialog.Open dialogConfig)
- ]
- [ text (getMessage "AddPayment" loggedData.translations) ]
-
-addPaymentForm : LoggedData -> HomeModel.Model -> Html Msg
-addPaymentForm loggedData { addPayment } =
- let htmlMap = Html.map (Msg.UpdateLoggedIn << LoggedInMsg.HomeMsg << HomeMsg.AddPaymentMsg)
- in Html.form
- [ class "addPayment"
- , onSubmitPrevDefault Msg.NoOp
- ]
- [ Form.textInput loggedData.translations addPayment htmlMap "name"
- , Form.textInput loggedData.translations addPayment htmlMap "cost"
- , Form.radioInputs loggedData.translations addPayment htmlMap "frequency" [ toString Payment.Punctual, toString Payment.Monthly ]
- ]