<%= f.label(:calculator_type, Spree::Calculator.model_name.human) %>
<%= f.select(:calculator_type, @calculators.map { |c| [c.description, c.name] }, {}, {class: 'custom-select fullwidth js-calculator-type'}) %>
<% @calculators.each do |calculator_class| %>
<% calculator = f.object.calculator.class == calculator_class ? f.object.calculator : calculator_class.new %>
<%= f.fields_for :calculator, calculator do |calculator_form| %>
<% calculator.admin_form_preference_names.each do |name| %>
<%= render "spree/admin/shared/preference_fields/#{calculator.preference_type(name)}",
form: calculator_form, attribute: "preferred_#{name}",
label: t(name, scope: 'spree', default: name.to_s.humanize) %>
<% end %>
<% end %>
<% end %>