aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm/View/LoggedIn/Table.elm
diff options
context:
space:
mode:
authorJoris2016-03-27 20:20:10 +0200
committerJoris2016-03-27 20:20:10 +0200
commit702d60cbcdf85216a1b18416f4480afb77384e8a (patch)
tree400c004181373255ff0ad40ed32c69674e62ae59 /src/client/elm/View/LoggedIn/Table.elm
parent5f6c66e4c3cf02e5b1c0a1fac6036b86be06a992 (diff)
downloadbudget-702d60cbcdf85216a1b18416f4480afb77384e8a.tar.gz
budget-702d60cbcdf85216a1b18416f4480afb77384e8a.tar.bz2
budget-702d60cbcdf85216a1b18416f4480afb77384e8a.zip
Regroup loggedIn modules
Diffstat (limited to 'src/client/elm/View/LoggedIn/Table.elm')
-rw-r--r--src/client/elm/View/LoggedIn/Table.elm35
1 files changed, 18 insertions, 17 deletions
diff --git a/src/client/elm/View/LoggedIn/Table.elm b/src/client/elm/View/LoggedIn/Table.elm
index 4c302a5..ababcbd 100644
--- a/src/client/elm/View/LoggedIn/Table.elm
+++ b/src/client/elm/View/LoggedIn/Table.elm
@@ -11,23 +11,24 @@ import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (..)
+import LoggedIn.Action as LoggedInAction
+import LoggedIn.Model as LoggedInModel
+
import Model exposing (Model)
import Model.User exposing (getUserName)
import Model.Payment exposing (..)
import Model.Translations exposing (getMessage)
import Model.Action exposing (..)
-import Model.Action.LoggedInAction exposing (..)
-import Model.View.LoggedInView exposing (LoggedInView)
import View.Icon exposing (renderIcon)
import View.Date exposing (..)
import View.Price exposing (price)
-paymentsTable : Address Action -> Model -> LoggedInView -> Html
-paymentsTable address model loggedInView =
+paymentsTable : Address Action -> Model -> LoggedInModel.Model -> Html
+paymentsTable address model loggedInModel =
div
[ class "table" ]
- ( headerLine model :: paymentLines address model loggedInView)
+ ( headerLine model :: paymentLines address model loggedInModel)
headerLine : Model -> Html
headerLine model =
@@ -40,23 +41,23 @@ headerLine model =
, div [ class "cell" ] []
]
-paymentLines : Address Action -> Model -> LoggedInView -> List Html
-paymentLines address model loggedInView =
- loggedInView.payments
+paymentLines : Address Action -> Model -> LoggedInModel.Model -> List Html
+paymentLines address model loggedInModel =
+ loggedInModel.payments
|> List.sortBy (Date.toTime << .creation)
|> List.reverse
- |> List.drop ((loggedInView.currentPage - 1) * perPage)
+ |> List.drop ((loggedInModel.currentPage - 1) * perPage)
|> List.take perPage
- |> List.map (paymentLine address model loggedInView)
+ |> List.map (paymentLine address model loggedInModel)
-paymentLine : Address Action -> Model -> LoggedInView -> Payment -> Html
-paymentLine address model loggedInView payment =
+paymentLine : Address Action -> Model -> LoggedInModel.Model -> Payment -> Html
+paymentLine address model loggedInModel payment =
a
[ classList
[ ("row", True)
- , ("edition", loggedInView.paymentEdition == Just payment.id)
+ , ("edition", loggedInModel.paymentEdition == Just payment.id)
]
- , onClick address (UpdateLoggedIn (ToggleEdit payment.id))
+ , onClick address (UpdateLoggedIn (LoggedInAction.ToggleEdit payment.id))
]
[ div [ class "cell category" ] [ text payment.name ]
, div
@@ -69,7 +70,7 @@ paymentLine address model loggedInView payment =
, div
[ class "cell user" ]
[ payment.userId
- |> getUserName loggedInView.users
+ |> getUserName loggedInModel.users
|> Maybe.withDefault "−"
|> text
]
@@ -82,12 +83,12 @@ paymentLine address model loggedInView payment =
[ class "longDate" ]
[ text (renderLongDate payment.creation model.translations) ]
]
- , if loggedInView.account.me == payment.userId
+ , if loggedInModel.account.me == payment.userId
then
div
[ class "cell delete" ]
[ button
- [ onClick address (UpdateLoggedIn <| DeletePayment payment Punctual)]
+ [ onClick address (UpdateLoggedIn <| LoggedInAction.DeletePayment payment Punctual)]
[ renderIcon "times" ]
]
else