diff options
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 ] |