customer search

This commit is contained in:
Aung Myo
2017-06-13 20:11:24 +06:30
parent 77a41eb9dc
commit b86ae8d32d
6 changed files with 61 additions and 40 deletions

View File

@@ -10,9 +10,12 @@ class Crm::CustomersController < BaseCrmController
@crm_customers = Customer.order("customer_id").page(params[:page])
#@products = Product.order("name").page(params[:page]).per(5)
else
@crm_customers = Customer.where("name LIKE ?", "%#{filter}%").order("name").page(params[:page]) end
@crm_customers = Customer.search(filter)
end
#@crm_customers = Customer.all
@crm_customer = Customer.new
@crm_customers = Kaminari.paginate_array(@crm_customers).page(params[:page]).per(50)
@crm_customer = Customer.new
if flash["errors"]
@crm_customer.valid?
@@ -52,7 +55,7 @@ class Crm::CustomersController < BaseCrmController
membership = MembershipSetting.find_by_membership_type("paypar_url")
memberaction = MembershipAction.find_by_membership_type("get_all_member_account")
merchant_uid = memberaction.merchant_account_id.to_s
merchant_uid = memberaction.merchant_account_id.to_s
auth_token = memberaction.auth_token.to_s
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s

View File

@@ -17,12 +17,17 @@ class Origami::CustomersController < BaseOrigamiController
@sale_id = params[:sale_id]
filter = params[:filter]
filter = params[:filter]
if filter.nil?
@crm_customers = Customer.order("name").page params[:page]
@crm_customers = Customer.order("customer_id").page(params[:page])
#@products = Product.order("name").page(params[:page]).per(5)
else
@crm_customers = Customer.where("name LIKE ?", "%#{filter}%").order("name").page params[:page]
@crm_customers = Customer.search(filter)
end
# @crm_customers = Kaminari.paginate_array(@crm_customers).page(params[:page]).per(2)
#@crm_customers = Customer.all
@crm_customers = Kaminari.paginate_array(@crm_customers).page(params[:page]).per(50)
@crm_customer = Customer.new
if flash["errors"]