aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm/LoggedIn/Home/View/Table.elm
diff options
context:
space:
mode:
authorJoris2017-03-26 21:10:42 +0200
committerJoris2017-03-26 21:10:42 +0200
commit1e47a7754ca38bd1a6c74765d8378caf68ce4619 (patch)
treed0d9238479dc2529a1b558bbbcde346e7e8c2935 /src/client/elm/LoggedIn/Home/View/Table.elm
parentc0ac16a713c4e53cf6af8e72a6d5f6b8ac5d6456 (diff)
downloadbudget-1e47a7754ca38bd1a6c74765d8378caf68ce4619.tar.gz
budget-1e47a7754ca38bd1a6c74765d8378caf68ce4619.tar.bz2
budget-1e47a7754ca38bd1a6c74765d8378caf68ce4619.zip
Separate client and server watch
Diffstat (limited to 'src/client/elm/LoggedIn/Home/View/Table.elm')
-rw-r--r--src/client/elm/LoggedIn/Home/View/Table.elm166
1 files changed, 0 insertions, 166 deletions
diff --git a/src/client/elm/LoggedIn/Home/View/Table.elm b/src/client/elm/LoggedIn/Home/View/Table.elm
deleted file mode 100644
index 8828488..0000000
--- a/src/client/elm/LoggedIn/Home/View/Table.elm
+++ /dev/null
@@ -1,166 +0,0 @@
-module LoggedIn.Home.View.Table exposing
- ( view
- )
-
-import Date exposing (Date)
-import Dict exposing (..)
-import String exposing (append)
-
-import FontAwesome
-import View.Color as Color
-
-import Html exposing (..)
-import Html.Attributes exposing (..)
-import Html.Events exposing (..)
-
-import Dialog
-import Dialog.AddPayment.Model as AddPayment
-import Dialog.AddPayment.View as AddPayment
-
-import Tooltip
-
-import Msg exposing (Msg)
-
-import LoggedData exposing (LoggedData)
-
-import LoggedIn.Msg as LoggedInMsg
-
-import LoggedIn.Home.Model as Home
-import LoggedIn.View.Format as Format
-import View.Date as Date
-
-import Model.Payment as Payment exposing (..)
-import Model.PaymentCategory as PaymentCategory
-import Model.Translations exposing (getMessage)
-import Model.User exposing (getUserName)
-
-view : LoggedData -> Home.Model -> Payments -> Frequency -> Html Msg
-view loggedData homeModel payments frequency =
- let visiblePayments =
- payments
- |> List.drop ((homeModel.currentPage - 1) * perPage)
- |> List.take perPage
- in div
- [ class "table" ]
- [ div
- [ class "lines" ]
- ( headerLine loggedData frequency :: List.map (paymentLine loggedData homeModel frequency) visiblePayments )
- , if List.isEmpty visiblePayments
- then
- div
- [ class "emptyTableMsg" ]
- [ text <| getMessage loggedData.translations "NoPayment" ]
- else
- text ""
- ]
-
-headerLine : LoggedData -> Frequency -> Html Msg
-headerLine loggedData frequency =
- div
- [ class "header" ]
- [ div [ class "cell category" ] [ text <| getMessage loggedData.translations "Name" ]
- , div [ class "cell cost" ] [ text <| getMessage loggedData.translations "Cost" ]
- , div [ class "cell user" ] [ text <| getMessage loggedData.translations "Payer" ]
- , div [ class "cell user" ] [ text <| getMessage loggedData.translations "PaymentCategory" ]
- , case frequency of
- Punctual -> div [ class "cell date" ] [ text <| getMessage loggedData.translations "Date" ]
- Monthly -> text ""
- , div [ class "cell" ] []
- , div [ class "cell" ] []
- , div [ class "cell" ] []
- ]
-
-paymentLine : LoggedData -> Home.Model -> Frequency -> Payment -> Html Msg
-paymentLine loggedData homeModel frequency payment =
- div
- [ class "row" ]
- [ div [ class "cell name" ] [ text payment.name ]
- , div
- [ classList
- [ ("cell cost", True)
- , ("refund", payment.cost < 0)
- ]
- ]
- [ text (Format.price loggedData.conf payment.cost) ]
- , div
- [ class "cell user" ]
- [ payment.userId
- |> getUserName loggedData.users
- |> Maybe.withDefault "−"
- |> text
- ]
- , div
- [ class "cell category" ]
- ( let mbCategory =
- PaymentCategory.search payment.name loggedData.paymentCategories
- |> Maybe.andThen (\category -> Dict.get category loggedData.categories)
- in case mbCategory of
- Just category ->
- [ span
- [ class "tag"
- , style [("background-color", category.color)]
- ]
- [ text category.name ]
- ]
- Nothing ->
- []
- )
- , case frequency of
- Punctual ->
- div
- [ class "cell date" ]
- [ span
- [ class "shortDate" ]
- [ text (Date.shortView payment.date loggedData.translations) ]
- , span
- [ class "longDate" ]
- [ text (Date.longView payment.date loggedData.translations) ]
- ]
- Monthly ->
- text ""
- , div
- [ class "cell button" ]
- [ let currentDate = Date.fromTime loggedData.currentTime
- category = PaymentCategory.search payment.name loggedData.paymentCategories
- in AddPayment.button
- loggedData
- (AddPayment.initialClone loggedData.translations currentDate category payment)
- "ClonePayment"
- (FontAwesome.clone Color.chestnutRose 18)
- (Just (getMessage loggedData.translations "Clone"))
- ]
- , div
- [ class "cell button" ]
- [ if loggedData.me /= payment.userId
- then
- text ""
- else
- let category = PaymentCategory.search payment.name loggedData.paymentCategories
- in AddPayment.button
- loggedData
- (AddPayment.initialEdit loggedData.translations category payment)
- "EditPayment"
- (FontAwesome.pencil Color.chestnutRose 18)
- (Just (getMessage loggedData.translations "Edit"))
- ]
- , div
- [ class "cell button" ]
- [ if loggedData.me /= payment.userId
- then
- text ""
- else
- let dialogConfig =
- { className = "deletePaymentDialog"
- , title = getMessage loggedData.translations "ConfirmPaymentDelete"
- , body = always <| text ""
- , confirm = getMessage loggedData.translations "Confirm"
- , confirmMsg = always <| Msg.Dialog <| Dialog.UpdateAndClose <| Msg.DeletePayment payment.id
- , undo = getMessage loggedData.translations "Undo"
- }
- in button
- ( Tooltip.show Msg.Tooltip (getMessage loggedData.translations "Delete")
- ++ [ onClick (Msg.Dialog <| Dialog.Open dialogConfig) ]
- )
- [ FontAwesome.trash Color.chestnutRose 18 ]
- ]
- ]