summary.json
This commit is contained in:
parent
1cc845215a
commit
0d0bbbacc5
2 changed files with 16 additions and 1 deletions
|
@ -1,7 +1,7 @@
|
|||
module Handler.Summary where
|
||||
|
||||
import Import
|
||||
import Data.List as L
|
||||
import qualified Data.List as L
|
||||
import Handler.Common
|
||||
|
||||
getSummaryR :: Handler Html
|
||||
|
@ -10,3 +10,17 @@ getSummaryR = do
|
|||
bevs <- runDB $ selectList [] [Asc BeverageIdent]
|
||||
defaultLayout $ do
|
||||
$(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
|
||||
/payout PayoutR GET POST
|
||||
/summary SummaryR GET
|
||||
/summary.json SummaryJsonR GET
|
||||
/modify/#BeverageId ModifyR GET POST
|
||||
/delete/#BeverageId DeleteBeverageR GET
|
||||
/cashcheck CashCheckR GET POST
|
||||
|
|
Loading…
Reference in a new issue