91 lines
3.7 KiB
Plaintext
91 lines
3.7 KiB
Plaintext
<%= render partial: 'measurements/filters',
|
|
locals: {url: filter_project_measurements_path(@project, @view_params)} %>
|
|
|
|
<% if @measurements.any? %>
|
|
<%= render partial: 'readouts/options' %>
|
|
|
|
<% formulas = @quantities.collect(&:formula) %>
|
|
<% formulas.unshift(@filter_q.formula) if @filter_q %>
|
|
<%= error_messages_for *formulas %>
|
|
|
|
<table id="readouts" class="list odd-even">
|
|
<thead>
|
|
<tr>
|
|
<% total_width = 3 + @quantities.length %>
|
|
<th style="width:<%= 2 * 100/total_width%>%"><%= l(:field_taken_at_date) %></th>
|
|
<% @quantities.each do |q| %>
|
|
<th style="width:<%= 100/total_width %>%" class="closable ellipsible">
|
|
<div style="float:right;position:relative;">
|
|
<%= link_to '',
|
|
measurement_routine_toggle_exposure_path(@routine, quantity_id: q.id),
|
|
{class: "icon icon-close", method: :post, remote: true} %>
|
|
</div>
|
|
<%= q.name %>
|
|
</th>
|
|
<% end %>
|
|
<th style="width:<%= 100/total_width %>%"><%= l(:field_action) %></th>
|
|
</tr>
|
|
</thead>
|
|
|
|
<tbody>
|
|
<% extra_quantities = @measurements.values.first.keys - @quantities %>
|
|
<% @measurements.each do |measurement, readouts| %>
|
|
<% row_class = "measurement #{cycle('odd', 'even')}" %>
|
|
<tr id="measurement-<%= measurement.id %>" class="primary <%= row_class %>">
|
|
<td class="topleft unwrappable" style="cursor: pointer;"
|
|
onclick="$(this).closest('tr').toggle(); $(this).closest('tr').nextUntil('tr.primary', '.measurement').toggle(); return false;">
|
|
<span class="icon icon-bullet-closed">
|
|
<%= format_datetime(measurement.taken_at) %>
|
|
</span>
|
|
</td>
|
|
<% @quantities.each do |q| %>
|
|
<td class="primary right ellipsible"><%= format_value(readouts[q]) %></td>
|
|
<% end %>
|
|
<td class="right shrunk unwrappable"><%= action_links(measurement) %></td>
|
|
</tr>
|
|
|
|
<tr class="<%= row_class %>" style="display:none">
|
|
<% if @quantities.length > 0
|
|
rows = (readouts.length - 1) / @quantities.length + 1
|
|
else
|
|
rows = 1
|
|
end %>
|
|
<td rowspan="<%= rows %>" class="topleft unwrappable" style="cursor: pointer;"
|
|
onclick="$(this).closest('tr').prev('tr.primary').toggle(); $(this).closest('tr').prev('tr.primary').nextUntil('tr.primary', '.measurement').toggle(); return false;">
|
|
<span class="icon icon-bullet-open">
|
|
<%= format_datetime(measurement.taken_at) %>
|
|
</span>
|
|
</td>
|
|
<% @quantities.each do |q| %>
|
|
<td class="primary topleft ellipsible">
|
|
<%= q.name %>
|
|
<p class="right"><%= format_value(readouts[q]) %></p>
|
|
</td>
|
|
<% end %>
|
|
<td rowspan="<%= rows %>" class="right shrunk unwrappable">
|
|
<%= action_links(measurement) %>
|
|
</td>
|
|
</tr>
|
|
|
|
<% next if @quantities.empty? %>
|
|
<% extra_quantities.each_slice(@quantities.length) do |eqs| %>
|
|
<tr class="extra <%= row_class %>" style="display:none">
|
|
<% eqs.each do |q| %>
|
|
<td class="extra topleft ellipsible">
|
|
<%= q.name if readouts[q] %>
|
|
<p class="right"><%= format_value(readouts[q]) %></p>
|
|
</td>
|
|
<% end %>
|
|
<% if @quantities.length > eqs.length %>
|
|
<td class="space" colspan="<%= @quantities.length - eqs.length %>"></td>
|
|
<% end %>
|
|
</tr>
|
|
<% end %>
|
|
|
|
<% end %>
|
|
</tbody>
|
|
</table>
|
|
<% else %>
|
|
<p class="nodata"><%= l(:label_no_data) %></p>
|
|
<% end %>
|