diff options
author | Joris | 2019-10-23 22:35:27 +0200 |
---|---|---|
committer | Joris | 2019-10-23 22:35:27 +0200 |
commit | e4b32ce15f8c92f3b477d3f3d4d301ba08f9b5e3 (patch) | |
tree | 274c3ef2111b7c7975bc1fb0aa2c5728ba19999c /client/src/View/Income/Add.hs | |
parent | f968c8ce63e1aec119b1e6f414cf27e2c0294bcb (diff) |
Edit an income
Diffstat (limited to 'client/src/View/Income/Add.hs')
-rw-r--r-- | client/src/View/Income/Add.hs | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/client/src/View/Income/Add.hs b/client/src/View/Income/Add.hs deleted file mode 100644 index 7780d73..0000000 --- a/client/src/View/Income/Add.hs +++ /dev/null @@ -1,42 +0,0 @@ -module View.Income.Add - ( view - , In(..) - ) where - -import Control.Monad.IO.Class (liftIO) -import qualified Data.Maybe as Maybe -import qualified Data.Text as T -import qualified Data.Time.Clock as Time -import Reflex.Dom (MonadWidget) - -import Common.Model (CreateIncomeForm (..), Income (..)) -import qualified Common.Msg as Msg -import qualified Common.Util.Time as TimeUtil -import qualified Component.Form -import qualified Component.Modal as Modal -import qualified Util.Ajax as Ajax -import qualified View.Income.Form as Form - -data In t = In - { _in_income :: Maybe Income - } - -view :: forall t m. MonadWidget t m => In t -> Modal.Content t m Income -view input cancel = do - - currentDay <- liftIO $ Time.getCurrentTime >>= TimeUtil.timeToDay - - let amount = - Maybe.fromMaybe "" ((T.pack . show . _income_amount) <$> (_in_income input)) - - form <- - Component.Form.view $ Form.view $ Form.In - { Form._in_cancel = cancel - , Form._in_headerLabel = Msg.get Msg.Income_AddLong - , Form._in_amount = amount - , Form._in_date = currentDay - , Form._in_mkPayload = CreateIncomeForm - , Form._in_ajax = Ajax.post - } - - return (Form._out_hide form, Form._out_addIncome form) |