From d4609d1cbea945085620675553194588f33634c3 Mon Sep 17 00:00:00 2001 From: nek0 Date: Thu, 9 Apr 2015 17:45:52 +0200 Subject: [PATCH] forgot files --- Handler/CashCheck.hs | 27 +++++++++++++++++++++++++++ templates/cashCheck.hamlet | 11 +++++++++++ 2 files changed, 38 insertions(+) create mode 100644 Handler/CashCheck.hs create mode 100644 templates/cashCheck.hamlet diff --git a/Handler/CashCheck.hs b/Handler/CashCheck.hs new file mode 100644 index 0000000..f495de5 --- /dev/null +++ b/Handler/CashCheck.hs @@ -0,0 +1,27 @@ +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 + setMessage "Kassensturz durchgeführt. Kasse aktualisiert" + redirect $ HomeR + _ -> do + setMessage "Fehler im Kassensturz" + redirect $ CashCheckR + +createCashierForm :: Form Cashier +createCashierForm = renderDivs $ Cashier + <$> areq currencyField "Gezählter Betrag" Nothing + <*> lift (liftIO getCurrentTime) diff --git a/templates/cashCheck.hamlet b/templates/cashCheck.hamlet new file mode 100644 index 0000000..088e09b --- /dev/null +++ b/templates/cashCheck.hamlet @@ -0,0 +1,11 @@ +$doctype 5 + +

Kassensturz + +

+ Bitte Kasse zählen und gezählten Betrag in unten stehendes Feld eintragen. + +

+ ^{cashCheckWidget} +
+