aboutsummaryrefslogtreecommitdiff
path: root/src/client/Update.elm
diff options
context:
space:
mode:
authorJoris Guyonvarch2015-07-20 21:55:52 +0200
committerJoris Guyonvarch2015-07-20 21:55:52 +0200
commita271d6034bc4cc631a64476d25d21c83a701fa39 (patch)
tree89ffa3df69999c5c9ed3cda9f4e4ec04f7a6ae1d /src/client/Update.elm
parenta40c4825996c90d107901b0d71162f9356f1395a (diff)
downloadbudget-a271d6034bc4cc631a64476d25d21c83a701fa39.tar.gz
budget-a271d6034bc4cc631a64476d25d21c83a701fa39.tar.bz2
budget-a271d6034bc4cc631a64476d25d21c83a701fa39.zip
Add a payment from the UI, it needs polishing however
Diffstat (limited to 'src/client/Update.elm')
-rw-r--r--src/client/Update.elm33
1 files changed, 21 insertions, 12 deletions
diff --git a/src/client/Update.elm b/src/client/Update.elm
index 508ee2f..f88a3a2 100644
--- a/src/client/Update.elm
+++ b/src/client/Update.elm
@@ -6,17 +6,20 @@ module Update
import Model exposing (Model)
import Model.Payment exposing (Payments)
-import Model.View exposing (..)
-import Model.View.SignIn exposing (..)
+import Model.View as V
+import Model.View.SignInView exposing (..)
+import Model.View.PaymentView exposing (..)
import Update.SignIn exposing (..)
+import Update.Payment exposing (..)
type Action =
NoOp
- | SignIn
+ | GoSignInView
| SignInError String
| UpdateSignIn SignInAction
- | UpdatePayments Payments
+ | GoPaymentView Payments
+ | UpdatePayment PaymentAction
actions : Signal.Mailbox Action
actions = Signal.mailbox NoOp
@@ -26,16 +29,22 @@ updateModel action model =
case action of
NoOp ->
model
- SignIn ->
- { model | view <- SignInView initSignIn }
+ GoSignInView ->
+ { model | view <- V.SignInView initSignInView }
+ GoPaymentView payments ->
+ { model | view <- V.PaymentView (initPaymentView payments) }
SignInError msg ->
- let signIn = { initSignIn | result <- Just (Err msg) }
- in { model | view <- SignInView signIn }
+ let signInView = { initSignInView | result <- Just (Err msg) }
+ in { model | view <- V.SignInView signInView }
UpdateSignIn signInAction ->
case model.view of
- SignInView signIn ->
- { model | view <- SignInView (updateSignIn signInAction signIn) }
+ V.SignInView signInView ->
+ { model | view <- V.SignInView (updateSignIn signInAction signInView) }
+ _ ->
+ model
+ UpdatePayment paymentAction ->
+ case model.view of
+ V.PaymentView paymentView ->
+ { model | view <- V.PaymentView (updatePayment paymentAction paymentView) }
_ ->
model
- UpdatePayments payments ->
- { model | view <- PaymentView payments }