aboutsummaryrefslogtreecommitdiff
path: root/src/client/Update/LoggedIn.elm
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/Update/LoggedIn.elm')
-rw-r--r--src/client/Update/LoggedIn.elm68
1 files changed, 0 insertions, 68 deletions
diff --git a/src/client/Update/LoggedIn.elm b/src/client/Update/LoggedIn.elm
deleted file mode 100644
index e477094..0000000
--- a/src/client/Update/LoggedIn.elm
+++ /dev/null
@@ -1,68 +0,0 @@
-module Update.LoggedIn
- ( LoggedAction(..)
- , updateLoggedIn
- ) where
-
-import Date
-import Dict
-
-import Model exposing (Model)
-import Model.User exposing (UserId)
-import Model.Payment exposing (..)
-import Model.View.LoggedInView exposing (..)
-import Model.View.LoggedIn.Add exposing (..)
-
-import Update.LoggedIn.Add exposing (..)
-import Update.LoggedIn.Monthly as UM
-import Update.LoggedIn.Account as UA
-
-type LoggedAction =
- UpdateAdd AddPaymentAction
- | UpdatePayments Payments
- | AddPayment UserId String Int Payments
- | AddMonthlyPayment PaymentId String Int
- | ToggleEdit PaymentId
- | DeletePayment Payment Payments
- | UpdatePage Int Payments
- | UpdateMonthly UM.MonthlyAction
- | UpdateAccount UA.AccountAction
-
-updateLoggedIn : Model -> LoggedAction -> LoggedInView -> LoggedInView
-updateLoggedIn model action loggedInView =
- case action of
- UpdateAdd addPaymentAction ->
- { loggedInView | add <- updateAddPayment addPaymentAction loggedInView.add }
- UpdatePayments payments ->
- { loggedInView | payments <- payments }
- AddPayment userId name cost payments ->
- { loggedInView
- | payments <- payments
- , currentPage <- 1
- , add <- initAddPayment Punctual
- , account <- UA.updateAccount (UA.UpdatePayer userId model.currentTime cost) loggedInView.account
- , paymentsCount <- loggedInView.paymentsCount + 1
- }
- AddMonthlyPayment id name cost ->
- { loggedInView
- | add <- initAddPayment Monthly
- , monthly <-
- let payment = Payment id (Date.fromTime model.currentTime) name cost loggedInView.account.me
- in UM.updateMonthly (UM.AddPayment payment) loggedInView.monthly
- }
- ToggleEdit id ->
- { loggedInView | paymentEdition <- if loggedInView.paymentEdition == Just id then Nothing else Just id }
- DeletePayment payment payments ->
- { loggedInView
- | payments <- payments
- , account <- UA.updateAccount (UA.UpdatePayer payment.userId (Date.toTime payment.creation) -payment.cost) loggedInView.account
- , paymentsCount <- loggedInView.paymentsCount - 1
- }
- UpdatePage page payments ->
- { loggedInView
- | currentPage <- page
- , payments <- payments
- }
- UpdateMonthly monthlyAction ->
- { loggedInView | monthly <- UM.updateMonthly monthlyAction loggedInView.monthly }
- UpdateAccount accountAction ->
- { loggedInView | account <- UA.updateAccount accountAction loggedInView.account }