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