2012-11-10 16:44:05 +01:00
|
|
|
class Finance::OrdergroupsController < Finance::BaseController
|
|
|
|
|
2011-06-09 21:35:05 +02:00
|
|
|
def index
|
|
|
|
if params["sort"]
|
|
|
|
sort = case params["sort"]
|
|
|
|
when "name" then "name"
|
|
|
|
when "account_balance" then "account_balance"
|
|
|
|
when "name_reverse" then "name DESC"
|
|
|
|
when "account_balance_reverse" then "account_balance DESC"
|
|
|
|
end
|
|
|
|
else
|
|
|
|
sort = "name"
|
|
|
|
end
|
|
|
|
|
|
|
|
@ordergroups = Ordergroup.order(sort)
|
2012-09-30 21:15:55 +02:00
|
|
|
@ordergroups = @ordergroups.where('name LIKE ?', "%#{params[:query]}%") unless params[:query].nil?
|
2011-06-09 21:35:05 +02:00
|
|
|
|
2012-11-10 16:44:05 +01:00
|
|
|
@ordergroups = @ordergroups.page(params[:page]).per(@per_page)
|
2011-06-09 21:35:05 +02:00
|
|
|
end
|
|
|
|
end
|