manage bookmarks, bugfixes
[smr.git] / gui / app / views / asset / index.html.erb
bloba39ab3cb928264d98f98fddfe5e6da2db5b775e0
2 <h1>Assets</h1>
4 <% if @quote %>
5     <%= render :partial=>'quote_form', locals: { :quote=>@quote, :securities=>@securities  } %>
6 <% end %>
8 <div id='assets_invested' class="overview_counters">
9   <ul>
10     <li>Market Value:  <span><%= smr_humanize(@assets.market_value, :shortword=>true) %></span></li>
11     <% if @assets.profit_loss>=0 %>
12         <li class="profit">Profit: <span><%= smr_humanize(@assets.profit_loss, :shortword=>true) %> (<%= percentage_change(@assets.invested, @assets.market_value) %>)</span></li>
13     <% else %>
14         <li class="loss">Loss: <span><%= smr_humanize(@assets.profit_loss, :shortword=>true) %> (<%= percentage_change(@assets.invested, @assets.market_value) %>)</span></li>
15     <% end %>
16     <% if @assets.accrued_interest > 0 %>
17        <li>Accrued Interest: <span><%= smr_humanize(@assets.accrued_interest, :shortword=>true) %></span></li>
18     <% end %>
19     <% if @assets.collateral_coverage_value > 0 %>
20        <li>Collateral:  <span><%= smr_humanize(@assets.collateral_coverage_value, :shortword=>true) %></span></li>
21     <% end %>
22   </ul>
23 </div>
25 <%= form_tag(show_portfolio_post_path, :id=>'controller_filter') do %>
26     <p>
27      <%= select_tag :id_portfolio, options_from_collection_for_select(@portfolios, :id, :name, @shown_portfolio), prompt: '-- All Portfolios --' %>
28      <%= button_tag :show, :name=>'show', :value=>'this' %>
29     </p>
30 <% end %>
32 <h2>Open Positions</h2>
33 <table id='assets'>
34   <thead>
35     <tr>
36         <th></th>
37         <th>Average Cost<span>per share</span></th>
38         <th>Last Trade</th>
39         <th>Market Value</th>
40         <th>Profit / Loss</th>
41         <th>Weight</th>
42     </tr>
43   </thead>
44   <tbody>
45   <% @open_positions.sort.reverse.each do |p| %>
46     <tr class="separaterows">
47       <td>
48         <%= link_to '+', p.link.to_url %> <%= p.security %>
49         <span>
50            <span class="symbol"><%=p.security.symbol%></span>
51         </span>
52         <% if not p.comment.blank? %><span class="comment_text"><%= 'at %s:' % p.portfolio if p.is_cash_position? %> <%= p.comment %></span><% end %>
53       </td>
54       <td><%= smr_humanize(p.cost_price) %></td>
55       <td><% if not p.last_quote.last %>-<% else %><%= p.last_quote.last %> <span class='<%= p.last_quote.css_class(smr_browse_date) %>'>&bull;</span><% end %></td>
56       <td><%= smr_humanize(p.market_value) %></td>
57       <td class="<%= smr_profitloss_status(p.profit_loss, :css=>true) %>">
58         <%= smr_humanize(p.profit_loss) %>
59         <span><%= percentage_change(p.invested, p.market_value) %></span>
60       </td>
61       <td><%= percentage_of(@assets.market_value, p.market_value) %></td>
62     </tr>
63   <% end %>
64   </tbody>
65 </table>