yammat/Handler/CashCheck.hs

28 lines
712 B
Haskell
Raw Normal View History

2015-04-09 15:45:52 +00:00
module Handler.CashCheck where
import Import
import Handler.Common
getCashCheckR :: Handler Html
getCashCheckR = do
(cashCheckWidget, enctype) <- generateFormPost createCashierForm
defaultLayout $ do
$(widgetFile "cashCheck")
postCashCheckR :: Handler Html
postCashCheckR = do
((res, _), _) <- runFormPost createCashierForm
case res of
FormSuccess c -> do
runDB $ insert_ c
2015-04-09 22:40:58 +00:00
setMessageI MsgCashChecked
2015-04-09 15:45:52 +00:00
redirect $ HomeR
_ -> do
2015-04-09 22:40:58 +00:00
setMessageI MsgCashCheckError
2015-04-09 15:45:52 +00:00
redirect $ CashCheckR
createCashierForm :: Form Cashier
createCashierForm = renderDivs $ Cashier
2015-04-09 22:40:58 +00:00
<$> areq currencyField (fieldSettingsLabel MsgCountedValue) Nothing
2015-04-09 15:45:52 +00:00
<*> lift (liftIO getCurrentTime)