diff --git a/admin/app/components/solidus_admin/orders/index/component.rb b/admin/app/components/solidus_admin/orders/index/component.rb index 6f15d11dd9b..3872c65fe08 100644 --- a/admin/app/components/solidus_admin/orders/index/component.rb +++ b/admin/app/components/solidus_admin/orders/index/component.rb @@ -26,9 +26,65 @@ def batch_actions def filters [ { - name: 'q[completed_at_not_null]', - value: 1, - label: t('.filters.only_show_complete_orders'), + presentation: t('.filters.status'), + combinator: 'or', + attribute: "state", + predicate: "eq", + options: Spree::Order.state_machines[:state].states.map do |state| + [ + state.value.titleize, + state.value + ] + end + }, + + { + presentation: t('.filters.shipment_state'), + combinator: 'or', + attribute: "shipment_state", + predicate: "eq", + options: %i[backorder canceled partial pending ready shipped].map do |option| + [ + option.to_s.capitalize, + option + ] + end + }, + { + presentation: t('.filters.payment_state'), + combinator: 'or', + attribute: "payment_state", + predicate: "eq", + options: %i[balance_due checkout completed credit_owed invalid paid pending processing void].map do |option| + [ + option.to_s.titleize, + option + ] + end + }, + { + presentation: t('.filters.variants'), + combinator: 'or', + attribute: "line_items_variant_id", + predicate: "in", + options: Spree::Variant.all.map do |variant| + [ + variant.descriptive_name, + variant.id + ] + end + }, + { + presentation: t('.filters.promotions'), + combinator: 'or', + attribute: "promotions_id", + predicate: "in", + options: Spree::Promotion.all.map do |promotion| + [ + promotion.name, + promotion.id + ] + end }, ] end diff --git a/admin/app/components/solidus_admin/orders/index/component.yml b/admin/app/components/solidus_admin/orders/index/component.yml index 370e0d25504..a94a884aa5e 100644 --- a/admin/app/components/solidus_admin/orders/index/component.yml +++ b/admin/app/components/solidus_admin/orders/index/component.yml @@ -7,7 +7,11 @@ en: one: 1 Item other: '%{count} Items' filters: - only_show_complete_orders: Only show complete orders + status: Status + shipment_state: Shipment State + payment_state: Payment State + variants: Variants + promotions: Promotions date: formats: short: '%d %b %y' diff --git a/admin/app/components/solidus_admin/products/index/component.rb b/admin/app/components/solidus_admin/products/index/component.rb index 0a0c744d7d4..b0ddcea548b 100644 --- a/admin/app/components/solidus_admin/products/index/component.rb +++ b/admin/app/components/solidus_admin/products/index/component.rb @@ -41,13 +41,20 @@ def batch_actions end def filters - [ + Spree::OptionType.all.map do |option_type| { - name: 'q[with_discarded]', - value: true, - label: t('.filters.with_deleted'), - }, - ] + presentation: option_type.presentation, + combinator: 'or', + attribute: "variants_option_values", + predicate: "in", + options: option_type.option_values.map do |option_value| + [ + option_value.name, + option_value.id + ] + end + } + end end def columns diff --git a/admin/app/components/solidus_admin/ui/table/component.html.erb b/admin/app/components/solidus_admin/ui/table/component.html.erb index d391bab0648..f8a9ba4f99a 100644 --- a/admin/app/components/solidus_admin/ui/table/component.html.erb +++ b/admin/app/components/solidus_admin/ui/table/component.html.erb @@ -3,13 +3,20 @@ rounded-lg border border-gray-100 - overflow-hidden " data-controller="<%= stimulus_id %>" data-<%= stimulus_id %>-selected-row-class="bg-gray-15" + data-action=" + <%= component("ui/table/ransack_filter").stimulus_id %>:search-><%= stimulus_id %>#search + <%= component("ui/table/ransack_filter").stimulus_id %>:showSearch-><%= stimulus_id %>#showSearch + " > - <% toolbar_classes = "h-14 p-2 bg-white border-b border-gray-100 justify-start items-center gap-2 visible:flex hidden:hidden" %> - + <% toolbar_classes = " + h-14 p-2 bg-white border-b border-gray-100 + justify-start items-center gap-2 + visible:flex hidden:hidden + rounded-t-lg + " %>
-target="searchToolbar"> <%= form_with( @@ -21,19 +28,18 @@ "data-turbo-frame": table_frame_id, "data-turbo-action": "replace", "data-#{stimulus_id}-target": "searchForm", - "data-action": "reset->#{stimulus_id}#search", + "data-action": "input->#{stimulus_id}#search change->#{stimulus_id}#search", }, ) do |form| %>