diff options
author | Joris | 2016-06-25 15:10:03 +0200 |
---|---|---|
committer | Joris | 2016-06-25 22:09:04 +0200 |
commit | 70720548c9af024dbb6080638ac8e5470c2213eb (patch) | |
tree | a149bd6d8f1448de11ac4b0b41c52bc82052035a /src/client/elm/LoggedIn/Home/View.elm | |
parent | 4ce4de89a5400b0d8b9cddaa2922901a081fdaaa (diff) |
Use the search to view either punctual or monthly payments
Diffstat (limited to 'src/client/elm/LoggedIn/Home/View.elm')
-rw-r--r-- | src/client/elm/LoggedIn/Home/View.elm | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/src/client/elm/LoggedIn/Home/View.elm b/src/client/elm/LoggedIn/Home/View.elm index 8076673..0def64e 100644 --- a/src/client/elm/LoggedIn/Home/View.elm +++ b/src/client/elm/LoggedIn/Home/View.elm @@ -12,22 +12,24 @@ import Utils.Form as Form import Msg exposing (Msg) import LoggedData exposing (LoggedData) -import Model.Payment as Payment +import Model.Payment as Payment exposing (Frequency(..)) -import LoggedIn.Home.Model as LoggedInModel -import LoggedIn.Home.Search.View as SearchView -import LoggedIn.Home.View.Monthly as MonthlyView +import LoggedIn.Home.Model as Home +import LoggedIn.Home.Header.View as Header -import LoggedIn.Home.View.Table exposing (paymentsTable) -import LoggedIn.Home.View.Paging exposing (paymentsPaging) +import LoggedIn.Home.View.Table as Table +import LoggedIn.Home.View.Paging as Paging -view : LoggedData -> LoggedInModel.Model -> Html Msg -view loggedData loggedIn = - let punctualPayments = Payment.sortedFiltredPunctual (Form.fieldAsText loggedIn.search "searchText") loggedData.payments +view : LoggedData -> Home.Model -> Html Msg +view loggedData home = + let (name, frequency) = + case Form.getOutput home.search of + Just data -> (Maybe.withDefault "" data.name, data.frequency) + Nothing -> ("", Punctual) + payments = Payment.search name frequency loggedData.payments in div [ class "home" ] - [ SearchView.view loggedData loggedIn punctualPayments - , MonthlyView.view loggedData loggedIn - , paymentsTable loggedData loggedIn punctualPayments - , paymentsPaging loggedIn punctualPayments + [ Header.view loggedData home payments frequency + , Table.view loggedData home payments frequency + , Paging.view home payments ] |