sort figures by year, bugfixes, layout work
[smr.git] / gui / app / views / figures / index.html.erb
blob6b16dd3e63692058aa37bed67b68e465cf48fafa
1 <h1>Figures</h1>
3 <%= form_tag({:action=>'index'}, method: :get) do %>
4     <p>
5      <%= select_tag 'id_stock', options_from_collection_for_select(@securities, "id", "name", @selected_security.id), prompt: '-- Select Security --' %>
6      <%= button_tag 'show', :name=>'show', :value=>'this' %>
7      <%= button_tag '<= previous', :name=>'show', :value=>'previous' %>
8      <%= button_tag 'next =>', :name=>'show', :value=>'next' %>
9     </p>
10 <% end %>
12 <% if @figuredata %>
13     <%= form_for @figuredata, :url=>{action: :create}, :method=>:POST do |f| %>
14      <fieldset id='figuredata'>
15       <legend><% if @figuredata.id  %>Edit <% else %>Add new<% end %>Figure Record</legend>
16         <%= f.hidden_field :id %>
17         <%= f.hidden_field :id_stock %>
18       <div style='display: block; float: left;'>
19         <%= f.select :id_figure_var, @figurevariables.collect{|v| [v.name, v.id] }, :prompt=>'-- Select Variable --' %><br/>
20         <%= f.select :period, @figuredata.get_periods.collect{|p| [@figuredata.translate_period(p), p] }, :prompt=>'-- Select Period --' %><br/>
21         <%= f.date_field :time, :placeholder=>'Date Recorded.' %><br/> 
22         <%= f.text_field :analyst, :placeholder=>'Who analysed?' %><br/> 
23         <%= f.number_field :value, :step=>0.01, :placeholder=>'The value.' %><br/> 
24         <hr/>
25         <div>Value options:</div>
26         <%= f.check_box :is_expected %><%= label :new_figuredata, :is_expected %><br/> 
27         <%= f.check_box :is_audited %><%= label :new_figuredata, :is_audited %><br/>
28         <hr/>
29         <div>Data entry options:</div>
30         <%= check_box_tag(:keep_form_open, true, @keep_form_open) %><%= label_tag :keep_form_open, 'Keep form open to add more data.' %><br/>
31         <%= number_field_tag(:scale_value, @scale_value, :placeholder=>'Scale the value.') %><%= label_tag :scale_value, 'thousands... billions...' %><br/>
32         <hr/>
33         <%= f.text_area :comment, :cols=>40, :rows=>15, placeholder: 'Remarks? Ie. how that number came up?' %>
34         <%= f.submit 'Save Figure Data' %>
35       </div>
36      </fieldset>
37     <% end %>
38 <% end %>
40 <% if not @have_data %>
41     <p>No figures recorded yet for this security.</p>
42 <% else %>
45 <table id='figures'>
46     <thead>
47     <tr>
48         <td colspan="<%= @datatable.columns %>">
49         <% @datayears.each do |y| %>
50             <%= link_to y, '?year=%i' % y %>
51         <% end %>
52         </td>
53     </tr>
54     </thead>
55     <tbody>
56     <% for row in 0...@datatable.rows %>
57     <tr>
58       <% for col in 0...@datatable.columns %>
59         <% next if col == 0  and not @datatable.rowspan(row) #skip blanked cells %>
61         <td <% if col == 0 %>rowspan="<%=@datatable.rowspan(row)%>"<% end %>>
62          <%= if @datatable.link(row, col) then
63                 link_to(smr_humanize(@datatable.cell(row, col), :scientific=>true), @datatable.link(row, col))
64              else smr_humanize(@datatable.cell(row, col), :scientific=>true) end %><%= @datatable.cell_unit(row, col) %>
65         </td>
66       <% end %>
67     </tr>
68     <% end %>
69     </tbody>
70 </table>
71 <% end %>