Skip to content

Commit

Permalink
Introduce new filters for the orders index
Browse files Browse the repository at this point in the history
  • Loading branch information
rainerdema committed Sep 21, 2023
1 parent 5df46bf commit 1820224
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 4 deletions.
62 changes: 59 additions & 3 deletions admin/app/components/solidus_admin/orders/index/component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'

0 comments on commit 1820224

Please sign in to comment.