mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 17:59:47 +02:00
107279984-balance_fix
This commit is contained in:
parent
6909f3d0ef
commit
cbe0193cbf
2 changed files with 9 additions and 3 deletions
|
@ -12,9 +12,15 @@ class Admin::AccountActivitiesController < AdminController
|
|||
logger.warn('Invalid date')
|
||||
end
|
||||
|
||||
balance_params = params[:q].deep_dup
|
||||
|
||||
if balance_params[:created_at_gteq]
|
||||
balance_params.delete('created_at_gteq')
|
||||
end
|
||||
|
||||
@q = AccountActivity.includes(:invoice, account: :registrar).search(params[:q])
|
||||
@q.sorts = 'id desc' if @q.sorts.empty?
|
||||
@b = AccountActivity.where.not(id: @q.result.map(&:id))
|
||||
@b = AccountActivity.search(balance_params).result.where.not(id: @q.result.map(&:id))
|
||||
|
||||
respond_to do |format|
|
||||
format.html { @account_activities = @q.result.page(params[:page]) }
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
%th{class: 'col-xs-2'}
|
||||
= sort_link(@q, 'sum')
|
||||
%tbody
|
||||
-total = 0
|
||||
-total = @b.sum('sum').to_f
|
||||
- @account_activities.each do |x|
|
||||
%tr
|
||||
%td= link_to(x.account.registrar.try(:code), admin_registrar_path(x.account.registrar))
|
||||
|
@ -79,7 +79,7 @@
|
|||
%td
|
||||
%td
|
||||
%td{class: 'text-right'}= t(:total)
|
||||
%td{class: 'text-success'}= total > 0 ? "+#{total} EUR" : "#{total} EUR"
|
||||
%td{class: total > 0 ? 'text-success' : 'text-danger'}= total > 0 ? "+#{total} EUR" : "#{total} EUR"
|
||||
.row
|
||||
.col-md-12
|
||||
= paginate @account_activities
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue