<% @legacy_return_authorization.order.shipments.shipped.collect{|s| s.inventory_units.to_a}.flatten.group_by(&:variant).each do | variant, units| %> <% end %>
<%= Spree.t(:product) %> <%= Spree.t(:quantity_shipped) %> <%= Spree.t(:quantity_returned) %> <%= Spree.t(:return_quantity) %>
<%= variant.name %>
<%= variant.options_text %>
<%= units.select(&:shipped?).size %> <%= units.select(&:returned?).size %> <% if @legacy_return_authorization.received? %> <%= @legacy_return_authorization.inventory_units.group_by(&:variant)[variant].try(:size) || 0 %> <% elsif units.select(&:shipped?).empty? %> 0 <% else %> <%= number_field_tag "return_quantity[#{variant.id}]", @legacy_return_authorization.inventory_units.group_by(&:variant)[variant].try(:size) || 0, {:style => 'width:100px;', :min => 0} %> <% end %>
<%= f.field_container :amount do %> <%= f.label :amount, Spree.t(:amount) %> *
<% if @legacy_return_authorization.received? %> <%= @legacy_return_authorization.display_amount %> <% else %> <%= f.text_field :amount, {:style => 'width:80px;'} %> <%= Spree.t(:legacy_rma_value) %>: 0.00 <%= f.error_message_on :amount %> <% end %> <% end %> <%= f.field_container :reason do %> <%= f.label :reason, Spree.t(:reason) %> <%= f.text_area :reason, {:style => 'height:100px;', :class => 'fullwidth'} %> <%= f.error_message_on :reason %> <% end %> <%= f.field_container :stock_location do %> <%= f.label :stock_location, Spree.t(:stock_location) %> <%= f.select :stock_location_id, Spree::StockLocation.active.to_a.collect{|l|[l.name, l.id]}, {:style => 'height:100px;', :class => 'fullwidth'} %> <%= f.error_message_on :reason %> <% end %>