Merge pull request #2126 from internetee/714-registrar-credit-changing-functionality

Admin: the functionality to change registrar credit balance
This commit is contained in:
Timo Võhmar 2021-08-25 14:09:47 +03:00 committed by GitHub
commit c1c9304377
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 286 additions and 6 deletions

View file

@ -0,0 +1,30 @@
module Admin
class AccountsController < BaseController
load_and_authorize_resource
def index
@q = Account.includes(:registrar).search(params[:q])
@accounts = @q.result.page(params[:page])
@accounts = @accounts.per(params[:results_per_page]) if paginate?
render_by_format('admin/accounts/index', 'accounts')
end
def show; end
def edit; end
def update
action = Actions::AccountActivityCreate.new(@account,
params[:account][:balance],
params[:description],
AccountActivity::UPDATE_CREDIT)
if action.call
redirect_to admin_accounts_path, notice: t('.updated')
else
flash[:alert] = t('invalid_balance')
render 'edit'
end
end
end
end