neat/Handler/Stock.hs

22 lines
673 B
Haskell
Raw Normal View History

2015-08-07 00:26:16 +00:00
module Handler.Stock where
import Import
getStockR :: Handler Html
getStockR = loginOrDo (\(uid,user) -> do
items <- runDB $ selectList [TransactionUser ==. uid, TransactionInStock >. 0] [Asc TransactionTypeName]
defaultLayout $ [whamlet|
<h1>Current Stock
<table>
<tr>
<th>Item name
<th>Quantity
<th>Buy Price
$forall Entity _ t <- items
<tr>
<td>#{transactionTypeName t}
<td>#{transactionInStock t}
<td>#{transactionPriceCents t}
|]
)