%= error_messages_for *@targets %>
<%= render partial: 'goals/show_form', locals: {goal_f: goal_f} %>
<%= goal_f.date_field :effective_from, value: @effective_from, disabled: !goal_f.object.is_binding? %>
<% else %> <%= render partial: 'goals/form' %> <% end %><%= goal_f.fields_for :targets, @targets, child_index: '' do |target_f| %> <%= target_f.hidden_field :_destroy %> <%= t ".choose_quantity" %> <%= target_f.select :quantity_id, quantity_options, {include_blank: true, required: true, label: :field_target}, onchange: "showQuantityPath(event);" %> <%= target_f.fields_for :thresholds do |threshold_f| %> <%= render partial: 'thresholds/form', locals: {threshold_f: threshold_f} %> <% end %> <% last_quantity = target_f.object.thresholds.last.quantity %> <% unless last_quantity.leaf? %> <%= target_f.fields_for 'thresholds_attributes', Threshold.new do |threshold_f| %> <%= render partial: 'thresholds/form', locals: {threshold_f: threshold_f, parent: last_quantity} %> <% end %> <% end %> <%= link_to t(".button_delete_target"), '#', class: 'icon icon-del', style: (@targets.many? ? "" : "display:none"), onclick: "deleteTarget(); return false;" %> <% end %>
<%= link_to t(".button_new_target"), '#', class: 'icon icon-add', onclick: 'newTarget(); return false;' %>