From ac00ceebefd29f80ff6a49537fe3e1711166d7dc Mon Sep 17 00:00:00 2001 From: Stefan Dresselhaus Date: Fri, 7 Aug 2015 02:34:45 +0200 Subject: [PATCH] made rough stock, without grouping. need esqueleto for that. --- Handler/Stock.hs | 17 ++++++++++++++++- templates/default-layout-wrapper.hamlet | 1 + 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Handler/Stock.hs b/Handler/Stock.hs index c334ed9..fae2dee 100644 --- a/Handler/Stock.hs +++ b/Handler/Stock.hs @@ -3,4 +3,19 @@ module Handler.Stock where import Import getStockR :: Handler Html -getStockR = error "Not yet implemented: getStockR" +getStockR = loginOrDo (\(uid,user) -> do + items <- runDB $ selectList [TransactionUser ==. uid, TransactionInStock >. 0] [Asc TransactionTypeName] + defaultLayout $ [whamlet| +

Current Stock + + + +
Item name + Quantity + Buy Price + $forall Entity _ t <- items +
#{transactionTypeName t} + #{transactionInStock t} + #{transactionPriceCents t} + |] + ) diff --git a/templates/default-layout-wrapper.hamlet b/templates/default-layout-wrapper.hamlet index 918a40e..d2d9929 100644 --- a/templates/default-layout-wrapper.hamlet +++ b/templates/default-layout-wrapper.hamlet @@ -41,6 +41,7 @@ $newline never