diff options
| author | Joris | 2019-10-20 21:31:57 +0200 | 
|---|---|---|
| committer | Joris | 2019-10-20 21:31:57 +0200 | 
| commit | 602c52acfcfa494b07fec05c20b317b60ea8a6f3 (patch) | |
| tree | 34fd9c44f82a83569822bc36eb2e0b04518e59f2 /client/src/View/Income/Table.hs | |
| parent | 7aadcc97f9df0e2daccbe8a8726d8bc6c63d67f4 (diff) | |
Load init data per page with AJAX
Diffstat (limited to 'client/src/View/Income/Table.hs')
| -rw-r--r-- | client/src/View/Income/Table.hs | 17 | 
1 files changed, 10 insertions, 7 deletions
diff --git a/client/src/View/Income/Table.hs b/client/src/View/Income/Table.hs index 5363ca5..d42848b 100644 --- a/client/src/View/Income/Table.hs +++ b/client/src/View/Income/Table.hs @@ -9,16 +9,19 @@ import           Data.Text          (Text)  import           Reflex.Dom         (Dynamic, MonadWidget)  import qualified Reflex.Dom         as R -import           Common.Model       (Income (..), Init (..), User (..)) +import           Common.Model       (Currency, Income (..), User (..))  import qualified Common.Model       as CM  import qualified Common.Msg         as Msg  import qualified Common.View.Format as Format +  import           Component          (TableIn (..))  import qualified Component +import           View.Income.Init   (Init (..))  data IncomeTableIn t = IncomeTableIn -  { _tableIn_init    :: Init -  , _tableIn_incomes :: Dynamic t [Income] +  { _tableIn_init     :: Init +  , _tableIn_currency :: Currency +  , _tableIn_incomes  :: Dynamic t [Income]    }  view :: forall t m. MonadWidget t m => IncomeTableIn t -> m () @@ -27,7 +30,7 @@ view tableIn = do      Component.table $ TableIn        { _tableIn_headerLabel = headerLabel        , _tableIn_rows = R.ffor (_tableIn_incomes tableIn) $ reverse . L.sortOn _income_date -      , _tableIn_cell = cell (_tableIn_init tableIn) +      , _tableIn_cell = cell (_tableIn_init tableIn) (_tableIn_currency tableIn)        , _tableIn_perPage = 7        , _tableIn_resetPage = R.never        } @@ -45,8 +48,8 @@ headerLabel UserHeader   = Msg.get Msg.Income_Name  headerLabel DateHeader   = Msg.get Msg.Income_Date  headerLabel AmountHeader = Msg.get Msg.Income_Amount -cell :: Init -> Header -> Income -> Text -cell init header income = +cell :: Init -> Currency -> Header -> Income -> Text +cell init currency header income =    case header of      UserHeader ->        Maybe.fromMaybe "" . fmap _user_name $ CM.findUser (_income_userId income) (_init_users init) @@ -55,4 +58,4 @@ cell init header income =        Format.longDay . _income_date $ income      AmountHeader -> -      Format.price (_init_currency init) . _income_amount $ income +      Format.price currency . _income_amount $ income  | 
