From 62c78b4e0570653610337b1f081fea2d13741910 Mon Sep 17 00:00:00 2001 From: bohung Date: Fri, 16 Oct 2020 16:12:28 +0800 Subject: [PATCH] Fix bug. --- app/controllers/admin/venue_management_bills_controller.rb | 4 +++- app/views/admin/venue_management_bills/_index.html.erb | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/controllers/admin/venue_management_bills_controller.rb b/app/controllers/admin/venue_management_bills_controller.rb index aaa1f5b..be5efab 100644 --- a/app/controllers/admin/venue_management_bills_controller.rb +++ b/app/controllers/admin/venue_management_bills_controller.rb @@ -195,8 +195,10 @@ class Admin::VenueManagementBillsController < Admin::VenueAdminController @bills = @bills.where(:venue_management_main_id.in=>@main_ids).page(params[:page]).per(10) end end - if @bills.nil? + if @bills.nil? && params[:id].blank? @bills = VenueManagementBill.all.page(params[:page]).per(10) + elsif @bills.nil? + @bills = VenueManagementBill.where(:venue_management_main_id=>params[:id]) end @bills = @bills.page(1).per(@bills.count) @protocol = (request.referer.blank? ? "http" : URI(request.referer).scheme) diff --git a/app/views/admin/venue_management_bills/_index.html.erb b/app/views/admin/venue_management_bills/_index.html.erb index 2c82eca..87b8917 100644 --- a/app/views/admin/venue_management_bills/_index.html.erb +++ b/app/views/admin/venue_management_bills/_index.html.erb @@ -53,6 +53,7 @@ <% filter_url = request.fullpath.split("?")[1..-1].join("?") %> <% if @venue_management.present? %> + <% filter_url.blank? ? (filter_url += "id=#{@venue_management.id}") : (filter_url += "&id=#{@venue_management.id}") %>
<%= content_tag :div, class: "pagination-centered" do %>