SU2-33 | Фикс критических и серьёзных ошибок, удаление/перезагрузка организации, пагинация, favicon
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
class OrganisationsController < ApplicationController
|
||||
before_action :set_organisation, only: [:show]
|
||||
before_action :set_organisation, only: [:show, :destroy, :reload]
|
||||
|
||||
DOC_TYPES = {
|
||||
0 => { title: 'Бухгалтерский баланс', form_code: '1.1' },
|
||||
@@ -9,7 +9,7 @@ class OrganisationsController < ApplicationController
|
||||
}.freeze
|
||||
|
||||
def index
|
||||
organizations = Organization.all
|
||||
@pagy, organizations = pagy(Organization.order(:created_at))
|
||||
|
||||
@info_about_organisations = organizations.each_with_object({}) do |org, hash|
|
||||
hash[org.id] = {
|
||||
@@ -42,6 +42,17 @@ class OrganisationsController < ApplicationController
|
||||
end
|
||||
|
||||
|
||||
def destroy
|
||||
@org.destroy!
|
||||
redirect_to '/organisations/index', notice: "Организация #{@org.inn} удалена"
|
||||
end
|
||||
|
||||
def reload
|
||||
report = Report.create!(inn: @org.inn, status: 'processing')
|
||||
FileProcessorJob.perform_async(@org.inn, report.id)
|
||||
redirect_to "/organisations/#{@org.id}", notice: 'Данные обновляются в фоне'
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_organisation
|
||||
|
||||
Reference in New Issue
Block a user