diff options
| author | Joris | 2017-03-26 21:10:42 +0200 | 
|---|---|---|
| committer | Joris | 2017-03-26 21:10:42 +0200 | 
| commit | 1e47a7754ca38bd1a6c74765d8378caf68ce4619 (patch) | |
| tree | d0d9238479dc2529a1b558bbbcde346e7e8c2935 /src/client/elm/LoggedIn/Home/Header | |
| parent | c0ac16a713c4e53cf6af8e72a6d5f6b8ac5d6456 (diff) | |
Separate client and server watch
Diffstat (limited to 'src/client/elm/LoggedIn/Home/Header')
| -rw-r--r-- | src/client/elm/LoggedIn/Home/Header/View.elm | 104 | 
1 files changed, 0 insertions, 104 deletions
| diff --git a/src/client/elm/LoggedIn/Home/Header/View.elm b/src/client/elm/LoggedIn/Home/Header/View.elm deleted file mode 100644 index 3f8a320..0000000 --- a/src/client/elm/LoggedIn/Home/Header/View.elm +++ /dev/null @@ -1,104 +0,0 @@ -module LoggedIn.Home.Header.View exposing -  ( view -  ) - -import Html exposing (..) -import Html.Attributes exposing (..) -import Html.Events exposing (..) -import String -import Dict -import Date - -import Form exposing (Form) -import View.Form as Form -import View.Events exposing (onSubmitPrevDefault) - -import Msg exposing (Msg) -import LoggedIn.Msg as LoggedInMsg -import LoggedIn.Home.Msg as HomeMsg - -import LoggedData exposing (LoggedData) -import LoggedIn.Home.Model as Home -import Model.Translations exposing (getParamMessage) -import Model.Conf exposing (Conf) -import Model.Payment as Payment exposing (Payments, Frequency(..)) -import Model.Translations exposing (getMessage) - -import Dialog.AddPayment.Model as AddPayment -import Dialog.AddPayment.View as AddPayment - -import LoggedIn.Home.View.ExceedingPayers as ExceedingPayers -import LoggedIn.View.Format as Format -import View.Plural exposing (plural) - -view : LoggedData -> Home.Model -> Payments -> Frequency -> Html Msg -view loggedData { search } payments frequency = -  let currentDate = Date.fromTime loggedData.currentTime -  in  Html.div -        [ class "header" ] -        [ div -            [ class "payerAndAdd" ] -            [ ExceedingPayers.view loggedData -            , AddPayment.button -                loggedData -                (AddPayment.initialAdd loggedData.translations currentDate frequency) -                "AddPayment" -                (text (getMessage loggedData.translations "AddPayment")) -                Nothing -            ] -        , Html.div -            [ class "searchLine" ] -            [ searchForm loggedData search ] -        , infos loggedData payments -        ] - -searchForm : LoggedData -> Form String Home.Search -> Html Msg -searchForm loggedData search = -  Html.map (Msg.UpdateLoggedIn << LoggedInMsg.HomeMsg << HomeMsg.SearchMsg) <| -    Html.form -      [ onSubmitPrevDefault Form.NoOp ] -      [ Form.textInput loggedData.translations search "search" "name" -      , if List.isEmpty (Payment.monthly loggedData.payments) -          then text "" -          else Form.radioInputs loggedData.translations search "search" "frequency" [ toString Punctual, toString Monthly ] -      ] - -infos : LoggedData -> Payments -> Html Msg -infos loggedData payments = -  let paymentsCount = List.length payments -  in  if paymentsCount == 0 -        then text "" -        else -          let count = plural loggedData.translations (List.length payments) "Payment" "Payments" -              sum = paymentsSum loggedData.conf payments -          in  div -                [ class "infos" ] -                [ span -                    [ class "total" ] -                    [ text <| getParamMessage [ count, sum ] loggedData.translations "Worth" ] -                , span -                    [ class "partition" ] -                    [ text <| paymentsPartition loggedData payments ] -                ] - -paymentsPartition : LoggedData -> Payments -> String -paymentsPartition loggedData payments = -  String.join -    ", " -    ( loggedData.users -        |> Dict.toList -        |> List.map (Tuple.mapFirst (\userId -> Payment.totalPayments (always True) userId payments)) -        |> List.filter (\(sum, _) -> sum > 0) -        |> List.sortBy Tuple.first -        |> List.reverse -        |> List.map (\(sum, user) -> -             getParamMessage [ user.name, Format.price loggedData.conf sum ] loggedData.translations "By" -           ) -    ) - -paymentsSum : Conf -> Payments -> String -paymentsSum conf payments = -  payments -    |> List.map .cost -    |> List.sum -    |> Format.price conf | 
