app/views/spree/admin/subscriptions/index.html.erb in solidus_subscriptions-1.0.0 vs app/views/spree/admin/subscriptions/index.html.erb in solidus_subscriptions-1.0.1

- old
+ new

@@ -46,25 +46,25 @@ </div> </div> </div> <div class="row"> - <div class="field-block col-4"> + <div class="field-block col-3"> <div class="field"> <%= label_tag :q_user_email_cont, Spree.user_class.human_attribute_name(:email) %> <%= f.text_field :user_email_cont, size: 25 %> </div> </div> - <div class="field-block col-4"> + <div class="field-block col-3"> <div class="field"> <%= 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' %> </div> </div> - <div class="field-block col-4"> + <div class="field-block col-3"> <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| @@ -83,14 +83,27 @@ class: 'select2 fullwidth' ) %> </div> </div> + <div class="field-block col-3"> + <div class="field"> + <%= label_tag :q_with_subscribable_eq, SolidusSubscriptions::Subscription.human_attribute_name(:with_subscribable) %> + + <%= + f.select( + :with_subscribable, + options_for_select(::Spree::Variant.includes(:product).where(id: ::SolidusSubscriptions::LineItem.distinct.pluck(:subscribable_id)).map { |subscribable| [ subscribable.name, subscribable.id ]}, params.dig(:q, :with_subscribable)), + { include_blank: true }, + class: 'select2 fullwidth' + ) + %> + </div> + </div> </div> <div class="clearfix"></div> - <div class="actions filter-actions"> <div data-hook="admin_subscriptions_index_search_buttons"> <%= button_tag I18n.t('spree.filter_results'), class: 'btn btn-primary' %> </div> </div> @@ -108,10 +121,11 @@ <th><%= sort_link(@search, :user_email, SolidusSubscriptions::Subscription.human_attribute_name(:user)) %></th> <th><%= sort_link(@search, :actionable_date, [:actionable_date, 'id asc'], SolidusSubscriptions::Subscription.human_attribute_name(:actionable_date)) %></th> <th><%= sort_link(@search, :line_item_interval_length, SolidusSubscriptions::Subscription.human_attribute_name(:interval)) %></th> <th><%= sort_link(@search, :state, [:state, 'id asc'], SolidusSubscriptions::Subscription.human_attribute_name(:state)) %></th> <th><%= sort_link(@search, :processing_state, [:processing_state, 'id asc'], SolidusSubscriptions::Subscription.human_attribute_name(:processing_state)) %></th> + <th><%= SolidusSubscriptions::Subscription.human_attribute_name(:line_items) %></th> <th data-hook="admin_subscriptions_index_header_actions" class="actions"></th> </tr> </thead> <tbody> @@ -121,10 +135,11 @@ <td><%= link_to subscription.user.email, admin_user_path(subscription.user) %></td> <td><%= subscription.actionable_date ? l(subscription.actionable_date) : '-' %></td> <td><%= subscription.interval.inspect %></td> <td><%= render 'state_pill', subscription: subscription %></td> <td><%= render 'processing_state_pill', subscription: subscription %></td> + <td><%= subscription.line_items.includes(subscribable: :product).map { |line_item| line_item.subscribable&.name }.join(", ") %></td> <td class="actions"> <% if subscription.state_events.include?(:cancel) %> <%= link_to_with_icon( :stop, @@ -148,21 +163,43 @@ ) %> <% 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 - ) - %> + <% if subscription.paused? %> + <%= + link_to_with_icon( + :'play-circle', + t('spree.admin.subscriptions.actions.resume'), + spree.resume_admin_subscription_path(subscription), + no_text: true, + method: :post + ) + %> + <% else %> + <%= + link_to_with_icon( + :'pause-circle', + t('spree.admin.subscriptions.actions.pause'), + spree.pause_admin_subscription_path(subscription), + no_text: true, + method: :post + ) + %> + <%= + link_to_with_icon( + :'fast-forward', + t('spree.admin.subscriptions.actions.skip'), + spree.skip_admin_subscription_path(subscription), + no_text: true, + method: :post + ) + %> + <% end %> <% end %> <%= link_to_edit(subscription, no_text: true) %> + </td> </tr> <% end %> </tbody> </table>