2020-07-27 16:34:33 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-08-04 09:04:04 +00:00
|
|
|
class Admin::VenueManagementInvitingsController < Admin::VenueAdminController
|
2020-07-27 16:34:33 +00:00
|
|
|
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',
|
2020-08-09 13:47:41 +00:00
|
|
|
'vm_inviting.type',
|
2020-07-27 16:34:33 +00:00
|
|
|
'vm_inviting.publish_times',
|
2020-08-09 13:47:41 +00:00
|
|
|
'vm_inviting.start_end',
|
2020-07-27 16:34:33 +00:00
|
|
|
'vm_inviting.rents',
|
|
|
|
'vm_inviting.royalty',
|
2020-08-09 13:47:41 +00:00
|
|
|
'vm_inviting.house_land_tax_payer',
|
2020-07-27 16:34:33 +00:00
|
|
|
'vm_inviting.contractor_manager',
|
|
|
|
'vm_inviting.bid_result',
|
|
|
|
]
|
2020-08-09 02:50:11 +00:00
|
|
|
@tags = @module_app.tags
|
|
|
|
@filter_fields = {}
|
|
|
|
@filter_fields['vm_inviting.type'] = @tags.map{|t| {:title => t.name,:id => t.id} }
|
2020-08-09 13:47:41 +00:00
|
|
|
filter_tags = params[:filters]["type"].to_a rescue []
|
|
|
|
@invitings = VenueManagementInviting.with_tags(filter_tags).order(updated_at: :desc).page(params[:page]).per(10)
|
2020-08-09 02:50:11 +00:00
|
|
|
@venue_management_page_url = Page.where(:module =>"venue_management").last.url rescue ""
|
|
|
|
if request.xhr?
|
|
|
|
render :partial => 'index'
|
|
|
|
end
|
2020-07-27 16:34:33 +00:00
|
|
|
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
|
2020-08-09 13:47:41 +00:00
|
|
|
inviting_params = params.require(:venue_management_inviting).permit!
|
|
|
|
inviting_params["tags"] = [] if inviting_params["tags"].nil?
|
|
|
|
return inviting_params
|
2020-07-27 16:34:33 +00:00
|
|
|
end
|
|
|
|
end
|