aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm/Model
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/elm/Model')
-rw-r--r--src/client/elm/Model/Action.elm6
-rw-r--r--src/client/elm/Model/Init.elm16
-rw-r--r--src/client/elm/Model/View/LoggedInView.elm15
3 files changed, 26 insertions, 11 deletions
diff --git a/src/client/elm/Model/Action.elm b/src/client/elm/Model/Action.elm
index 7267259..60c1aca 100644
--- a/src/client/elm/Model/Action.elm
+++ b/src/client/elm/Model/Action.elm
@@ -5,17 +5,15 @@ module Model.Action
import Time exposing (Time)
import Signal exposing (Address)
-import Model.User exposing (Users, UserId)
-import Model.Payment exposing (Payments)
-import Model.Payer exposing (Payers)
import Model.Action.SignInAction exposing (SignInAction)
import Model.Action.LoggedInAction exposing (LoggedInAction)
+import Model.Init exposing (Init)
type Action =
NoOp
| SignIn String
| UpdateTime Time
- | GoLoggedInView Users UserId Payments Payments Int Payers
+ | GoLoggedInView Init
| UpdateSignIn SignInAction
| UpdateLoggedIn LoggedInAction
| GoSignInView
diff --git a/src/client/elm/Model/Init.elm b/src/client/elm/Model/Init.elm
new file mode 100644
index 0000000..490321b
--- /dev/null
+++ b/src/client/elm/Model/Init.elm
@@ -0,0 +1,16 @@
+module Model.Init
+ ( Init
+ ) where
+
+import Model.Payment exposing (Payments)
+import Model.Payer exposing (Payers)
+import Model.User exposing (Users, UserId)
+
+type alias Init =
+ { users : Users
+ , me : UserId
+ , payments : Payments
+ , monthlyPayments : Payments
+ , paymentsCount : Int
+ , payers : Payers
+ }
diff --git a/src/client/elm/Model/View/LoggedInView.elm b/src/client/elm/Model/View/LoggedInView.elm
index 75285b1..2df3525 100644
--- a/src/client/elm/Model/View/LoggedInView.elm
+++ b/src/client/elm/Model/View/LoggedInView.elm
@@ -6,6 +6,7 @@ module Model.View.LoggedInView
import Model.User exposing (Users, UserId)
import Model.Payment exposing (Payments, PaymentFrequency(..))
import Model.Payer exposing (Payers)
+import Model.Init exposing (..)
import Model.View.LoggedIn.AddPayment exposing (..)
import Model.View.LoggedIn.Edition exposing (..)
import Model.View.LoggedIn.Monthly exposing (..)
@@ -22,14 +23,14 @@ type alias LoggedInView =
, currentPage : Int
}
-initLoggedInView : Users -> UserId -> Payments -> Payments -> Int -> Payers -> LoggedInView
-initLoggedInView users me monthlyPayments payments paymentsCount payers =
- { users = users
+initLoggedInView : Init -> LoggedInView
+initLoggedInView init =
+ { users = init.users
, add = initAddPayment Punctual
- , monthly = initMonthly monthlyPayments
- , account = initAccount me payers
- , payments = payments
- , paymentsCount = paymentsCount
+ , monthly = initMonthly init.monthlyPayments
+ , account = initAccount init.me init.payers
+ , payments = init.payments
+ , paymentsCount = init.paymentsCount
, paymentEdition = Nothing
, currentPage = 1
}