diff options
Diffstat (limited to 'src/client/View/Payments/Table.elm')
-rw-r--r-- | src/client/View/Payments/Table.elm | 86 |
1 files changed, 0 insertions, 86 deletions
diff --git a/src/client/View/Payments/Table.elm b/src/client/View/Payments/Table.elm deleted file mode 100644 index 1646186..0000000 --- a/src/client/View/Payments/Table.elm +++ /dev/null @@ -1,86 +0,0 @@ -module View.Payments.Table - ( paymentsTable - ) where - -import Html exposing (..) -import Html.Attributes exposing (..) -import Html.Events exposing (..) -import Dict exposing (..) - -import Date -import Date exposing (Date) - -import String exposing (append) - -import Model exposing (Model) -import Model.User exposing (getUserName) -import Model.Payment exposing (..) -import Model.View.LoggedView exposing (LoggedView) -import Model.Translations exposing (getMessage) - -import ServerCommunication as SC exposing (serverCommunications) - -import Update exposing (..) -import Update.LoggedView exposing (..) - -import View.Icon exposing (renderIcon) -import View.Date exposing (..) - -paymentsTable : Model -> LoggedView -> Html -paymentsTable model loggedView = - div - [ class "table" ] - ( headerLine model :: paymentLines model loggedView) - -headerLine : Model -> Html -headerLine model = - div - [ class "header" ] - [ div [ class "cell category" ] [ renderIcon "shopping-cart" ] - , div [ class "cell cost" ] [ text (getMessage "MoneySymbol" model.translations) ] - , div [ class "cell user" ] [ renderIcon "user" ] - , div [ class "cell date" ] [ renderIcon "calendar" ] - , div [ class "cell" ] [] - ] - -paymentLines : Model -> LoggedView -> List Html -paymentLines model loggedView = - loggedView.payments - |> List.sortBy (Date.toTime << .creation) - |> List.reverse - |> List.map (paymentLine model loggedView) - -paymentLine : Model -> LoggedView -> Payment -> Html -paymentLine model loggedView payment = - a - [ class ("row" ++ (if loggedView.paymentEdition == Just payment.id then " edition" else "")) - , onClick actions.address (UpdateLoggedView (ToggleEdit payment.id)) - ] - [ div [ class "cell category" ] [ text payment.name ] - , div [ class "cell cost" ] [ text ((toString payment.cost) ++ " " ++ (getMessage "MoneySymbol" model.translations)) ] - , div - [ class "cell user" ] - [ payment.userId - |> getUserName loggedView.users - |> Maybe.withDefault "−" - |> text - ] - , div - [ class "cell date" ] - [ span - [ class "shortDate" ] - [ text (renderShortDate payment.creation model.translations) ] - , span - [ class "longDate" ] - [ text (renderLongDate payment.creation model.translations) ] - ] - , if loggedView.me == payment.userId - then - div - [ class "cell delete" - , onClick serverCommunications.address (SC.DeletePayment payment.id payment.userId payment.cost loggedView.currentPage) - ] - [ renderIcon "times" ] - else - div [ class "cell" ] [] - ] |