outputs each do output output output_products each with_index do outpu

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<% @outputs.each do |output| %>
<% output.output_products.each.with_index do |output_product, index| %>
<tr>
<% if index == 0 %>
<td rowspan="<%= output.output_products.count %>"><%= best_in_place output, :date, :as => :date %></td>
<td rowspan="<%= output.output_products.count %>"><%= best_in_place output, :employee_id, :as => :select, :collection => Employee.all.map {|i| [i.id, i.fio]} %></td>
<td rowspan="<%= output.output_products.count %>"><%= best_in_place output.employee, :base_pay %></td>
<% end %>
<td>
<%= best_in_place output_product.product, :id, :as => :select, :collection => Product.all.map {|i| [i.id, i.title]} %>
</td>
<td>
<%= best_in_place output_product.product.machine_output, :id, :as => :select, :collection => MachineOutput.all.map {|i| [i.id, i.prod]} %>
</td>
<td>
<%= best_in_place output_product, :work_time %>
</td>
<td>
<%= best_in_place output_product, :output_amount %>
</td>
<td>
<%= plan = output_product.product.machine_output.production / 12 * output_product.work_time %>
</td>
<td>
<%= output_product.output_amount * 100 / plan %>
</td>
<% if index == 0 %>
<td rowspan="<%= output.output_products.count %>">
<%= output.salary %>
</td>
<% if current_user.has_role? :admin %>
<td rowspan="<%= output.output_products.count %>">
<%= link_to image_tag('edit.png', size: "24x24", alt: "Редактировать"), edit_output_path(output), remote: true %>
</td>
<td rowspan="<%= output.output_products.count %>">
<%= link_to image_tag('close.svg', size: "24x24", alt: "Удалить"), output, remote: true, method: :delete, data: { confirm: 'Are you sure?' } %>
</td>
<% end %>
<% end %>
</tr>
<% end %>
<% end %>