<% if child.object.portion %> <% portion_id = child.object.portion_id %>
<%= child.hidden_field :number, class: "number-mp" %> <%= child.select :quantity, unit_values(child.object.portion.unit), { value: child.object.portion.quantity }, class: "quantity form-control-sm", id: "ctrl-qty-#{child.object.id}", data: { quantity: child.object.portion.quantity, portion: portion_id, meal: meal_id, target: "#substitutes-list-#{child.object.id} .portion-unit-#{child.object.portion.unit}" } %>

<%= child.object.unidad %> <%= child.object.portion.name.downcase %>

<%= child.label :_destroy, data: { meal: meal_id, target: "#meal-#{meal_id}-portion-#{portion_id}" }, class: "remove-portion btn btn-danger" do %> <%= child.check_box :_destroy %> <% end %>
<%= clean_float(child.object.proteins) %> <%= clean_float(child.object.carbs) %> <%= clean_float(child.object.fiber) %> <%= clean_float(child.object.fats) %> <%= clean_float(child.object.calories) %> <%= child.select :substitutes_selector, Portion.all.order(name: :asc).map { |p| [p.name, p.id] }, { :include_blank => "Alternativas a #{child.object.portion.abbrv}" }, class: "substitutes-selector selectize-p0", data: { mp: child.object.id } %>
<%= child.fields_for :substitutes do |sub| %> <%= render "plans/meals/substitutes_fields", obj: sub, mp: child %> <% end %>
<% end %>