mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-15 23:57:48 +00:00
Sort correctly in Bulk Order Managment
Converting date to utc + iso8601 format is
sufficient to ensure proper sorting.
This commit is contained in:
@@ -3,7 +3,8 @@
|
||||
module Api
|
||||
module Admin
|
||||
class OrderSerializer < ActiveModel::Serializer
|
||||
attributes :id, :number, :user_id, :full_name, :email, :phone, :completed_at, :display_total,
|
||||
attributes :id, :number, :user_id, :full_name, :email, :phone, :completed_at,
|
||||
:completed_at_utc_iso8601, :display_total,
|
||||
:edit_path, :state, :payment_state, :shipment_state,
|
||||
:payments_path, :ready_to_ship, :ready_to_capture, :created_at,
|
||||
:distributor_name, :special_instructions, :display_outstanding_balance,
|
||||
@@ -73,6 +74,10 @@ module Api
|
||||
object.line_items.count
|
||||
end
|
||||
|
||||
def completed_at_utc_iso8601
|
||||
object.completed_at.blank? ? "" : object.completed_at.utc.iso8601
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def spree_routes_helper
|
||||
|
||||
@@ -138,7 +138,7 @@
|
||||
%a{ :href => '', 'ng-click' => "sorting.toggle('order.phone')" }
|
||||
= t("admin.phone")
|
||||
%th.date{ 'ng-show' => 'columns.order_date.visible' }
|
||||
%a{ :href => '', 'ng-click' => "sorting.toggle('order.completed_at')" }
|
||||
%a{ :href => '', 'ng-click' => "sorting.toggle('order.completed_at_utc_iso8601')" }
|
||||
= t("admin.orders.bulk_management.order_date")
|
||||
%th.producer{ 'ng-show' => 'columns.producer.visible' }
|
||||
%a{ :href => '', 'ng-click' => "sorting.toggle('supplier.name')" }
|
||||
|
||||
Reference in New Issue
Block a user