fix search order on transaction
This commit is contained in:
@@ -10,10 +10,12 @@ class Transactions::OrdersController < ApplicationController
|
||||
|
||||
if filter.nil? && from.nil? && to.nil?
|
||||
orders = Order.order("order_id desc")
|
||||
else
|
||||
from = Time.zone.parse(params[:from]).beginning_of_day
|
||||
to = Time.zone.parse(params[:to]).end_of_day
|
||||
elsif from.present? && to.present?
|
||||
from = Time.zone.parse(params[:from]).beginning_of_day
|
||||
to = Time.zone.parse(params[:to]).end_of_day
|
||||
orders = Order.search(filter,from,to)
|
||||
elsif filter.present?
|
||||
orders = Order.search(filter)
|
||||
end
|
||||
|
||||
if !orders.nil?
|
||||
|
||||
@@ -345,7 +345,7 @@ class Order < ApplicationRecord
|
||||
|
||||
end
|
||||
|
||||
def self.search(filter,from,to)
|
||||
def self.search(filter,from=nil,to=nil)
|
||||
if filter.blank?
|
||||
keyword = ''
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user