diff --git a/app/controllers/admin/venue_management_contracts_controller.rb b/app/controllers/admin/venue_management_contracts_controller.rb index bff17c0..6163452 100644 --- a/app/controllers/admin/venue_management_contracts_controller.rb +++ b/app/controllers/admin/venue_management_contracts_controller.rb @@ -110,17 +110,25 @@ class Admin::VenueManagementContractsController < Admin::VenueAdminController @contracts = @contracts.and(:venue_management_main_id=>params[:id]) end if params[:keywords].present? + @contracts = @contracts.page(nil).per(@contracts.count) @main_ids = @contracts.pluck(:venue_management_main_id) @venue_managements = VenueManagementMain.where(:id.in=>@main_ids) @main_ids = search_data(@venue_managements,[:title]).pluck(:id) + ids = [] if params[:keywords] == I18n.t(:empty) - @contracts = @contracts.where(:case_no=>"") + ids = @contracts.where(:case_no.in=>["",nil]).pluck(:id) else - @contracts = search_data(@contracts,[:case_no]) + ids = search_data(@contracts,[:case_no]).pluck(:id) + end + ids2 = [] #ids for search contractors + if params[:keywords] == I18n.t(:empty) + ids2 = @contracts.map{|contract| ((contract.display_contractors.blank?) rescue true) ? contract.id : nil } + else + ids2 = @contracts.map{|contract| (contract.display_contractors.include?(params[:keywords]) rescue false) ? contract.id : nil } end - ids = @contracts.pluck(:id) ids1 = VenueManagementContract.where(:venue_management_main_id.in=>@main_ids).pluck(:id) - @contracts = VenueManagementContract.where(:id.in=>(ids + ids1)).page(params[:page]).per(10) + @contracts = VenueManagementContract.where(:id.in=>(ids + ids1 + ids2)).page(params[:page]).per(10) + #render :html => ids and return end @contracts = @contracts.order(updated_at: :desc).page(params[:page]).per(10) end diff --git a/app/controllers/admin/venue_management_invitings_controller.rb b/app/controllers/admin/venue_management_invitings_controller.rb index 2a2ef4b..5b943f5 100644 --- a/app/controllers/admin/venue_management_invitings_controller.rb +++ b/app/controllers/admin/venue_management_invitings_controller.rb @@ -62,6 +62,7 @@ class Admin::VenueManagementInvitingsController < Admin::VenueAdminController @invitings = @invitings.where(:venue_management_main_id=>params[:id]) end if params[:keywords].present? + @invitings = @invitings.page(nil).per(@invitings.count) @main_ids = @invitings.pluck(:venue_management_main_id) @venue_managements = VenueManagementMain.where(:id.in=>@main_ids) @main_ids = search_data(@venue_managements,[:title]).pluck(:id) diff --git a/app/controllers/admin/venue_management_memorabilias_controller.rb b/app/controllers/admin/venue_management_memorabilias_controller.rb index c88cdf4..5cf32fc 100644 --- a/app/controllers/admin/venue_management_memorabilias_controller.rb +++ b/app/controllers/admin/venue_management_memorabilias_controller.rb @@ -30,14 +30,15 @@ class Admin::VenueManagementMemorabiliasController < Admin::VenueAdminController @invintings = VenueManagementInviting.where(:id.in => VenueManagementMemorabilia.all.pluck(:venue_management_inviting_id)) @venue_managements = VenueManagementMain.where(:id.in=>@main_ids) @main_ids = search_data(@venue_managements,[:title]).pluck(:id) + ids2 = [] if params[:keywords] == I18n.t(:empty) @invintings = @invintings.where(:case_no=>"") + ids2 = VenueManagementMemorabilia.where(:venue_management_inviting_id =>nil ).pluck(:id) else @invintings = search_data(@invintings,[:case_no]) end ids = VenueManagementMemorabilia.where(:venue_management_inviting_id.in=>@invintings.pluck(:id)).pluck(:id) ids1 = VenueManagementMemorabilia.where(:venue_management_main_id.in=>@main_ids).pluck(:id) - ids2 = VenueManagementMemorabilia.where(:venue_management_inviting_id =>nil ).pluck(:id) @memorabilias = VenueManagementMemorabilia.where(:id.in=>(ids + ids1 + ids2)) end end diff --git a/app/views/admin/venue_management_memorabilias/_index.html.erb b/app/views/admin/venue_management_memorabilias/_index.html.erb index 8ab23a4..59b7c5b 100644 --- a/app/views/admin/venue_management_memorabilias/_index.html.erb +++ b/app/views/admin/venue_management_memorabilias/_index.html.erb @@ -46,11 +46,11 @@