diff options
Diffstat (limited to 'src/client/elm/View/LoggedIn/Table.elm')
-rw-r--r-- | src/client/elm/View/LoggedIn/Table.elm | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/src/client/elm/View/LoggedIn/Table.elm b/src/client/elm/View/LoggedIn/Table.elm index 51a7b73..8590dc5 100644 --- a/src/client/elm/View/LoggedIn/Table.elm +++ b/src/client/elm/View/LoggedIn/Table.elm @@ -2,36 +2,33 @@ module View.LoggedIn.Table ( paymentsTable ) where -import Html exposing (..) -import Html.Attributes exposing (..) -import Html.Events exposing (..) import Dict exposing (..) - -import Date import Date exposing (Date) - +import Signal exposing (Address) import String exposing (append) +import Html exposing (..) +import Html.Attributes exposing (..) +import Html.Events exposing (..) + import Model exposing (Model) import Model.User exposing (getUserName) import Model.Payment exposing (..) -import Model.View.LoggedInView exposing (LoggedInView) import Model.Translations exposing (getMessage) - -import ServerCommunication as SC exposing (serverCommunications) - -import Update exposing (..) -import Update.LoggedIn exposing (..) +import Model.Action exposing (..) +import Model.Action.LoggedInAction exposing (..) +import Model.Communication as Communication +import Model.View.LoggedInView exposing (LoggedInView) import View.Icon exposing (renderIcon) import View.Date exposing (..) import View.Price exposing (price) -paymentsTable : Model -> LoggedInView -> Html -paymentsTable model loggedInView = +paymentsTable : Address Action -> Model -> LoggedInView -> Html +paymentsTable address model loggedInView = div [ class "table" ] - ( headerLine model :: paymentLines model loggedInView) + ( headerLine model :: paymentLines address model loggedInView) headerLine : Model -> Html headerLine model = @@ -44,23 +41,23 @@ headerLine model = , div [ class "cell" ] [] ] -paymentLines : Model -> LoggedInView -> List Html -paymentLines model loggedInView = +paymentLines : Address Action -> Model -> LoggedInView -> List Html +paymentLines address model loggedInView = loggedInView.payments |> List.sortBy (Date.toTime << .creation) |> List.reverse |> List.drop ((loggedInView.currentPage - 1) * perPage) |> List.take perPage - |> List.map (paymentLine model loggedInView) + |> List.map (paymentLine address model loggedInView) -paymentLine : Model -> LoggedInView -> Payment -> Html -paymentLine model loggedInView payment = +paymentLine : Address Action -> Model -> LoggedInView -> Payment -> Html +paymentLine address model loggedInView payment = a [ classList [ ("row", True) , ("edition", loggedInView.paymentEdition == Just payment.id) ] - , onClick actions.address (UpdateLoggedIn (ToggleEdit payment.id)) + , onClick address (UpdateLoggedIn (ToggleEdit payment.id)) ] [ div [ class "cell category" ] [ text payment.name ] , div @@ -91,7 +88,7 @@ paymentLine model loggedInView payment = div [ class "cell delete" ] [ button - [ onClick serverCommunications.address (SC.DeletePayment payment loggedInView.currentPage) ] + [ onClick address (ServerCommunication <| Communication.DeletePayment payment loggedInView.currentPage) ] [ renderIcon "times" ] ] else |