aboutsummaryrefslogtreecommitdiff
path: root/client/src/View/Income/Income.hs
diff options
context:
space:
mode:
authorJoris2019-10-23 22:35:27 +0200
committerJoris2019-10-23 22:35:27 +0200
commite4b32ce15f8c92f3b477d3f3d4d301ba08f9b5e3 (patch)
tree274c3ef2111b7c7975bc1fb0aa2c5728ba19999c /client/src/View/Income/Income.hs
parentf968c8ce63e1aec119b1e6f414cf27e2c0294bcb (diff)
downloadbudget-e4b32ce15f8c92f3b477d3f3d4d301ba08f9b5e3.tar.gz
budget-e4b32ce15f8c92f3b477d3f3d4d301ba08f9b5e3.tar.bz2
budget-e4b32ce15f8c92f3b477d3f3d4d301ba08f9b5e3.zip
Edit an income
Diffstat (limited to 'client/src/View/Income/Income.hs')
-rw-r--r--client/src/View/Income/Income.hs9
1 files changed, 6 insertions, 3 deletions
diff --git a/client/src/View/Income/Income.hs b/client/src/View/Income/Income.hs
index 2784cac..90f1fde 100644
--- a/client/src/View/Income/Income.hs
+++ b/client/src/View/Income/Income.hs
@@ -50,6 +50,7 @@ view input = do
incomes <- reduceIncomes
(_init_incomes init)
addIncome
+ (Table._out_edit table)
(Table._out_delete table)
header <- Header.view $ Header.In
@@ -72,11 +73,13 @@ view input = do
reduceIncomes
:: forall t m. MonadWidget t m
=> [Income]
- -> Event t Income -- add income
- -> Event t Income -- delete income
+ -> Event t Income -- add
+ -> Event t Income -- edit
+ -> Event t Income -- delete
-> m (Dynamic t [Income])
-reduceIncomes initIncomes add delete =
+reduceIncomes initIncomes add edit delete =
R.foldDyn id initIncomes $ R.leftmost
[ (:) <$> add
+ , R.ffor edit (\p -> (p:) . filter ((/= (_income_id p)) . _income_id))
, R.ffor delete (\p -> filter ((/= (_income_id p)) . _income_id))
]