mirror of
https://github.com/internetee/registry.git
synced 2025-07-22 02:35:57 +02:00
Add filter to account activities #2691
This commit is contained in:
parent
d6a151b141
commit
ca2a2db9ad
4 changed files with 61 additions and 4 deletions
|
@ -2,9 +2,17 @@ class Registrar::AccountActivitiesController < RegistrarController
|
|||
load_and_authorize_resource
|
||||
|
||||
def index
|
||||
params[:q] ||= {}
|
||||
account = current_user.registrar.cash_account
|
||||
|
||||
ca_cache = params[:q][:created_at_lteq]
|
||||
end_time = params[:q][:created_at_lteq].try(:to_date)
|
||||
params[:q][:created_at_lteq] = end_time.try(:end_of_day)
|
||||
|
||||
@q = account.activities.includes(:invoice).search(params[:q])
|
||||
@q.sorts = 'id desc' if @q.sorts.empty?
|
||||
@account_activities = @q.result.page(params[:page])
|
||||
|
||||
params[:q][:created_at_lteq] = ca_cache
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue