<% new ||= false %>
<%= t('.subscription') %> <% if new %>
<%= f.label :user_id, Spree.t(:user), class: "required" %> <%= f.collection_select :user_id, Spree::User.all, :id, :email, {}, class: "select2 fullwidth" %>
<% end %>
<%= content_tag :div, class: "field alpha three columns" do %> <%= f.label :actionable_date %> <%= f.text_field :actionable_date, class: "fullwidth datepicker" %> <% end %>
<%= f.label :inverval_length %> <%= f.number_field :interval_length, class: "fullwidth" %>
<%= f.label :interval_units %> <% unit_values = SolidusSubscriptions::LineItem.interval_units.keys units = unit_values.map do |unit| [ unit, SolidusSubscriptions::LineItem.human_attribute_name("interval_units.#{ unit }") ] end %>
<% units.each_with_index do |(value, name), i| %>
<%= f.label :interval_units, for: "interval_units_#{ value }", class: 'fullwidth' do %> <%= f.radio_button :interval_units, value, id: "interval_units_#{ value }" %> <%= name %> <% end %>
<% end %>
<%= f.label :end_date %> <%= f.date_field :end_date, class: "required fullwidth" %>
<%= f.fields_for :line_items do |lf| %>
<%= t('.subscription_line_item') %>
<%= lf.label :quantity %> <%= lf.number_field :quantity, min: 1, class: "fullwidth" %>
<%= lf.label :subscribable_id %> <%= lf.collection_select :subscribable_id, Spree::Variant.where(subscribable: true), :id, :pretty_name, {}, { class: "fullwidth select2" } %>
<% end %>
<%= f.button type: :submit %>