aboutsummaryrefslogtreecommitdiff
path: root/src/client/Update/LoggedView.elm
diff options
context:
space:
mode:
authorJoris2015-09-06 16:46:59 +0200
committerJoris2015-09-06 16:46:59 +0200
commit3853811450d4fe801da996eb48825049c3541030 (patch)
treeb483c6152f55b6fe87d23108d2d0346a593e51ac /src/client/Update/LoggedView.elm
parent0b6f0fa29075178b45cb17d2932003ab4b342280 (diff)
Renaming PaymentView to LoggedInView
Diffstat (limited to 'src/client/Update/LoggedView.elm')
-rw-r--r--src/client/Update/LoggedView.elm65
1 files changed, 0 insertions, 65 deletions
diff --git a/src/client/Update/LoggedView.elm b/src/client/Update/LoggedView.elm
deleted file mode 100644
index cf6bcb2..0000000
--- a/src/client/Update/LoggedView.elm
+++ /dev/null
@@ -1,65 +0,0 @@
-module Update.LoggedView
- ( LoggedAction(..)
- , updateLoggedView
- ) where
-
-import Date
-import Dict
-
-import Model exposing (Model)
-import Model.User exposing (UserId)
-import Model.Payment exposing (..)
-import Model.Payers exposing (..)
-import Model.View.LoggedView exposing (..)
-import Model.View.Payment.Add exposing (..)
-
-import Update.LoggedView.Add exposing (..)
-import Update.LoggedView.Monthly as UM
-
-type LoggedAction =
- UpdateAdd AddPaymentAction
- | UpdatePayments Payments
- | AddPayment UserId String Int Payments
- | AddMonthlyPayment PaymentId String Int
- | ToggleEdit PaymentId
- | DeletePayment UserId Int Payments
- | UpdatePage Int Payments
- | UpdateMonthly UM.MonthlyAction
-
-updateLoggedView : Model -> LoggedAction -> LoggedView -> LoggedView
-updateLoggedView model action loggedView =
- case action of
- UpdateAdd addPaymentAction ->
- { loggedView | add <- updateAddPayment addPaymentAction loggedView.add }
- UpdatePayments payments ->
- { loggedView | payments <- payments }
- AddPayment userId name cost payments ->
- { loggedView
- | payments <- payments
- , currentPage <- 1
- , add <- initAddPayment Punctual
- , payers <- updatePayers loggedView.payers userId cost
- , paymentsCount <- loggedView.paymentsCount + 1
- }
- AddMonthlyPayment id name cost ->
- { loggedView
- | add <- initAddPayment Monthly
- , monthly <-
- let payment = Payment id (Date.fromTime model.currentTime) name cost loggedView.me
- in UM.updateMonthly (UM.AddPayment payment) loggedView.monthly
- }
- ToggleEdit id ->
- { loggedView | paymentEdition <- if loggedView.paymentEdition == Just id then Nothing else Just id }
- DeletePayment userId cost payments ->
- { loggedView
- | payments <- payments
- , payers <- updatePayers loggedView.payers userId -cost
- , paymentsCount <- loggedView.paymentsCount - 1
- }
- UpdatePage page payments ->
- { loggedView
- | currentPage <- page
- , payments <- payments
- }
- UpdateMonthly monthlyAction ->
- { loggedView | monthly <- UM.updateMonthly monthlyAction loggedView.monthly }