Fix bugs.
This commit is contained in:
parent
a885881651
commit
2dbc2c6590
|
@ -110,17 +110,25 @@ class Admin::VenueManagementContractsController < Admin::VenueAdminController
|
||||||
@contracts = @contracts.and(:venue_management_main_id=>params[:id])
|
@contracts = @contracts.and(:venue_management_main_id=>params[:id])
|
||||||
end
|
end
|
||||||
if params[:keywords].present?
|
if params[:keywords].present?
|
||||||
|
@contracts = @contracts.page(nil).per(@contracts.count)
|
||||||
@main_ids = @contracts.pluck(:venue_management_main_id)
|
@main_ids = @contracts.pluck(:venue_management_main_id)
|
||||||
@venue_managements = VenueManagementMain.where(:id.in=>@main_ids)
|
@venue_managements = VenueManagementMain.where(:id.in=>@main_ids)
|
||||||
@main_ids = search_data(@venue_managements,[:title]).pluck(:id)
|
@main_ids = search_data(@venue_managements,[:title]).pluck(:id)
|
||||||
|
ids = []
|
||||||
if params[:keywords] == I18n.t(:empty)
|
if params[:keywords] == I18n.t(:empty)
|
||||||
@contracts = @contracts.where(:case_no=>"")
|
ids = @contracts.where(:case_no.in=>["",nil]).pluck(:id)
|
||||||
else
|
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
|
end
|
||||||
ids = @contracts.pluck(:id)
|
|
||||||
ids1 = VenueManagementContract.where(:venue_management_main_id.in=>@main_ids).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
|
end
|
||||||
@contracts = @contracts.order(updated_at: :desc).page(params[:page]).per(10)
|
@contracts = @contracts.order(updated_at: :desc).page(params[:page]).per(10)
|
||||||
end
|
end
|
||||||
|
|
|
@ -62,6 +62,7 @@ class Admin::VenueManagementInvitingsController < Admin::VenueAdminController
|
||||||
@invitings = @invitings.where(:venue_management_main_id=>params[:id])
|
@invitings = @invitings.where(:venue_management_main_id=>params[:id])
|
||||||
end
|
end
|
||||||
if params[:keywords].present?
|
if params[:keywords].present?
|
||||||
|
@invitings = @invitings.page(nil).per(@invitings.count)
|
||||||
@main_ids = @invitings.pluck(:venue_management_main_id)
|
@main_ids = @invitings.pluck(:venue_management_main_id)
|
||||||
@venue_managements = VenueManagementMain.where(:id.in=>@main_ids)
|
@venue_managements = VenueManagementMain.where(:id.in=>@main_ids)
|
||||||
@main_ids = search_data(@venue_managements,[:title]).pluck(:id)
|
@main_ids = search_data(@venue_managements,[:title]).pluck(:id)
|
||||||
|
|
|
@ -30,14 +30,15 @@ class Admin::VenueManagementMemorabiliasController < Admin::VenueAdminController
|
||||||
@invintings = VenueManagementInviting.where(:id.in => VenueManagementMemorabilia.all.pluck(:venue_management_inviting_id))
|
@invintings = VenueManagementInviting.where(:id.in => VenueManagementMemorabilia.all.pluck(:venue_management_inviting_id))
|
||||||
@venue_managements = VenueManagementMain.where(:id.in=>@main_ids)
|
@venue_managements = VenueManagementMain.where(:id.in=>@main_ids)
|
||||||
@main_ids = search_data(@venue_managements,[:title]).pluck(:id)
|
@main_ids = search_data(@venue_managements,[:title]).pluck(:id)
|
||||||
|
ids2 = []
|
||||||
if params[:keywords] == I18n.t(:empty)
|
if params[:keywords] == I18n.t(:empty)
|
||||||
@invintings = @invintings.where(:case_no=>"")
|
@invintings = @invintings.where(:case_no=>"")
|
||||||
|
ids2 = VenueManagementMemorabilia.where(:venue_management_inviting_id =>nil ).pluck(:id)
|
||||||
else
|
else
|
||||||
@invintings = search_data(@invintings,[:case_no])
|
@invintings = search_data(@invintings,[:case_no])
|
||||||
end
|
end
|
||||||
ids = VenueManagementMemorabilia.where(:venue_management_inviting_id.in=>@invintings.pluck(:id)).pluck(:id)
|
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)
|
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))
|
@memorabilias = VenueManagementMemorabilia.where(:id.in=>(ids + ids1 + ids2))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -46,11 +46,11 @@
|
||||||
<div class="bottomnav clearfix">
|
<div class="bottomnav clearfix">
|
||||||
<%= content_tag :div, class: "pagination pagination-centered" do %>
|
<%= content_tag :div, class: "pagination pagination-centered" do %>
|
||||||
<%= paginate(@memorabilias) %>
|
<%= paginate(@memorabilias) %>
|
||||||
<% if can_edit_or_delete?(@venue_management) %>
|
<% end %>
|
||||||
<div class="action pull-right">
|
<% if can_edit_or_delete?(@venue_management) %>
|
||||||
<%= link_to content_tag(:i, nil, class: "icons-plus") + " " + t(:add), new_admin_venue_management_memorabilia_path(id: @venue_management.id), class: "btn btn-primary" %>
|
<div class="action pull-right">
|
||||||
</div>
|
<%= link_to content_tag(:i, nil, class: "icons-plus") + " " + t(:add), new_admin_venue_management_memorabilia_path(id: @venue_management.id), class: "btn btn-primary" %>
|
||||||
<% end %>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<!-- footer:end -->
|
<!-- footer:end -->
|
||||||
|
|
Loading…
Reference in New Issue