From a271d6034bc4cc631a64476d25d21c83a701fa39 Mon Sep 17 00:00:00 2001 From: Joris Guyonvarch Date: Mon, 20 Jul 2015 21:55:52 +0200 Subject: Add a payment from the UI, it needs polishing however --- src/client/Update/Payment.elm | 22 ++++++++++++++++++++++ src/client/Update/SignIn.elm | 12 ++++++------ 2 files changed, 28 insertions(+), 6 deletions(-) create mode 100644 src/client/Update/Payment.elm (limited to 'src/client/Update') diff --git a/src/client/Update/Payment.elm b/src/client/Update/Payment.elm new file mode 100644 index 0000000..129ccde --- /dev/null +++ b/src/client/Update/Payment.elm @@ -0,0 +1,22 @@ +module Update.Payment + ( PaymentAction(..) + , updatePayment + ) where + +import Model.View.PaymentView exposing (..) +import Model.Payment exposing (..) + +type PaymentAction = + UpdateName String + | UpdateCost String + | UpdatePayments Payments + +updatePayment : PaymentAction -> PaymentView -> PaymentView +updatePayment action paymentView = + case action of + UpdateName name -> + { paymentView | name <- name } + UpdateCost cost -> + { paymentView | cost <- cost } + UpdatePayments payments -> + { paymentView | payments <- payments } diff --git a/src/client/Update/SignIn.elm b/src/client/Update/SignIn.elm index 0e118dc..0aa7c84 100644 --- a/src/client/Update/SignIn.elm +++ b/src/client/Update/SignIn.elm @@ -3,22 +3,22 @@ module Update.SignIn , updateSignIn ) where -import Model.View.SignIn exposing (..) +import Model.View.SignInView exposing (..) type SignInAction = UpdateLogin String | ValidLogin String | ErrorLogin String -updateSignIn : SignInAction -> SignIn -> SignIn -updateSignIn action signIn = +updateSignIn : SignInAction -> SignInView -> SignInView +updateSignIn action signInView = case action of UpdateLogin login -> - { signIn | login <- login } + { signInView | login <- login } ValidLogin message -> - { signIn + { signInView | login <- "" , result <- Just (Ok message) } ErrorLogin message -> - { signIn | result <- Just (Err message) } + { signInView | result <- Just (Err message) } -- cgit v1.2.3