aboutsummaryrefslogtreecommitdiff
path: root/src/client/LoggedIn/Home/View.elm
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/LoggedIn/Home/View.elm')
-rw-r--r--src/client/LoggedIn/Home/View.elm38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/client/LoggedIn/Home/View.elm b/src/client/LoggedIn/Home/View.elm
new file mode 100644
index 0000000..0b90e67
--- /dev/null
+++ b/src/client/LoggedIn/Home/View.elm
@@ -0,0 +1,38 @@
+module LoggedIn.Home.View exposing
+ ( view
+ )
+
+import Date
+import Html exposing (..)
+import Html.Attributes exposing (..)
+
+import Form
+import Utils.Form as Form
+
+import LoggedData exposing (LoggedData)
+import LoggedIn.Home.Header.View as Header
+import LoggedIn.Home.Model as Home
+import LoggedIn.Home.Msg as HomeMsg
+import LoggedIn.Home.View.Paging as Paging
+import LoggedIn.Home.View.Table as Table
+import LoggedIn.Msg as LoggedInMsg
+import Model.Payment as Payment exposing (Frequency(..))
+import Msg exposing (Msg)
+
+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" ]
+ [ Header.view loggedData home payments frequency
+ , Table.view loggedData home payments frequency
+ , Paging.view
+ home.currentPage
+ (List.length payments)
+ Msg.NoOp
+ (Msg.UpdateLoggedIn << LoggedInMsg.HomeMsg << HomeMsg.UpdatePage)
+ ]