diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/spree/admin/subscriptions_controller.rb | 6 | ||||
-rw-r--r-- | app/views/spree/admin/subscriptions/index.html.erb | 80 |
2 files changed, 86 insertions, 0 deletions
diff --git a/app/controllers/spree/admin/subscriptions_controller.rb b/app/controllers/spree/admin/subscriptions_controller.rb index c63521f..622ddca 100644 --- a/app/controllers/spree/admin/subscriptions_controller.rb +++ b/app/controllers/spree/admin/subscriptions_controller.rb @@ -1,7 +1,13 @@ module Spree module Admin class SubscriptionsController < ResourceController + skip_before_filter :load_resource, only: :index + def index + @search = SolidusSubscriptions::Subscription. + accessible_by(current_ability, :index).ransack(params[:q]) + + @subscriptions = @search.result(distinct: true) end private diff --git a/app/views/spree/admin/subscriptions/index.html.erb b/app/views/spree/admin/subscriptions/index.html.erb index 792fc61..ba6b325 100644 --- a/app/views/spree/admin/subscriptions/index.html.erb +++ b/app/views/spree/admin/subscriptions/index.html.erb @@ -1,5 +1,85 @@ <% admin_breadcrumb(plural_resource_name(SolidusSubscriptions::Subscription)) %> +<% content_for :table_filter_title do %> + <%= Spree.t(:search) %> +<% end %> + +<% content_for :table_filter do %> + <%= search_form_for [:admin, @search] do |f| %> + <div class='field-block alpha four columns'> + <div class="date-range-filter field"> + <%= label_tag :q_created_at_gt, Spree.t(:date_range) %> + <div class="date-range-fields"> + <%= f.text_field :created_at_gt, class: 'datepicker datepicker-from', placeholder: Spree.t(:start) %> + + <span class="range-divider"> + <i class="fa fa-arrow-right"></i> + </span> + + <%= f.text_field :created_at_lt, class: 'datepicker datepicker-to', placeholder: Spree.t(:stop) %> + </div> + </div> + + <div class="date-range-filter field"> + <%= label_tag :q_actionable_date_gt, SolidusSubscriptions::Subscription.human_attribute_name(:actionable_date) %> + <div class="date-range-fields"> + <%= f.text_field :actionable_date_gt, class: 'datepicker datepicker-from', placeholder: Spree.t(:start) %> + + <span class="range-divider"> + <i class="fa fa-arrow-right"></i> + </span> + + <%= f.text_field :actionable_date_lt, class: 'datepicker datepicker-to', placeholder: Spree.t(:stop) %> + </div> + </div> + </div> + + <div class="four columns"> + <div class="field"> + <%= label_tag :q_state_eq, Spree.t(:status) %> + <%= f.select :state_eq, SolidusSubscriptions::Subscription.state_machines[:state].states.map {|s| [s.human_name, s.value]}, {include_blank: true}, class: 'select2 fullwidth' %> + </div> + </div> + + <div class="four columns"> + <div class="field"> + <%= label_tag :q_user_email_cont, Spree::User.human_attribute_name(:email) %> + <%= f.text_field :user_email_cont, size: 25 %> + </div> + </div> + + <div class="omega four columns"> + <div class="field"> + <%= 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), + { include_blank: true }, + class: 'select2 fullwidth' + ) + %> + </div> + </div> + + <div class="clearfix"></div> + + <div class="actions filter-actions"> + <div><%= button Spree.t(:filter_results) %></div> + </div> + <% end %> +<% end %> + <table id="listing_subscriptions" class="index"> <thead> <tr> |