commit
de5ed7abf5
2 changed files with 16 additions and 1 deletions
|
@ -1,7 +1,7 @@
|
||||||
module Handler.Summary where
|
module Handler.Summary where
|
||||||
|
|
||||||
import Import
|
import Import
|
||||||
import Data.List as L
|
import qualified Data.List as L
|
||||||
import Handler.Common
|
import Handler.Common
|
||||||
|
|
||||||
getSummaryR :: Handler Html
|
getSummaryR :: Handler Html
|
||||||
|
@ -10,3 +10,17 @@ getSummaryR = do
|
||||||
bevs <- runDB $ selectList [] [Asc BeverageIdent]
|
bevs <- runDB $ selectList [] [Asc BeverageIdent]
|
||||||
defaultLayout $ do
|
defaultLayout $ do
|
||||||
$(widgetFile "summary")
|
$(widgetFile "summary")
|
||||||
|
|
||||||
|
getSummaryJsonR :: Handler RepJson
|
||||||
|
getSummaryJsonR = do
|
||||||
|
master <- getYesod
|
||||||
|
bevs <- runDB $ selectList [] [Asc BeverageIdent]
|
||||||
|
return $
|
||||||
|
repJson $ array $
|
||||||
|
map (\(Entity _ bev) ->
|
||||||
|
object [ "name" .= beverageIdent bev
|
||||||
|
, "value" .= beverageAmount bev
|
||||||
|
, "price" .= beveragePrice bev
|
||||||
|
, "currency" .= appCurrency (appSettings master)
|
||||||
|
]
|
||||||
|
) bevs
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
/journal JournalR GET
|
/journal JournalR GET
|
||||||
/payout PayoutR GET POST
|
/payout PayoutR GET POST
|
||||||
/summary SummaryR GET
|
/summary SummaryR GET
|
||||||
|
/summary.json SummaryJsonR GET
|
||||||
/modify/#BeverageId ModifyR GET POST
|
/modify/#BeverageId ModifyR GET POST
|
||||||
/delete/#BeverageId DeleteBeverageR GET
|
/delete/#BeverageId DeleteBeverageR GET
|
||||||
/cashcheck CashCheckR GET POST
|
/cashcheck CashCheckR GET POST
|
||||||
|
|
Loading…
Reference in a new issue