Commit a267f0bb authored by Joris's avatar Joris

Show users in income table

parent 227dcd44
......@@ -45,6 +45,7 @@ Executable client
, uri-bytestring
other-modules:
Component.Appearing
Component.Button
Component.ConfirmDialog
Component.Form
......
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"
......@@ -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 ->
......
{-# 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
......
......@@ -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
......
......@@ -65,6 +65,7 @@ Executable server
Controller.Payment
Controller.User
Cookie
Design.Appearing
Design.Color
Design.Constants
Design.Errors
......
module Design.Appearing
( design
) where
import Clay
design :: Css
design = do
appearKeyframe
".g-Appearing" ? do
appearAnimation
appearAnimation :: Css
appearAnimation = do
animationName "appear"
animationDuration (sec 0.2)
animationTimingFunction easeIn
appearKeyframe :: Css
appearKeyframe = keyframes
"appear"
[ (0, "opacity" -: "0")
]
......@@ -6,6 +6,7 @@ import Clay
import Clay.Color as C
import Data.Text.Lazy (Text)
import qualified Design.Appearing as Appearing
import qualified Design.Color as Color
import qualified Design.Constants as Constants
import qualified Design.Errors as Errors
......@@ -22,6 +23,7 @@ globalDesign = renderWith compact [] global
global :: Css
global = do
".errors" ? Errors.design
Appearing.design
Modal.design
".tooltip" ? Tooltip.design
Views.design
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment