venue_management/app/controllers/admin/venue_management_invitings_...

67 lines
1.9 KiB
Ruby

# frozen_string_literal: true
class Admin::VenueManagementInvitingsController < Admin::VenueAdminController
include Admin::VenueManagementsHelper
before_action ->(module_app = @app_title) { set_variables module_app }
before_action :set_venue_management_inviting, only: [:edit, :update, :destroy]
def initialize
super
@app_title = 'venue_management'
end
def index
@table_fields = [
'venue_management.title',
'vm_inviting.case_no',
'vm_inviting.publish_times',
'vm_inviting.rents',
'vm_inviting.royalty',
'vm_inviting.house_tax_payer',
'vm_inviting.land_tax_payer',
'vm_inviting.contractor_manager',
'vm_inviting.bid_result',
]
@invitings = VenueManagementInviting.order(updated_at: :desc).page(params[:page]).per(10)
end
def new
@venue_management = VenueManagementMain.find(params[:id])
@venue_management_inviting = @venue_management.venue_management_invitings.build
end
def create
@venue_management_inviting = VenueManagementInviting.new(venue_management_inviting_params)
@venue_management_inviting.save
redirect_to params['referer_url']
end
def edit
@venue_management = VenueManagementMain.find(@venue_management_inviting.venue_management_main_id)
end
def update
@venue_management_inviting.update_attributes(venue_management_inviting_params)
redirect_to venue_management_invitings_admin_venue_management_path(@venue_management_inviting.venue_management_main_id)
end
def destroy
@venue_management_main_id = @venue_management_inviting.venue_management_main_id
@venue_management_inviting.destroy
redirect_to venue_management_invitings_admin_venue_management_path(@venue_management_main_id)
end
private
def set_venue_management_inviting
@venue_management_inviting = VenueManagementInviting.find(params[:id])
end
def venue_management_inviting_params
params.require(:venue_management_inviting).permit!
end
end