diff --git a/app/controllers/admin/venue_management_bills_controller.rb b/app/controllers/admin/venue_management_bills_controller.rb
index f2788cb..c816eda 100644
--- a/app/controllers/admin/venue_management_bills_controller.rb
+++ b/app/controllers/admin/venue_management_bills_controller.rb
@@ -1,16 +1,12 @@
class Admin::VenueManagementBillsController < Admin::VenueAdminController
include Admin::VenueManagementsHelper
include ActionView::Helpers::FormOptionsHelper
- include ActionView::Helpers::FormTagHelper
- include ActionView::Helpers::FormHelper
+ #include ActionView::Helpers::FormTagHelper #don't include this helper,or you will got an error when using redirect_to and url_for
+ #include ActionView::Helpers::FormHelper #don't include this helper,or you will got an error when using redirect_to and url_for
include VenueAdminHelper
include ActionView::Context
before_action ->(module_app = @app_title) { set_variables module_app }
before_action :set_venue_management_bill, only: [:edit, :update, :destroy]
- def objectify_options(options)
- @default_options = {}
- @default_options.merge(options)
- end
def initialize
super
@app_title = 'venue_management'
@@ -20,9 +16,6 @@ class Admin::VenueManagementBillsController < Admin::VenueAdminController
:category=>categories.map{|c| {:title=>(c.title.blank? ? " " : c.title), :id=>c.id}}
}
end
- def text_field(object_name , options = {})
- text_field_tag(object_name, options[:value], options)
- end
def index
@table_fields = [
'venue_management.title',
@@ -44,17 +37,17 @@ class Admin::VenueManagementBillsController < Admin::VenueAdminController
bill_type_select_str = "
"
@filter_fields['vm_bill.bill_type'] = bill_type_select_str
@filter_fields['vm_bill.accounting_month'] = ('')
filter_tags = params[:filters]["type"].to_a rescue []
@main_ids = nil
@@ -72,7 +65,13 @@ class Admin::VenueManagementBillsController < Admin::VenueAdminController
accounting_month_start = DateTime.parse(params[:filters]["accounting_month_start"]) rescue 0
accounting_month_end = DateTime.parse(params[:filters]["accounting_month_end"]) rescue 0
if @bills.nil?
- @bills = VenueManagementBill.where(:accounting_month.gt=>accounting_month_start,:accounting_month.lte=>accounting_month_end).page(params[:page]).per(10)
+ if accounting_month_start != 0 && accounting_month_end != 0
+ @bills = VenueManagementBill.where(:accounting_month.gt=>accounting_month_start,:accounting_month.lte=>accounting_month_end).page(params[:page]).per(10)
+ elsif accounting_month_start != 0
+ @bills = VenueManagementBill.where(:accounting_month.gt=>accounting_month_start).page(params[:page]).per(10)
+ elsif accounting_month_end != 0
+ @bills = VenueManagementBill.where(:accounting_month.lte=>accounting_month_end).page(params[:page]).per(10)
+ end
else
if accounting_month_start != 0 && accounting_month_end != 0
@bills = @bills.where(:accounting_month.gt=>accounting_month_start,:accounting_month.lte=>accounting_month_end).page(params[:page]).per(10)
@@ -85,6 +84,9 @@ class Admin::VenueManagementBillsController < Admin::VenueAdminController
if !@main_ids.nil?
@bills = @bills.where(:venue_management_main_id.in=>@main_ids).page(params[:page]).per(10)
end
+ if @bills.nil?
+ @bills = VenueManagementBill.all.page(params[:page]).per(10)
+ end
@venue_management_page_url = Page.where(:module =>"venue_management").last.url rescue ""
if request.xhr?
render '_index'
@@ -134,7 +136,9 @@ class Admin::VenueManagementBillsController < Admin::VenueAdminController
redirect_to venue_management_bills_admin_venue_management_path(@venue_management_main_id)
end
-
+ def render_html(code,pass_variables={})
+ render_to_string(:inline=>code,:locals=>pass_variables)
+ end
private
def set_venue_management_bill
diff --git a/app/controllers/admin/venue_managements_controller.rb b/app/controllers/admin/venue_managements_controller.rb
index afa5df9..ea2cc9c 100644
--- a/app/controllers/admin/venue_managements_controller.rb
+++ b/app/controllers/admin/venue_managements_controller.rb
@@ -1,21 +1,14 @@
# encoding: utf-8
class Admin::VenueManagementsController < Admin::VenueAdminController
include ActionView::Helpers::FormOptionsHelper
- include ActionView::Helpers::FormTagHelper
- include ActionView::Helpers::FormHelper
+ #include ActionView::Helpers::FormTagHelper #don't include this helper,or you will got an error when using redirect_to and url_for
+ #include ActionView::Helpers::FormHelper #don't include this helper,or you will got an error when using redirect_to and url_for
include VenueAdminHelper
include ActionView::Context
require 'axlsx'
helper Admin::VenueManagementsFieldHelper
before_action ->(module_app = @app_title) { set_variables module_app }
before_action :set_venue_management, only: [:edit, :set_write_off, :venue_management_signup, :destroy, :venue_management_invitings, :venue_management_memorabilias, :venue_management_bills, :venue_management_contracts]
- def objectify_options(options)
- @default_options = {}
- @default_options.merge(options)
- end
- def text_field(object_name , options = {})
- text_field_tag(object_name, options[:value], options)
- end
def initialize
super
@app_title = "venue_management"
@@ -358,20 +351,20 @@ class Admin::VenueManagementsController < Admin::VenueAdminController
@filter_fields = filter_fields(@categories)
@tags = @module_app.tags
@filter_fields['vm_inviting.type'] = @tags.map{|t| {:title => t.name,:id => t.id} }
+ bill_type_select_str = "