made rough stock, without grouping. need esqueleto for that.

This commit is contained in:
Nicole Dresselhaus 2015-08-07 02:34:45 +02:00
parent 9ad4be6ba4
commit ac00ceebef
2 changed files with 17 additions and 1 deletions

View File

@ -3,4 +3,19 @@ module Handler.Stock where
import Import import Import
getStockR :: Handler Html 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|
<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}
|]
)

View File

@ -41,6 +41,7 @@ $newline never
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<li><a href="@{HomeR}">Home</a> <li><a href="@{HomeR}">Home</a>
<li><a href="@{WalletR}">Transactions</a> <li><a href="@{WalletR}">Transactions</a>
<li><a href="@{StockR}">Stock</a>
<li><a href="@{SettingsR}">Settings</a> <li><a href="@{SettingsR}">Settings</a>
<!--li class="dropdown"> <!--li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span>