From 70720548c9af024dbb6080638ac8e5470c2213eb Mon Sep 17 00:00:00 2001 From: Joris Date: Sat, 25 Jun 2016 15:10:03 +0200 Subject: Use the search to view either punctual or monthly payments --- src/client/elm/LoggedIn/Home/Search/View.elm | 56 ---------------------------- 1 file changed, 56 deletions(-) delete mode 100644 src/client/elm/LoggedIn/Home/Search/View.elm (limited to 'src/client/elm/LoggedIn/Home/Search') diff --git a/src/client/elm/LoggedIn/Home/Search/View.elm b/src/client/elm/LoggedIn/Home/Search/View.elm deleted file mode 100644 index 99eec95..0000000 --- a/src/client/elm/LoggedIn/Home/Search/View.elm +++ /dev/null @@ -1,56 +0,0 @@ -module LoggedIn.Home.Search.View exposing - ( view - ) - -import Html exposing (..) -import Html.Attributes exposing (..) -import Html.Events exposing (..) -import Html.App as Html - -import Form exposing (Form) -import View.Form as Form - -import Msg exposing (Msg) -import LoggedIn.Msg as LoggedInMsg -import LoggedIn.Home.Msg as HomeMsg - -import LoggedData exposing (LoggedData) -import LoggedIn.Home.Model as HomeModel -import Model.Translations exposing (getParamMessage) -import Model.Conf exposing (Conf) -import Model.Payment exposing (Payments) -import Model.Translations exposing (getMessage) - -import LoggedIn.Home.AddPayment.View as AddPayment - -import LoggedIn.View.Format as Format -import View.Plural exposing (plural) - -view : LoggedData -> HomeModel.Model -> Payments -> Html Msg -view loggedData { search } payments = - Html.div - [ class "search" ] - [ searchForm loggedData search - , paymentsStat loggedData payments - , AddPayment.view loggedData - ] - -searchForm : LoggedData -> Form String HomeModel.Search -> Html Msg -searchForm loggedData search = - let htmlMap = Html.map (Msg.UpdateLoggedIn << LoggedInMsg.HomeMsg << HomeMsg.SearchMsg) - in Form.textInput loggedData.translations search htmlMap "searchText" - -paymentsStat : LoggedData -> Payments -> Html Msg -paymentsStat loggedData payments = - let count = plural loggedData.translations (List.length payments) "Payment" "Payments" - sum = paymentsSum loggedData.conf payments - in span - [ class "stat" ] - [ text <| getParamMessage [ count, sum ] "Worth" loggedData.translations ] - -paymentsSum : Conf -> Payments -> String -paymentsSum conf payments = - payments - |> List.map .cost - |> List.sum - |> Format.price conf -- cgit v1.2.3