<% admin_breadcrumb(plural_resource_name(SolidusSubscriptions::Subscription)) %> <% content_for :page_actions do %>
  • <%= link_to t('.new_subscription'), new_admin_subscription_path, class: 'btn btn-primary' %>
  • <% end %> <% content_for :table_filter_title do %> <%= I18n.t('spree.search') %> <% end %> <% content_for :table_filter do %>
    <%= search_form_for [:admin, @search] do |f| %>
    <%= label_tag :q_created_at_gt, I18n.t('spree.date_range') %>
    <%= f.text_field :created_at_gt, class: 'datepicker form-control datepicker-from', placeholder: I18n.t('spree.start') %>
    <%= f.text_field :created_at_lt, class: 'datepicker form-control datepicker-to', placeholder: I18n.t('spree.stop') %>
    <%= label_tag :q_actionable_date_gt, SolidusSubscriptions::Subscription.human_attribute_name(:actionable_date) %>
    <%= f.text_field :actionable_date_gt, class: 'datepicker form-control datepicker-from', placeholder: I18n.t('spree.start') %>
    <%= f.text_field :actionable_date_lt, class: 'datepicker form-control datepicker-to', placeholder: I18n.t('spree.stop') %>
    <%= label_tag :q_user_email_cont, Spree.user_class.human_attribute_name(:email) %> <%= f.text_field :user_email_cont, size: 25 %>
    <%= label_tag :q_state_eq, SolidusSubscriptions::Subscription.human_attribute_name(:state) %> <%= f.select :state_eq, SolidusSubscriptions::Subscription.state_machines[:state].states.map {|s| [s.human_name, s.value]}, {include_blank: true}, class: 'select2 fullwidth' %>
    <%= label_tag :q_processing_state_eq, SolidusSubscriptions::Subscription.human_attribute_name(:processing_state) %> <% processing_states = SolidusSubscriptions::Subscription.processing_states.map do |state| [ SolidusSubscriptions::Subscription.human_attribute_name("processing_state.#{ state }"), state ] end %> <%= f.select( :in_processing_state, options_for_select(processing_states, params.dig(:q, :in_processing_state)), { include_blank: true }, class: 'select2 fullwidth' ) %>
    <%= button_tag I18n.t('spree.filter_results'), class: 'btn btn-primary' %>
    <% end %>
    <% end %> <%= paginate @subscriptions, theme: 'solidus_admin' %> <% if @subscriptions.any? %> <% @subscriptions.each do |subscription| %> <% end %>
    <%= sort_link(@search, :created_at, SolidusSubscriptions::Subscription.human_attribute_name(:created_at)) %> <%= sort_link(@search, :user_email, SolidusSubscriptions::Subscription.human_attribute_name(:user)) %> <%= sort_link(@search, :actionable_date, [:actionable_date, 'id asc'], SolidusSubscriptions::Subscription.human_attribute_name(:actionable_date)) %> <%= sort_link(@search, :line_item_interval_length, SolidusSubscriptions::Subscription.human_attribute_name(:interval)) %> <%= sort_link(@search, :state, [:state, 'id asc'], SolidusSubscriptions::Subscription.human_attribute_name(:state)) %> <%= sort_link(@search, :processing_state, [:processing_state, 'id asc'], SolidusSubscriptions::Subscription.human_attribute_name(:processing_state)) %>
    <%= l(subscription.created_at.to_date) %> <%= link_to subscription.user.email, admin_user_path(subscription.user) %> <%= subscription.actionable_date ? l(subscription.actionable_date) : '-' %> <%= subscription.interval.inspect %> <%= render 'state_pill', subscription: subscription %> <%= render 'processing_state_pill', subscription: subscription %> <% if subscription.state_events.include?(:cancel) %> <%= link_to_with_icon( :stop, t('spree.admin.subscriptions.actions.cancel'), spree.cancel_admin_subscription_path(subscription), no_text: true, method: :delete, data: { confirm: t('spree.admin.subscriptions.actions.cancel_alert') } ) %> <% end %> <% if subscription.state_events.include?(:activate) %> <%= link_to_with_icon( :play, t('spree.admin.subscriptions.actions.activate'), spree.activate_admin_subscription_path(subscription), no_text: true, method: :post ) %> <% end %> <% if subscription.active? %> <%= link_to_with_icon( :'fast-forward', t('spree.admin.subscriptions.actions.skip'), spree.skip_admin_subscription_path(subscription), no_text: true, method: :post ) %> <% end %> <%= link_to_edit(subscription, no_text: true) %>
    <% else %>
    <%= render 'spree/admin/shared/no_objects_found', resource: SolidusSubscriptions::Subscription, new_resource_url: spree.new_admin_subscription_path %>
    <% end %>