aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm/LoggedIn/Home
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/elm/LoggedIn/Home')
-rw-r--r--src/client/elm/LoggedIn/Home/AddPayment/Action.elm4
-rw-r--r--src/client/elm/LoggedIn/Home/AddPayment/Model.elm6
-rw-r--r--src/client/elm/LoggedIn/Home/AddPayment/Update.elm2
-rw-r--r--src/client/elm/LoggedIn/Home/AddPayment/View.elm2
-rw-r--r--src/client/elm/LoggedIn/Home/Model.elm2
-rw-r--r--src/client/elm/LoggedIn/Home/View/Monthly.elm10
-rw-r--r--src/client/elm/LoggedIn/Home/View/Paging.elm4
-rw-r--r--src/client/elm/LoggedIn/Home/View/Table.elm1
8 files changed, 16 insertions, 15 deletions
diff --git a/src/client/elm/LoggedIn/Home/AddPayment/Action.elm b/src/client/elm/LoggedIn/Home/AddPayment/Action.elm
index 81c32e2..a692b15 100644
--- a/src/client/elm/LoggedIn/Home/AddPayment/Action.elm
+++ b/src/client/elm/LoggedIn/Home/AddPayment/Action.elm
@@ -2,11 +2,11 @@ module LoggedIn.Home.AddPayment.Action
( Action(..)
) where
-import Model.Payment exposing (PaymentFrequency)
+import Model.Payment exposing (Frequency)
type Action =
NoOp
- | Init PaymentFrequency
+ | Init Frequency
| UpdateName String
| UpdateCost String
| AddError (Maybe String) (Maybe String)
diff --git a/src/client/elm/LoggedIn/Home/AddPayment/Model.elm b/src/client/elm/LoggedIn/Home/AddPayment/Model.elm
index 22b6883..19933fd 100644
--- a/src/client/elm/LoggedIn/Home/AddPayment/Model.elm
+++ b/src/client/elm/LoggedIn/Home/AddPayment/Model.elm
@@ -7,18 +7,18 @@ import Result as Result exposing (Result(..))
import Json.Decode exposing ((:=))
import Model.Translations exposing (..)
-import Model.Payment exposing (PaymentFrequency(..))
+import Model.Payment exposing (Frequency(..))
type alias Model =
{ name : String
, nameError : Maybe String
, cost : String
, costError : Maybe String
- , frequency : PaymentFrequency
+ , frequency : Frequency
, waitingServer : Bool
}
-init : PaymentFrequency -> Model
+init : Frequency -> Model
init frequency =
{ name = ""
, nameError = Nothing
diff --git a/src/client/elm/LoggedIn/Home/AddPayment/Update.elm b/src/client/elm/LoggedIn/Home/AddPayment/Update.elm
index 473e998..7f5fb0a 100644
--- a/src/client/elm/LoggedIn/Home/AddPayment/Update.elm
+++ b/src/client/elm/LoggedIn/Home/AddPayment/Update.elm
@@ -10,7 +10,7 @@ import LoggedIn.Home.AddPayment.Action as AddPaymentAction
import LoggedIn.Home.AddPayment.Model as AddPaymentModel
import Model.Translations exposing (Translations, getMessage)
-import Model.Payment exposing (PaymentFrequency(..))
+import Model.Payment exposing (Frequency(..))
update : AddPaymentAction.Action -> AddPaymentModel.Model -> AddPaymentModel.Model
update action addPayment =
diff --git a/src/client/elm/LoggedIn/Home/AddPayment/View.elm b/src/client/elm/LoggedIn/Home/AddPayment/View.elm
index 47dd6e8..562f69b 100644
--- a/src/client/elm/LoggedIn/Home/AddPayment/View.elm
+++ b/src/client/elm/LoggedIn/Home/AddPayment/View.elm
@@ -16,7 +16,7 @@ import LoggedIn.Home.Model as HomeModel
import LoggedIn.Home.AddPayment.Action as AddPaymentAction
import LoggedIn.Home.AddPayment.Model as AddPaymentModel
-import Model.Payment exposing (PaymentFrequency(..))
+import Model.Payment exposing (Frequency(..))
import Model.Translations exposing (getMessage)
import LoggedData exposing (LoggedData)
diff --git a/src/client/elm/LoggedIn/Home/Model.elm b/src/client/elm/LoggedIn/Home/Model.elm
index 2bcbe9a..cd8b4d0 100644
--- a/src/client/elm/LoggedIn/Home/Model.elm
+++ b/src/client/elm/LoggedIn/Home/Model.elm
@@ -6,7 +6,7 @@ module LoggedIn.Home.Model
import LoggedIn.Home.Model.Payer exposing (Payers)
import Model.User exposing (Users, UserId)
-import Model.Payment exposing (PaymentId, Payments, PaymentFrequency(..))
+import Model.Payment exposing (PaymentId, Payments, Frequency(..))
import LoggedIn.Home.Account.Model as AccountModel
import LoggedIn.Home.AddPayment.Model as AddPaymentModel
diff --git a/src/client/elm/LoggedIn/Home/View/Monthly.elm b/src/client/elm/LoggedIn/Home/View/Monthly.elm
index 487c05d..c1f3b51 100644
--- a/src/client/elm/LoggedIn/Home/View/Monthly.elm
+++ b/src/client/elm/LoggedIn/Home/View/Monthly.elm
@@ -15,7 +15,7 @@ import LoggedIn.Home.Model as HomeModel
import LoggedIn.Home.View.Price exposing (price)
import LoggedIn.Home.View.Expand exposing (..)
-import Model.Payment as Payment exposing (Payment)
+import Model.Payment as Payment exposing (Payment, monthlyPayments)
import Model.Translations exposing (getMessage, getParamMessage)
import LoggedData exposing (LoggedData)
@@ -26,7 +26,7 @@ import View.Icon exposing (renderIcon)
view : LoggedData -> HomeModel.Model -> Html
view loggedData homeModel =
- if List.length loggedData.monthlyPayments == 0
+ if List.length (monthlyPayments loggedData.payments) == 0
then
text ""
else
@@ -44,8 +44,8 @@ view loggedData homeModel =
monthlyCount : LoggedData -> HomeModel.Model -> Html
monthlyCount loggedData homeModel =
- let count = List.length loggedData.monthlyPayments
- total = List.sum << List.map .cost <| loggedData.monthlyPayments
+ let count = List.length (monthlyPayments loggedData.payments)
+ total = List.sum << List.map .cost <| (monthlyPayments loggedData.payments)
key = if count > 1 then "PluralMonthlyCount" else "SingularMonthlyCount"
in button
[ class "header"
@@ -59,7 +59,7 @@ paymentsTable : LoggedData -> HomeModel.Model -> Html
paymentsTable loggedData homeModel =
div
[ class "table" ]
- ( loggedData.monthlyPayments
+ ( (monthlyPayments loggedData.payments)
|> List.sortBy (String.toLower << .name)
|> List.map (paymentLine loggedData homeModel)
)
diff --git a/src/client/elm/LoggedIn/Home/View/Paging.elm b/src/client/elm/LoggedIn/Home/View/Paging.elm
index 09a5b62..8433494 100644
--- a/src/client/elm/LoggedIn/Home/View/Paging.elm
+++ b/src/client/elm/LoggedIn/Home/View/Paging.elm
@@ -15,7 +15,7 @@ import LoggedIn.Home.Model as HomeModel
import Action exposing (Action)
import LoggedData exposing (LoggedData)
-import Model.Payment exposing (Payments, perPage)
+import Model.Payment exposing (Payments, perPage, punctualPayments)
import View.Icon exposing (renderIcon)
@@ -24,7 +24,7 @@ showedPages = 5
paymentsPaging : Address Action -> Payments -> HomeModel.Model -> Html
paymentsPaging address payments homeModel =
- let maxPage = ceiling (toFloat (List.length payments) / toFloat perPage)
+ let maxPage = ceiling (toFloat (List.length (punctualPayments payments)) / toFloat perPage)
pages = truncatePages homeModel.currentPage [1..maxPage]
in if maxPage == 1
then
diff --git a/src/client/elm/LoggedIn/Home/View/Table.elm b/src/client/elm/LoggedIn/Home/View/Table.elm
index 58f2d0b..c73b428 100644
--- a/src/client/elm/LoggedIn/Home/View/Table.elm
+++ b/src/client/elm/LoggedIn/Home/View/Table.elm
@@ -46,6 +46,7 @@ headerLine loggedData =
paymentLines : LoggedData -> HomeModel.Model -> List Html
paymentLines loggedData homeModel =
loggedData.payments
+ |> punctualPayments
|> List.sortBy (Date.toTime << .creation)
|> List.reverse
|> List.drop ((homeModel.currentPage - 1) * perPage)