<% admin_breadcrumb(plural_resource_name(Spree::Promotion)) %> <% content_for :page_actions do %> <% if can? :create, Spree::Promotion %>
  • <%= button_link_to Spree.t(:new_promotion), spree.new_admin_promotion_path %>
  • <% end %> <% end %> <% content_for :table_filter_title do %> <%= Spree.t(:search) %> <% end %> <% content_for :table_filter do %>
    <%= search_form_for [:admin, @search] do |f| %>
    <%= label_tag :q_name_cont, Spree::Promotion.human_attribute_name(:name) %> <%= f.text_field :name_cont, tabindex: 1 %>
    <%= label_tag :q_codes_value_cont, Spree::Promotion.human_attribute_name(:code) %> <%= f.text_field :codes_value_cont, tabindex: 1 %>
    <%= label_tag :q_path_cont, Spree::Promotion.human_attribute_name(:path) %> <%= f.text_field :path_cont, tabindex: 1 %>
    <%= label_tag :q_promotion_category_id_eq, Spree::PromotionCategory.model_name.human %>
    <%= f.collection_select(:promotion_category_id_eq, @promotion_categories, :id, :name, { include_blank: Spree.t('match_choices.all') }, { class: 'custom-select fullwidth' }) %>
    <%= button Spree.t(:filter_results) %>
    <% end %>
    <% end %> <%= paginate @promotions, theme: "solidus_admin" %> <% if @promotions.any? %> <% @promotions.each do |promotion| %> <% end %>
    <%= Spree::Promotion.human_attribute_name(:name) %> <%= Spree::Promotion.human_attribute_name(:code) %> <%= Spree::Promotion.human_attribute_name(:status) %> <%= Spree::Promotion.human_attribute_name(:usage_limit) %> <%= Spree::Promotion.human_attribute_name(:uses) %> <%= Spree::Promotion.human_attribute_name(:starts_at) %> <%= Spree::Promotion.human_attribute_name(:expires_at) %>
    <%= promotion.name %> <%= (promotion.codes.size == 1) ? promotion.codes.first.try!(:value) : Spree.t(:number_of_codes, count: promotion.codes.size) %> <%= Spree.t(promotion.active?? :active : :inactive) %> <%= promotion.usage_limit.nil? ? "∞" : promotion.usage_limit %> <%= promotion.usage_count %> <%= promotion.starts_at.to_date.to_s(:short_date) if promotion.starts_at %> <%= promotion.expires_at.to_date.to_s(:short_date) if promotion.expires_at %> <% if can?(:edit, promotion) %> <%= link_to_edit promotion, no_text: true %> <% end %> <% if can?(:destroy, promotion) %> <%= link_to_delete promotion, no_text: true %> <% end %>
    <% else %>
    <%= render 'spree/admin/shared/no_objects_found', resource: Spree::Promotion, new_resource_url: new_object_url %>
    <% end %>