mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-23 05:28:53 +00:00
Add distributor_name_alias to searchable attributes and implement ransacker for filtering line items
This commit is contained in:
@@ -19,7 +19,7 @@ angular.module("admin.lineItems").controller 'LineItemsCtrl', ($scope, $timeout,
|
||||
$scope.page = 1
|
||||
$scope.per_page = $scope.per_page_options[0].id
|
||||
$scope.filterByVariantId = null
|
||||
searchThrough = ["order_distributor_name",
|
||||
searchThrough = ["order_distributor_name_alias",
|
||||
"order_bill_address_phone",
|
||||
"order_bill_address_firstname",
|
||||
"order_bill_address_lastname",
|
||||
|
||||
@@ -9,7 +9,7 @@ module Spree
|
||||
include SetUnusedAddressFields
|
||||
|
||||
searchable_attributes :number, :state, :shipment_state, :payment_state, :distributor_id,
|
||||
:order_cycle_id, :email, :total, :customer_id
|
||||
:order_cycle_id, :email, :total, :customer_id, :distributor_name_alias
|
||||
searchable_associations :shipping_method, :bill_address, :distributor
|
||||
searchable_scopes :complete, :incomplete, :sort_by_billing_address_name_asc,
|
||||
:sort_by_billing_address_name_desc
|
||||
@@ -181,6 +181,11 @@ module Spree
|
||||
scope :by_state, lambda { |state| where(state:) }
|
||||
scope :not_state, lambda { |state| where.not(state:) }
|
||||
|
||||
# This is used to filter line items by the distributor name on BOM page
|
||||
ransacker :distributor_name_alias do
|
||||
Arel.sql("distributor.name")
|
||||
end
|
||||
|
||||
def initialize(*_args)
|
||||
@checkout_processing = nil
|
||||
@manual_shipping_selection = nil
|
||||
|
||||
Reference in New Issue
Block a user