2017-06-28 12:56:56 +02:00
|
|
|
class Admin::FinancialTransactionClassesController < Admin::BaseController
|
|
|
|
inherit_resources
|
|
|
|
|
|
|
|
def new
|
|
|
|
@financial_transaction_class = FinancialTransactionClass.new(params[:financial_transaction_class])
|
|
|
|
render layout: false
|
|
|
|
end
|
|
|
|
|
2023-05-12 13:01:12 +02:00
|
|
|
def edit
|
|
|
|
@financial_transaction_class = FinancialTransactionClass.find(params[:id])
|
|
|
|
render action: 'new', layout: false
|
|
|
|
end
|
|
|
|
|
2017-06-28 12:56:56 +02:00
|
|
|
def create
|
|
|
|
@financial_transaction_class = FinancialTransactionClass.new(params[:financial_transaction_class])
|
|
|
|
if @financial_transaction_class.save
|
2023-05-12 13:01:12 +02:00
|
|
|
redirect_to update_transaction_types_admin_finances_url, status: :see_other
|
2017-06-28 12:56:56 +02:00
|
|
|
else
|
|
|
|
render action: 'new', layout: false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def update
|
|
|
|
@financial_transaction_class = FinancialTransactionClass.find(params[:id])
|
|
|
|
|
2022-10-13 18:25:52 +02:00
|
|
|
if @financial_transaction_class.update(params[:financial_transaction_class])
|
2023-05-12 13:01:12 +02:00
|
|
|
redirect_to update_transaction_types_admin_finances_url, status: :see_other
|
2017-06-28 12:56:56 +02:00
|
|
|
else
|
|
|
|
render action: 'new', layout: false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def destroy
|
|
|
|
@financial_transaction_class = FinancialTransactionClass.find(params[:id])
|
|
|
|
@financial_transaction_class.destroy!
|
2023-05-12 13:01:12 +02:00
|
|
|
redirect_to update_transaction_types_admin_finances_url, status: :see_other
|
|
|
|
rescue StandardError => e
|
|
|
|
flash.now[:alert] = e.message
|
2017-06-28 12:56:56 +02:00
|
|
|
render template: 'shared/alert'
|
|
|
|
end
|
|
|
|
end
|