aboutsummaryrefslogtreecommitdiff
path: root/client/src
diff options
context:
space:
mode:
authorJoris2019-11-03 09:22:12 +0100
committerJoris2019-11-03 09:22:12 +0100
commita267f0bb4566389342c3244d3c082dc2453f4615 (patch)
tree29e62a08293bf740340518fc9be9b181aefed588 /client/src
parent227dcd4435b775d7dbc5ae5d3d81b589897253cc (diff)
downloadbudget-a267f0bb4566389342c3244d3c082dc2453f4615.tar.gz
budget-a267f0bb4566389342c3244d3c082dc2453f4615.tar.bz2
budget-a267f0bb4566389342c3244d3c082dc2453f4615.zip
Show users in income table
Diffstat (limited to 'client/src')
-rw-r--r--client/src/Component/Appearing.hs10
-rw-r--r--client/src/View/App.hs3
-rw-r--r--client/src/View/Income/Income.hs24
-rw-r--r--client/src/View/Income/Table.hs3
4 files changed, 19 insertions, 21 deletions
diff --git a/client/src/Component/Appearing.hs b/client/src/Component/Appearing.hs
new file mode 100644
index 0000000..e0144ca
--- /dev/null
+++ b/client/src/Component/Appearing.hs
@@ -0,0 +1,10 @@
+module Component.Appearing
+ ( view
+ ) where
+
+import Reflex.Dom (MonadWidget)
+import qualified Reflex.Dom as R
+
+view :: forall t m a. MonadWidget t m => m a -> m a
+view =
+ R.divClass "g-Appearing"
diff --git a/client/src/View/App.hs b/client/src/View/App.hs
index 1e26417..d305d00 100644
--- a/client/src/View/App.hs
+++ b/client/src/View/App.hs
@@ -67,11 +67,10 @@ signedWidget init route = do
}
IncomeRoute -> do
- incomeInit <- Income.init
Income.view $ Income.In
{ Income._in_currentUser = _init_currentUser init
, Income._in_currency = _init_currency init
- , Income._in_init = incomeInit
+ , Income._in_users = _init_users init
}
NotFoundRoute ->
diff --git a/client/src/View/Income/Income.hs b/client/src/View/Income/Income.hs
index fedf3d8..d31775a 100644
--- a/client/src/View/Income/Income.hs
+++ b/client/src/View/Income/Income.hs
@@ -1,20 +1,18 @@
{-# LANGUAGE ExplicitForAll #-}
module View.Income.Income
- ( init
- , view
+ ( view
, In(..)
) where
-import qualified Data.Text as T
import Data.Aeson (FromJSON)
import qualified Data.Maybe as Maybe
-import Prelude hiding (init)
+import qualified Data.Text as T
import Reflex.Dom (Dynamic, Event, MonadWidget)
import qualified Reflex.Dom as R
import Common.Model (Currency, Income (..),
- IncomesAndCount (..), UserId)
+ IncomesAndCount (..), User, UserId)
import qualified Component.Pages as Pages
import Loadable (Loadable (..))
@@ -27,22 +25,11 @@ import qualified View.Income.Reducer as Reducer
import qualified View.Income.Table as Table
data In t = In
- { _in_currentUser :: UserId
+ { _in_users :: [User]
+ , _in_currentUser :: UserId
, _in_currency :: Currency
- , _in_init :: Dynamic t (Loadable Init)
}
-init :: forall t m. MonadWidget t m => m (Dynamic t (Loadable Init))
-init = do
- users <- AjaxUtil.getNow "api/users"
- incomes <- AjaxUtil.getNow "api/incomes"
- payments <- AjaxUtil.getNow "api/payments"
- return $ do
- us <- users
- is <- incomes
- ps <- payments
- return $ Init <$> us <*> is <*> ps
-
view :: forall t m. MonadWidget t m => In t -> m ()
view input = do
rec
@@ -69,6 +56,7 @@ view input = do
{ Table._in_currentUser = _in_currentUser input
, Table._in_currency = _in_currency input
, Table._in_incomes = incomes
+ , Table._in_users = _in_users input
}
pages <- Pages.view $ Pages.In
diff --git a/client/src/View/Income/Table.hs b/client/src/View/Income/Table.hs
index 9b2129f..32ab27b 100644
--- a/client/src/View/Income/Table.hs
+++ b/client/src/View/Income/Table.hs
@@ -27,6 +27,7 @@ data In t = In
{ _in_currentUser :: UserId
, _in_currency :: Currency
, _in_incomes :: [Income]
+ , _in_users :: [User]
}
data Out t = Out
@@ -41,7 +42,7 @@ view input = do
table <- Table.view $ Table.In
{ Table._in_headerLabel = headerLabel
, Table._in_rows = reverse . L.sortOn _income_date $ _in_incomes input
- , Table._in_cell = cell [] (_in_currency input)
+ , Table._in_cell = cell (_in_users input) (_in_currency input)
, Table._in_cloneModal = \income ->
Form.view $ Form.In
{ Form._in_operation = Form.Clone income